From 7d0d7186dd933c866ea33669bc2949e024d36ead Mon Sep 17 00:00:00 2001 From: Herwig Birke Date: Tue, 24 Apr 2018 15:15:05 +0200 Subject: [PATCH] . --- cchapterwindow.cpp | 56 ++++++++++++ cchapterwindow.h | 35 ++++++++ cchapterwindow.ui | 110 +++++++++++++++++++++++ cmainwindow.cpp | 74 ++++++++++------ cpartwindow.ui | 9 ++ cscene.cpp | 43 +++++++-- cscene.h | 17 ++-- cscenewindow.cpp | 176 +++++++++++++++++++++++++++++++++++++ cscenewindow.h | 39 +++++++++ cscenewindow.ui | 214 +++++++++++++++++++++++++++++++++++++++++++++ cstorybook.cpp | 27 +++--- cstorybook.h | 1 + cwidget.cpp | 16 ++++ cwidget.h | 6 ++ qtStoryWriter.pro | 12 ++- 15 files changed, 783 insertions(+), 52 deletions(-) create mode 100644 cchapterwindow.cpp create mode 100644 cchapterwindow.h create mode 100644 cchapterwindow.ui create mode 100644 cscenewindow.cpp create mode 100644 cscenewindow.h create mode 100644 cscenewindow.ui diff --git a/cchapterwindow.cpp b/cchapterwindow.cpp new file mode 100644 index 0000000..c73da85 --- /dev/null +++ b/cchapterwindow.cpp @@ -0,0 +1,56 @@ +#include "cchapterwindow.h" +#include "ui_cchapterwindow.h" + +#include + + +cChapterWindow::cChapterWindow(QWidget *parent) : + QWidget(parent), + ui(new Ui::cChapterWindow), + m_lpChapter(0), + m_lpSceneList(0) +{ + ui->setupUi(this); + + m_lpSceneModel = new QStandardItemModel(0, 1); + ui->m_lpSceneList->setModel(m_lpSceneModel); +} + +cChapterWindow::~cChapterWindow() +{ + delete ui; +} + +void cChapterWindow::setChapter(cChapter* lpChapter, cSceneList* lpSceneList) +{ + m_lpChapter = lpChapter; + m_lpSceneList = lpSceneList; + + ui->m_lpPart->setText(lpChapter->part()->name()); + ui->m_lpName->setText(lpChapter->name()); + ui->m_lpDescription->setDocument(lpChapter->description()); + ui->m_lpText->setDocument(lpChapter->text()); + + QStringList headerLabels = QStringList() << tr("name"); + m_lpSceneModel->setHorizontalHeaderLabels(headerLabels); + + QList sceneList = m_lpSceneList->find(lpChapter); + for(int x = 0;x < sceneList.count();x++) + { + cScene* lpScene = sceneList.at(x); + + QStandardItem* lpItem = new QStandardItem(lpScene->name()); + lpItem->setData(QVariant::fromValue(lpScene)); + lpItem->setToolTip(lpScene->description()->toPlainText()); + m_lpSceneModel->appendRow(lpItem); + } + + ui->m_lpSceneList->resizeColumnToContents(0); + + setWindowTitle(tr("[chapter] - ") + lpChapter->name()); +} + +cChapter* cChapterWindow::chapter() +{ + return(m_lpChapter); +} diff --git a/cchapterwindow.h b/cchapterwindow.h new file mode 100644 index 0000000..9340bc0 --- /dev/null +++ b/cchapterwindow.h @@ -0,0 +1,35 @@ +#ifndef CCHAPTERWINDOW_H +#define CCHAPTERWINDOW_H + + +#include "cpart.h" +#include "cchapter.h" +#include "cscene.h" + +#include +#include + + +namespace Ui { +class cChapterWindow; +} + +class cChapterWindow : public QWidget +{ + Q_OBJECT + +public: + explicit cChapterWindow(QWidget *parent = 0); + ~cChapterWindow(); + + void setChapter(cChapter* lpChapter, cSceneList* lpSceneList); + cChapter* chapter(); + +private: + Ui::cChapterWindow *ui; + cChapter* m_lpChapter; + cSceneList* m_lpSceneList; + QStandardItemModel* m_lpSceneModel; +}; + +#endif // CCHAPTERWINDOW_H diff --git a/cchapterwindow.ui b/cchapterwindow.ui new file mode 100644 index 0000000..4b5bc45 --- /dev/null +++ b/cchapterwindow.ui @@ -0,0 +1,110 @@ + + + cChapterWindow + + + + 0 + 0 + 725 + 528 + + + + Form + + + + + + + + Description: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + + Scenes: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + Name: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + QAbstractItemView::NoEditTriggers + + + true + + + false + + + false + + + + + + + Part: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + true + + + + + + + + + + cTextEdit + QTextEdit +
ctextedit.h
+
+
+ + m_lpName + m_lpDescription + m_lpSceneList + m_lpText + + + +
diff --git a/cmainwindow.cpp b/cmainwindow.cpp index 6b0e71f..50ccb98 100644 --- a/cmainwindow.cpp +++ b/cmainwindow.cpp @@ -4,6 +4,9 @@ #include "ctextdocument.h" #include "cpartwindow.h" +#include "cchapterwindow.h" +#include "cscenewindow.h" + #include "cwidget.h" #include @@ -42,29 +45,6 @@ cMainWindow::cMainWindow(QWidget *parent) : m_lpStoryBook->fillRechercheList(ui->m_lpRechercheList); updateWindowTitle(); - -// cPartWindow* lpPartWindow = new cPartWindow(this); - -// QStandardItem* lpItem = m_lpOutlineModel->item(0, 0); -// cPart* lpPart = qvariant_cast(lpItem->data()); - -// lpPartWindow->setPart(lpPart); -// cWidget* lpWidget1 = new cWidget(lpPartWindow); -// lpWidget1->setWindow(ui->m_lpMdiArea->addSubWindow(lpPartWindow)); -// ui->m_lpMainTab->addTab((QWidget*)lpWidget1, lpPartWindow->windowTitle()); - -// cStructureWindow* lpStructureWindow = new cStructureWindow(this); -// cWidget* lpWidget1 = new cWidget(lpStructureWindow); -// lpWidget1->setWindow(ui->m_lpMdiArea->addSubWindow(lpStructureWindow)); - -// QMainWindow* lpMainWindow = new QMainWindow(this); -// lpMainWindow->setWindowTitle("Bla"); - -// cWidget* lpWidget2 = new cWidget(lpMainWindow); -// lpWidget2->setWindow(ui->m_lpMdiArea->addSubWindow(lpMainWindow)); - -// ui->m_lpMainTab->addTab((QWidget*)lpWidget1, "Structure"); -// ui->m_lpMainTab->addTab((QWidget*)lpWidget2, "Bla"); } cMainWindow::~cMainWindow() @@ -248,10 +228,54 @@ void cMainWindow::showPartWindow(cPart* lpPart) void cMainWindow::showChapterWindow(cChapter* lpChapter) { - QMessageBox::information(this, "CHAPTER", lpChapter->name()); + for(int x = 0;x < ui->m_lpMainTab->count();x++) + { + cWidget* lpWidget = (cWidget*)ui->m_lpMainTab->widget(x); + if(lpWidget->type() == cWidget::TYPE_chapter) + { + cChapterWindow* lpChapterWindow = (cChapterWindow*)lpWidget->widget(); + if(lpChapterWindow->chapter() == lpChapter) + { + ui->m_lpMainTab->setCurrentIndex(x); + ui->m_lpMdiArea->setActiveSubWindow(lpWidget->window()); + m_bUpdatingTab = false; + return; + } + } + } + + cChapterWindow* lpChapterWindow = new cChapterWindow(this); + lpChapterWindow->setChapter(lpChapter, m_lpStoryBook->sceneList()); + cWidget* lpWidget1 = new cWidget(lpChapterWindow); + lpWidget1->setWindow(ui->m_lpMdiArea->addSubWindow(lpChapterWindow)); + ui->m_lpMainTab->addTab((QWidget*)lpWidget1, lpChapterWindow->windowTitle()); + + lpChapterWindow->show(); } void cMainWindow::showSceneWindow(cScene* lpScene) { - QMessageBox::information(this, "SCENE", lpScene->name()); + for(int x = 0;x < ui->m_lpMainTab->count();x++) + { + cWidget* lpWidget = (cWidget*)ui->m_lpMainTab->widget(x); + if(lpWidget->type() == cWidget::TYPE_scene) + { + cSceneWindow* lpSceneWindow = (cSceneWindow*)lpWidget->widget(); + if(lpSceneWindow->scene() == lpScene) + { + ui->m_lpMainTab->setCurrentIndex(x); + ui->m_lpMdiArea->setActiveSubWindow(lpWidget->window()); + m_bUpdatingTab = false; + return; + } + } + } + + cSceneWindow* lpSceneWindow = new cSceneWindow(this); + lpSceneWindow->setScene(lpScene); + cWidget* lpWidget1 = new cWidget(lpSceneWindow); + lpWidget1->setWindow(ui->m_lpMdiArea->addSubWindow(lpSceneWindow)); + ui->m_lpMainTab->addTab((QWidget*)lpWidget1, lpSceneWindow->windowTitle()); + + lpSceneWindow->show(); } diff --git a/cpartwindow.ui b/cpartwindow.ui index c011f08..560a34b 100644 --- a/cpartwindow.ui +++ b/cpartwindow.ui @@ -21,6 +21,9 @@ Description: + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -34,6 +37,9 @@ Name: + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -44,6 +50,9 @@ Chapters: + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + diff --git a/cscene.cpp b/cscene.cpp index fe84860..d0a44b9 100644 --- a/cscene.cpp +++ b/cscene.cpp @@ -12,7 +12,7 @@ cScene::cScene(qint32 iID, QObject *parent) : m_lpChapter(0), m_szName(""), m_iSortOrder(-1), - m_szDescription(""), + m_lpDescription(0), m_state(STATE::STATE_unknown), m_lpText(0) { @@ -58,14 +58,14 @@ qint32 cScene::sortOrder() return(m_iSortOrder); } -void cScene::setDescription(const QString& szDescription) +void cScene::setDescription(cTextDocument* lpDescription) { - m_szDescription = szDescription; + m_lpDescription = lpDescription; } -QString cScene::description() +cTextDocument* cScene::description() { - return(m_szDescription); + return(m_lpDescription); } void cScene::setState(const cScene::STATE state) @@ -125,6 +125,11 @@ void cScene::addCharacter(cCharacter* lpCharacter) m_characterList.append(lpCharacter); } +QList cScene::characterList() +{ + return(m_characterList); +} + void cScene::addObject(cObject* lpObject) { if(m_objectList.contains(lpObject)) @@ -132,6 +137,11 @@ void cScene::addObject(cObject* lpObject) m_objectList.append(lpObject); } +QList cScene::objectList() +{ + return(m_objectList); +} + void cScene::addPlace(cPlace* lpPlace) { if(m_placeList.contains(lpPlace)) @@ -139,12 +149,17 @@ void cScene::addPlace(cPlace* lpPlace) m_placeList.append(lpPlace); } +QList cScene::placeList() +{ + return(m_placeList); +} + QString cScene::stateText() { return(stateText(m_state)); } -QString cScene::stateText(STATE state) const +QString cScene::stateText(STATE state) { switch(state) { @@ -167,7 +182,7 @@ QColor cScene::stateColor() return(stateColor(m_state)); } -QColor cScene::stateColor(STATE state) const +QColor cScene::stateColor(STATE state) { switch(state) { @@ -209,6 +224,18 @@ cScene* cSceneList::find(const qint32& iID) return(0); } +QList cSceneList::find(cChapter* lpChapter) +{ + QList sceneList; + + for(int x = 0;x < count();x++) + { + if(at(x)->chapter() == lpChapter) + sceneList.append(at(x)); + } + return(sceneList); +} + bool cSceneList::load(cChapterList* lpChapterList, cCharacterList *lpCharacterList, cObjectList *lpObjectList, cPlaceList *lpPlaceList) { QSqlQuery query; @@ -227,7 +254,7 @@ bool cSceneList::load(cChapterList* lpChapterList, cCharacterList *lpCharacterLi lpScene->setChapter(lpChapterList->find(query.value("chapterID").toInt())); lpScene->setName(query.value("name").toString()); lpScene->setSortOrder(query.value("sortOrder").toInt()); - lpScene->setDescription(query.value("description").toString()); + lpScene->setDescription(blob2TextDocument(query.value("description").toByteArray())); lpScene->setState((cScene::STATE)query.value("state").toInt()); lpScene->setStartedAt(query.value("startedAt").toDateTime()); lpScene->setFinishedAt(query.value("finishedAt").toDateTime()); diff --git a/cscene.h b/cscene.h index f87f279..5fa63ad 100644 --- a/cscene.h +++ b/cscene.h @@ -44,8 +44,8 @@ public: void setSortOrder(const qint32& iSortOrder); qint32 sortOrder(); - void setDescription(const QString& szDescription); - QString description(); + void setDescription(cTextDocument* lpDescription); + cTextDocument* description(); void setState(const STATE state); STATE state(); @@ -63,19 +63,24 @@ public: cTextDocument* text(); void addCharacter(cCharacter* lpCharacter); + QList characterList(); + void addObject(cObject* lpObject); + QList objectList(); + void addPlace(cPlace* lpPlace); + QList placeList(); QString stateText(); - QString stateText(STATE state) const; + static QString stateText(STATE state); QColor stateColor(); - QColor stateColor(STATE state) const; + static QColor stateColor(STATE state); private: qint32 m_iID; cChapter* m_lpChapter; QString m_szName; qint32 m_iSortOrder; - QString m_szDescription; + cTextDocument* m_lpDescription; STATE m_state; QDateTime m_startedAt; QDateTime m_finishedAt; @@ -96,6 +101,8 @@ public: cScene* add(const qint32& iID); cScene* find(const qint32& iID); + + QList find(cChapter* lpChapter); }; #endif // CSCENE_H diff --git a/cscenewindow.cpp b/cscenewindow.cpp new file mode 100644 index 0000000..6ec5e5c --- /dev/null +++ b/cscenewindow.cpp @@ -0,0 +1,176 @@ +#include "cscenewindow.h" +#include "ui_cscenewindow.h" + +#include + + +cSceneWindow::cSceneWindow(QWidget *parent) : + QWidget(parent), + ui(new Ui::cSceneWindow), + m_lpScene(0) +{ + ui->setupUi(this); + + ui->m_lpTabs->setCurrentIndex(0); + + m_lpCharacterModel = new QStandardItemModel(0, 1); + ui->m_lpCharacterList->setModel(m_lpCharacterModel); + + m_lpPlaceModel = new QStandardItemModel(0, 1); + ui->m_lpPlaceList->setModel(m_lpPlaceModel); + + m_lpObjectModel = new QStandardItemModel(0, 1); + ui->m_lpObjectList->setModel(m_lpObjectModel); + + ui->m_lpState->addItem(cScene::stateText(cScene::STATE_init), cScene::STATE_init); + ui->m_lpState->setItemData(0, QBrush(cScene::stateColor(cScene::STATE_init)), Qt::TextColorRole); + + ui->m_lpState->addItem(cScene::stateText(cScene::STATE_progress), cScene::STATE_progress); + ui->m_lpState->setItemData(1, QBrush(cScene::stateColor(cScene::STATE_progress)), Qt::BackgroundColorRole); + + ui->m_lpState->addItem(cScene::stateText(cScene::STATE_delayed), cScene::STATE_delayed); + ui->m_lpState->setItemData(2, QBrush(cScene::stateColor(cScene::STATE_delayed)), Qt::BackgroundColorRole); + + ui->m_lpState->addItem(cScene::stateText(cScene::STATE_finished), cScene::STATE_finished); + ui->m_lpState->setItemData(3, QBrush(cScene::stateColor(cScene::STATE_finished)), Qt::BackgroundColorRole); + + ui->m_lpState->addItem(cScene::stateText(cScene::STATE_unknown), cScene::STATE_unknown); + ui->m_lpState->setItemData(4, QBrush(cScene::stateColor(cScene::STATE_unknown)), Qt::BackgroundColorRole); +} + +cSceneWindow::~cSceneWindow() +{ + delete ui; +} + +void cSceneWindow::setScene(cScene* lpScene) +{ + m_lpScene = lpScene; + + ui->m_lpPart->setText(lpScene->chapter()->part()->name()); + ui->m_lpChapter->setText(lpScene->chapter()->name()); + ui->m_lpName->setText(lpScene->name()); + ui->m_lpDescription->setDocument(lpScene->description()); + ui->m_lpState->setCurrentText(lpScene->stateText()); + if(lpScene->startedAt().isValid()) + ui->m_lpStartedAt->setDateTime(lpScene->startedAt()); + else + { + ui->m_lpStartedLabel->setVisible(false); + ui->m_lpStartedAt->setVisible(false); + } + if(lpScene->finishedAt().isValid()) + ui->m_lpFinishedAt->setDateTime(lpScene->finishedAt()); + else + { + ui->m_lpFinishedLabel->setVisible(false); + ui->m_lpFinishedAt->setVisible(false); + } + ui->m_lpTargetDate->setDateTime(lpScene->targetDate()); + ui->m_lpText->setDocument(lpScene->text()); + + QList characterList = lpScene->characterList(); + QList placeList = lpScene->placeList(); + QList objectList = lpScene->objectList(); + + QStringList headerLabels; + + headerLabels = QStringList() << tr("name") << tr("creature") << tr("gender") << tr("title"); + m_lpCharacterModel->setHorizontalHeaderLabels(headerLabels); + for(int x = 0;x < characterList.count();x++) + { + cCharacter* lpCharacter = characterList[x]; + QList items; + + items.append(new QStandardItem(lpCharacter->name())); + items.append(new QStandardItem(lpCharacter->creature())); + items.append(new QStandardItem(lpCharacter->genderText())); + items.append(new QStandardItem(lpCharacter->title())); + + if(lpCharacter->mainCharacter()) + { + QFont font = items[0]->font(); + font.setBold(true); + + for(int y = 0;y < headerLabels.count();y++) + items[y]->setFont(font); + } + + for(int y = 0;y < headerLabels.count();y++) + { + items[y]->setData(QVariant::fromValue(lpCharacter)); + items[y]->setToolTip(lpCharacter->description()->toPlainText()); + } + + m_lpCharacterModel->appendRow(items); + } + + ui->m_lpCharacterList->header()->setStretchLastSection(true); + + for(int i = 0;i < headerLabels.count();i++) + ui->m_lpCharacterList->resizeColumnToContents(i); + + headerLabels = QStringList() << tr("name") << tr("location") << tr("type"); + m_lpPlaceModel->setHorizontalHeaderLabels(headerLabels); + for(int x = 0;x < placeList.count();x++) + { + cPlace* lpPlace = placeList[x]; + QList items; + + items.append(new QStandardItem(lpPlace->name())); + items.append(new QStandardItem(lpPlace->location())); + items.append(new QStandardItem(lpPlace->type())); + + for(int y = 0;y < headerLabels.count();y++) + { + items[y]->setData(QVariant::fromValue(lpPlace)); + items[y]->setToolTip(lpPlace->description()->toPlainText()); + } + + m_lpPlaceModel->appendRow(items); + } + + ui->m_lpPlaceList->header()->setStretchLastSection(true); + + for(int i = 0;i < headerLabels.count();i++) + ui->m_lpPlaceList->resizeColumnToContents(i); + + headerLabels = QStringList() << tr("name") << tr("type"); + m_lpObjectModel->setHorizontalHeaderLabels(headerLabels); + for(int x = 0;x < objectList.count();x++) + { + cObject* lpObject = objectList[x]; + QList items; + + items.append(new QStandardItem(lpObject->name())); + items.append(new QStandardItem(lpObject->type())); + + for(int y = 0;y < headerLabels.count();y++) + { + items[y]->setData(QVariant::fromValue(lpObject)); + items[y]->setToolTip(lpObject->description()->toPlainText()); + } + + m_lpObjectModel->appendRow(items); + } + + ui->m_lpObjectList->header()->setStretchLastSection(true); + + for(int i = 0;i < headerLabels.count();i++) + ui->m_lpObjectList->resizeColumnToContents(i); + + setWindowTitle(tr("[scene] - ") + lpScene->name()); +} + +cScene* cSceneWindow::scene() +{ + return(m_lpScene); +} + +void cSceneWindow::on_m_lpState_currentIndexChanged(int /*index*/) +{ + QBrush brush = qvariant_cast(ui->m_lpState->currentData(Qt::BackgroundColorRole)); + QColor color = brush.color(); + + ui->m_lpState->setStyleSheet(QString("background-color: rgb(%1, %2, %3);").arg(color.red()).arg(color.green()).arg(color.blue())); +} diff --git a/cscenewindow.h b/cscenewindow.h new file mode 100644 index 0000000..56be848 --- /dev/null +++ b/cscenewindow.h @@ -0,0 +1,39 @@ +#ifndef CSCENEWINDOW_H +#define CSCENEWINDOW_H + + +#include "cpart.h" +#include "cchapter.h" +#include "cscene.h" + +#include +#include + + +namespace Ui { +class cSceneWindow; +} + +class cSceneWindow : public QWidget +{ + Q_OBJECT + +public: + explicit cSceneWindow(QWidget *parent = 0); + ~cSceneWindow(); + + void setScene(cScene* lpScene); + cScene* scene(); + +private slots: + void on_m_lpState_currentIndexChanged(int index); + +private: + Ui::cSceneWindow* ui; + QStandardItemModel* m_lpCharacterModel; + QStandardItemModel* m_lpPlaceModel; + QStandardItemModel* m_lpObjectModel; + cScene* m_lpScene; +}; + +#endif // CSCENEWINDOW_H diff --git a/cscenewindow.ui b/cscenewindow.ui new file mode 100644 index 0000000..4d22dfc --- /dev/null +++ b/cscenewindow.ui @@ -0,0 +1,214 @@ + + + cSceneWindow + + + + 0 + 0 + 725 + 528 + + + + Form + + + + + + + + 1 + + + + Description + + + + + + + + + + Character + + + + + + true + + + false + + + + + + + + Place + + + + + + true + + + false + + + + + + + + Object + + + + + + true + + + false + + + + + + + + + + + true + + + + + + + Chapter: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Finished: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + + State: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Name: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Target Date: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + true + + + + + + + Started: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + Part: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + true + + + + + + + true + + + + + + + + + + cTextEdit + QTextEdit +
ctextedit.h
+
+
+ + m_lpName + m_lpText + + + +
diff --git a/cstorybook.cpp b/cstorybook.cpp index 623ae14..f565dcf 100644 --- a/cstorybook.cpp +++ b/cstorybook.cpp @@ -34,6 +34,15 @@ cStoryBook::cStoryBook(const QString &szProject, QObject *parent) : if(!loadImageList()) return; + if(!loadCharacterList()) + return; + + if(!loadPlaceList()) + return; + + if(!loadObjectList()) + return; + if(!loadBook()) return; @@ -46,15 +55,6 @@ cStoryBook::cStoryBook(const QString &szProject, QObject *parent) : if(!loadSceneList()) return; - if(!loadCharacterList()) - return; - - if(!loadPlaceList()) - return; - - if(!loadObjectList()) - return; - if(!loadRechercheList()) return; @@ -400,6 +400,11 @@ cChapterList* cStoryBook::chapterList() return(&m_chapterList); } +cSceneList* cStoryBook::sceneList() +{ + return(&m_sceneList); +} + bool cStoryBook::fillOutlineList(QTreeView* lpView) { QMap part; @@ -467,12 +472,12 @@ bool cStoryBook::fillOutlineList(QTreeView* lpView) lpItems[0]->setData(QVariant::fromValue(lpScene)); lpItems[0]->setFont(fontScene); lpItems[0]->setForeground(QBrush(Qt::blue)); - lpItems[0]->setToolTip(lpScene->description()); + lpItems[0]->setToolTip(lpScene->description()->toPlainText()); lpItems[1]->setData(QVariant::fromValue(lpScene)); lpItems[1]->setBackground(QBrush(lpScene->stateColor())); lpItems[1]->setTextAlignment(Qt::AlignCenter); - lpItems[1]->setToolTip(lpScene->description()); + lpItems[1]->setToolTip(lpScene->description()->toPlainText()); lpChapterItem->appendRow(lpItems); } diff --git a/cstorybook.h b/cstorybook.h index 813d12a..f230ded 100644 --- a/cstorybook.h +++ b/cstorybook.h @@ -41,6 +41,7 @@ public: bool fillRechercheList(QTreeView* lpView); cChapterList* chapterList(); + cSceneList* sceneList(); private: QString m_szProject; bool m_bIsOpen; diff --git a/cwidget.cpp b/cwidget.cpp index 1e67084..a1be74e 100644 --- a/cwidget.cpp +++ b/cwidget.cpp @@ -9,6 +9,22 @@ cWidget::cWidget(cPartWindow* parent) : { } +cWidget::cWidget(cChapterWindow* parent) : + QWidget(parent), + m_type(TYPE_chapter), + m_lpWidget(parent), + m_lpWindow(0) +{ +} + +cWidget::cWidget(cSceneWindow* parent) : + QWidget(parent), + m_type(TYPE_scene), + m_lpWidget(parent), + m_lpWindow(0) +{ +} + cWidget::cWidget(QWidget* parent) : QWidget(parent), m_type(TYPE_unknown), diff --git a/cwidget.h b/cwidget.h index 08ecb71..5b63c50 100644 --- a/cwidget.h +++ b/cwidget.h @@ -3,6 +3,8 @@ #include "cpartwindow.h" +#include "cchapterwindow.h" +#include "cscenewindow.h" #include #include @@ -16,9 +18,13 @@ public: { TYPE_unknown = 0, TYPE_part = 1, + TYPE_chapter = 2, + TYPE_scene = 3, }; explicit cWidget(cPartWindow* parent); + explicit cWidget(cChapterWindow* parent); + explicit cWidget(cSceneWindow* parent); explicit cWidget(QWidget* parent); QWidget* widget(); diff --git a/qtStoryWriter.pro b/qtStoryWriter.pro index 5a300f5..bfdf47e 100644 --- a/qtStoryWriter.pro +++ b/qtStoryWriter.pro @@ -57,7 +57,9 @@ SOURCES += \ cplace.cpp \ cobject.cpp \ crecherche.cpp \ - cimage.cpp + cimage.cpp \ + cchapterwindow.cpp \ + cscenewindow.cpp HEADERS += \ cmainwindow.h \ @@ -76,11 +78,15 @@ HEADERS += \ cplace.h \ cobject.h \ crecherche.h \ - cimage.h + cimage.h \ + cchapterwindow.h \ + cscenewindow.h FORMS += \ cmainwindow.ui \ - cpartwindow.ui + cpartwindow.ui \ + cchapterwindow.ui \ + cscenewindow.ui DISTFILES += \ storyBook.project