diff --git a/cchapterwindow.cpp b/cchapterwindow.cpp index ec0e680..78495d6 100644 --- a/cchapterwindow.cpp +++ b/cchapterwindow.cpp @@ -8,6 +8,8 @@ #include "cmainwindow.h" +#include "common.h" + #include @@ -22,6 +24,8 @@ 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_lpName, SIGNAL(gotFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditGotFocus(cLineEdit*))); connect(ui->m_lpName, SIGNAL(lostFocus(cLineEdit*)), (cMainWindow*)parent, SLOT(onLineEditLostFocus(cLineEdit*))); @@ -76,3 +80,11 @@ cChapter* cChapterWindow::chapter() { return(m_lpChapter); } + +void cChapterWindow::onSceneDoubleClicked(const QModelIndex& index) +{ + QStandardItem* lpItem = m_lpSceneModel->itemFromIndex(index); + cScene* lpScene = qvariant_cast(lpItem->data()); + if(lpScene) + showSceneWindow(lpScene); +} diff --git a/cchapterwindow.h b/cchapterwindow.h index 4c26b43..e94b93e 100644 --- a/cchapterwindow.h +++ b/cchapterwindow.h @@ -61,6 +61,24 @@ public: */ cChapter* chapter(); +private slots: + /*! + \brief + + \fn onSceneDoubleClicked + \param index + */ + void onSceneDoubleClicked(const QModelIndex& index); + +signals: + /*! + \brief + + \fn showSceneWindow + \param lpScene + */ + void showSceneWindow(cScene* lpScene); + private: Ui::cChapterWindow *ui; /*!< TODO: describe */ cChapter* m_lpChapter; /*!< TODO: describe */ diff --git a/ccharacterwindow.cpp b/ccharacterwindow.cpp index 2ed08d9..d22bf88 100644 --- a/ccharacterwindow.cpp +++ b/ccharacterwindow.cpp @@ -10,6 +10,8 @@ #include "cmainwindow.h" +#include "common.h" + #include diff --git a/cimagewidget.cpp b/cimagewidget.cpp index 2a07659..7183fd3 100644 --- a/cimagewidget.cpp +++ b/cimagewidget.cpp @@ -8,6 +8,8 @@ #include "cmainwindow.h" +#include "common.h" + cImageWidget::cImageWidget(QWidget *parent) : QWidget(parent), @@ -15,6 +17,7 @@ cImageWidget::cImageWidget(QWidget *parent) : { ui->setupUi(this); +// CONNECT CURRENTLY NOT POSSIBLE connect(ui->m_lpDescription, SIGNAL(gotFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditGotFocus(cTextEdit*))); connect(ui->m_lpDescription, SIGNAL(lostFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditLostFocus(cTextEdit*))); } diff --git a/cmainwindow.cpp b/cmainwindow.cpp index fc6b454..f51e4c4 100644 --- a/cmainwindow.cpp +++ b/cmainwindow.cpp @@ -158,15 +158,23 @@ void cMainWindow::createActions() createEditActions(); createTextActions(); - connect(ui->m_lpMainTab, &QTabWidget::currentChanged, this, &cMainWindow::onMainTabCurrentChanged); - connect(ui->m_lpMainTab, &QTabWidget::tabCloseRequested, this, &cMainWindow::onMainTabTabCloseRequested); - connect(ui->m_lpMdiArea, &QMdiArea::subWindowActivated, this, &cMainWindow::onMdiAreaSubWindowActivated); + createContextActions(); - connect(ui->m_lpOutlineList, &QTreeView::doubleClicked, this, &cMainWindow::onOutlineDoubleClicked); - connect(ui->m_lpCharacterList, &QTreeView::doubleClicked, this, &cMainWindow::onCharacterDoubleClicked); - connect(ui->m_lpPlaceList, &QTreeView::doubleClicked, this, &cMainWindow::onPlaceDoubleClicked); - connect(ui->m_lpObjectList, &QTreeView::doubleClicked, this, &cMainWindow::onObjectDoubleClicked); - connect(ui->m_lpRechercheList, &QTreeView::doubleClicked, this, &cMainWindow::onRechercheDoubleClicked); + connect(ui->m_lpMainTab, &QTabWidget::currentChanged, this, &cMainWindow::onMainTabCurrentChanged); + connect(ui->m_lpMainTab, &QTabWidget::tabCloseRequested, this, &cMainWindow::onMainTabTabCloseRequested); + connect(ui->m_lpMdiArea, &QMdiArea::subWindowActivated, this, &cMainWindow::onMdiAreaSubWindowActivated); + + connect(ui->m_lpOutlineList, &QTreeView::doubleClicked, this, &cMainWindow::onOutlineDoubleClicked); + connect(ui->m_lpCharacterList, &QTreeView::doubleClicked, this, &cMainWindow::onCharacterDoubleClicked); + connect(ui->m_lpPlaceList, &QTreeView::doubleClicked, this, &cMainWindow::onPlaceDoubleClicked); + connect(ui->m_lpObjectList, &QTreeView::doubleClicked, this, &cMainWindow::onObjectDoubleClicked); + connect(ui->m_lpRechercheList, &QTreeView::doubleClicked, this, &cMainWindow::onRechercheDoubleClicked); + + connect(ui->m_lpOutlineList, &QTreeView::customContextMenuRequested, this, &cMainWindow::onOutlineContextMenu); + connect(ui->m_lpCharacterList, &QTreeView::customContextMenuRequested, this, &cMainWindow::onCharacterContextMenu); + connect(ui->m_lpPlaceList, &QTreeView::customContextMenuRequested, this, &cMainWindow::onPlaceContextMenu); + connect(ui->m_lpObjectList, &QTreeView::customContextMenuRequested, this, &cMainWindow::onObjectContextMenu); + connect(ui->m_lpRechercheList, &QTreeView::customContextMenuRequested, this, &cMainWindow::onRechercheContextMenu); } void cMainWindow::createFileActions() @@ -367,6 +375,93 @@ void cMainWindow::createTextActions() m_focusException.append(m_lpComboSize); } +void cMainWindow::createContextActions() +{ + m_lpActionPartAdd = new QAction(tr("add part"), this); + m_lpActionPartAdd->setStatusTip(tr("add a new part")); + connect(m_lpActionPartAdd, &QAction::triggered, this, &cMainWindow::onAddPart); + + m_lpActionPartEdit = new QAction(tr("edit part"), this); + m_lpActionPartEdit->setStatusTip(tr("edit the part")); + connect(m_lpActionPartEdit, &QAction::triggered, this, &cMainWindow::onEditPart); + + m_lpActionPartDelete = new QAction(tr("delete part"), this); + m_lpActionPartDelete->setStatusTip(tr("delete the part")); + connect(m_lpActionPartDelete, &QAction::triggered, this, &cMainWindow::onDeletePart); + + m_lpActionChapterAdd = new QAction(tr("add chapter"), this); + m_lpActionChapterAdd->setStatusTip(tr("add a new chapter")); + connect(m_lpActionChapterAdd, &QAction::triggered, this, &cMainWindow::onAddChapter); + + m_lpActionChapterEdit = new QAction(tr("edit chapter"), this); + m_lpActionChapterEdit->setStatusTip(tr("edit the chapter")); + connect(m_lpActionChapterEdit, &QAction::triggered, this, &cMainWindow::onEditChapter); + + m_lpActionChapterDelete = new QAction(tr("delete chapter"), this); + m_lpActionChapterDelete->setStatusTip(tr("delete the chapter")); + connect(m_lpActionChapterDelete, &QAction::triggered, this, &cMainWindow::onDeleteChapter); + + m_lpActionSceneAdd = new QAction(tr("add scene"), this); + m_lpActionSceneAdd->setStatusTip(tr("add a new scene")); + connect(m_lpActionSceneAdd, &QAction::triggered, this, &cMainWindow::onAddScene); + + m_lpActionSceneEdit = new QAction(tr("edit scene"), this); + m_lpActionSceneEdit->setStatusTip(tr("edit the scene")); + connect(m_lpActionSceneEdit, &QAction::triggered, this, &cMainWindow::onEditScene); + + m_lpActionSceneDelete = new QAction(tr("delete scene"), this); + m_lpActionSceneDelete->setStatusTip(tr("delete the scene")); + connect(m_lpActionSceneDelete, &QAction::triggered, this, &cMainWindow::onDeleteScene); + + m_lpActionCharacterAdd = new QAction(tr("add character"), this); + m_lpActionCharacterAdd->setStatusTip(tr("add a new character")); + connect(m_lpActionCharacterAdd, &QAction::triggered, this, &cMainWindow::onAddCharacter); + + m_lpActionCharacterEdit = new QAction(tr("edit character"), this); + m_lpActionCharacterEdit->setStatusTip(tr("edit the character")); + connect(m_lpActionCharacterEdit, &QAction::triggered, this, &cMainWindow::onEditCharacter); + + m_lpActionCharacterDelete = new QAction(tr("delete character"), this); + m_lpActionCharacterDelete->setStatusTip(tr("delete the character")); + connect(m_lpActionCharacterDelete, &QAction::triggered, this, &cMainWindow::onDeleteCharacter); + + m_lpActionPlaceAdd = new QAction(tr("add place"), this); + m_lpActionPlaceAdd->setStatusTip(tr("add a new place")); + connect(m_lpActionPlaceAdd, &QAction::triggered, this, &cMainWindow::onAddPlace); + + m_lpActionPlaceEdit = new QAction(tr("edit place"), this); + m_lpActionPlaceEdit->setStatusTip(tr("edit the place")); + connect(m_lpActionPlaceEdit, &QAction::triggered, this, &cMainWindow::onEditPlace); + + m_lpActionPlaceDelete = new QAction(tr("delete place"), this); + m_lpActionPlaceDelete->setStatusTip(tr("delete the place")); + connect(m_lpActionPlaceDelete, &QAction::triggered, this, &cMainWindow::onDeletePlace); + + m_lpActionObjectAdd = new QAction(tr("add object"), this); + m_lpActionObjectAdd->setStatusTip(tr("add a new object")); + connect(m_lpActionObjectAdd, &QAction::triggered, this, &cMainWindow::onAddObject); + + m_lpActionObjectEdit = new QAction(tr("edit object"), this); + m_lpActionObjectEdit->setStatusTip(tr("edit the object")); + connect(m_lpActionObjectEdit, &QAction::triggered, this, &cMainWindow::onEditObject); + + m_lpActionObjectDelete = new QAction(tr("delete object"), this); + m_lpActionObjectDelete->setStatusTip(tr("delete the object")); + connect(m_lpActionObjectDelete, &QAction::triggered, this, &cMainWindow::onDeleteObject); + + m_lpActionRechercheAdd = new QAction(tr("add recherche"), this); + m_lpActionRechercheAdd->setStatusTip(tr("add a new recherche")); + connect(m_lpActionRechercheAdd, &QAction::triggered, this, &cMainWindow::onAddRecherche); + + m_lpActionRechercheEdit = new QAction(tr("edit recherche"), this); + m_lpActionRechercheEdit->setStatusTip(tr("edit the recherche")); + connect(m_lpActionRechercheEdit, &QAction::triggered, this, &cMainWindow::onEditRecherche); + + m_lpActionRechercheDelete = new QAction(tr("delete recherche"), this); + m_lpActionRechercheDelete->setStatusTip(tr("delete the recherche")); + connect(m_lpActionRechercheDelete, &QAction::triggered, this, &cMainWindow::onDeleteRecherche); +} + void cMainWindow::disableTextEdit() { m_lpEditMenu->setEnabled(false); @@ -704,7 +799,9 @@ void cMainWindow::onShowPartWindow(cPart* lpPart) lpWidget1->setWindow(ui->m_lpMdiArea->addSubWindow(lpPartWindow)); ui->m_lpMainTab->addTab((QWidget*)lpWidget1, lpPartWindow->windowTitle()); - connect(lpPartWindow, &cPartWindow::subWindowClosed, this, &cMainWindow::onSubWindowClosed); + connect(lpPartWindow, &cPartWindow::showChapterWindow, this, &cMainWindow::onShowChapterWindow); + + connect(lpPartWindow, &cPartWindow::subWindowClosed, this, &cMainWindow::onSubWindowClosed); lpPartWindow->show(); } @@ -733,6 +830,8 @@ void cMainWindow::onShowChapterWindow(cChapter* lpChapter) lpWidget1->setWindow(ui->m_lpMdiArea->addSubWindow(lpChapterWindow)); ui->m_lpMainTab->addTab((QWidget*)lpWidget1, lpChapterWindow->windowTitle()); + connect(lpChapterWindow, &cChapterWindow::showSceneWindow, this, &cMainWindow::onShowSceneWindow); + connect(lpChapterWindow, &cChapterWindow::subWindowClosed, this, &cMainWindow::onSubWindowClosed); lpChapterWindow->show(); @@ -824,7 +923,7 @@ void cMainWindow::onShowPlaceWindow(cPlace* lpPlace) lpWidget1->setWindow(ui->m_lpMdiArea->addSubWindow(lpPlaceWindow)); ui->m_lpMainTab->addTab((QWidget*)lpWidget1, lpPlaceWindow->windowTitle()); - connect(lpPlaceWindow, &cSceneWindow::subWindowClosed, this, &cMainWindow::onSubWindowClosed); + connect(lpPlaceWindow, &cPlaceWindow::subWindowClosed, this, &cMainWindow::onSubWindowClosed); lpPlaceWindow->show(); } @@ -853,7 +952,7 @@ void cMainWindow::onShowObjectWindow(cObject* lpObject) lpWidget1->setWindow(ui->m_lpMdiArea->addSubWindow(lpObjectWindow)); ui->m_lpMainTab->addTab((QWidget*)lpWidget1, lpObjectWindow->windowTitle()); - connect(lpObjectWindow, &cSceneWindow::subWindowClosed, this, &cMainWindow::onSubWindowClosed); + connect(lpObjectWindow, &cObjectWindow::subWindowClosed, this, &cMainWindow::onSubWindowClosed); lpObjectWindow->show(); } @@ -886,11 +985,131 @@ void cMainWindow::onShowRechercheWindow(cRecherche* lpRecherche) connect(lpRechercheWindow, &cRechercheWindow::showPlaceWindow, this, &cMainWindow::onShowPlaceWindow); connect(lpRechercheWindow, &cRechercheWindow::showObjectWindow, this, &cMainWindow::onShowObjectWindow); - connect(lpRechercheWindow, &cSceneWindow::subWindowClosed, this, &cMainWindow::onSubWindowClosed); + connect(lpRechercheWindow, &cRechercheWindow::subWindowClosed, this, &cMainWindow::onSubWindowClosed); lpRechercheWindow->show(); } +void cMainWindow::onOutlineContextMenu(const QPoint& pos) +{ + QMenu menu(this); + + QStandardItem* lpItem = m_lpOutlineModel->itemFromIndex(ui->m_lpOutlineList->currentIndex()); + if(!lpItem) + { + menu.addAction(m_lpActionPartAdd); + } + else + { + cPart* lpPart = qvariant_cast(lpItem->data()); + cChapter* lpChapter = qvariant_cast(lpItem->data()); + cScene* lpScene = qvariant_cast(lpItem->data()); + + if(lpPart) + { + menu.addAction(m_lpActionPartAdd); + menu.addAction(m_lpActionPartEdit); + menu.addAction(m_lpActionPartDelete); + menu.addSeparator(); + menu.addAction(m_lpActionChapterAdd); + } + else if(lpChapter) + { + menu.addAction(m_lpActionChapterAdd); + menu.addAction(m_lpActionChapterEdit); + menu.addAction(m_lpActionChapterDelete); + menu.addSeparator(); + menu.addAction(m_lpActionSceneAdd); + } + else if(lpScene) + { + menu.addAction(m_lpActionSceneAdd); + menu.addAction(m_lpActionSceneEdit); + menu.addAction(m_lpActionSceneDelete); + } + else + menu.addAction(m_lpActionPartAdd); + } + + menu.exec(ui->m_lpOutlineList->mapToGlobal(pos)); +} + +void cMainWindow::onCharacterContextMenu(const QPoint& pos) +{ + QMenu menu(this); + + QStandardItem* lpItem = m_lpCharacterModel->itemFromIndex(ui->m_lpCharacterList->currentIndex()); + if(!lpItem) + { + menu.addAction(m_lpActionCharacterAdd); + } + else + { + menu.addAction(m_lpActionCharacterAdd); + menu.addAction(m_lpActionCharacterEdit); + menu.addAction(m_lpActionCharacterDelete); + } + + menu.exec(ui->m_lpCharacterList->mapToGlobal(pos)); +} + +void cMainWindow::onPlaceContextMenu(const QPoint& pos) +{ + QMenu menu(this); + + QStandardItem* lpItem = m_lpPlaceModel->itemFromIndex(ui->m_lpPlaceList->currentIndex()); + if(!lpItem) + { + menu.addAction(m_lpActionPlaceAdd); + } + else + { + menu.addAction(m_lpActionPlaceAdd); + menu.addAction(m_lpActionPlaceEdit); + menu.addAction(m_lpActionPlaceDelete); + } + + menu.exec(ui->m_lpPlaceList->mapToGlobal(pos)); +} + +void cMainWindow::onObjectContextMenu(const QPoint& pos) +{ + QMenu menu(this); + + QStandardItem* lpItem = m_lpObjectModel->itemFromIndex(ui->m_lpObjectList->currentIndex()); + if(!lpItem) + { + menu.addAction(m_lpActionObjectAdd); + } + else + { + menu.addAction(m_lpActionObjectAdd); + menu.addAction(m_lpActionObjectEdit); + menu.addAction(m_lpActionObjectDelete); + } + + menu.exec(ui->m_lpObjectList->mapToGlobal(pos)); +} + +void cMainWindow::onRechercheContextMenu(const QPoint& pos) +{ + QMenu menu(this); + + QStandardItem* lpItem = m_lpRechercheModel->itemFromIndex(ui->m_lpRechercheList->currentIndex()); + if(!lpItem) + { + menu.addAction(m_lpActionRechercheAdd); + } + else + { + menu.addAction(m_lpActionRechercheAdd); + menu.addAction(m_lpActionRechercheEdit); + menu.addAction(m_lpActionRechercheDelete); + } + + menu.exec(ui->m_lpRechercheList->mapToGlobal(pos)); +} + void cMainWindow::onFileNew() { } @@ -956,3 +1175,157 @@ void cMainWindow::onAlignmentChanged(const Qt::Alignment &alignment) else if(alignment & Qt::AlignJustify) m_lpActionAlignJustify->setChecked(true); } + +void cMainWindow::onAddPart() +{ +} + +void cMainWindow::onEditPart() +{ + QStandardItem* lpItem = m_lpOutlineModel->itemFromIndex(ui->m_lpOutlineList->currentIndex()); + if(!lpItem) + return; + + cPart* lpPart = qvariant_cast(lpItem->data()); + + if(!lpPart) + return; + + onShowPartWindow(lpPart); +} + +void cMainWindow::onDeletePart() +{ +} + +void cMainWindow::onAddChapter() +{ +} + +void cMainWindow::onEditChapter() +{ + QStandardItem* lpItem = m_lpOutlineModel->itemFromIndex(ui->m_lpOutlineList->currentIndex()); + if(!lpItem) + return; + + cChapter* lpChapter = qvariant_cast(lpItem->data()); + + if(!lpChapter) + return; + + onShowChapterWindow(lpChapter); +} + +void cMainWindow::onDeleteChapter() +{ +} + +void cMainWindow::onAddScene() +{ +} + +void cMainWindow::onEditScene() +{ + QStandardItem* lpItem = m_lpOutlineModel->itemFromIndex(ui->m_lpOutlineList->currentIndex()); + if(!lpItem) + return; + + cScene* lpScene = qvariant_cast(lpItem->data()); + + if(!lpScene) + return; + + onShowSceneWindow(lpScene); +} + +void cMainWindow::onDeleteScene() +{ +} + +void cMainWindow::onAddCharacter() +{ +} + +void cMainWindow::onEditCharacter() +{ + QStandardItem* lpItem = m_lpCharacterModel->itemFromIndex(ui->m_lpCharacterList->currentIndex()); + if(!lpItem) + return; + + cCharacter* lpCharacter = qvariant_cast(lpItem->data()); + + if(!lpCharacter) + return; + + onShowCharacterWindow(lpCharacter); +} + +void cMainWindow::onDeleteCharacter() +{ +} + +void cMainWindow::onAddPlace() +{ +} + +void cMainWindow::onEditPlace() +{ + QStandardItem* lpItem = m_lpPlaceModel->itemFromIndex(ui->m_lpPlaceList->currentIndex()); + if(!lpItem) + return; + + cPlace* lpPlace = qvariant_cast(lpItem->data()); + + if(!lpPlace) + return; + + onShowPlaceWindow(lpPlace); +} + +void cMainWindow::onDeletePlace() +{ +} + +void cMainWindow::onAddObject() +{ +} + +void cMainWindow::onEditObject() +{ + QStandardItem* lpItem = m_lpObjectModel->itemFromIndex(ui->m_lpObjectList->currentIndex()); + if(!lpItem) + return; + + cObject* lpObject = qvariant_cast(lpItem->data()); + + if(!lpObject) + return; + + onShowObjectWindow(lpObject); +} + +void cMainWindow::onDeleteObject() +{ +} + +void cMainWindow::onAddRecherche() +{ +} + +void cMainWindow::onEditRecherche() +{ + QStandardItem* lpItem = m_lpRechercheModel->itemFromIndex(ui->m_lpRechercheList->currentIndex()); + if(!lpItem) + return; + + cRecherche* lpRecherche = qvariant_cast(lpItem->data()); + + if(!lpRecherche) + return; + + onShowRechercheWindow(lpRecherche); +} + +void cMainWindow::onDeleteRecherche() +{ +} diff --git a/cmainwindow.h b/cmainwindow.h index 9396581..9e1c987 100644 --- a/cmainwindow.h +++ b/cmainwindow.h @@ -30,6 +30,8 @@ #include +#include + namespace Ui { class cMainWindow; @@ -339,6 +341,42 @@ private slots: */ void onShowRechercheWindow(cRecherche* lpRecherche); + /*! + \brief + + \fn onOutlineContextMenu + \param index + */ + void onOutlineContextMenu(const QPoint& pos); + /*! + \brief + + \fn onCharacterContextMenu + \param index + */ + void onCharacterContextMenu(const QPoint& pos); + /*! + \brief + + \fn onPlaceContextMenu + \param index + */ + void onPlaceContextMenu(const QPoint& pos); + /*! + \brief + + \fn onObjectContextMenu + \param index + */ + void onObjectContextMenu(const QPoint& pos); + /*! + \brief + + \fn onRechercheContextMenu + \param index + */ + void onRechercheContextMenu(const QPoint& pos); + /*! \brief @@ -413,6 +451,34 @@ private slots: */ void onAlignmentChanged(const Qt::Alignment& alignment); + void onAddPart(); + void onEditPart(); + void onDeletePart(); + + void onAddChapter(); + void onEditChapter(); + void onDeleteChapter(); + + void onAddScene(); + void onEditScene(); + void onDeleteScene(); + + void onAddCharacter(); + void onEditCharacter(); + void onDeleteCharacter(); + + void onAddPlace(); + void onEditPlace(); + void onDeletePlace(); + + void onAddObject(); + void onEditObject(); + void onDeleteObject(); + + void onAddRecherche(); + void onEditRecherche(); + void onDeleteRecherche(); + private: Ui::cMainWindow* ui; /*!< TODO: describe */ QStandardItemModel* m_lpOutlineModel; /*!< TODO: describe */ @@ -452,6 +518,34 @@ private: QAction* m_lpActionCopy; /*!< TODO: describe */ QAction* m_lpActionPaste; /*!< TODO: describe */ + QAction* m_lpActionPartAdd; /*!< TODO: describe */ + QAction* m_lpActionPartEdit; /*!< TODO: describe */ + QAction* m_lpActionPartDelete; /*!< TODO: describe */ + + QAction* m_lpActionChapterAdd; /*!< TODO: describe */ + QAction* m_lpActionChapterEdit; /*!< TODO: describe */ + QAction* m_lpActionChapterDelete; /*!< TODO: describe */ + + QAction* m_lpActionSceneAdd; /*!< TODO: describe */ + QAction* m_lpActionSceneEdit; /*!< TODO: describe */ + QAction* m_lpActionSceneDelete; /*!< TODO: describe */ + + QAction* m_lpActionCharacterAdd; /*!< TODO: describe */ + QAction* m_lpActionCharacterEdit; /*!< TODO: describe */ + QAction* m_lpActionCharacterDelete; /*!< TODO: describe */ + + QAction* m_lpActionPlaceAdd; /*!< TODO: describe */ + QAction* m_lpActionPlaceEdit; /*!< TODO: describe */ + QAction* m_lpActionPlaceDelete; /*!< TODO: describe */ + + QAction* m_lpActionObjectAdd; /*!< TODO: describe */ + QAction* m_lpActionObjectEdit; /*!< TODO: describe */ + QAction* m_lpActionObjectDelete; /*!< TODO: describe */ + + QAction* m_lpActionRechercheAdd; /*!< TODO: describe */ + QAction* m_lpActionRechercheEdit; /*!< TODO: describe */ + QAction* m_lpActionRechercheDelete; /*!< TODO: describe */ + QActionGroup* m_lpAlignGroup; /*!< TODO: describe */ QFontComboBox* m_lpComboFont; /*!< TODO: describe */ @@ -490,6 +584,12 @@ private: \fn createTextActions */ void createTextActions(); + /*! + \brief + + \fn createContextActions + */ + void createContextActions(); /*! \brief diff --git a/cmainwindow.ui b/cmainwindow.ui index 1727a59..d337097 100644 --- a/cmainwindow.ui +++ b/cmainwindow.ui @@ -28,7 +28,7 @@ QFrame::Sunken - 0 + 4 @@ -45,6 +45,9 @@ + + Qt::CustomContextMenu + QAbstractItemView::NoEditTriggers @@ -76,7 +79,7 @@ 0 0 89 - 462 + 445 @@ -85,6 +88,9 @@ + + Qt::CustomContextMenu + QAbstractItemView::NoEditTriggers @@ -113,7 +119,7 @@ 0 0 89 - 462 + 445 @@ -122,6 +128,9 @@ + + Qt::CustomContextMenu + QAbstractItemView::NoEditTriggers @@ -150,7 +159,7 @@ 0 0 89 - 462 + 445 @@ -159,6 +168,9 @@ + + Qt::CustomContextMenu + QAbstractItemView::NoEditTriggers @@ -187,7 +199,7 @@ 0 0 89 - 462 + 445 @@ -196,6 +208,9 @@ + + Qt::CustomContextMenu + QAbstractItemView::NoEditTriggers diff --git a/cobjectwindow.cpp b/cobjectwindow.cpp index 1d6a3fe..9ba5817 100644 --- a/cobjectwindow.cpp +++ b/cobjectwindow.cpp @@ -10,6 +10,8 @@ #include "cmainwindow.h" +#include "common.h" + #include diff --git a/cpartwindow.cpp b/cpartwindow.cpp index b8ff82c..785cda9 100644 --- a/cpartwindow.cpp +++ b/cpartwindow.cpp @@ -8,6 +8,8 @@ #include "cmainwindow.h" +#include "common.h" + #include @@ -22,6 +24,8 @@ cPartWindow::cPartWindow(QWidget *parent) : m_lpChapterModel = new QStandardItemModel(0, 1); ui->m_lpChapterList->setModel(m_lpChapterModel); + connect(ui->m_lpChapterList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onChapterDoubleClicked(QModelIndex))); + connect(ui->m_lpDescription, SIGNAL(gotFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditGotFocus(cTextEdit*))); connect(ui->m_lpDescription, SIGNAL(lostFocus(cTextEdit*)), (cMainWindow*)parent, SLOT(onTextEditLostFocus(cTextEdit*))); @@ -72,3 +76,11 @@ cPart* cPartWindow::part() { return(m_lpPart); } + +void cPartWindow::onChapterDoubleClicked(const QModelIndex& index) +{ + QStandardItem* lpItem = m_lpChapterModel->itemFromIndex(index); + cChapter* lpChapter = qvariant_cast(lpItem->data()); + if(lpChapter) + showChapterWindow(lpChapter); +} diff --git a/cpartwindow.h b/cpartwindow.h index 72a40ae..011ed7b 100644 --- a/cpartwindow.h +++ b/cpartwindow.h @@ -60,6 +60,24 @@ public: */ cPart* part(); +private slots: + /*! + \brief + + \fn onChapterDoubleClicked + \param index + */ + void onChapterDoubleClicked(const QModelIndex& index); + +signals: + /*! + \brief + + \fn showPartWindow + \param lpPart + */ + void showChapterWindow(cChapter* lpChapter); + private: Ui::cPartWindow* ui; /*!< TODO: describe */ cPart* m_lpPart; /*!< TODO: describe */ diff --git a/cplacewindow.cpp b/cplacewindow.cpp index 8296dc9..eb64b56 100644 --- a/cplacewindow.cpp +++ b/cplacewindow.cpp @@ -10,6 +10,8 @@ #include "cmainwindow.h" +#include "common.h" + #include diff --git a/crecherchewindow.cpp b/crecherchewindow.cpp index 3f45114..ef12dd3 100644 --- a/crecherchewindow.cpp +++ b/crecherchewindow.cpp @@ -10,6 +10,8 @@ #include "cmainwindow.h" +#include "common.h" + #include diff --git a/cscenewindow.cpp b/cscenewindow.cpp index b3d61d0..6155a8b 100644 --- a/cscenewindow.cpp +++ b/cscenewindow.cpp @@ -8,6 +8,8 @@ #include "cmainwindow.h" +#include "common.h" + #include diff --git a/cwidget.cpp b/cwidget.cpp index e19b9e4..9d2d17f 100644 --- a/cwidget.cpp +++ b/cwidget.cpp @@ -41,7 +41,7 @@ cWidget::cWidget(cCharacterWindow* parent) : cWidget::cWidget(cObjectWindow* parent) : QWidget(parent), m_type(TYPE_object), - m_lpWidget(0), + m_lpWidget(parent), m_lpWindow(0) { } @@ -49,7 +49,7 @@ cWidget::cWidget(cObjectWindow* parent) : cWidget::cWidget(cPlaceWindow* parent) : QWidget(parent), m_type(TYPE_place), - m_lpWidget(0), + m_lpWidget(parent), m_lpWindow(0) { } @@ -57,7 +57,7 @@ cWidget::cWidget(cPlaceWindow* parent) : cWidget::cWidget(cRechercheWindow* parent) : QWidget(parent), m_type(TYPE_recherche), - m_lpWidget(0), + m_lpWidget(parent), m_lpWindow(0) { } @@ -65,7 +65,7 @@ cWidget::cWidget(cRechercheWindow* parent) : cWidget::cWidget(QWidget* parent) : QWidget(parent), m_type(TYPE_unknown), - m_lpWidget(0), + m_lpWidget(parent), m_lpWindow(0) { }