.
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
#include "cchapterwindow.h"
|
||||
#include "ui_cchapterwindow.h"
|
||||
|
||||
#include <QStandardItem>
|
||||
|
||||
|
||||
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<cScene*> 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);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef CCHAPTERWINDOW_H
|
||||
#define CCHAPTERWINDOW_H
|
||||
|
||||
|
||||
#include "cpart.h"
|
||||
#include "cchapter.h"
|
||||
#include "cscene.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
|
||||
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
|
||||
@@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>cChapterWindow</class>
|
||||
<widget class="QWidget" name="cChapterWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>725</width>
|
||||
<height>528</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout" rowstretch="1,1,1,5,10">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Description:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="cTextEdit" name="m_lpText"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="m_lpName"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Scenes:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QTextEdit" name="m_lpDescription"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QTreeView" name="m_lpSceneList">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Part:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="m_lpPart">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>cTextEdit</class>
|
||||
<extends>QTextEdit</extends>
|
||||
<header>ctextedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>m_lpName</tabstop>
|
||||
<tabstop>m_lpDescription</tabstop>
|
||||
<tabstop>m_lpSceneList</tabstop>
|
||||
<tabstop>m_lpText</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+49
-25
@@ -4,6 +4,9 @@
|
||||
#include "ctextdocument.h"
|
||||
|
||||
#include "cpartwindow.h"
|
||||
#include "cchapterwindow.h"
|
||||
#include "cscenewindow.h"
|
||||
|
||||
#include "cwidget.h"
|
||||
|
||||
#include <QTextDocument>
|
||||
@@ -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<cPart*>(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();
|
||||
}
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
<property name="text">
|
||||
<string>Description:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
@@ -34,6 +37,9 @@
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
@@ -44,6 +50,9 @@
|
||||
<property name="text">
|
||||
<string>Chapters:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
|
||||
+35
-8
@@ -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<cCharacter*> 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<cObject*> 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<cPlace*> 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<cScene*> cSceneList::find(cChapter* lpChapter)
|
||||
{
|
||||
QList<cScene*> 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());
|
||||
|
||||
@@ -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<cCharacter*> characterList();
|
||||
|
||||
void addObject(cObject* lpObject);
|
||||
QList<cObject*> objectList();
|
||||
|
||||
void addPlace(cPlace* lpPlace);
|
||||
QList<cPlace*> 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<cScene*> find(cChapter* lpChapter);
|
||||
};
|
||||
|
||||
#endif // CSCENE_H
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
#include "cscenewindow.h"
|
||||
#include "ui_cscenewindow.h"
|
||||
|
||||
#include <QStandardItem>
|
||||
|
||||
|
||||
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<cCharacter*> characterList = lpScene->characterList();
|
||||
QList<cPlace*> placeList = lpScene->placeList();
|
||||
QList<cObject*> 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<QStandardItem*> 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<QStandardItem*> 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<QStandardItem*> 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<QBrush>(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()));
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
#ifndef CSCENEWINDOW_H
|
||||
#define CSCENEWINDOW_H
|
||||
|
||||
|
||||
#include "cpart.h"
|
||||
#include "cchapter.h"
|
||||
#include "cscene.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
|
||||
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
|
||||
+214
@@ -0,0 +1,214 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>cSceneWindow</class>
|
||||
<widget class="QWidget" name="cSceneWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>725</width>
|
||||
<height>528</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="1">
|
||||
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,1,0,0,5">
|
||||
<item row="3" column="0" colspan="8">
|
||||
<widget class="QTabWidget" name="m_lpTabs">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="m_lpTabDescription">
|
||||
<attribute name="title">
|
||||
<string>Description</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTextEdit" name="m_lpDescription"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="m_lpTabCharacter">
|
||||
<attribute name="title">
|
||||
<string>Character</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTreeView" name="m_lpCharacterList">
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="m_lpTabPlace">
|
||||
<attribute name="title">
|
||||
<string>Place</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTreeView" name="m_lpPlaceList">
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="m_lpTabObject">
|
||||
<attribute name="title">
|
||||
<string>Object</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTreeView" name="m_lpObjectList">
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="5">
|
||||
<widget class="QDateTimeEdit" name="m_lpFinishedAt">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Chapter:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="4">
|
||||
<widget class="QLabel" name="m_lpFinishedLabel">
|
||||
<property name="text">
|
||||
<string>Finished:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="7">
|
||||
<widget class="QLineEdit" name="m_lpName"/>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="8">
|
||||
<widget class="cTextEdit" name="m_lpText"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>State:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="6">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Target Date:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="m_lpState"/>
|
||||
</item>
|
||||
<item row="5" column="3">
|
||||
<widget class="QDateTimeEdit" name="m_lpStartedAt">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QLabel" name="m_lpStartedLabel">
|
||||
<property name="text">
|
||||
<string>Started:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="7">
|
||||
<widget class="QDateTimeEdit" name="m_lpTargetDate"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Part:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="7">
|
||||
<widget class="QLineEdit" name="m_lpPart">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="7">
|
||||
<widget class="QLineEdit" name="m_lpChapter">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>cTextEdit</class>
|
||||
<extends>QTextEdit</extends>
|
||||
<header>ctextedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>m_lpName</tabstop>
|
||||
<tabstop>m_lpText</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+16
-11
@@ -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<qint32, QStandardItem*> 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);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ public:
|
||||
bool fillRechercheList(QTreeView* lpView);
|
||||
|
||||
cChapterList* chapterList();
|
||||
cSceneList* sceneList();
|
||||
private:
|
||||
QString m_szProject;
|
||||
bool m_bIsOpen;
|
||||
|
||||
+16
@@ -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),
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
|
||||
#include "cpartwindow.h"
|
||||
#include "cchapterwindow.h"
|
||||
#include "cscenewindow.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QMdiSubWindow>
|
||||
@@ -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();
|
||||
|
||||
+9
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user