This commit is contained in:
2018-04-19 19:04:19 +02:00
parent 4cf33e9ae7
commit 5b6f27be7f
6 changed files with 60 additions and 37 deletions
+32 -15
View File
@@ -2,8 +2,8 @@
cCharacter::cCharacter(qint32 iID, QObject *parent) :
m_id(id),
QObject(parent),
m_id(iID),
m_bMainCharacter(false),
m_szCreature(QString("")),
m_gender(GENDER::GENDER_undefined),
@@ -34,7 +34,7 @@ cCharacter::cCharacter(qint32 iID, QObject *parent) :
void cCharacter::setID(const qint32& iID)
{
m_id = id;
m_id = iID;
}
qint32 cCharacter::id()
@@ -67,9 +67,9 @@ void cCharacter::setGender(GENDER gender)
m_gender = gender;
}
GENDER cCharacter::gender()
cCharacter::GENDER cCharacter::gender()
{
return(gender);
return(m_gender);
}
void cCharacter::setTitle(const QString& szTitle)
@@ -157,7 +157,7 @@ void cCharacter::setDateOfBirth(const QDate& dateOfBirth)
m_dateOfBirth = dateOfBirth;
}
QDateTime cCharacter::dateOfBirth()
QDate cCharacter::dateOfBirth()
{
return(m_dateOfBirth);
}
@@ -177,7 +177,7 @@ void cCharacter::setDateOfDeath(const QDate& dateOfDeath)
m_dateOfDeath = dateOfDeath;
}
QDateTime cCharacter::dateOfDeath()
QDate cCharacter::dateOfDeath()
{
return(m_dateOfDeath);
}
@@ -292,19 +292,36 @@ QString cCharacter::description()
return(m_szDescription);
}
bool cCharacterList::load()
cCharacter* cCharacterList::add(const qint32& iID)
{
cScene* lpScene = find(iID);
cCharacter* lpCharacter = find(iID);
if(!lpScene)
if(!lpCharacter)
{
lpScene = new cScene(iID);
append(lpScene);
lpCharacter = new cCharacter(iID);
append(lpCharacter);
}
return(lpScene);
return(lpCharacter);
}
bool cCharacterList::save();
cCharacter* cCharacterList::add(const qint32& iID);
cCharacter* cCharacterList::find(const qint32& iID);
cCharacter* cCharacterList::find(const qint32& iID)
{
for(int x = 0;x < count();x++)
{
if(at(x)->id() == iID)
return(at(x));
}
return(0);
}
bool cCharacterList::load()
{
return(true);
}
bool cCharacterList::save()
{
return(true);
}
+2 -2
View File
@@ -60,13 +60,13 @@ public:
qreal age();
void setDateOfBirth(const QDate& dateOfBirth);
QDateTime dateOfBirth();
QDate dateOfBirth();
void setPlaceOfBirth(const QString& szPlaceOfBirth);
QString placeOfBirth();
void setDateOfDeath(const QDate& dateOfDeath);
QDateTime dateOfDeath();
QDate dateOfDeath();
void setPlaceOfDeath(const QString& szPlaceOfDeath);
QString placeOfDeath();
+3 -5
View File
@@ -13,10 +13,11 @@
#include <QSettings>
#include <QDir>
#include <QThread>
#include <QTextEdit>
cMainWindow::cMainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::cMainWindow),
@@ -30,9 +31,6 @@ cMainWindow::cMainWindow(QWidget *parent) :
QString szPath = QDir::homePath() + QDir::separator() + "OneDrive - WINDESIGN" + QDir::separator() + "__BOOKS__" + QDir::separator() + "qtStoryWriter" + QDir::separator() + "DerAdler";
m_lpStoryBook = new cStoryBook(szPath);
m_lpStoryBook->fillOutlineList(ui->m_lpOutline);
ui->m_lpOutline->expandAll();
ui->m_lpOutline->resizeColumnToContents(0);
ui->m_lpOutline->resizeColumnToContents(1);
updateWindowTitle();
@@ -125,7 +123,7 @@ void cMainWindow::updateWindowTitle()
setWindowTitle(QString("%1 by %2 - qtStoryWriter").arg(szTitle).arg(szAuthor));
}
void cMainWindow::onMainTabCurrentChanged(int index)
void cMainWindow::onMainTabCurrentChanged(int /*index*/)
{
if(m_bUpdatingTab)
return;
+8 -5
View File
@@ -35,7 +35,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>194</width>
<width>147</width>
<height>477</height>
</rect>
</property>
@@ -49,7 +49,7 @@
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="animated">
<bool>true</bool>
@@ -57,6 +57,9 @@
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
</widget>
</item>
</layout>
@@ -66,7 +69,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>194</width>
<width>147</width>
<height>477</height>
</rect>
</property>
@@ -79,7 +82,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>194</width>
<width>147</width>
<height>477</height>
</rect>
</property>
@@ -92,7 +95,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>194</width>
<width>147</width>
<height>477</height>
</rect>
</property>
+7 -3
View File
@@ -4,8 +4,12 @@
#include <QDebug>
#define myDebug qDebug() << __FILE__ << "(" << __LINE__ << ") - " << __PRETTY_FUNCTION__ << ":"
#ifdef __GNUC__
#define myDebug qDebug() << __FILE__ << "(" << __LINE__ << ") - " << __PRETTY_FUNCTION__ << ":"
#elif __MINGW32__
#define myDebug qDebug() << __FILE__ << "(" << __LINE__ << ") - " << __PRETTY_FUNCTION__ << ":"
#else
#define myDebug qDebug() << __FILE__ << "(" << __LINE__ << ") - " << __FUNCTION__ << ":"
#endif
#endif // COMMON_H
+8 -7
View File
@@ -367,10 +367,6 @@ bool cStoryBook::fillOutlineList(QTreeView* lpView)
QStringList headerLabels = QStringList() << tr("name") << tr("state");
lpModel->setHorizontalHeaderLabels(headerLabels);
lpView->header()->setStretchLastSection(false);
lpView->header()->setSectionResizeMode(0, QHeaderView::Stretch);
lpView->header()->setSectionResizeMode(1, QHeaderView::Interactive);
fontPart.setBold(true);
fontChapter.setItalic(true);
@@ -385,7 +381,6 @@ bool cStoryBook::fillOutlineList(QTreeView* lpView)
part.insert(lpPart->id(), lpItem);
lpModel->appendRow(lpItem);
lpView->setFirstColumnSpanned(lpModel->rowCount()-1, lpRootItem->index(), true);
QThread::msleep(50);
}
for(int x = 0;x < m_chapterList.count();x++)
@@ -404,7 +399,6 @@ bool cStoryBook::fillOutlineList(QTreeView* lpView)
chapter.insert(lpChapter->id(), lpItem);
lpRoot->appendRow(lpItem);
lpView->setFirstColumnSpanned(lpRoot->rowCount()-1, lpRoot->index(), true);
QThread::msleep(50);
}
}
@@ -432,8 +426,15 @@ bool cStoryBook::fillOutlineList(QTreeView* lpView)
lpChapterItem->appendRow(lpItems);
}
QThread::msleep(50);
}
lpView->header()->setStretchLastSection(false);
lpView->header()->setSectionResizeMode(0, QHeaderView::Stretch);
lpView->header()->setSectionResizeMode(1, QHeaderView::Interactive);
lpView->expandAll();
lpView->resizeColumnToContents(0);
lpView->resizeColumnToContents(1);
return(true);
}