Skip to content

Commit

Permalink
Initial upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Strahinja Marković committed Aug 1, 2009
0 parents commit a38dea9
Show file tree
Hide file tree
Showing 294 changed files with 94,390 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .hgignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
syntax: glob
# Backup files left behind by the Emacs editor.
*~

# Lock files used by the Emacs editor.
.\#*

# Temporary files used by the vim editor.
.*.swp

# A hidden file created by the Mac OS X Finder.
.DS_Store

# Image thumbnail database created by windows
Thumbs.db

# Various files created by Visual Studio
*.sln
*.suo
*.vcproj
*.user
#*.rc
*.ncb
*.pch
*.dep
*.idb
*.exp
*.res
*.manifest
*.ilk
*.pdb
*.def
BuildLog.htm

# Various files and folders created by CMake
CMakeFiles
CMakeScripts
CMakeCache.txt
*.cmake
*.dir
ALL_BUILD*

# Various Qt files
ui_*
moc_*
qrc_*

# Misc files
*.svn
*.a
*.o
*.obj
*.lib
*.exe
*.dll
*.a
*.app
*.plist
*.xcodeproj
*.pbxbtree
*.pbxindex
*.build
*.smp
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

cmake_minimum_required( VERSION 2.6 )

project( Sigil )

set( CMAKE_DEBUG_POSTFIX "d" )
set( EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin )
set( LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib )

add_subdirectory( src/tidyLib )

#TODO: Switch sigil and ziparchive to cmake and then add them here.
674 changes: 674 additions & 0 deletions COPYING.txt

Large diffs are not rendered by default.

51 changes: 51 additions & 0 deletions src/Sigil/About.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/************************************************************************
**
** Copyright (C) 2009 Strahinja Markovic
**
** This file is part of Sigil.
**
** Sigil is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Sigil is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Sigil. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/

#include "stdafx.h"
#include "About.h"

static const QDateTime BUILD_TIME = QDateTime::currentDateTime();


// Constructor
About::About( QWidget *parent )
: QDialog( parent )
{
ui.setupUi( this );

ui.lbBuildTimeDisplay->setText( BUILD_TIME.toString( "yyyy.MM.dd HH:mm:ss" ) );
ui.lbLoadedQtDisplay->setText( QString( qVersion() ) );

// The individual numbers that make up the build version string
// always take up 3 spaces; we want to display them
// in exactly the number of spaces needed
// (regex used in case we change the number of digits)
QRegExp version_number( "(\\d+)\\.(\\d+)\\.(\\d+)" );

QString( SIGIL_VERSION ).indexOf( version_number );

QString version_text = QString( "%1.%2.%3" )
.arg( version_number.cap( 1 ).toInt() )
.arg( version_number.cap( 2 ).toInt() )
.arg( version_number.cap( 3 ).toInt() );

ui.lbVersionDisplay->setText( version_text );
}
44 changes: 44 additions & 0 deletions src/Sigil/About.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/************************************************************************
**
** Copyright (C) 2009 Strahinja Markovic
**
** This file is part of Sigil.
**
** Sigil is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Sigil is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Sigil. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/

#pragma once
#ifndef ABOUT_H
#define ABOUT_H

#include <QtGui/QDialog>
#include "ui_About.h"

class About : public QDialog
{
Q_OBJECT

public:

// Constructor
About( QWidget *parent = 0 );

private:

// Holds all the widgets Qt Designer created for us
Ui::About ui;
};

#endif // ABOUT_H
64 changes: 64 additions & 0 deletions src/Sigil/AddMetadata.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/************************************************************************
**
** Copyright (C) 2009 Strahinja Markovic
**
** This file is part of Sigil.
**
** Sigil is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Sigil is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Sigil. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/

#include "stdafx.h"
#include "AddMetadata.h"
#include "Metadata.h"


// Constructor
AddMetadata::AddMetadata( const QMap< QString, Metadata::MetaInfo > &metadata, QWidget *parent )
: QDialog( parent ), m_Metadata( metadata )
{
ui.setupUi( this );

connect( ui.lwProperties, SIGNAL( currentItemChanged( QListWidgetItem*, QListWidgetItem* ) ),
this, SLOT( UpdateDescription( QListWidgetItem* ) ) );

connect( this, SIGNAL( accepted() ), this, SLOT( EmitSelection() ) );

// Filling the dialog with metadata names
foreach( QString name, m_Metadata.keys() )
{
ui.lwProperties->addItem( name );
}
}


// Updates the description of the currently selected item
// whenever the user selects a new item
void AddMetadata::UpdateDescription( QListWidgetItem *current )
{
QString text = m_Metadata.value( current->text() ).description;

if ( text.isNull() != true )

ui.lbDescription->setText( text );
}


// Emits the name of the metadata that
// should be added to the metadata table;
// should be called on accept signal
void AddMetadata::EmitSelection()
{
emit MetadataToAdd( ui.lwProperties->currentItem()->text() );
}
66 changes: 66 additions & 0 deletions src/Sigil/AddMetadata.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/************************************************************************
**
** Copyright (C) 2009 Strahinja Markovic
**
** This file is part of Sigil.
**
** Sigil is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Sigil is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Sigil. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/

#pragma once
#ifndef ADDMETADATA_H
#define ADDMETADATA_H

#include <QtGui/QDialog>
#include "ui_AddMetadata.h"
#include "Metadata.h"

class AddMetadata : public QDialog
{
Q_OBJECT

public:

// Constructor
AddMetadata( const QMap< QString, Metadata::MetaInfo > &elements, QWidget *parent = 0 );

signals:

// The name of the metadata the user
// wants inserted into the table
void MetadataToAdd( QString name );

private slots:

// Updates the description of the currently selected item
// whenever the user selects a new item
void UpdateDescription( QListWidgetItem *current );

// Emits the name of the metadata that
// should be added to the metadata table;
// should be called on accept signal
void EmitSelection();

private:

// Represents the metadata list that this dialog displays
// For description of the stored types, see Metadata.h
const QMap< QString, Metadata::MetaInfo > &m_Metadata;

// Holds all the widgets Qt Designer created for us
Ui::AddMetadata ui;
};

#endif // ADDMETADATA_H
42 changes: 42 additions & 0 deletions src/Sigil/Book.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/************************************************************************
**
** Copyright (C) 2009 Strahinja Markovic
**
** This file is part of Sigil.
**
** Sigil is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Sigil is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Sigil. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/

#include "stdafx.h"
#include "Book.h"
#include "Utility.h"

static const int BOOK_IDENTIFIER_LENGTH = 30;

// Constructor
Book::Book()
: PublicationIdentifier( Utility::GetRandomString( BOOK_IDENTIFIER_LENGTH ) )
{

}


// Returns the base url of the book,
// that is the location to the text folder
// within the main folder
QUrl Book::GetBaseUrl()
{
return QUrl::fromLocalFile( mainfolder.GetFullPathToTextFolder() + "/" );
}
Loading

0 comments on commit a38dea9

Please sign in to comment.