This commit is contained in:
Herwig Birke
2018-04-27 10:22:14 +02:00
parent 40d5eb5a05
commit fb721a9260
23 changed files with 1091 additions and 22 deletions
+127 -11
View File
@@ -4,9 +4,9 @@
#include "ctextdocument.h"
#include "cpartwindow.h"
#include "cchapterwindow.h"
#include "cscenewindow.h"
#include "ccharacterwindow.h"
//#include "cchapterwindow.h"
//#include "cscenewindow.h"
//#include "ccharacterwindow.h"
#include "cwidget.h"
@@ -127,6 +127,9 @@ void cMainWindow::createActions()
connect(ui->m_lpOutlineList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onOutlineDoubleClicked(QModelIndex)));
connect(ui->m_lpCharacterList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onCharacterDoubleClicked(QModelIndex)));
connect(ui->m_lpPlaceList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onPlaceDoubleClicked(QModelIndex)));
connect(ui->m_lpObjectList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onObjectDoubleClicked(QModelIndex)));
connect(ui->m_lpRechercheList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onRechercheDoubleClicked(QModelIndex)));
}
void cMainWindow::createFileActions()
@@ -419,11 +422,11 @@ void cMainWindow::onOutlineDoubleClicked(const QModelIndex& index)
cScene* lpScene = qvariant_cast<cScene*>(lpItem->data());
if(lpPart)
showPartWindow(lpPart);
onShowPartWindow(lpPart);
else if(lpChapter)
showChapterWindow(lpChapter);
onShowChapterWindow(lpChapter);
else if(lpScene)
showSceneWindow(lpScene);
onShowSceneWindow(lpScene);
else
QMessageBox::information(this, "DoubleClicked", "outline");
}
@@ -433,10 +436,34 @@ void cMainWindow::onCharacterDoubleClicked(const QModelIndex& index)
QStandardItem* lpItem = m_lpCharacterModel->itemFromIndex(index);
cCharacter* lpCharacter = qvariant_cast<cCharacter*>(lpItem->data());
showCharacterWindow(lpCharacter);
onShowCharacterWindow(lpCharacter);
}
void cMainWindow::showPartWindow(cPart* lpPart)
void cMainWindow::onPlaceDoubleClicked(const QModelIndex& index)
{
QStandardItem* lpItem = m_lpPlaceModel->itemFromIndex(index);
cPlace* lpPlace = qvariant_cast<cPlace*>(lpItem->data());
onShowPlaceWindow(lpPlace);
}
void cMainWindow::onObjectDoubleClicked(const QModelIndex& index)
{
QStandardItem* lpItem = m_lpObjectModel->itemFromIndex(index);
cObject* lpObject = qvariant_cast<cObject*>(lpItem->data());
onShowObjectWindow(lpObject);
}
void cMainWindow::onRechercheDoubleClicked(const QModelIndex& index)
{
QStandardItem* lpItem = m_lpRechercheModel->itemFromIndex(index);
cRecherche* lpRecherche = qvariant_cast<cRecherche*>(lpItem->data());
onShowRechercheWindow(lpRecherche);
}
void cMainWindow::onShowPartWindow(cPart* lpPart)
{
for(int x = 0;x < ui->m_lpMainTab->count();x++)
{
@@ -463,7 +490,7 @@ void cMainWindow::showPartWindow(cPart* lpPart)
lpPartWindow->show();
}
void cMainWindow::showChapterWindow(cChapter* lpChapter)
void cMainWindow::onShowChapterWindow(cChapter* lpChapter)
{
for(int x = 0;x < ui->m_lpMainTab->count();x++)
{
@@ -490,7 +517,7 @@ void cMainWindow::showChapterWindow(cChapter* lpChapter)
lpChapterWindow->show();
}
void cMainWindow::showSceneWindow(cScene* lpScene)
void cMainWindow::onShowSceneWindow(cScene* lpScene)
{
for(int x = 0;x < ui->m_lpMainTab->count();x++)
{
@@ -514,10 +541,14 @@ void cMainWindow::showSceneWindow(cScene* lpScene)
lpWidget1->setWindow(ui->m_lpMdiArea->addSubWindow(lpSceneWindow));
ui->m_lpMainTab->addTab((QWidget*)lpWidget1, lpSceneWindow->windowTitle());
connect(lpSceneWindow, SIGNAL(showCharacterWindow(cCharacter*)), this, SLOT(onShowCharacterWindow(cCharacter*)));
connect(lpSceneWindow, SIGNAL(showPlaceWindow(cPlace*)), this, SLOT(onShowPlaceWindow(cPlace*)));
connect(lpSceneWindow, SIGNAL(showObjectWindow(cObject*)), this, SLOT(onShowObjectWindow(cObject*)));
lpSceneWindow->show();
}
void cMainWindow::showCharacterWindow(cCharacter* lpCharacter)
void cMainWindow::onShowCharacterWindow(cCharacter* lpCharacter)
{
for(int x = 0;x < ui->m_lpMainTab->count();x++)
{
@@ -544,6 +575,91 @@ void cMainWindow::showCharacterWindow(cCharacter* lpCharacter)
lpCharacterWindow->show();
}
void cMainWindow::onShowPlaceWindow(cPlace* lpPlace)
{
for(int x = 0;x < ui->m_lpMainTab->count();x++)
{
cWidget* lpWidget = (cWidget*)ui->m_lpMainTab->widget(x);
if(lpWidget->type() == cWidget::TYPE_place)
{
cPlaceWindow* lpPlaceWindow = (cPlaceWindow*)lpWidget->widget();
if(lpPlaceWindow->place() == lpPlace)
{
ui->m_lpMainTab->setCurrentIndex(x);
ui->m_lpMdiArea->setActiveSubWindow(lpWidget->window());
m_bUpdatingTab = false;
return;
}
}
}
cPlaceWindow* lpPlaceWindow = new cPlaceWindow(this);
lpPlaceWindow->setPlace(lpPlace);
cWidget* lpWidget1 = new cWidget(lpPlaceWindow);
lpWidget1->setWindow(ui->m_lpMdiArea->addSubWindow(lpPlaceWindow));
ui->m_lpMainTab->addTab((QWidget*)lpWidget1, lpPlaceWindow->windowTitle());
lpPlaceWindow->show();
}
void cMainWindow::onShowObjectWindow(cObject* lpObject)
{
for(int x = 0;x < ui->m_lpMainTab->count();x++)
{
cWidget* lpWidget = (cWidget*)ui->m_lpMainTab->widget(x);
if(lpWidget->type() == cWidget::TYPE_object)
{
cObjectWindow* lpObjectWindow = (cObjectWindow*)lpWidget->widget();
if(lpObjectWindow->object() == lpObject)
{
ui->m_lpMainTab->setCurrentIndex(x);
ui->m_lpMdiArea->setActiveSubWindow(lpWidget->window());
m_bUpdatingTab = false;
return;
}
}
}
cObjectWindow* lpObjectWindow = new cObjectWindow(this);
lpObjectWindow->setObject(lpObject);
cWidget* lpWidget1 = new cWidget(lpObjectWindow);
lpWidget1->setWindow(ui->m_lpMdiArea->addSubWindow(lpObjectWindow));
ui->m_lpMainTab->addTab((QWidget*)lpWidget1, lpObjectWindow->windowTitle());
lpObjectWindow->show();
}
void cMainWindow::onShowRechercheWindow(cRecherche* lpRecherche)
{
for(int x = 0;x < ui->m_lpMainTab->count();x++)
{
cWidget* lpWidget = (cWidget*)ui->m_lpMainTab->widget(x);
if(lpWidget->type() == cWidget::TYPE_recherche)
{
cRechercheWindow* lpRechercheWindow = (cRechercheWindow*)lpWidget->widget();
if(lpRechercheWindow->recherche() == lpRecherche)
{
ui->m_lpMainTab->setCurrentIndex(x);
ui->m_lpMdiArea->setActiveSubWindow(lpWidget->window());
m_bUpdatingTab = false;
return;
}
}
}
cRechercheWindow* lpRechercheWindow = new cRechercheWindow(this);
lpRechercheWindow->setRecherche(lpRecherche);
cWidget* lpWidget1 = new cWidget(lpRechercheWindow);
lpWidget1->setWindow(ui->m_lpMdiArea->addSubWindow(lpRechercheWindow));
ui->m_lpMainTab->addTab((QWidget*)lpWidget1, lpRechercheWindow->windowTitle());
connect(lpRechercheWindow, SIGNAL(showCharacterWindow(cCharacter*)), this, SLOT(onShowCharacterWindow(cCharacter*)));
connect(lpRechercheWindow, SIGNAL(showPlaceWindow(cPlace*)), this, SLOT(onShowPlaceWindow(cPlace*)));
connect(lpRechercheWindow, SIGNAL(showObjectWindow(cObject*)), this, SLOT(onShowObjectWindow(cObject*)));
lpRechercheWindow->show();
}
void cMainWindow::onFileNew()
{
}
+11 -5
View File
@@ -36,6 +36,17 @@ private slots:
void onOutlineDoubleClicked(const QModelIndex& index);
void onCharacterDoubleClicked(const QModelIndex& index);
void onPlaceDoubleClicked(const QModelIndex& index);
void onObjectDoubleClicked(const QModelIndex& index);
void onRechercheDoubleClicked(const QModelIndex& index);
void onShowPartWindow(cPart* lpPart);
void onShowChapterWindow(cChapter* lpChapter);
void onShowSceneWindow(cScene* lpScene);
void onShowCharacterWindow(cCharacter* lpCharacter);
void onShowPlaceWindow(cPlace* lpPlace);
void onShowObjectWindow(cObject* lpObject);
void onShowRechercheWindow(cRecherche* lpRecherche);
void onFileNew();
void onFileOpen();
@@ -102,11 +113,6 @@ private:
void createEditActions();
void createTextActions();
void showPartWindow(cPart* lpPart);
void showChapterWindow(cChapter* lpChapter);
void showSceneWindow(cScene* lpScene);
void showCharacterWindow(cCharacter* lpCharacter);
protected:
void closeEvent(QCloseEvent *event);
};
+5
View File
@@ -62,6 +62,11 @@ void cObject::addImage(cImage* lpImage)
m_imageList.append(lpImage);
}
QList<cImage*> cObject::images()
{
return(m_imageList);
}
cObject* cObjectList::add(const qint32& iID)
{
cObject* lpObject = find(iID);
+1
View File
@@ -30,6 +30,7 @@ public:
cTextDocument* description();
void addImage(cImage* lpImage);
QList<cImage*> images();
private:
qint32 m_iID;
+50
View File
@@ -0,0 +1,50 @@
#include "cobjectwindow.h"
#include "ui_cobjectwindow.h"
#include "cimagewidget.h"
#include <QStandardItem>
cObjectWindow::cObjectWindow(QWidget *parent) :
QWidget(parent),
ui(new Ui::cObjectWindow),
m_lpObject(0)
{
ui->setupUi(this);
}
cObjectWindow::~cObjectWindow()
{
delete ui;
}
void cObjectWindow::setObject(cObject* lpObject)
{
m_lpObject = lpObject;
ui->m_lpName->setText(lpObject->name());
ui->m_lpType->setText(lpObject->type());
ui->m_lpDescription->setDocument(lpObject->description());
QList<cImage*> images = lpObject->images();
for(int x = 0;x < images.count();x++)
{
cImage* lpImage = images[x];
QPixmap pixmap = lpImage->load();
cImageWidget* lpImageWidget = new cImageWidget;
lpImageWidget->setValues(lpImage->name(), lpImage->type(), lpImage->description(), pixmap);
ui->m_lpLayout->addWidget(lpImageWidget);
}
QSpacerItem* lpSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
ui->m_lpLayout->addItem(lpSpacer);
setWindowTitle(tr("[object] - ") + lpObject->name());
}
cObject* cObjectWindow::object()
{
return(m_lpObject);
}
+31
View File
@@ -0,0 +1,31 @@
#ifndef COBJECTWINDOW_H
#define COBJECTWINDOW_H
#include "cobject.h"
#include <QWidget>
#include <QStandardItemModel>
namespace Ui {
class cObjectWindow;
}
class cObjectWindow : public QWidget
{
Q_OBJECT
public:
explicit cObjectWindow(QWidget *parent = 0);
~cObjectWindow();
void setObject(cObject* lpObject);
cObject* object();
private:
Ui::cObjectWindow* ui;
cObject* m_lpObject;
};
#endif // COBJECTWINDOW_H
+124
View File
@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>cObjectWindow</class>
<widget class="QWidget" name="cObjectWindow">
<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">
<widget class="QTabWidget" name="m_lpTab">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="m_lpBasic">
<attribute name="title">
<string>Basic</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout" rowstretch="1,0">
<item row="0" column="3">
<widget class="QLineEdit" name="m_lpType"/>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="m_lpName"/>
</item>
<item row="1" 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="0" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Type:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1" colspan="4">
<widget class="QTextEdit" name="m_lpDescription"/>
</item>
<item row="0" 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>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="m_lpImages">
<attribute name="title">
<string>Images</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QScrollArea" name="m_lpScrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>681</width>
<height>464</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<layout class="QVBoxLayout" name="m_lpLayout"/>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>m_lpName</tabstop>
<tabstop>m_lpDescription</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
+5
View File
@@ -73,6 +73,11 @@ void cPlace::addImage(cImage* lpImage)
m_imageList.append(lpImage);
}
QList<cImage*> cPlace::images()
{
return(m_imageList);
}
cPlace* cPlaceList::add(const qint32& iID)
{
cPlace* lpPlace = find(iID);
+1
View File
@@ -33,6 +33,7 @@ public:
cTextDocument* description();
void addImage(cImage* lpImage);
QList<cImage*> images();
private:
qint32 m_iID;
+51
View File
@@ -0,0 +1,51 @@
#include "cplacewindow.h"
#include "ui_cplacewindow.h"
#include "cimagewidget.h"
#include <QStandardItem>
cPlaceWindow::cPlaceWindow(QWidget *parent) :
QWidget(parent),
ui(new Ui::cPlaceWindow),
m_lpPlace(0)
{
ui->setupUi(this);
}
cPlaceWindow::~cPlaceWindow()
{
delete ui;
}
void cPlaceWindow::setPlace(cPlace* lpPlace)
{
m_lpPlace = lpPlace;
ui->m_lpName->setText(lpPlace->name());
ui->m_lpType->setText(lpPlace->type());
ui->m_lpLocation->setText(lpPlace->location());
ui->m_lpDescription->setDocument(lpPlace->description());
QList<cImage*> images = lpPlace->images();
for(int x = 0;x < images.count();x++)
{
cImage* lpImage = images[x];
QPixmap pixmap = lpImage->load();
cImageWidget* lpImageWidget = new cImageWidget;
lpImageWidget->setValues(lpImage->name(), lpImage->type(), lpImage->description(), pixmap);
ui->m_lpLayout->addWidget(lpImageWidget);
}
QSpacerItem* lpSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
ui->m_lpLayout->addItem(lpSpacer);
setWindowTitle(tr("[place] - ") + lpPlace->name());
}
cPlace* cPlaceWindow::place()
{
return(m_lpPlace);
}
+31
View File
@@ -0,0 +1,31 @@
#ifndef CPLACEWINDOW_H
#define CPLACEWINDOW_H
#include "cplace.h"
#include <QWidget>
#include <QStandardItemModel>
namespace Ui {
class cPlaceWindow;
}
class cPlaceWindow : public QWidget
{
Q_OBJECT
public:
explicit cPlaceWindow(QWidget *parent = 0);
~cPlaceWindow();
void setPlace(cPlace* lpPlace);
cPlace* place();
private:
Ui::cPlaceWindow* ui;
cPlace* m_lpPlace;
};
#endif // CPLACEWINDOW_H
+141
View File
@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>cPlaceWindow</class>
<widget class="QWidget" name="cPlaceWindow">
<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">
<widget class="QTabWidget" name="m_lpTab">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="m_lpBasic">
<attribute name="title">
<string>Basic</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout" rowstretch="1,0">
<item row="0" column="4">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Location:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Type:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLineEdit" name="m_lpType"/>
</item>
<item row="1" 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="0" column="1">
<widget class="QLineEdit" name="m_lpName"/>
</item>
<item row="0" 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="0" column="5">
<widget class="QLineEdit" name="m_lpLocation"/>
</item>
<item row="1" column="1" colspan="5">
<widget class="QTextEdit" name="m_lpDescription"/>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="m_lpImages">
<attribute name="title">
<string>Images</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QScrollArea" name="m_lpScrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>681</width>
<height>464</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<layout class="QVBoxLayout" name="m_lpLayout"/>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>m_lpName</tabstop>
<tabstop>m_lpType</tabstop>
<tabstop>m_lpLocation</tabstop>
<tabstop>m_lpDescription</tabstop>
<tabstop>m_lpTab</tabstop>
<tabstop>m_lpScrollArea</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
+20
View File
@@ -83,6 +83,26 @@ void cRecherche::addPlace(cPlace* lpPlace)
m_placeList.append(lpPlace);
}
QList<cImage*> cRecherche::images()
{
return(m_imageList);
}
QList<cCharacter*> cRecherche::characterList()
{
return(m_characterList);
}
QList<cObject*> cRecherche::objectList()
{
return(m_objectList);
}
QList<cPlace*> cRecherche::placeList()
{
return(m_placeList);
}
cRecherche* cRechercheList::add(const qint32& iID)
{
cRecherche* lpRecherche = find(iID);
+5
View File
@@ -37,6 +37,11 @@ public:
void addObject(cObject* lpObject);
void addPlace(cPlace* lpPlace);
QList<cImage*> images();
QList<cCharacter*> characterList();
QList<cObject*> objectList();
QList<cPlace*> placeList();
private:
qint32 m_iID;
QString m_szName;
+180
View File
@@ -0,0 +1,180 @@
#include "crecherchewindow.h"
#include "ui_crecherchewindow.h"
#include "cimagewidget.h"
#include <QStandardItem>
cRechercheWindow::cRechercheWindow(QWidget *parent) :
QWidget(parent),
ui(new Ui::cRechercheWindow),
m_lpRecherche(0)
{
ui->setupUi(this);
ui->m_lpTab->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);
connect(ui->m_lpCharacterList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onCharacterDoubleClicked(QModelIndex)));
connect(ui->m_lpPlaceList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onPlaceDoubleClicked(QModelIndex)));
connect(ui->m_lpObjectList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onObjectDoubleClicked(QModelIndex)));
}
cRechercheWindow::~cRechercheWindow()
{
delete ui;
}
void cRechercheWindow::setRecherche(cRecherche* lpRecherche)
{
m_lpRecherche = lpRecherche;
ui->m_lpName->setText(lpRecherche->name());
ui->m_lpLink->setText(lpRecherche->link());
ui->m_lpDescription->setDocument(lpRecherche->description());
QList<cImage*> images = lpRecherche->images();
for(int x = 0;x < images.count();x++)
{
cImage* lpImage = images[x];
QPixmap pixmap = lpImage->load();
cImageWidget* lpImageWidget = new cImageWidget;
lpImageWidget->setValues(lpImage->name(), lpImage->type(), lpImage->description(), pixmap);
ui->m_lpLayout->addWidget(lpImageWidget);
}
QSpacerItem* lpSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
ui->m_lpLayout->addItem(lpSpacer);
QList<cCharacter*> characterList = lpRecherche->characterList();
QList<cPlace*> placeList = lpRecherche->placeList();
QList<cObject*> objectList = lpRecherche->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("[recherche] - ") + lpRecherche->name());
}
cRecherche* cRechercheWindow::recherche()
{
return(m_lpRecherche);
}
void cRechercheWindow::onCharacterDoubleClicked(const QModelIndex& index)
{
QStandardItem* lpItem = m_lpCharacterModel->itemFromIndex(index);
cCharacter* lpCharacter = qvariant_cast<cCharacter*>(lpItem->data());
if(lpCharacter)
showCharacterWindow(lpCharacter);
}
void cRechercheWindow::onPlaceDoubleClicked(const QModelIndex& index)
{
QStandardItem* lpItem = m_lpPlaceModel->itemFromIndex(index);
cPlace* lpPlace = qvariant_cast<cPlace*>(lpItem->data());
if(lpPlace)
showPlaceWindow(lpPlace);
}
void cRechercheWindow::onObjectDoubleClicked(const QModelIndex& index)
{
QStandardItem* lpItem = m_lpObjectModel->itemFromIndex(index);
cObject* lpObject = qvariant_cast<cObject*>(lpItem->data());
if(lpObject)
showObjectWindow(lpObject);
}
+44
View File
@@ -0,0 +1,44 @@
#ifndef CRECHERCHEWINDOW_H
#define CRECHERCHEWINDOW_H
#include "crecherche.h"
#include <QWidget>
#include <QStandardItemModel>
namespace Ui {
class cRechercheWindow;
}
class cRechercheWindow : public QWidget
{
Q_OBJECT
public:
explicit cRechercheWindow(QWidget *parent = 0);
~cRechercheWindow();
void setRecherche(cRecherche* lpRecherche);
cRecherche* recherche();
private slots:
void onCharacterDoubleClicked(const QModelIndex& index);
void onPlaceDoubleClicked(const QModelIndex& index);
void onObjectDoubleClicked(const QModelIndex& index);
signals:
void showCharacterWindow(cCharacter* lpCharacter);
void showPlaceWindow(cPlace* lpPlace);
void showObjectWindow(cObject* lpObject);
private:
Ui::cRechercheWindow* ui;
QStandardItemModel* m_lpCharacterModel;
QStandardItemModel* m_lpPlaceModel;
QStandardItemModel* m_lpObjectModel;
cRecherche* m_lpRecherche;
};
#endif // CRECHERCHEWINDOW_H
+169
View File
@@ -0,0 +1,169 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>cRechercheWindow</class>
<widget class="QWidget" name="cRechercheWindow">
<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">
<widget class="QTabWidget" name="m_lpTab">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="m_lpBasic">
<attribute name="title">
<string>Basic</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout" rowstretch="1,0">
<item row="0" 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="1" column="1" colspan="4">
<widget class="QTextEdit" name="m_lpDescription"/>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Link:</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_lpName"/>
</item>
<item row="0" column="3">
<widget class="QLineEdit" name="m_lpLink"/>
</item>
<item row="1" 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>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="m_lpImages">
<attribute name="title">
<string>Images</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QScrollArea" name="m_lpScrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>681</width>
<height>464</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<layout class="QVBoxLayout" name="m_lpLayout"/>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="m_lpCharacter">
<attribute name="title">
<string>Character</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QTreeView" name="m_lpCharacterList">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="m_lpObject">
<attribute name="title">
<string>Object</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<widget class="QTreeView" name="m_lpObjectList">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="m_lpPlace">
<attribute name="title">
<string>Place</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_8">
<item row="0" column="0">
<widget class="QTreeView" name="m_lpPlaceList">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>m_lpName</tabstop>
<tabstop>m_lpLink</tabstop>
<tabstop>m_lpDescription</tabstop>
<tabstop>m_lpTab</tabstop>
<tabstop>m_lpScrollArea</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
+31 -1
View File
@@ -36,6 +36,12 @@ cSceneWindow::cSceneWindow(QWidget *parent) :
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);
connect(ui->m_lpState, SIGNAL(currentIndexChanged(int)), this, SLOT(onStateCurrentIndexChanged(int)));
connect(ui->m_lpCharacterList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onCharacterDoubleClicked(QModelIndex)));
connect(ui->m_lpPlaceList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onPlaceDoubleClicked(QModelIndex)));
connect(ui->m_lpObjectList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onObjectDoubleClicked(QModelIndex)));
}
cSceneWindow::~cSceneWindow()
@@ -167,10 +173,34 @@ cScene* cSceneWindow::scene()
return(m_lpScene);
}
void cSceneWindow::on_m_lpState_currentIndexChanged(int /*index*/)
void cSceneWindow::onStateCurrentIndexChanged(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()));
}
void cSceneWindow::onCharacterDoubleClicked(const QModelIndex& index)
{
QStandardItem* lpItem = m_lpCharacterModel->itemFromIndex(index);
cCharacter* lpCharacter = qvariant_cast<cCharacter*>(lpItem->data());
if(lpCharacter)
showCharacterWindow(lpCharacter);
}
void cSceneWindow::onPlaceDoubleClicked(const QModelIndex& index)
{
QStandardItem* lpItem = m_lpPlaceModel->itemFromIndex(index);
cPlace* lpPlace = qvariant_cast<cPlace*>(lpItem->data());
if(lpPlace)
showPlaceWindow(lpPlace);
}
void cSceneWindow::onObjectDoubleClicked(const QModelIndex& index)
{
QStandardItem* lpItem = m_lpObjectModel->itemFromIndex(index);
cObject* lpObject = qvariant_cast<cObject*>(lpItem->data());
if(lpObject)
showObjectWindow(lpObject);
}
+9 -1
View File
@@ -26,7 +26,15 @@ public:
cScene* scene();
private slots:
void on_m_lpState_currentIndexChanged(int index);
void onStateCurrentIndexChanged(int index);
void onCharacterDoubleClicked(const QModelIndex& index);
void onPlaceDoubleClicked(const QModelIndex& index);
void onObjectDoubleClicked(const QModelIndex& index);
signals:
void showCharacterWindow(cCharacter* lpCharacter);
void showPlaceWindow(cPlace* lpPlace);
void showObjectWindow(cObject* lpObject);
private:
Ui::cSceneWindow* ui;
+10 -1
View File
@@ -19,7 +19,7 @@
<item row="3" column="0" colspan="8">
<widget class="QTabWidget" name="m_lpTabs">
<property name="currentIndex">
<number>1</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="QTreeView" name="m_lpCharacterList">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
@@ -55,6 +58,9 @@
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QTreeView" name="m_lpPlaceList">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
@@ -72,6 +78,9 @@
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<widget class="QTreeView" name="m_lpObjectList">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
+24
View File
@@ -33,6 +33,30 @@ cWidget::cWidget(cCharacterWindow* parent) :
{
}
cWidget::cWidget(cObjectWindow* parent) :
QWidget(parent),
m_type(TYPE_object),
m_lpWidget(0),
m_lpWindow(0)
{
}
cWidget::cWidget(cPlaceWindow* parent) :
QWidget(parent),
m_type(TYPE_place),
m_lpWidget(0),
m_lpWindow(0)
{
}
cWidget::cWidget(cRechercheWindow* parent) :
QWidget(parent),
m_type(TYPE_recherche),
m_lpWidget(0),
m_lpWindow(0)
{
}
cWidget::cWidget(QWidget* parent) :
QWidget(parent),
m_type(TYPE_unknown),
+9
View File
@@ -6,6 +6,9 @@
#include "cchapterwindow.h"
#include "cscenewindow.h"
#include "ccharacterwindow.h"
#include "cobjectwindow.h"
#include "cplacewindow.h"
#include "crecherchewindow.h"
#include <QWidget>
#include <QMdiSubWindow>
@@ -22,12 +25,18 @@ public:
TYPE_chapter = 2,
TYPE_scene = 3,
TYPE_character = 4,
TYPE_object = 5,
TYPE_place = 6,
TYPE_recherche = 7,
};
explicit cWidget(cPartWindow* parent);
explicit cWidget(cChapterWindow* parent);
explicit cWidget(cSceneWindow* parent);
explicit cWidget(cCharacterWindow* parent);
explicit cWidget(cObjectWindow* parent);
explicit cWidget(cPlaceWindow* parent);
explicit cWidget(cRechercheWindow* parent);
explicit cWidget(QWidget* parent);
QWidget* widget();
+12 -3
View File
@@ -61,7 +61,10 @@ SOURCES += \
cchapterwindow.cpp \
cscenewindow.cpp \
ccharacterwindow.cpp \
cimagewidget.cpp
cimagewidget.cpp \
cobjectwindow.cpp \
cplacewindow.cpp \
crecherchewindow.cpp
HEADERS += \
cmainwindow.h \
@@ -84,7 +87,10 @@ HEADERS += \
cchapterwindow.h \
cscenewindow.h \
ccharacterwindow.h \
cimagewidget.h
cimagewidget.h \
cobjectwindow.h \
cplacewindow.h \
crecherchewindow.h
FORMS += \
cmainwindow.ui \
@@ -92,7 +98,10 @@ FORMS += \
cchapterwindow.ui \
cscenewindow.ui \
ccharacterwindow.ui \
cimagewidget.ui
cimagewidget.ui \
cobjectwindow.ui \
cplacewindow.ui \
crecherchewindow.ui
DISTFILES += \
storyBook.project