.
This commit is contained in:
+2
-1
@@ -937,7 +937,8 @@ void cMainWindow::onShowSceneWindow(cScene* lpScene)
|
||||
}
|
||||
|
||||
cSceneWindow* lpSceneWindow = new cSceneWindow(this);
|
||||
lpSceneWindow->setScene(lpScene);
|
||||
lpSceneWindow->setScene(lpScene, m_lpStoryBook->characterList(), m_lpStoryBook->placeList(), m_lpStoryBook->objectList());
|
||||
|
||||
cWidget* lpWidget1 = new cWidget(lpSceneWindow);
|
||||
lpWidget1->setWindow(ui->m_lpMdiArea->addSubWindow(lpSceneWindow));
|
||||
ui->m_lpMainTab->addTab((QWidget*)lpWidget1, lpSceneWindow->windowTitle());
|
||||
|
||||
+102
-21
@@ -126,38 +126,32 @@ cTextDocument* cScene::text()
|
||||
return(m_lpText);
|
||||
}
|
||||
|
||||
void cScene::addCharacter(cCharacter* lpCharacter)
|
||||
void cScene::addCharacter(cCharacter* lpCharacter, cTextDocument* lpDescription)
|
||||
{
|
||||
if(m_characterList.contains(lpCharacter))
|
||||
return;
|
||||
m_characterList.append(lpCharacter);
|
||||
m_characterList.append(new cCharacterDescription(lpCharacter, lpDescription));
|
||||
}
|
||||
|
||||
QList<cCharacter*> cScene::characterList()
|
||||
QList<cCharacterDescription*> cScene::characterList()
|
||||
{
|
||||
return(m_characterList);
|
||||
}
|
||||
|
||||
void cScene::addObject(cObject* lpObject)
|
||||
void cScene::addObject(cObject* lpObject, cTextDocument* lpDescription)
|
||||
{
|
||||
if(m_objectList.contains(lpObject))
|
||||
return;
|
||||
m_objectList.append(lpObject);
|
||||
m_objectList.append(new cObjectDescription(lpObject, lpDescription));
|
||||
}
|
||||
|
||||
QList<cObject*> cScene::objectList()
|
||||
QList<cObjectDescription*> cScene::objectList()
|
||||
{
|
||||
return(m_objectList);
|
||||
}
|
||||
|
||||
void cScene::addPlace(cPlace* lpPlace)
|
||||
void cScene::addPlace(cPlace* lpPlace, cTextDocument* lpDescription)
|
||||
{
|
||||
if(m_placeList.contains(lpPlace))
|
||||
return;
|
||||
m_placeList.append(lpPlace);
|
||||
m_placeList.append(new cPlaceDescription(lpPlace, lpDescription));
|
||||
}
|
||||
|
||||
QList<cPlace*> cScene::placeList()
|
||||
QList<cPlaceDescription*> cScene::placeList()
|
||||
{
|
||||
return(m_placeList);
|
||||
}
|
||||
@@ -315,7 +309,7 @@ bool cSceneList::load(cChapterList* lpChapterList, cCharacterList *lpCharacterLi
|
||||
lpScene->setText(blob2TextDocument(query.value("text").toByteArray()));
|
||||
}
|
||||
|
||||
query.prepare("SELECT sceneID, characterID FROM sceneCharacter;");
|
||||
query.prepare("SELECT sceneID, characterID, description FROM sceneCharacter;");
|
||||
if(!query.exec())
|
||||
{
|
||||
myDebug << query.lastError().text();
|
||||
@@ -329,11 +323,11 @@ bool cSceneList::load(cChapterList* lpChapterList, cCharacterList *lpCharacterLi
|
||||
{
|
||||
cCharacter* lpCharacter = lpCharacterList->find(query.value("characterID").toInt());
|
||||
if(lpCharacter)
|
||||
lpScene->addCharacter(lpCharacter);
|
||||
lpScene->addCharacter(lpCharacter, blob2TextDocument(query.value("description").toByteArray()));
|
||||
}
|
||||
}
|
||||
|
||||
query.prepare("SELECT sceneID, objectID FROM sceneObject;");
|
||||
query.prepare("SELECT sceneID, objectID, description FROM sceneObject;");
|
||||
if(!query.exec())
|
||||
{
|
||||
myDebug << query.lastError().text();
|
||||
@@ -347,11 +341,11 @@ bool cSceneList::load(cChapterList* lpChapterList, cCharacterList *lpCharacterLi
|
||||
{
|
||||
cObject* lpObject = lpObjectList->find(query.value("objectID").toInt());
|
||||
if(lpObject)
|
||||
lpScene->addObject(lpObject);
|
||||
lpScene->addObject(lpObject, blob2TextDocument(query.value("description").toByteArray()));
|
||||
}
|
||||
}
|
||||
|
||||
query.prepare("SELECT sceneID, placeID FROM scenePlace;");
|
||||
query.prepare("SELECT sceneID, placeID, description FROM scenePlace;");
|
||||
if(!query.exec())
|
||||
{
|
||||
myDebug << query.lastError().text();
|
||||
@@ -365,7 +359,7 @@ bool cSceneList::load(cChapterList* lpChapterList, cCharacterList *lpCharacterLi
|
||||
{
|
||||
cPlace* lpPlace = lpPlaceList->find(query.value("placeID").toInt());
|
||||
if(lpPlace)
|
||||
lpScene->addPlace(lpPlace);
|
||||
lpScene->addPlace(lpPlace, blob2TextDocument(query.value("description").toByteArray()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,6 +378,24 @@ bool cSceneList::save()
|
||||
querySelect.prepare("SELECT id FROM scene WHERE _rowid_=(SELECT MAX(_rowid_) FROM part);");
|
||||
queryDelete.prepare("DELETE FROM scene WHERE id=:id;");
|
||||
|
||||
QSqlQuery characterDelete;
|
||||
QSqlQuery characterAdd;
|
||||
|
||||
characterDelete.prepare("DELETE FROM sceneCharacter WHERE sceneID=:sceneID;");
|
||||
characterAdd.prepare("INSERT INTO sceneCharacter (sceneID, characterID, description) VALUES (:sceneID, :characterID, :description);");
|
||||
|
||||
QSqlQuery placeDelete;
|
||||
QSqlQuery placeAdd;
|
||||
|
||||
placeDelete.prepare("DELETE FROM scenePlace WHERE sceneID=:sceneID;");
|
||||
placeAdd.prepare("INSERT INTO scenePlace (sceneID, placeID, description) VALUES (:sceneID, :placeID, :description);");
|
||||
|
||||
QSqlQuery objectDelete;
|
||||
QSqlQuery objectAdd;
|
||||
|
||||
objectDelete.prepare("DELETE FROM sceneObject WHERE sceneID=:sceneID;");
|
||||
objectAdd.prepare("INSERT INTO sceneObject (sceneID, objectID, description) VALUES (:sceneID, :objectID, :description);");
|
||||
|
||||
for(int x = 0;x < count();x++)
|
||||
{
|
||||
cScene* lpScene = at(x);
|
||||
@@ -444,6 +456,75 @@ bool cSceneList::save()
|
||||
querySelect.next();
|
||||
lpScene->setID(querySelect.value("id").toInt());
|
||||
}
|
||||
|
||||
characterDelete.bindValue(":sceneID", lpScene->id());
|
||||
if(!characterDelete.exec())
|
||||
{
|
||||
myDebug << characterDelete.lastError().text();
|
||||
return(false);
|
||||
}
|
||||
|
||||
QList<cCharacterDescription*> character = lpScene->characterList();
|
||||
|
||||
for(int x = 0;x < character.count();x++)
|
||||
{
|
||||
cCharacterDescription* lpCharacter = character.at(x);
|
||||
|
||||
characterAdd.bindValue(":sceneID", lpScene->id());
|
||||
characterAdd.bindValue(":characterID", lpCharacter->character()->id());
|
||||
characterAdd.bindValue(":description", textDocument2Blob(lpCharacter->description()));
|
||||
if(!characterAdd.exec())
|
||||
{
|
||||
myDebug << characterAdd.lastError().text();
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
|
||||
placeDelete.bindValue(":sceneID", lpScene->id());
|
||||
if(!placeDelete.exec())
|
||||
{
|
||||
myDebug << placeDelete.lastError().text();
|
||||
return(false);
|
||||
}
|
||||
|
||||
QList<cPlaceDescription*> place = lpScene->placeList();
|
||||
|
||||
for(int x = 0;x < place.count();x++)
|
||||
{
|
||||
cPlaceDescription* lpPlace = place.at(x);
|
||||
|
||||
placeAdd.bindValue(":sceneID", lpScene->id());
|
||||
placeAdd.bindValue(":placeID", lpPlace->place()->id());
|
||||
placeAdd.bindValue(":description", textDocument2Blob(lpPlace->description()));
|
||||
if(!placeAdd.exec())
|
||||
{
|
||||
myDebug << placeAdd.lastError().text();
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
|
||||
objectDelete.bindValue(":sceneID", lpScene->id());
|
||||
if(!objectDelete.exec())
|
||||
{
|
||||
myDebug << objectDelete.lastError().text();
|
||||
return(false);
|
||||
}
|
||||
|
||||
QList<cObjectDescription*> object = lpScene->objectList();
|
||||
|
||||
for(int x = 0;x < object.count();x++)
|
||||
{
|
||||
cObjectDescription* lpObject = object.at(x);
|
||||
|
||||
objectAdd.bindValue(":sceneID", lpScene->id());
|
||||
objectAdd.bindValue(":objectID", lpObject->object()->id());
|
||||
objectAdd.bindValue(":description", textDocument2Blob(lpObject->description()));
|
||||
if(!objectAdd.exec())
|
||||
{
|
||||
myDebug << objectAdd.lastError().text();
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(true);
|
||||
|
||||
@@ -60,14 +60,14 @@ public:
|
||||
\fn setID
|
||||
\param iID
|
||||
*/
|
||||
void setID(const qint32& iID);
|
||||
void setID(const qint32& iID);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn id
|
||||
\return qint32
|
||||
*/
|
||||
qint32 id();
|
||||
qint32 id();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
@@ -75,14 +75,14 @@ public:
|
||||
\fn setChapter
|
||||
\param lpChapter
|
||||
*/
|
||||
void setChapter(cChapter *lpChapter);
|
||||
void setChapter(cChapter *lpChapter);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn chapter
|
||||
\return cChapter
|
||||
*/
|
||||
cChapter* chapter();
|
||||
cChapter* chapter();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
@@ -90,14 +90,14 @@ public:
|
||||
\fn setName
|
||||
\param szName
|
||||
*/
|
||||
void setName(const QString& szName);
|
||||
void setName(const QString& szName);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn name
|
||||
\return QString
|
||||
*/
|
||||
QString name();
|
||||
QString name();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
@@ -105,14 +105,14 @@ public:
|
||||
\fn setSortOrder
|
||||
\param iSortOrder
|
||||
*/
|
||||
void setSortOrder(const qint32& iSortOrder);
|
||||
void setSortOrder(const qint32& iSortOrder);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn sortOrder
|
||||
\return qint32
|
||||
*/
|
||||
qint32 sortOrder();
|
||||
qint32 sortOrder();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
@@ -120,14 +120,14 @@ public:
|
||||
\fn setDescription
|
||||
\param lpDescription
|
||||
*/
|
||||
void setDescription(cTextDocument* lpDescription);
|
||||
void setDescription(cTextDocument* lpDescription);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn description
|
||||
\return cTextDocument
|
||||
*/
|
||||
cTextDocument* description();
|
||||
cTextDocument* description();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
@@ -135,14 +135,14 @@ public:
|
||||
\fn setState
|
||||
\param state
|
||||
*/
|
||||
void setState(const STATE state);
|
||||
void setState(const STATE state);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn state
|
||||
\return STATE
|
||||
*/
|
||||
STATE state();
|
||||
STATE state();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
@@ -150,14 +150,14 @@ public:
|
||||
\fn setStartedAt
|
||||
\param startedAt
|
||||
*/
|
||||
void setStartedAt(const QDateTime& startedAt);
|
||||
void setStartedAt(const QDateTime& startedAt);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn startedAt
|
||||
\return QDateTime
|
||||
*/
|
||||
QDateTime startedAt();
|
||||
QDateTime startedAt();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
@@ -165,14 +165,14 @@ public:
|
||||
\fn setFinishedAt
|
||||
\param finishedAt
|
||||
*/
|
||||
void setFinishedAt(const QDateTime& finishedAt);
|
||||
void setFinishedAt(const QDateTime& finishedAt);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn finishedAt
|
||||
\return QDateTime
|
||||
*/
|
||||
QDateTime finishedAt();
|
||||
QDateTime finishedAt();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
@@ -180,14 +180,14 @@ public:
|
||||
\fn setTargetDate
|
||||
\param targetDate
|
||||
*/
|
||||
void setTargetDate(const QDateTime& targetDate);
|
||||
void setTargetDate(const QDateTime& targetDate);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn targetDate
|
||||
\return QDateTime
|
||||
*/
|
||||
QDateTime targetDate();
|
||||
QDateTime targetDate();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
@@ -195,59 +195,62 @@ public:
|
||||
\fn setText
|
||||
\param lpText
|
||||
*/
|
||||
void setText(cTextDocument* lpText);
|
||||
void setText(cTextDocument* lpText);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn text
|
||||
\return cTextDocument
|
||||
*/
|
||||
cTextDocument* text();
|
||||
cTextDocument* text();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn addCharacter
|
||||
\param lpCharacter
|
||||
\param lpDescription
|
||||
*/
|
||||
void addCharacter(cCharacter* lpCharacter);
|
||||
void addCharacter(cCharacter* lpCharacter, cTextDocument* lpDescription);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn characterList
|
||||
\return QList<cCharacter *>
|
||||
*/
|
||||
QList<cCharacter*> characterList();
|
||||
QList<cCharacterDescription*> characterList();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn addObject
|
||||
\param lpObject
|
||||
\param lpDescription
|
||||
*/
|
||||
void addObject(cObject* lpObject);
|
||||
void addObject(cObject* lpObject, cTextDocument* lpDescription);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn objectList
|
||||
\return QList<cObject *>
|
||||
*/
|
||||
QList<cObject*> objectList();
|
||||
QList<cObjectDescription*> objectList();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn addPlace
|
||||
\param lpPlace
|
||||
\param lpDescription
|
||||
*/
|
||||
void addPlace(cPlace* lpPlace);
|
||||
void addPlace(cPlace* lpPlace, cTextDocument* lpDescription);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn placeList
|
||||
\return QList<cPlace *>
|
||||
*/
|
||||
QList<cPlace*> placeList();
|
||||
QList<cPlaceDescription*> placeList();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
@@ -255,7 +258,7 @@ public:
|
||||
\fn stateText
|
||||
\return QString
|
||||
*/
|
||||
QString stateText();
|
||||
QString stateText();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
@@ -263,14 +266,14 @@ public:
|
||||
\param state
|
||||
\return QString
|
||||
*/
|
||||
static QString stateText(STATE state);
|
||||
static QString stateText(STATE state);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn stateColor
|
||||
\return QColor
|
||||
*/
|
||||
QColor stateColor();
|
||||
QColor stateColor();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
@@ -278,7 +281,7 @@ public:
|
||||
\param state
|
||||
\return QColor
|
||||
*/
|
||||
static QColor stateColor(STATE state);
|
||||
static QColor stateColor(STATE state);
|
||||
|
||||
/*!
|
||||
\brief
|
||||
@@ -286,14 +289,14 @@ public:
|
||||
\fn setItem
|
||||
\param lpItem
|
||||
*/
|
||||
void setItem(QStandardItem* lpItem);
|
||||
void setItem(QStandardItem* lpItem);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn item
|
||||
\return QStandardItem
|
||||
*/
|
||||
QStandardItem* item();
|
||||
QStandardItem* item();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
@@ -301,14 +304,14 @@ public:
|
||||
\fn setStateItem
|
||||
\param lpItem
|
||||
*/
|
||||
void setStateItem(QStandardItem* lpItem);
|
||||
void setStateItem(QStandardItem* lpItem);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn stateItem
|
||||
\return QStandardItem
|
||||
*/
|
||||
QStandardItem* stateItem();
|
||||
QStandardItem* stateItem();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
@@ -316,32 +319,32 @@ public:
|
||||
\fn setDeleted
|
||||
\param bDeleted
|
||||
*/
|
||||
void setDeleted(bool bDeleted);
|
||||
void setDeleted(bool bDeleted);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn deleted
|
||||
\return bool
|
||||
*/
|
||||
bool deleted();
|
||||
bool deleted();
|
||||
|
||||
private:
|
||||
qint32 m_iID; /*!< TODO: describe */
|
||||
cChapter* m_lpChapter; /*!< TODO: describe */
|
||||
QString m_szName; /*!< TODO: describe */
|
||||
qint32 m_iSortOrder; /*!< TODO: describe */
|
||||
cTextDocument* m_lpDescription; /*!< TODO: describe */
|
||||
STATE m_state; /*!< TODO: describe */
|
||||
QDateTime m_startedAt; /*!< TODO: describe */
|
||||
QDateTime m_finishedAt; /*!< TODO: describe */
|
||||
QDateTime m_targetDate; /*!< TODO: describe */
|
||||
cTextDocument* m_lpText; /*!< TODO: describe */
|
||||
QList<cCharacter*> m_characterList; /*!< TODO: describe */
|
||||
QList<cObject*> m_objectList; /*!< TODO: describe */
|
||||
QList<cPlace*> m_placeList; /*!< TODO: describe */
|
||||
QStandardItem* m_lpItem; /*!< TODO: describe */
|
||||
QStandardItem* m_lpStateItem; /*!< TODO: describe */
|
||||
bool m_bDeleted; /*!< TODO: describe */
|
||||
qint32 m_iID; /*!< TODO: describe */
|
||||
cChapter* m_lpChapter; /*!< TODO: describe */
|
||||
QString m_szName; /*!< TODO: describe */
|
||||
qint32 m_iSortOrder; /*!< TODO: describe */
|
||||
cTextDocument* m_lpDescription; /*!< TODO: describe */
|
||||
STATE m_state; /*!< TODO: describe */
|
||||
QDateTime m_startedAt; /*!< TODO: describe */
|
||||
QDateTime m_finishedAt; /*!< TODO: describe */
|
||||
QDateTime m_targetDate; /*!< TODO: describe */
|
||||
cTextDocument* m_lpText; /*!< TODO: describe */
|
||||
QList<cCharacterDescription*> m_characterList; /*!< TODO: describe */
|
||||
QList<cObjectDescription*> m_objectList; /*!< TODO: describe */
|
||||
QList<cPlaceDescription*> m_placeList; /*!< TODO: describe */
|
||||
QStandardItem* m_lpItem; /*!< TODO: describe */
|
||||
QStandardItem* m_lpStateItem; /*!< TODO: describe */
|
||||
bool m_bDeleted; /*!< TODO: describe */
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cScene*)
|
||||
|
||||
+174
-41
@@ -11,13 +11,17 @@
|
||||
#include "common.h"
|
||||
|
||||
#include <QStandardItem>
|
||||
#include <QMenu>
|
||||
|
||||
|
||||
cSceneWindow::cSceneWindow(QWidget *parent) :
|
||||
cMDISubWindow(parent),
|
||||
ui(new Ui::cSceneWindow),
|
||||
m_lpMainWindow((cMainWindow*)parent),
|
||||
m_lpScene(0)
|
||||
m_lpScene(0),
|
||||
m_lpCharacterList(0),
|
||||
m_lpPlaceList(0),
|
||||
m_lpObjectList(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@@ -48,45 +52,49 @@ cSceneWindow::cSceneWindow(QWidget *parent) :
|
||||
ui->m_lpState->setItemData(4, QBrush(cScene::stateColor(cScene::STATE_unknown)), Qt::BackgroundColorRole);
|
||||
|
||||
|
||||
connect(ui->m_lpCharacterList, &cTreeView::doubleClicked, this, &cSceneWindow::onCharacterDoubleClicked);
|
||||
connect(ui->m_lpPlaceList, &cTreeView::doubleClicked, this, &cSceneWindow::onPlaceDoubleClicked);
|
||||
connect(ui->m_lpObjectList, &cTreeView::doubleClicked, this, &cSceneWindow::onObjectDoubleClicked);
|
||||
connect(ui->m_lpCharacterList, &cTreeView::doubleClicked, this, &cSceneWindow::onCharacterDoubleClicked);
|
||||
connect(ui->m_lpPlaceList, &cTreeView::doubleClicked, this, &cSceneWindow::onPlaceDoubleClicked);
|
||||
connect(ui->m_lpObjectList, &cTreeView::doubleClicked, this, &cSceneWindow::onObjectDoubleClicked);
|
||||
|
||||
connect(ui->m_lpPart, &cLineEdit::gotFocus, (cMainWindow*)parent, &cMainWindow::onLineEditGotFocus);
|
||||
connect(ui->m_lpPart, &cLineEdit::lostFocus, (cMainWindow*)parent, &cMainWindow::onLineEditLostFocus);
|
||||
connect(ui->m_lpPart, &cLineEdit::gotFocus, (cMainWindow*)parent, &cMainWindow::onLineEditGotFocus);
|
||||
connect(ui->m_lpPart, &cLineEdit::lostFocus, (cMainWindow*)parent, &cMainWindow::onLineEditLostFocus);
|
||||
|
||||
connect(ui->m_lpChapter, &cLineEdit::gotFocus, (cMainWindow*)parent, &cMainWindow::onLineEditGotFocus);
|
||||
connect(ui->m_lpChapter, &cLineEdit::lostFocus, (cMainWindow*)parent, &cMainWindow::onLineEditLostFocus);
|
||||
connect(ui->m_lpChapter, &cLineEdit::gotFocus, (cMainWindow*)parent, &cMainWindow::onLineEditGotFocus);
|
||||
connect(ui->m_lpChapter, &cLineEdit::lostFocus, (cMainWindow*)parent, &cMainWindow::onLineEditLostFocus);
|
||||
|
||||
connect(ui->m_lpName, &cLineEdit::gotFocus, (cMainWindow*)parent, &cMainWindow::onLineEditGotFocus);
|
||||
connect(ui->m_lpName, &cLineEdit::lostFocus, (cMainWindow*)parent, &cMainWindow::onLineEditLostFocus);
|
||||
connect(ui->m_lpName, &cLineEdit::gotFocus, (cMainWindow*)parent, &cMainWindow::onLineEditGotFocus);
|
||||
connect(ui->m_lpName, &cLineEdit::lostFocus, (cMainWindow*)parent, &cMainWindow::onLineEditLostFocus);
|
||||
|
||||
connect(ui->m_lpDescription, &cTextEdit::gotFocus, (cMainWindow*)parent, &cMainWindow::onTextEditGotFocus);
|
||||
connect(ui->m_lpDescription, &cTextEdit::lostFocus, (cMainWindow*)parent, &cMainWindow::onTextEditLostFocus);
|
||||
connect(ui->m_lpDescription, &cTextEdit::gotFocus, (cMainWindow*)parent, &cMainWindow::onTextEditGotFocus);
|
||||
connect(ui->m_lpDescription, &cTextEdit::lostFocus, (cMainWindow*)parent, &cMainWindow::onTextEditLostFocus);
|
||||
|
||||
connect(ui->m_lpCharacterList, &cTreeView::gotFocus, (cMainWindow*)parent, &cMainWindow::onTreeViewGotFocus);
|
||||
connect(ui->m_lpCharacterList, &cTreeView::lostFocus, (cMainWindow*)parent, &cMainWindow::onTreeViewLostFocus);
|
||||
connect(ui->m_lpCharacterList, &cTreeView::gotFocus, (cMainWindow*)parent, &cMainWindow::onTreeViewGotFocus);
|
||||
connect(ui->m_lpCharacterList, &cTreeView::lostFocus, (cMainWindow*)parent, &cMainWindow::onTreeViewLostFocus);
|
||||
|
||||
connect(ui->m_lpObjectList, &cTreeView::gotFocus, (cMainWindow*)parent, &cMainWindow::onTreeViewGotFocus);
|
||||
connect(ui->m_lpObjectList, &cTreeView::lostFocus, (cMainWindow*)parent, &cMainWindow::onTreeViewLostFocus);
|
||||
connect(ui->m_lpObjectList, &cTreeView::gotFocus, (cMainWindow*)parent, &cMainWindow::onTreeViewGotFocus);
|
||||
connect(ui->m_lpObjectList, &cTreeView::lostFocus, (cMainWindow*)parent, &cMainWindow::onTreeViewLostFocus);
|
||||
|
||||
connect(ui->m_lpPlaceList, &cTreeView::gotFocus, (cMainWindow*)parent, &cMainWindow::onTreeViewGotFocus);
|
||||
connect(ui->m_lpPlaceList, &cTreeView::lostFocus, (cMainWindow*)parent, &cMainWindow::onTreeViewLostFocus);
|
||||
connect(ui->m_lpPlaceList, &cTreeView::gotFocus, (cMainWindow*)parent, &cMainWindow::onTreeViewGotFocus);
|
||||
connect(ui->m_lpPlaceList, &cTreeView::lostFocus, (cMainWindow*)parent, &cMainWindow::onTreeViewLostFocus);
|
||||
|
||||
connect(ui->m_lpState, &cComboBox::gotFocus, (cMainWindow*)parent, &cMainWindow::onComboBoxGotFocus);
|
||||
connect(ui->m_lpState, &cComboBox::lostFocus, (cMainWindow*)parent, &cMainWindow::onComboBoxLostFocus);
|
||||
connect(ui->m_lpState, &cComboBox::gotFocus, (cMainWindow*)parent, &cMainWindow::onComboBoxGotFocus);
|
||||
connect(ui->m_lpState, &cComboBox::lostFocus, (cMainWindow*)parent, &cMainWindow::onComboBoxLostFocus);
|
||||
|
||||
connect(ui->m_lpStartedAt, &cDateTimeEdit::gotFocus, (cMainWindow*)parent, &cMainWindow::onDateTimeEditGotFocus);
|
||||
connect(ui->m_lpStartedAt, &cDateTimeEdit::lostFocus, (cMainWindow*)parent, &cMainWindow::onDateTimeEditLostFocus);
|
||||
connect(ui->m_lpStartedAt, &cDateTimeEdit::gotFocus, (cMainWindow*)parent, &cMainWindow::onDateTimeEditGotFocus);
|
||||
connect(ui->m_lpStartedAt, &cDateTimeEdit::lostFocus, (cMainWindow*)parent, &cMainWindow::onDateTimeEditLostFocus);
|
||||
|
||||
connect(ui->m_lpFinishedAt, &cDateTimeEdit::gotFocus, (cMainWindow*)parent, &cMainWindow::onDateTimeEditGotFocus);
|
||||
connect(ui->m_lpFinishedAt, &cDateTimeEdit::lostFocus, (cMainWindow*)parent, &cMainWindow::onDateTimeEditLostFocus);
|
||||
connect(ui->m_lpFinishedAt, &cDateTimeEdit::gotFocus, (cMainWindow*)parent, &cMainWindow::onDateTimeEditGotFocus);
|
||||
connect(ui->m_lpFinishedAt, &cDateTimeEdit::lostFocus, (cMainWindow*)parent, &cMainWindow::onDateTimeEditLostFocus);
|
||||
|
||||
connect(ui->m_lpTargetDate, &cDateTimeEdit::gotFocus, (cMainWindow*)parent, &cMainWindow::onDateTimeEditGotFocus);
|
||||
connect(ui->m_lpTargetDate, &cDateTimeEdit::lostFocus, (cMainWindow*)parent, &cMainWindow::onDateTimeEditLostFocus);
|
||||
connect(ui->m_lpTargetDate, &cDateTimeEdit::gotFocus, (cMainWindow*)parent, &cMainWindow::onDateTimeEditGotFocus);
|
||||
connect(ui->m_lpTargetDate, &cDateTimeEdit::lostFocus, (cMainWindow*)parent, &cMainWindow::onDateTimeEditLostFocus);
|
||||
|
||||
connect(ui->m_lpText, &cTextEdit::gotFocus, (cMainWindow*)parent, &cMainWindow::onTextEditGotFocus);
|
||||
connect(ui->m_lpText, &cTextEdit::lostFocus, (cMainWindow*)parent, &cMainWindow::onTextEditLostFocus);
|
||||
connect(ui->m_lpText, &cTextEdit::gotFocus, (cMainWindow*)parent, &cMainWindow::onTextEditGotFocus);
|
||||
connect(ui->m_lpText, &cTextEdit::lostFocus, (cMainWindow*)parent, &cMainWindow::onTextEditLostFocus);
|
||||
|
||||
connect(ui->m_lpCharacterList, &cTreeView::customContextMenuRequested, this, &cSceneWindow::onCharacterContextMenu);
|
||||
connect(ui->m_lpPlaceList, &cTreeView::customContextMenuRequested, this, &cSceneWindow::onPlaceContextMenu);
|
||||
connect(ui->m_lpObjectList, &cTreeView::customContextMenuRequested, this, &cSceneWindow::onObjectContextMenu);
|
||||
}
|
||||
|
||||
cSceneWindow::~cSceneWindow()
|
||||
@@ -94,9 +102,12 @@ cSceneWindow::~cSceneWindow()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void cSceneWindow::setScene(cScene* lpScene)
|
||||
void cSceneWindow::setScene(cScene* lpScene, cCharacterList* lpCharacterList, cPlaceList* lpPlaceList, cObjectList* lpObjectList)
|
||||
{
|
||||
m_lpScene = lpScene;
|
||||
m_lpCharacterList = lpCharacterList;
|
||||
m_lpPlaceList = lpPlaceList;
|
||||
m_lpObjectList = lpObjectList;
|
||||
|
||||
ui->m_lpPart->setText(lpScene->chapter()->part()->name());
|
||||
ui->m_lpChapter->setText(lpScene->chapter()->name());
|
||||
@@ -120,9 +131,9 @@ void cSceneWindow::setScene(cScene* lpScene)
|
||||
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();
|
||||
QList<cCharacterDescription*> characterList = lpScene->characterList();
|
||||
QList<cPlaceDescription*> placeList = lpScene->placeList();
|
||||
QList<cObjectDescription*> objectList = lpScene->objectList();
|
||||
|
||||
QStringList headerLabels;
|
||||
|
||||
@@ -130,7 +141,8 @@ void cSceneWindow::setScene(cScene* lpScene)
|
||||
m_lpCharacterModel->setHorizontalHeaderLabels(headerLabels);
|
||||
for(int x = 0;x < characterList.count();x++)
|
||||
{
|
||||
cCharacter* lpCharacter = characterList[x];
|
||||
cCharacterDescription* lpCharacterDescription = characterList[x];
|
||||
cCharacter* lpCharacter = lpCharacterDescription->character();
|
||||
QList<QStandardItem*> items;
|
||||
|
||||
items.append(new QStandardItem(lpCharacter->name()));
|
||||
@@ -149,8 +161,8 @@ void cSceneWindow::setScene(cScene* lpScene)
|
||||
|
||||
for(int y = 0;y < headerLabels.count();y++)
|
||||
{
|
||||
items[y]->setData(QVariant::fromValue(lpCharacter));
|
||||
items[y]->setToolTip(lpCharacter->description()->toPlainText());
|
||||
items[y]->setData(QVariant::fromValue(lpCharacterDescription));
|
||||
items[y]->setToolTip(lpCharacterDescription->description()->toPlainText());
|
||||
}
|
||||
|
||||
m_lpCharacterModel->appendRow(items);
|
||||
@@ -161,11 +173,13 @@ void cSceneWindow::setScene(cScene* lpScene)
|
||||
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];
|
||||
cPlaceDescription* lpPlaceDescription = placeList[x];
|
||||
cPlace* lpPlace = lpPlaceDescription->place();
|
||||
QList<QStandardItem*> items;
|
||||
|
||||
items.append(new QStandardItem(lpPlace->name()));
|
||||
@@ -174,8 +188,8 @@ void cSceneWindow::setScene(cScene* lpScene)
|
||||
|
||||
for(int y = 0;y < headerLabels.count();y++)
|
||||
{
|
||||
items[y]->setData(QVariant::fromValue(lpPlace));
|
||||
items[y]->setToolTip(lpPlace->description()->toPlainText());
|
||||
items[y]->setData(QVariant::fromValue(lpPlaceDescription));
|
||||
items[y]->setToolTip(lpPlaceDescription->description()->toPlainText());
|
||||
}
|
||||
|
||||
m_lpPlaceModel->appendRow(items);
|
||||
@@ -186,11 +200,13 @@ void cSceneWindow::setScene(cScene* lpScene)
|
||||
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];
|
||||
cObjectDescription* lpObjectDescription = objectList[x];
|
||||
cObject* lpObject = lpObjectDescription->object();
|
||||
QList<QStandardItem*> items;
|
||||
|
||||
items.append(new QStandardItem(lpObject->name()));
|
||||
@@ -198,8 +214,8 @@ void cSceneWindow::setScene(cScene* lpScene)
|
||||
|
||||
for(int y = 0;y < headerLabels.count();y++)
|
||||
{
|
||||
items[y]->setData(QVariant::fromValue(lpObject));
|
||||
items[y]->setToolTip(lpObject->description()->toPlainText());
|
||||
items[y]->setData(QVariant::fromValue(lpObjectDescription));
|
||||
items[y]->setToolTip(lpObjectDescription->description()->toPlainText());
|
||||
}
|
||||
|
||||
m_lpObjectModel->appendRow(items);
|
||||
@@ -318,3 +334,120 @@ void cSceneWindow::onTextChanged()
|
||||
{
|
||||
m_lpMainWindow->somethingChanged();
|
||||
}
|
||||
|
||||
void cSceneWindow::onCharacterContextMenu(const QPoint& pos)
|
||||
{
|
||||
QMenu menu(this);
|
||||
|
||||
QStandardItem* lpItem = m_lpCharacterModel->itemFromIndex(ui->m_lpCharacterList->currentIndex());
|
||||
|
||||
if(!lpItem)
|
||||
{
|
||||
menu.addAction(tr("add character to list"), this, SLOT(onAddCharacterToList()));
|
||||
}
|
||||
else
|
||||
{
|
||||
cCharacterDescription* lpCharacterDescription = qvariant_cast<cCharacterDescription*>(lpItem->data());
|
||||
|
||||
if(lpCharacterDescription)
|
||||
{
|
||||
menu.addAction(tr("add character to list"), this, SLOT(onAddCharacterToList()));
|
||||
menu.addAction(tr("edit character description"), this, SLOT(onEditCharacterDescription()));
|
||||
menu.addAction(tr("remove character from list"), this, SLOT(onRemoveCharacterFromList()));
|
||||
}
|
||||
else
|
||||
menu.addAction(tr("add character to list"), this, SLOT(onAddCharacterToList()));
|
||||
}
|
||||
|
||||
menu.exec(ui->m_lpCharacterList->mapToGlobal(pos));
|
||||
}
|
||||
|
||||
void cSceneWindow::onPlaceContextMenu(const QPoint& pos)
|
||||
{
|
||||
QMenu menu(this);
|
||||
|
||||
QStandardItem* lpItem = m_lpPlaceModel->itemFromIndex(ui->m_lpPlaceList->currentIndex());
|
||||
|
||||
if(!lpItem)
|
||||
{
|
||||
menu.addAction(tr("add place to list"), this, SLOT(onAddPlaceToList()));
|
||||
}
|
||||
else
|
||||
{
|
||||
cPlaceDescription* lpPlaceDescription = qvariant_cast<cPlaceDescription*>(lpItem->data());
|
||||
|
||||
if(lpPlaceDescription)
|
||||
{
|
||||
menu.addAction(tr("add place to list"), this, SLOT(onAddPlaceToList()));
|
||||
menu.addAction(tr("edit place description"), this, SLOT(onEditPlaceDescription()));
|
||||
menu.addAction(tr("remove place from list"), this, SLOT(onRemovePlaceFromList()));
|
||||
}
|
||||
else
|
||||
menu.addAction(tr("add place to list"), this, SLOT(onAddPlaceToList()));
|
||||
}
|
||||
|
||||
menu.exec(ui->m_lpPlaceList->mapToGlobal(pos));
|
||||
}
|
||||
|
||||
void cSceneWindow::onObjectContextMenu(const QPoint& pos)
|
||||
{
|
||||
QMenu menu(this);
|
||||
|
||||
QStandardItem* lpItem = m_lpObjectModel->itemFromIndex(ui->m_lpObjectList->currentIndex());
|
||||
|
||||
if(!lpItem)
|
||||
{
|
||||
menu.addAction(tr("add object to list"), this, SLOT(onAddObjectToList()));
|
||||
}
|
||||
else
|
||||
{
|
||||
cObjectDescription* lpObjectDescription = qvariant_cast<cObjectDescription*>(lpItem->data());
|
||||
|
||||
if(lpObjectDescription)
|
||||
{
|
||||
menu.addAction(tr("add object to list"), this, SLOT(onAddObjectToList()));
|
||||
menu.addAction(tr("edit object description"), this, SLOT(onEditObjectDescription()));
|
||||
menu.addAction(tr("remove object from list"), this, SLOT(onRemoveObjectFromList()));
|
||||
}
|
||||
else
|
||||
menu.addAction(tr("add object to list"), this, SLOT(onAddObjectToList()));
|
||||
}
|
||||
|
||||
menu.exec(ui->m_lpObjectList->mapToGlobal(pos));
|
||||
}
|
||||
|
||||
void cSceneWindow::onAddCharacterToList()
|
||||
{
|
||||
}
|
||||
|
||||
void cSceneWindow::onRemoveCharacterFromList()
|
||||
{
|
||||
}
|
||||
|
||||
void cSceneWindow::onEditCharacterDescription()
|
||||
{
|
||||
}
|
||||
|
||||
void cSceneWindow::onAddPlaceToList()
|
||||
{
|
||||
}
|
||||
|
||||
void cSceneWindow::onRemovePlaceFromList()
|
||||
{
|
||||
}
|
||||
|
||||
void cSceneWindow::onEditPlaceDescription()
|
||||
{
|
||||
}
|
||||
|
||||
void cSceneWindow::onAddObjectToList()
|
||||
{
|
||||
}
|
||||
|
||||
void cSceneWindow::onRemoveObjectFromList()
|
||||
{
|
||||
}
|
||||
|
||||
void cSceneWindow::onEditObjectDescription()
|
||||
{
|
||||
}
|
||||
|
||||
+44
-7
@@ -47,7 +47,7 @@ public:
|
||||
\fn setScene
|
||||
\param lpScene
|
||||
*/
|
||||
void setScene(cScene* lpScene);
|
||||
void setScene(cScene* lpScene, cCharacterList* lpCharacterList, cPlaceList* lpPlaceList, cObjectList* lpObjectList);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
@@ -126,6 +126,40 @@ private slots:
|
||||
*/
|
||||
void onTextChanged();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn onCharacterContextMenu
|
||||
\param pos
|
||||
*/
|
||||
void onCharacterContextMenu(const QPoint& pos);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn onPlaceContextMenu
|
||||
\param pos
|
||||
*/
|
||||
void onPlaceContextMenu(const QPoint& pos);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn onObjectContextMenu
|
||||
\param pos
|
||||
*/
|
||||
void onObjectContextMenu(const QPoint& pos);
|
||||
|
||||
void onAddCharacterToList();
|
||||
void onRemoveCharacterFromList();
|
||||
void onEditCharacterDescription();
|
||||
|
||||
void onAddPlaceToList();
|
||||
void onRemovePlaceFromList();
|
||||
void onEditPlaceDescription();
|
||||
|
||||
void onAddObjectToList();
|
||||
void onRemoveObjectFromList();
|
||||
void onEditObjectDescription();
|
||||
|
||||
signals:
|
||||
/*!
|
||||
\brief
|
||||
@@ -150,12 +184,15 @@ signals:
|
||||
void showObjectWindow(cObject* lpObject);
|
||||
|
||||
private:
|
||||
Ui::cSceneWindow* ui; /*!< TODO: describe */
|
||||
cMainWindow* m_lpMainWindow; /*!< TODO: describe */
|
||||
QStandardItemModel* m_lpCharacterModel; /*!< TODO: describe */
|
||||
QStandardItemModel* m_lpPlaceModel; /*!< TODO: describe */
|
||||
QStandardItemModel* m_lpObjectModel; /*!< TODO: describe */
|
||||
cScene* m_lpScene; /*!< TODO: describe */
|
||||
Ui::cSceneWindow* ui; /*!< TODO: describe */
|
||||
cMainWindow* m_lpMainWindow; /*!< TODO: describe */
|
||||
QStandardItemModel* m_lpCharacterModel; /*!< TODO: describe */
|
||||
QStandardItemModel* m_lpPlaceModel; /*!< TODO: describe */
|
||||
QStandardItemModel* m_lpObjectModel; /*!< TODO: describe */
|
||||
cScene* m_lpScene; /*!< TODO: describe */
|
||||
cCharacterList* m_lpCharacterList; /*!< TODO: describe */
|
||||
cPlaceList* m_lpPlaceList; /*!< TODO: describe */
|
||||
cObjectList* m_lpObjectList; /*!< TODO: describe */
|
||||
};
|
||||
|
||||
#endif // CSCENEWINDOW_H
|
||||
|
||||
+10
-1
@@ -19,7 +19,7 @@
|
||||
<item row="3" column="0" colspan="8">
|
||||
<widget class="QTabWidget" name="m_lpTabs">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="m_lpTabDescription">
|
||||
<attribute name="title">
|
||||
@@ -38,6 +38,9 @@
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="cTreeView" name="m_lpCharacterList">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
@@ -58,6 +61,9 @@
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0">
|
||||
<widget class="cTreeView" name="m_lpPlaceList">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
@@ -78,6 +84,9 @@
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="0">
|
||||
<widget class="cTreeView" name="m_lpObjectList">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
|
||||
@@ -548,6 +548,21 @@ cSceneList* cStoryBook::sceneList()
|
||||
return(&m_sceneList);
|
||||
}
|
||||
|
||||
cCharacterList* cStoryBook::characterList()
|
||||
{
|
||||
return(&m_characterList);
|
||||
}
|
||||
|
||||
cPlaceList* cStoryBook::placeList()
|
||||
{
|
||||
return(&m_placeList);
|
||||
}
|
||||
|
||||
cObjectList* cStoryBook::objectList()
|
||||
{
|
||||
return(&m_objectList);
|
||||
}
|
||||
|
||||
QString cStoryBook::project()
|
||||
{
|
||||
return(m_szProject);
|
||||
|
||||
@@ -172,6 +172,27 @@ public:
|
||||
\return cSceneList
|
||||
*/
|
||||
cSceneList* sceneList();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn characterList
|
||||
\return cCharacterList
|
||||
*/
|
||||
cCharacterList* characterList();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn placeList
|
||||
\return cPlaceList
|
||||
*/
|
||||
cPlaceList* placeList();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn objectList
|
||||
\return cObjectList
|
||||
*/
|
||||
cObjectList* objectList();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
Reference in New Issue
Block a user