From 97a94f6ce3594979be4a0a61d1b19c90624d007c Mon Sep 17 00:00:00 2001 From: Herwig Birke Date: Fri, 22 Jun 2018 10:23:56 +0200 Subject: [PATCH] added options dialog --- cmainwindow.cpp | 16 +++++ cmainwindow.h | 9 ++- coptionsdialog.cpp | 24 +++++++ coptionsdialog.h | 43 ++++++++++++ coptionsdialog.ui | 107 ++++++++++++++++++++++++++++++ images/category/category_core.png | Bin 0 -> 593 bytes storyWriter.pro | 9 ++- storywriter.qrc | 3 + 8 files changed, 207 insertions(+), 4 deletions(-) create mode 100644 coptionsdialog.cpp create mode 100644 coptionsdialog.h create mode 100644 coptionsdialog.ui create mode 100644 images/category/category_core.png diff --git a/cmainwindow.cpp b/cmainwindow.cpp index 4f49ce4..66a918b 100644 --- a/cmainwindow.cpp +++ b/cmainwindow.cpp @@ -15,6 +15,8 @@ #include "cwidget.h" +#include "coptionsdialog.h" + #include #include #include @@ -437,6 +439,11 @@ void cMainWindow::createTextActions() void cMainWindow::createToolsActions() { + QAction* lpAction; + + m_lpToolsMenu = menuBar()->addMenu(tr("&Tools")); + + lpAction = m_lpToolsMenu->addAction(tr("&Options..."), this, &cMainWindow::onToolsOptions); } void cMainWindow::createWindowActions() @@ -1379,6 +1386,15 @@ void cMainWindow::onFileProperties() onShowPropertiesWindow(); } +void cMainWindow::onToolsOptions() +{ + cOptionsDialog* lpOptionsDialog = new cOptionsDialog(this); + + lpOptionsDialog->exec(); + + delete lpOptionsDialog; +} + void cMainWindow::onHelpContents() { QMessageBox::information(this, "Help", "Contents"); diff --git a/cmainwindow.h b/cmainwindow.h index 7a24303..30f1e3e 100644 --- a/cmainwindow.h +++ b/cmainwindow.h @@ -445,6 +445,13 @@ private slots: */ void onFileProperties(); + /*! + \brief + + \fn onToolsOptions + */ + void onToolsOptions(); + /*! \brief @@ -638,7 +645,7 @@ private slots: private: Ui::cMainWindow* ui; /*!< User Interface */ - cSplashScreen* m_lpSplashScreen; + cSplashScreen* m_lpSplashScreen; /*!< Splash Screen */ QStandardItemModel* m_lpOutlineModel; /*!< Item Model for Outline list */ QStandardItemModel* m_lpCharacterModel; /*!< Item Model for Character list */ diff --git a/coptionsdialog.cpp b/coptionsdialog.cpp new file mode 100644 index 0000000..7e533ed --- /dev/null +++ b/coptionsdialog.cpp @@ -0,0 +1,24 @@ +#include "coptionsdialog.h" +#include "ui_coptionsdialog.h" + + +cOptionsDialog::cOptionsDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::cOptionsDialog) +{ + ui->setupUi(this); + + m_lpCategoryModel = new QStandardItemModel(0, 1); + ui->m_lpCategoryList->setModel(m_lpCategoryModel); + + QIcon icon(":/category/category_core.png"); + QStandardItem* lpItem = new QStandardItem(icon, tr("General")); + m_lpCategoryModel->appendRow(lpItem); + + ui->m_lpCategoryList->resizeColumnToContents(0); +} + +cOptionsDialog::~cOptionsDialog() +{ + delete ui; +} diff --git a/coptionsdialog.h b/coptionsdialog.h new file mode 100644 index 0000000..bcc5219 --- /dev/null +++ b/coptionsdialog.h @@ -0,0 +1,43 @@ +#ifndef COPTIONSDIALOG_H +#define COPTIONSDIALOG_H + + +#include + +#include + + +namespace Ui { +class cOptionsDialog; +} + +/*! + \brief + + \class cOptionsDialog coptionsdialog.h "coptionsdialog.h" +*/ +class cOptionsDialog : public QDialog +{ + Q_OBJECT + +public: + /*! + \brief + + \fn cOptionsDialog + \param parent + */ + explicit cOptionsDialog(QWidget *parent = 0); + /*! + \brief + + \fn ~cOptionsDialog + */ + ~cOptionsDialog(); + +private: + Ui::cOptionsDialog* ui; /*!< TODO: describe */ + QStandardItemModel* m_lpCategoryModel; /*!< TODO: describe */ +}; + +#endif // COPTIONSDIALOG_H diff --git a/coptionsdialog.ui b/coptionsdialog.ui new file mode 100644 index 0000000..eec6591 --- /dev/null +++ b/coptionsdialog.ui @@ -0,0 +1,107 @@ + + + cOptionsDialog + + + + 0 + 0 + 544 + 386 + + + + Dialog + + + + + + + + + 150 + 0 + + + + + 24 + 24 + + + + false + + + false + + + + + + + true + + + + + 0 + 0 + 366 + 335 + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + cOptionsDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + cOptionsDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/images/category/category_core.png b/images/category/category_core.png new file mode 100644 index 0000000000000000000000000000000000000000..aaa9464535529bb3cef7e3eede71e3e76fd4dea5 GIT binary patch literal 593 zcmV-X0`6kNLKQ@C{D19T^DTA`b+f`vYXh$tc=NEiP9HD~b3Bqp_Knt`K} z%=n#q?<6w@_WM2gsQ~%hl+@D|rN3@(jDE?`ogvjDb8G0`P))yldsT|X;(ag}e930B zluRZm5b&1NZnvX$yG_kzlO~hNBWR^uE=Q?UiWEihTyroIi3EWOwq|^!W3iYR>~uQR zXf$Xv8kwT9LJ%di*=%UNUJKzm91c^VP!Pd_sj6xQ8C)10F`-_so8U4G+HSW3x>~Jh zHk%18mrHRE>h*e5tyaZcG)>b;V-VVSJU$ySfH0Dc*&N^fe*ef5CcH2|fze+q7ROT9 zfvwjj1KeaID;Q(*`P>m?cg?($40w`kf;wA&>^cLh0h=IlE{mHC91XCD96i8x3wrL_ z)_`j!Po7Svu1aGaJIMfVATq!pBL8h^WXWsCPo>EKPyp~q!t5_#?mK3H=<%lh73^q$ z77B%^+wC4p storyWriter_de.qm + + images/category/category_core.png +