This commit is contained in:
Herwig Birke
2018-05-18 12:55:01 +02:00
parent a734838ac6
commit f8c2b163fb
21 changed files with 475 additions and 126 deletions
+8 -8
View File
@@ -156,14 +156,14 @@ public:
bool deleted();
private:
qint32 m_iID; /*!< TODO: describe */
cPart* m_lpPart; /*!< TODO: describe */
QString m_szName; /*!< TODO: describe */
qint32 m_iSortOrder; /*!< TODO: describe */
cTextDocument* m_lpDescription; /*!< TODO: describe */
cTextDocument* m_lpText; /*!< TODO: describe */
QStandardItem* m_lpItem; /*!< TODO: describe */
bool m_bDeleted; /*!< TODO: describe */
qint32 m_iID; /*!< TODO: describe */
cPart* m_lpPart; /*!< TODO: describe */
QString m_szName; /*!< TODO: describe */
qint32 m_iSortOrder; /*!< TODO: describe */
cTextDocument* m_lpDescription; /*!< TODO: describe */
cTextDocument* m_lpText; /*!< TODO: describe */
QStandardItem* m_lpItem; /*!< TODO: describe */
bool m_bDeleted; /*!< TODO: describe */
};
Q_DECLARE_METATYPE(cChapter*)
+5 -5
View File
@@ -96,11 +96,11 @@ signals:
void showSceneWindow(cScene* lpScene);
private:
Ui::cChapterWindow* ui; /*!< TODO: describe */
cMainWindow* m_lpMainWindow; /*!< TODO: describe */
cChapter* m_lpChapter; /*!< TODO: describe */
cSceneList* m_lpSceneList; /*!< TODO: describe */
QStandardItemModel* m_lpSceneModel; /*!< TODO: describe */
Ui::cChapterWindow* ui; /*!< TODO: describe */
cMainWindow* m_lpMainWindow; /*!< TODO: describe */
cChapter* m_lpChapter; /*!< TODO: describe */
cSceneList* m_lpSceneList; /*!< TODO: describe */
QStandardItemModel* m_lpSceneModel; /*!< TODO: describe */
};
#endif // CCHAPTERWINDOW_H
+29 -29
View File
@@ -476,33 +476,33 @@ public:
*/
QList<cImageDescription*> images();
private:
qint32 m_id; /*!< TODO: describe */
bool m_bMainCharacter; /*!< TODO: describe */
QString m_szCreature; /*!< TODO: describe */
GENDER m_gender; /*!< TODO: describe */
QString m_szTitle; /*!< TODO: describe */
QString m_szFirstName; /*!< TODO: describe */
QString m_szMiddleName; /*!< TODO: describe */
QString m_szLastName; /*!< TODO: describe */
QString m_szNickName; /*!< TODO: describe */
qreal m_dHeight; /*!< TODO: describe */
qreal m_dWeight; /*!< TODO: describe */
qreal m_dAge; /*!< TODO: describe */
QDate m_dateOfBirth; /*!< TODO: describe */
QString m_szPlaceOfBirth; /*!< TODO: describe */
QDate m_dateOfDeath; /*!< TODO: describe */
QString m_szPlaceOfDeath; /*!< TODO: describe */
QString m_szHairColor; /*!< TODO: describe */
QString m_szHairCut; /*!< TODO: describe */
QString m_szHairLength; /*!< TODO: describe */
QString m_szFigure; /*!< TODO: describe */
QString m_szNature; /*!< TODO: describe */
QString m_szSpokenLanguages; /*!< TODO: describe */
QString m_szSkin; /*!< TODO: describe */
QString m_szSchool; /*!< TODO: describe */
QString m_szJob; /*!< TODO: describe */
cTextDocument* m_lpDescription; /*!< TODO: describe */
QList<cImageDescription*> m_imageList; /*!< TODO: describe */
qint32 m_id; /*!< TODO: describe */
bool m_bMainCharacter; /*!< TODO: describe */
QString m_szCreature; /*!< TODO: describe */
GENDER m_gender; /*!< TODO: describe */
QString m_szTitle; /*!< TODO: describe */
QString m_szFirstName; /*!< TODO: describe */
QString m_szMiddleName; /*!< TODO: describe */
QString m_szLastName; /*!< TODO: describe */
QString m_szNickName; /*!< TODO: describe */
qreal m_dHeight; /*!< TODO: describe */
qreal m_dWeight; /*!< TODO: describe */
qreal m_dAge; /*!< TODO: describe */
QDate m_dateOfBirth; /*!< TODO: describe */
QString m_szPlaceOfBirth; /*!< TODO: describe */
QDate m_dateOfDeath; /*!< TODO: describe */
QString m_szPlaceOfDeath; /*!< TODO: describe */
QString m_szHairColor; /*!< TODO: describe */
QString m_szHairCut; /*!< TODO: describe */
QString m_szHairLength; /*!< TODO: describe */
QString m_szFigure; /*!< TODO: describe */
QString m_szNature; /*!< TODO: describe */
QString m_szSpokenLanguages; /*!< TODO: describe */
QString m_szSkin; /*!< TODO: describe */
QString m_szSchool; /*!< TODO: describe */
QString m_szJob; /*!< TODO: describe */
cTextDocument* m_lpDescription; /*!< TODO: describe */
QList<cImageDescription*> m_imageList; /*!< TODO: describe */
signals:
public slots:
@@ -549,8 +549,8 @@ public:
*/
cTextDocument* description();
private:
cCharacter* m_lpCharacter; /*!< TODO: describe */
cTextDocument* m_lpDescription; /*!< TODO: describe */
cCharacter* m_lpCharacter; /*!< TODO: describe */
cTextDocument* m_lpDescription; /*!< TODO: describe */
};
Q_DECLARE_METATYPE(cCharacter*)
+100
View File
@@ -0,0 +1,100 @@
#include "ccharacterselectdialog.h"
#include "ui_ccharacterselectdialog.h"
cCharacterSelectDialog::cCharacterSelectDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::cCharacterSelectDialog)
{
ui->setupUi(this);
m_lpCharacterListModel = new QStandardItemModel(0, 1);
ui->m_lpCharacterList->setModel(m_lpCharacterListModel);
connect(ui->m_lpCharacterList, &QTreeView::doubleClicked, this, &cCharacterSelectDialog::onCharacterDoubleClicked);
}
cCharacterSelectDialog::~cCharacterSelectDialog()
{
delete ui;
}
void cCharacterSelectDialog::setCharacterList(cCharacterList* lpCharacterList, QList<cCharacterDescription *> characterDescriptionList)
{
QStandardItemModel* lpModel = m_lpCharacterListModel;
QStandardItem* lpRootItem = lpModel->invisibleRootItem();
QFont fontMainCharacter = lpRootItem->font();
QFont fontNonMainCharacter = lpRootItem->font();
lpModel->clear();
QStringList headerLabels = QStringList() << tr("name") << tr("creature") << tr("gender");
m_lpCharacterListModel->setHorizontalHeaderLabels(headerLabels);
fontMainCharacter.setBold(true);
fontNonMainCharacter.setItalic(true);
for(int x = 0;x < lpCharacterList->count();x++)
{
bool bFound = false;
cCharacter* lpCharacter = lpCharacterList->at(x);
for(int y = 0;y < characterDescriptionList.count();y++)
{
if(lpCharacter == characterDescriptionList.at(y)->character())
{
bFound = true;
break;
}
}
if(bFound)
continue;
QList<QStandardItem*> lpItems;
lpItems.append(new QStandardItem(lpCharacter->name()));
lpItems.append(new QStandardItem(lpCharacter->creature()));
lpItems.append(new QStandardItem(lpCharacter->genderText()));
for(int i = 0;i < headerLabels.count();i++)
{
lpItems[i]->setData(QVariant::fromValue(lpCharacter));
if(lpCharacter->mainCharacter())
lpItems[i]->setFont(fontMainCharacter);
else
lpItems[i]->setFont(fontNonMainCharacter);
if(lpCharacter->description())
lpItems[i]->setToolTip(lpCharacter->description()->toPlainText());
}
m_lpCharacterListModel->appendRow(lpItems);
}
ui->m_lpCharacterList->header()->setStretchLastSection(true);
ui->m_lpCharacterList->expandAll();
for(int i = 0;i < headerLabels.count();i++)
ui->m_lpCharacterList->resizeColumnToContents(i);
ui->m_lpCharacterList->setCurrentIndex(m_lpCharacterListModel->index(0, 0));
}
void cCharacterSelectDialog::onCharacterDoubleClicked(const QModelIndex& /*index*/)
{
this->accept();
}
cCharacter* cCharacterSelectDialog::selected()
{
if(!ui->m_lpCharacterList->currentIndex().isValid())
return(0);
QStandardItem* lpItem = m_lpCharacterListModel->itemFromIndex(ui->m_lpCharacterList->currentIndex());
if(!lpItem)
return(0);
return(qvariant_cast<cCharacter*>(lpItem->data()));
}
+69
View File
@@ -0,0 +1,69 @@
#ifndef CCHARACTERSELECTDIALOG_H
#define CCHARACTERSELECTDIALOG_H
#include "ccharacter.h"
#include <QList>
#include <QStandardItemModel>
#include <QDialog>
namespace Ui {
class cCharacterSelectDialog;
}
/*!
\brief
\class cCharacterSelectDialog ccharacterselectdialog.h "ccharacterselectdialog.h"
*/
class cCharacterSelectDialog : public QDialog
{
Q_OBJECT
public:
/*!
\brief
\fn cCharacterSelectDialog
\param parent
*/
explicit cCharacterSelectDialog(QWidget *parent = 0);
/*!
\brief
\fn ~cCharacterSelectDialog
*/
~cCharacterSelectDialog();
/*!
\brief
\fn setCharacterList
\param lpCharacterList
\param characterDescriptionList
*/
void setCharacterList(cCharacterList* lpCharacterList, QList<cCharacterDescription *> characterDescriptionList);
/*!
\brief
\fn selected
\return cCharacter
*/
cCharacter* selected();
private:
Ui::cCharacterSelectDialog* ui; /*!< TODO: describe */
QStandardItemModel* m_lpCharacterListModel; /*!< TODO: describe */
private slots:
/*!
\brief
\fn onCharacterDoubleClicked
\param index
*/
void onCharacterDoubleClicked(const QModelIndex& index);
};
#endif // CCHARACTERSELECTDIALOG_H
+77
View File
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>cCharacterSelectDialog</class>
<widget class="QDialog" name="cCharacterSelectDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Select Character</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTreeView" name="m_lpCharacterList">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>cCharacterSelectDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>cCharacterSelectDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
+3 -3
View File
@@ -235,9 +235,9 @@ private slots:
void onDescriptionChanged();
private:
Ui::cCharacterWindow* ui; /*!< TODO: describe */
cMainWindow* m_lpMainWindow; /*!< TODO: describe */
cCharacter* m_lpCharacter; /*!< TODO: describe */
Ui::cCharacterWindow* ui; /*!< TODO: describe */
cMainWindow* m_lpMainWindow; /*!< TODO: describe */
cCharacter* m_lpCharacter; /*!< TODO: describe */
};
#endif // CCHARACTERWINDOW_H
+7 -7
View File
@@ -111,11 +111,11 @@ public:
QList<cImageDescription*> images();
private:
qint32 m_iID; /*!< TODO: describe */
QString m_szName; /*!< TODO: describe */
QString m_szType; /*!< TODO: describe */
cTextDocument* m_lpDescription; /*!< TODO: describe */
QList<cImageDescription*> m_imageList; /*!< TODO: describe */
qint32 m_iID; /*!< TODO: describe */
QString m_szName; /*!< TODO: describe */
QString m_szType; /*!< TODO: describe */
cTextDocument* m_lpDescription; /*!< TODO: describe */
QList<cImageDescription*> m_imageList; /*!< TODO: describe */
signals:
@@ -163,8 +163,8 @@ public:
*/
cTextDocument* description();
private:
cObject* m_lpObject; /*!< TODO: describe */
cTextDocument* m_lpDescription; /*!< TODO: describe */
cObject* m_lpObject; /*!< TODO: describe */
cTextDocument* m_lpDescription; /*!< TODO: describe */
};
Q_DECLARE_METATYPE(cObject*)
+3 -3
View File
@@ -77,9 +77,9 @@ private slots:
void onDescriptionChanged();
private:
Ui::cObjectWindow* ui; /*!< TODO: describe */
cMainWindow* m_lpMainWindow; /*!< TODO: describe */
cObject* m_lpObject; /*!< TODO: describe */
Ui::cObjectWindow* ui; /*!< TODO: describe */
cMainWindow* m_lpMainWindow; /*!< TODO: describe */
cObject* m_lpObject; /*!< TODO: describe */
};
#endif // COBJECTWINDOW_H
+7 -7
View File
@@ -140,13 +140,13 @@ public:
bool deleted();
private:
qint32 m_iID; /*!< TODO: describe */
QString m_szName; /*!< TODO: describe */
qint32 m_iSortOrder; /*!< TODO: describe */
cTextDocument* m_lpDescription; /*!< TODO: describe */
cTextDocument* m_lpText; /*!< TODO: describe */
QStandardItem* m_lpItem; /*!< TODO: describe */
bool m_bDeleted; /*!< TODO: describe */
qint32 m_iID; /*!< TODO: describe */
QString m_szName; /*!< TODO: describe */
qint32 m_iSortOrder; /*!< TODO: describe */
cTextDocument* m_lpDescription; /*!< TODO: describe */
cTextDocument* m_lpText; /*!< TODO: describe */
QStandardItem* m_lpItem; /*!< TODO: describe */
bool m_bDeleted; /*!< TODO: describe */
};
Q_DECLARE_METATYPE(cPart*)
+5 -5
View File
@@ -95,11 +95,11 @@ signals:
void showChapterWindow(cChapter* lpChapter);
private:
Ui::cPartWindow* ui; /*!< TODO: describe */
cMainWindow* m_lpMainWindow; /*!< TODO: describe */
cPart* m_lpPart; /*!< TODO: describe */
cChapterList* m_lpChapterList; /*!< TODO: describe */
QStandardItemModel* m_lpChapterModel; /*!< TODO: describe */
Ui::cPartWindow* ui; /*!< TODO: describe */
cMainWindow* m_lpMainWindow; /*!< TODO: describe */
cPart* m_lpPart; /*!< TODO: describe */
cChapterList* m_lpChapterList; /*!< TODO: describe */
QStandardItemModel* m_lpChapterModel; /*!< TODO: describe */
};
#endif // CPARTWINDOW_H
+8 -8
View File
@@ -126,12 +126,12 @@ public:
QList<cImageDescription*> images();
private:
qint32 m_iID; /*!< TODO: describe */
QString m_szName; /*!< TODO: describe */
QString m_szLocation; /*!< TODO: describe */
QString m_szType; /*!< TODO: describe */
cTextDocument* m_lpDescription; /*!< TODO: describe */
QList<cImageDescription*> m_imageList; /*!< TODO: describe */
qint32 m_iID; /*!< TODO: describe */
QString m_szName; /*!< TODO: describe */
QString m_szLocation; /*!< TODO: describe */
QString m_szType; /*!< TODO: describe */
cTextDocument* m_lpDescription; /*!< TODO: describe */
QList<cImageDescription*> m_imageList; /*!< TODO: describe */
signals:
@@ -179,8 +179,8 @@ public:
*/
cTextDocument* description();
private:
cPlace* m_lpPlace; /*!< TODO: describe */
cTextDocument* m_lpDescription; /*!< TODO: describe */
cPlace* m_lpPlace; /*!< TODO: describe */
cTextDocument* m_lpDescription; /*!< TODO: describe */
};
Q_DECLARE_METATYPE(cPlace*)
+3 -3
View File
@@ -84,9 +84,9 @@ private slots:
void onDescriptionChanged();
private:
Ui::cPlaceWindow* ui; /*!< TODO: describe */
cMainWindow* m_lpMainWindow; /*!< TODO: describe */
cPlace* m_lpPlace; /*!< TODO: describe */
Ui::cPlaceWindow* ui; /*!< TODO: describe */
cMainWindow* m_lpMainWindow; /*!< TODO: describe */
cPlace* m_lpPlace; /*!< TODO: describe */
};
#endif // CPLACEWINDOW_H
+3 -3
View File
@@ -111,9 +111,9 @@ private slots:
void onTargetDateChanged(const QDateTime& dateTime);
private:
Ui::cPropertiesWindow* ui; /*!< TODO: describe */
cMainWindow* m_lpMainWindow; /*!< TODO: describe */
cBook* m_lpBook; /*!< TODO: describe */
Ui::cPropertiesWindow* ui; /*!< TODO: describe */
cMainWindow* m_lpMainWindow; /*!< TODO: describe */
cBook* m_lpBook; /*!< TODO: describe */
};
#endif // CPROPERTIESWINDOW_H
+8 -8
View File
@@ -160,14 +160,14 @@ public:
QList<cPlaceDescription*> placeList();
private:
qint32 m_iID; /*!< TODO: describe */
QString m_szName; /*!< TODO: describe */
QString m_szLink; /*!< TODO: describe */
cTextDocument* m_lpDescription; /*!< TODO: describe */
QList<cImageDescription*> m_imageList; /*!< TODO: describe */
QList<cCharacterDescription*> m_characterList; /*!< TODO: describe */
QList<cObjectDescription*> m_objectList; /*!< TODO: describe */
QList<cPlaceDescription*> m_placeList; /*!< TODO: describe */
qint32 m_iID; /*!< TODO: describe */
QString m_szName; /*!< TODO: describe */
QString m_szLink; /*!< TODO: describe */
cTextDocument* m_lpDescription; /*!< TODO: describe */
QList<cImageDescription*> m_imageList; /*!< TODO: describe */
QList<cCharacterDescription*> m_characterList; /*!< TODO: describe */
QList<cObjectDescription*> m_objectList; /*!< TODO: describe */
QList<cPlaceDescription*> m_placeList; /*!< TODO: describe */
signals:
+6 -6
View File
@@ -122,12 +122,12 @@ signals:
void showObjectWindow(cObject* lpObject);
private:
Ui::cRechercheWindow* ui; /*!< TODO: describe */
cMainWindow* m_lpMainWindow; /*!< TODO: describe */
QStandardItemModel* m_lpCharacterModel; /*!< TODO: describe */
QStandardItemModel* m_lpPlaceModel; /*!< TODO: describe */
QStandardItemModel* m_lpObjectModel; /*!< TODO: describe */
cRecherche* m_lpRecherche; /*!< TODO: describe */
Ui::cRechercheWindow* ui; /*!< TODO: describe */
cMainWindow* m_lpMainWindow; /*!< TODO: describe */
QStandardItemModel* m_lpCharacterModel; /*!< TODO: describe */
QStandardItemModel* m_lpPlaceModel; /*!< TODO: describe */
QStandardItemModel* m_lpObjectModel; /*!< TODO: describe */
cRecherche* m_lpRecherche; /*!< TODO: describe */
};
#endif // CRECHERCHEWINDOW_H
+16 -16
View File
@@ -329,22 +329,22 @@ public:
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<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 */
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*)
+70
View File
@@ -6,6 +6,8 @@
#include "cscenewindow.h"
#include "ui_cscenewindow.h"
#include "ccharacterselectdialog.h"
#include "cmainwindow.h"
#include "common.h"
@@ -146,6 +148,9 @@ void cSceneWindow::setScene(cScene* lpScene, cCharacterList* lpCharacterList, cP
ui->m_lpCharacterList->setCurrentText(0);
ui->m_lpCharacterDetails->setCurrentIndex(0);
ui->m_lpCharacterRemove->setEnabled((characterList.count() > 0));
ui->m_lpCharacterShowDetails->setEnabled((characterList.count() > 0));
for(int x = 0;x < placeList.count();x++)
{
cPlaceDescription* lpPlaceDescription = placeList[x];
@@ -164,6 +169,9 @@ void cSceneWindow::setScene(cScene* lpScene, cCharacterList* lpCharacterList, cP
ui->m_lpPlaceList->setCurrentText(0);
ui->m_lpPlaceDetails->setCurrentIndex(0);
ui->m_lpPlaceRemove->setEnabled((characterList.count() > 0));
ui->m_lpPlaceShowDetails->setEnabled((characterList.count() > 0));
for(int x = 0;x < objectList.count();x++)
{
cObjectDescription* lpObjectDescription = objectList[x];
@@ -182,6 +190,9 @@ void cSceneWindow::setScene(cScene* lpScene, cCharacterList* lpCharacterList, cP
ui->m_lpObjectList->setCurrentText(0);
ui->m_lpObjectDetails->setCurrentIndex(0);
ui->m_lpObjectRemove->setEnabled((characterList.count() > 0));
ui->m_lpObjectShowDetails->setEnabled((characterList.count() > 0));
connect(ui->m_lpCharacterList, QOverload<int>::of(&cComboBox::currentIndexChanged), this, &cSceneWindow::onCharacterIndexChanged);
connect(ui->m_lpPlaceList, QOverload<int>::of(&cComboBox::currentIndexChanged), this, &cSceneWindow::onPlaceIndexChanged);
connect(ui->m_lpObjectList, QOverload<int>::of(&cComboBox::currentIndexChanged), this, &cSceneWindow::onObjectIndexChanged);
@@ -333,24 +344,83 @@ void cSceneWindow::onObjectIndexChanged(int index)
void cSceneWindow::onAddCharacterToList()
{
cCharacterSelectDialog* lpDialog = new cCharacterSelectDialog(this);
lpDialog->setCharacterList(m_lpCharacterList, m_lpScene->characterList());
if(lpDialog->exec() == QDialog::Rejected)
{
delete lpDialog;
return;
}
cCharacter* lpCharacterNew = lpDialog->selected();
delete lpDialog;
if(!lpCharacterNew)
return;
m_lpScene->addCharacter(lpCharacterNew, new cTextDocument(this));
QList<cCharacterDescription*> characterList = m_lpScene->characterList();
ui->m_lpCharacterList->clear();
for(int x = ui->m_lpCharacterDetails->count()-1;x >= 0;x--)
ui->m_lpCharacterDetails->removeWidget(ui->m_lpCharacterDetails->widget(x));
qint16 index = 0;
for(int x = 0;x < characterList.count();x++)
{
cCharacterDescription* lpCharacterDescription = characterList[x];
cCharacter* lpCharacter = lpCharacterDescription->character();
ui->m_lpCharacterList->addItem(lpCharacter->name(), QVariant::fromValue(lpCharacterDescription));
cTextEdit* lpTextEdit = new cTextEdit(ui->m_lpCharacterDetails);
lpTextEdit->setDocument(lpCharacterDescription->description());
ui->m_lpCharacterDetails->addWidget(lpTextEdit);
connect(lpTextEdit, &cTextEdit::gotFocus, m_lpMainWindow, &cMainWindow::onTextEditGotFocus);
connect(lpTextEdit, &cTextEdit::lostFocus, m_lpMainWindow, &cMainWindow::onTextEditLostFocus);
connect(lpTextEdit, &cTextEdit::textChanged, this, &cSceneWindow::onCharacterDescriptionChanged);
if(lpCharacter == lpCharacterNew)
index = x;
}
ui->m_lpCharacterList->setCurrentIndex(index);
ui->m_lpCharacterDetails->setCurrentIndex(index);
ui->m_lpCharacterRemove->setEnabled((ui->m_lpCharacterList->count() > 0));
ui->m_lpCharacterShowDetails->setEnabled((ui->m_lpCharacterList->count() > 0));
}
void cSceneWindow::onRemoveCharacterFromList()
{
ui->m_lpCharacterRemove->setEnabled((ui->m_lpCharacterList->count() > 0));
ui->m_lpCharacterShowDetails->setEnabled((ui->m_lpCharacterList->count() > 0));
}
void cSceneWindow::onAddPlaceToList()
{
ui->m_lpPlaceRemove->setEnabled((ui->m_lpPlaceList->count() > 0));
ui->m_lpPlaceShowDetails->setEnabled((ui->m_lpPlaceList->count() > 0));
}
void cSceneWindow::onRemovePlaceFromList()
{
ui->m_lpPlaceRemove->setEnabled((ui->m_lpPlaceList->count() > 0));
ui->m_lpPlaceShowDetails->setEnabled((ui->m_lpPlaceList->count() > 0));
}
void cSceneWindow::onAddObjectToList()
{
ui->m_lpObjectRemove->setEnabled((ui->m_lpObjectList->count() > 0));
ui->m_lpObjectShowDetails->setEnabled((ui->m_lpObjectList->count() > 0));
}
void cSceneWindow::onRemoveObjectFromList()
{
ui->m_lpObjectRemove->setEnabled((ui->m_lpObjectList->count() > 0));
ui->m_lpObjectShowDetails->setEnabled((ui->m_lpObjectList->count() > 0));
}
+30
View File
@@ -169,13 +169,43 @@ private slots:
*/
void onObjectIndexChanged(int index);
/*!
\brief
\fn onAddCharacterToList
*/
void onAddCharacterToList();
/*!
\brief
\fn onRemoveCharacterFromList
*/
void onRemoveCharacterFromList();
/*!
\brief
\fn onAddPlaceToList
*/
void onAddPlaceToList();
/*!
\brief
\fn onRemovePlaceFromList
*/
void onRemovePlaceFromList();
/*!
\brief
\fn onAddObjectToList
*/
void onAddObjectToList();
/*!
\brief
\fn onRemoveObjectFromList
*/
void onRemoveObjectFromList();
signals:
+12 -12
View File
@@ -278,18 +278,18 @@ public:
bool hasScene(cChapter* lpChapter);
private:
QString m_szProject; /*!< TODO: describe */
bool m_bIsOpen; /*!< TODO: describe */
QSqlDatabase m_db; /*!< TODO: describe */
cBook m_book; /*!< TODO: describe */
cPartList m_partList; /*!< TODO: describe */
cChapterList m_chapterList; /*!< TODO: describe */
cSceneList m_sceneList; /*!< TODO: describe */
cCharacterList m_characterList; /*!< TODO: describe */
cPlaceList m_placeList; /*!< TODO: describe */
cObjectList m_objectList; /*!< TODO: describe */
cRechercheList m_rechercheList; /*!< TODO: describe */
cImageList m_imageList; /*!< TODO: describe */
QString m_szProject; /*!< TODO: describe */
bool m_bIsOpen; /*!< TODO: describe */
QSqlDatabase m_db; /*!< TODO: describe */
cBook m_book; /*!< TODO: describe */
cPartList m_partList; /*!< TODO: describe */
cChapterList m_chapterList; /*!< TODO: describe */
cSceneList m_sceneList; /*!< TODO: describe */
cCharacterList m_characterList; /*!< TODO: describe */
cPlaceList m_placeList; /*!< TODO: describe */
cObjectList m_objectList; /*!< TODO: describe */
cRechercheList m_rechercheList; /*!< TODO: describe */
cImageList m_imageList; /*!< TODO: describe */
/*!
\brief
+6 -3
View File
@@ -74,7 +74,8 @@ SOURCES += \
cdoublespinbox.cpp \
ccombobox.cpp \
cdatetimeedit.cpp \
cpropertieswindow.cpp
cpropertieswindow.cpp \
ccharacterselectdialog.cpp
HEADERS += \
cmainwindow.h \
@@ -110,7 +111,8 @@ HEADERS += \
cdoublespinbox.h \
ccombobox.h \
cdatetimeedit.h \
cpropertieswindow.h
cpropertieswindow.h \
ccharacterselectdialog.h
FORMS += \
cmainwindow.ui \
@@ -122,7 +124,8 @@ FORMS += \
cobjectwindow.ui \
cplacewindow.ui \
crecherchewindow.ui \
cpropertieswindow.ui
cpropertieswindow.ui \
ccharacterselectdialog.ui
DISTFILES += \
storyBook.project \