diff --git a/Doxyfile b/Doxyfile index 3658ae5..0486281 100644 --- a/Doxyfile +++ b/Doxyfile @@ -2233,7 +2233,7 @@ HIDE_UNDOC_RELATIONS = YES # set to NO # The default value is: NO. -HAVE_DOT = NO +HAVE_DOT = YES # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed # to run in parallel. When set to 0 doxygen will base this on the number of @@ -2350,7 +2350,7 @@ INCLUDED_BY_GRAPH = YES # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. -CALL_GRAPH = NO +CALL_GRAPH = YES # If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller # dependency graph for every global function or class method. @@ -2362,7 +2362,7 @@ CALL_GRAPH = NO # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. -CALLER_GRAPH = NO +CALLER_GRAPH = YES # If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical # hierarchy of all classes instead of a textual one. @@ -2411,7 +2411,7 @@ INTERACTIVE_SVG = NO # found. If left blank, it is assumed the dot tool can be found in the path. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_PATH = +DOT_PATH = ../../../PortableApps/Graphviz/bin # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the \dotfile diff --git a/cchapterwindow.cpp b/cchapterwindow.cpp index 78495d6..f787898 100644 --- a/cchapterwindow.cpp +++ b/cchapterwindow.cpp @@ -6,8 +6,6 @@ #include "cchapterwindow.h" #include "ui_cchapterwindow.h" -#include "cmainwindow.h" - #include "common.h" #include @@ -16,6 +14,7 @@ cChapterWindow::cChapterWindow(QWidget *parent) : cMDISubWindow(parent), ui(new Ui::cChapterWindow), + m_lpMainWindow((cMainWindow*)parent), m_lpChapter(0), m_lpSceneList(0) { @@ -24,22 +23,26 @@ cChapterWindow::cChapterWindow(QWidget *parent) : m_lpSceneModel = new QStandardItemModel(0, 1); ui->m_lpSceneList->setModel(m_lpSceneModel); - connect(ui->m_lpSceneList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onSceneDoubleClicked(QModelIndex))); + connect(ui->m_lpSceneList, &cTreeView::doubleClicked, this, &cChapterWindow::onSceneDoubleClicked); - connect(ui->m_lpName, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*))); - connect(ui->m_lpName, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*))); + connect(ui->m_lpName, &cLineEdit::gotFocus, m_lpMainWindow, &cMainWindow::onLineEditGotFocus); + connect(ui->m_lpName, &cLineEdit::lostFocus, m_lpMainWindow, &cMainWindow::onLineEditLostFocus); - connect(ui->m_lpPart, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*))); - connect(ui->m_lpPart, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*))); + connect(ui->m_lpPart, &cLineEdit::gotFocus, m_lpMainWindow, &cMainWindow::onLineEditGotFocus); + connect(ui->m_lpPart, &cLineEdit::lostFocus, m_lpMainWindow, &cMainWindow::onLineEditLostFocus); - connect(ui->m_lpSceneList, SIGNAL(gotFocus(cTreeView*)), (cMainWindow*)parent, SLOT(onTreeViewGotFocus(cTreeView*))); - connect(ui->m_lpSceneList, SIGNAL(lostFocus(cTreeView*)), (cMainWindow*)parent, SLOT(onTreeViewLostFocus(cTreeView*))); + connect(ui->m_lpSceneList, &cTreeView::gotFocus, m_lpMainWindow, &cMainWindow::onTreeViewGotFocus); + connect(ui->m_lpSceneList, &cTreeView::lostFocus, m_lpMainWindow, &cMainWindow::onTreeViewLostFocus); - connect(ui->m_lpDescription, SIGNAL(gotFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditGotFocus(cTextEdit*))); - connect(ui->m_lpDescription, SIGNAL(lostFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditLostFocus(cTextEdit*))); + connect(ui->m_lpDescription, &cTextEdit::gotFocus, m_lpMainWindow, &cMainWindow::onTextEditGotFocus); + connect(ui->m_lpDescription, &cTextEdit::lostFocus, m_lpMainWindow, &cMainWindow::onTextEditLostFocus); - connect(ui->m_lpText, SIGNAL(gotFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditGotFocus(cTextEdit*))); - connect(ui->m_lpText, SIGNAL(lostFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditLostFocus(cTextEdit*))); + connect(ui->m_lpText, &cTextEdit::gotFocus, m_lpMainWindow, &cMainWindow::onTextEditGotFocus); + connect(ui->m_lpText, &cTextEdit::lostFocus, m_lpMainWindow, &cMainWindow::onTextEditLostFocus); + + connect(ui->m_lpName, &cLineEdit::textChanged, this, &cChapterWindow::onNameChanged); + connect(ui->m_lpDescription, &cTextEdit::textChanged, this, &cChapterWindow::onDescriptionChanged); + connect(ui->m_lpText, &cTextEdit::textChanged, this, &cChapterWindow::onTextChanged); } cChapterWindow::~cChapterWindow() @@ -88,3 +91,19 @@ void cChapterWindow::onSceneDoubleClicked(const QModelIndex& index) if(lpScene) showSceneWindow(lpScene); } + +void cChapterWindow::onNameChanged(const QString& szName) +{ + m_lpChapter->setName(szName); + m_lpMainWindow->somethingChanged(); +} + +void cChapterWindow::onDescriptionChanged() +{ + m_lpMainWindow->somethingChanged(); +} + +void cChapterWindow::onTextChanged() +{ + m_lpMainWindow->somethingChanged(); +} diff --git a/cchapterwindow.h b/cchapterwindow.h index e94b93e..891f44a 100644 --- a/cchapterwindow.h +++ b/cchapterwindow.h @@ -1,8 +1,3 @@ -/*! - \file cchapterwindow.h - -*/ - #ifndef CCHAPTERWINDOW_H #define CCHAPTERWINDOW_H @@ -13,6 +8,8 @@ #include "cmdisubwindow.h" +#include "cmainwindow.h" + #include #include @@ -52,14 +49,14 @@ public: \param lpChapter \param lpSceneList */ - void setChapter(cChapter* lpChapter, cSceneList* lpSceneList); + void setChapter(cChapter* lpChapter, cSceneList* lpSceneList); /*! \brief \fn chapter \return cChapter */ - cChapter* chapter(); + cChapter* chapter(); private slots: /*! @@ -70,6 +67,9 @@ private slots: */ void onSceneDoubleClicked(const QModelIndex& index); + void onNameChanged(const QString& szName); + void onDescriptionChanged(); + void onTextChanged(); signals: /*! \brief @@ -80,10 +80,11 @@ signals: void showSceneWindow(cScene* lpScene); private: - Ui::cChapterWindow *ui; /*!< TODO: describe */ - cChapter* m_lpChapter; /*!< TODO: describe */ - cSceneList* m_lpSceneList; /*!< TODO: describe */ - QStandardItemModel* m_lpSceneModel; /*!< TODO: describe */ + Ui::cChapterWindow* ui; /*!< TODO: describe */ + cMainWindow* m_lpMainWindow; /*!< TODO: describe */ + cChapter* m_lpChapter; /*!< TODO: describe */ + cSceneList* m_lpSceneList; /*!< TODO: describe */ + QStandardItemModel* m_lpSceneModel; /*!< TODO: describe */ }; #endif // CCHAPTERWINDOW_H diff --git a/ccharacterwindow.h b/ccharacterwindow.h index be00236..30c1186 100644 --- a/ccharacterwindow.h +++ b/ccharacterwindow.h @@ -1,8 +1,3 @@ -/*! - \file ccharacterwindow.h - -*/ - #ifndef CCHARACTERWINDOW_H #define CCHARACTERWINDOW_H diff --git a/cmainwindow.cpp b/cmainwindow.cpp index f51e4c4..1c3a92f 100644 --- a/cmainwindow.cpp +++ b/cmainwindow.cpp @@ -31,7 +31,11 @@ #include +#include +#include + #include +#include cMainWindow::cMainWindow(QWidget *parent) : @@ -76,6 +80,15 @@ cMainWindow::~cMainWindow() delete ui; } +void cMainWindow::somethingChanged() +{ + if(!m_bSomethingChanged) + { + m_bSomethingChanged = true; + updateWindowTitle(); + } +} + QAction* cMainWindow::actionAlignLeft() { return(m_lpActionAlignLeft); @@ -572,11 +585,16 @@ void cMainWindow::updateWindowTitle() QString szTitle = m_lpStoryBook->title(); QString szAuthor = m_lpStoryBook->author(); - + QString szWindowTitle; if(szAuthor.isEmpty()) - setWindowTitle(QString("\"%1\" - qtStoryWriter").arg(szTitle)); + szWindowTitle = QString("\"%1\" - qtStoryWriter").arg(szTitle); else - setWindowTitle(QString("\"%1\" by %2 - qtStoryWriter").arg(szTitle).arg(szAuthor)); + szWindowTitle = QString("\"%1\" by %2 - qtStoryWriter").arg(szTitle).arg(szAuthor); + + if(m_bSomethingChanged) + szWindowTitle.append(" *"); + + setWindowTitle(szWindowTitle); } void cMainWindow::onTextEditGotFocus(cTextEdit* lpTextEdit) @@ -1178,6 +1196,34 @@ void cMainWindow::onAlignmentChanged(const Qt::Alignment &alignment) void cMainWindow::onAddPart() { + bool bOK; + QString szPartName = ""; + + for(;;) + { + szPartName = QInputDialog::getText(this, tr("New Part"), tr("Name:"), QLineEdit::Normal, "", &bOK); + if(!bOK) + return; + + if(szPartName.isEmpty()) + { + QMessageBox::critical(this, tr("New Part"), tr("Part Name is empty.")); + bOK = false; + } + else + break; + } + + if(bOK && !szPartName.isEmpty()) + { + if(!m_lpStoryBook->addPart(szPartName)) + { + QMessageBox::critical(this, tr("New Part"), tr("Part could not be created.")); + return; + } + + m_lpStoryBook->fillOutlineList(ui->m_lpOutlineList); + } } void cMainWindow::onEditPart() diff --git a/cmainwindow.h b/cmainwindow.h index 9e1c987..bf9ebbf 100644 --- a/cmainwindow.h +++ b/cmainwindow.h @@ -61,6 +61,13 @@ public: */ ~cMainWindow(); + /*! + \brief + + \fn somethingChanged + */ + void somethingChanged(); + /*! \brief @@ -97,7 +104,7 @@ public: */ QAction* actionAlignJustify(); -private slots: +public slots: /*! \brief @@ -225,6 +232,7 @@ private slots: */ void onComboBoxLostFocus(cComboBox* lpComboBox); +private slots: /*! \brief @@ -451,32 +459,139 @@ private slots: */ void onAlignmentChanged(const Qt::Alignment& alignment); + /*! + \brief + + \fn onAddPart + */ void onAddPart(); + /*! + \brief + + \fn onEditPart + */ void onEditPart(); + /*! + \brief + + \fn onDeletePart + */ void onDeletePart(); + /*! + \brief + + \fn onAddChapter + */ void onAddChapter(); + /*! + \brief + + \fn onEditChapter + */ void onEditChapter(); + /*! + \brief + + \fn onDeleteChapter + */ void onDeleteChapter(); + /*! + \brief + + \fn onAddScene + */ void onAddScene(); + /*! + \brief + + \fn onEditScene + */ void onEditScene(); + /*! + \brief + + \fn onDeleteScene + */ void onDeleteScene(); + /*! + \brief + + \fn onAddCharacter + */ void onAddCharacter(); + /*! + \brief + + \fn onEditCharacter + */ void onEditCharacter(); + /*! + \brief + + \fn onDeleteCharacter + */ void onDeleteCharacter(); + /*! + \brief + + \fn onAddPlace + */ void onAddPlace(); + /*! + \brief + + \fn onEditPlace + */ void onEditPlace(); + /*! + \brief + + \fn onDeletePlace + */ void onDeletePlace(); + /*! + \brief + + \fn onAddObject + */ void onAddObject(); + /*! + \brief + + \fn onEditObject + */ void onEditObject(); + /*! + \brief + + \fn onDeleteObject + */ void onDeleteObject(); + /*! + \brief + + \fn onAddRecherche + */ void onAddRecherche(); + + /*! + \brief + + \fn onEditRecherche + */ void onEditRecherche(); + + /*! + \brief + + \fn onDeleteRecherche + */ void onDeleteRecherche(); private: @@ -487,6 +602,7 @@ private: QStandardItemModel* m_lpObjectModel; /*!< TODO: describe */ QStandardItemModel* m_lpRechercheModel; /*!< TODO: describe */ bool m_bUpdatingTab; /*!< TODO: describe */ + bool m_bSomethingChanged; /*!< TODO: describe */ cStoryBook* m_lpStoryBook; /*!< TODO: describe */ QList m_focusException; /*!< TODO: describe */ diff --git a/cobjectwindow.h b/cobjectwindow.h index 72443b1..c1998f3 100644 --- a/cobjectwindow.h +++ b/cobjectwindow.h @@ -1,8 +1,3 @@ -/*! - \file cobjectwindow.h - -*/ - #ifndef COBJECTWINDOW_H #define COBJECTWINDOW_H diff --git a/cpart.cpp b/cpart.cpp index 0f83de4..e7c5b01 100644 --- a/cpart.cpp +++ b/cpart.cpp @@ -86,6 +86,9 @@ cPart* cPartList::add(const qint32& iID) cPart* cPartList::find(const qint32& iID) { + if(iID == -1) + return(0); + for(int x = 0;x < count();x++) { if(at(x)->id() == iID) diff --git a/cpartwindow.h b/cpartwindow.h index 011ed7b..83b49f6 100644 --- a/cpartwindow.h +++ b/cpartwindow.h @@ -1,8 +1,3 @@ -/*! - \file cpartwindow.h - -*/ - #ifndef CPARTWINDOW_H #define CPARTWINDOW_H @@ -73,8 +68,8 @@ signals: /*! \brief - \fn showPartWindow - \param lpPart + \fn showChapterWindow + \param lpChapter */ void showChapterWindow(cChapter* lpChapter); diff --git a/cplacewindow.h b/cplacewindow.h index 13c933b..e1dd961 100644 --- a/cplacewindow.h +++ b/cplacewindow.h @@ -1,8 +1,3 @@ -/*! - \file cplacewindow.h - -*/ - #ifndef CPLACEWINDOW_H #define CPLACEWINDOW_H diff --git a/crecherchewindow.h b/crecherchewindow.h index 5cf4156..8c9b7fc 100644 --- a/crecherchewindow.h +++ b/crecherchewindow.h @@ -1,8 +1,3 @@ -/*! - \file crecherchewindow.h - -*/ - #ifndef CRECHERCHEWINDOW_H #define CRECHERCHEWINDOW_H diff --git a/cscenewindow.h b/cscenewindow.h index 7721bd0..6ae81e6 100644 --- a/cscenewindow.h +++ b/cscenewindow.h @@ -1,8 +1,3 @@ -/*! - \file cscenewindow.h - -*/ - #ifndef CSCENEWINDOW_H #define CSCENEWINDOW_H diff --git a/cstorybook.cpp b/cstorybook.cpp index ac655e3..6e9610f 100644 --- a/cstorybook.cpp +++ b/cstorybook.cpp @@ -410,6 +410,13 @@ cSceneList* cStoryBook::sceneList() return(&m_sceneList); } +bool cStoryBook::addPart(const QString& szPartName) +{ + cPart* lpPart = m_partList.add(-1); + lpPart->setName(szPartName); + return(true); +} + bool cStoryBook::fillOutlineList(QTreeView* lpView) { QMap part; @@ -436,7 +443,8 @@ bool cStoryBook::fillOutlineList(QTreeView* lpView) lpItem->setData(QVariant::fromValue(lpPart)); lpItem->setFont(fontPart); lpItem->setBackground(QBrush(background)); - lpItem->setToolTip(lpPart->description()->toPlainText()); + if(lpPart->description()) + lpItem->setToolTip(lpPart->description()->toPlainText()); part.insert(lpPart->id(), lpItem); lpModel->appendRow(lpItem); diff --git a/cstorybook.h b/cstorybook.h index d75564e..b78c0c8 100644 --- a/cstorybook.h +++ b/cstorybook.h @@ -135,6 +135,15 @@ public: \return cSceneList */ cSceneList* sceneList(); + + /*! + \brief + + \fn addPart + \param szPartName + \return bool + */ + bool addPart(const QString& szPartName); private: QString m_szProject; /*!< TODO: describe */ bool m_bIsOpen; /*!< TODO: describe */ diff --git a/cwidget.h b/cwidget.h index 72fe730..dea7703 100644 --- a/cwidget.h +++ b/cwidget.h @@ -1,8 +1,3 @@ -/*! - \file cwidget.h - -*/ - #ifndef CWIDGET_H #define CWIDGET_H @@ -40,7 +35,7 @@ public: TYPE_chapter = 2, TYPE_scene = 3, TYPE_character = 4, - TYPE_object = 5, + TYPE_object = 5, /*!< TODO: describe */ TYPE_place = 6, TYPE_recherche = 7, }; @@ -124,7 +119,6 @@ public: \return QMdiSubWindow */ QMdiSubWindow* window(); - /*! \brief