From bb420269fe36be2359c1449e9295d57461fddec0 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Fri, 14 Jun 2013 22:15:37 +0200 Subject: [PATCH] Work on ThemeFactory + added settings dialog. --- CMakeLists.txt | 3 + src/core/defs.h.in | 1 - src/gui/formmain.cpp | 9 +++ src/gui/formmain.h | 1 + src/gui/formmain.ui | 18 ++++- src/gui/formsettings.cpp | 10 +++ src/gui/formsettings.h | 24 +++++++ src/gui/formsettings.ui | 150 +++++++++++++++++++++++++++++++++++++++ src/gui/themefactory.cpp | 12 ++-- 9 files changed, 219 insertions(+), 9 deletions(-) create mode 100644 src/gui/formsettings.cpp create mode 100644 src/gui/formsettings.h create mode 100644 src/gui/formsettings.ui diff --git a/CMakeLists.txt b/CMakeLists.txt index 18928f8e9..aabf3ff72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,6 +157,7 @@ set(APP_SOURCES src/gui/formmain.cpp src/gui/systemtrayicon.cpp src/gui/themefactory.cpp + src/gui/formsettings.cpp # CORE sources. src/core/debugging.cpp @@ -178,6 +179,7 @@ set(APP_HEADERS # GUI headers. src/gui/formmain.h src/gui/systemtrayicon.h + src/gui/formsettings.h # CORE headers. ) @@ -185,6 +187,7 @@ set(APP_HEADERS # Add form files. set(APP_FORMS src/gui/formmain.ui + src/gui/formsettings.ui ) # Add resources. diff --git a/src/core/defs.h.in b/src/core/defs.h.in index 823a8a344..605d78532 100644 --- a/src/core/defs.h.in +++ b/src/core/defs.h.in @@ -23,7 +23,6 @@ #define APP_IS_RUNNING "app_is_running" -// TODO: OS/2 support missing. No way to test this w/o OS/2 machine. #if defined(Q_OS_LINUX) #define APP_LANG_PATH APP_PREFIX + QString("/share/rssguard/l10n") #define APP_SKIN_PATH APP_PREFIX + QString("/share/rssguard/skins") diff --git a/src/gui/formmain.cpp b/src/gui/formmain.cpp index cc7432b9f..493436c2d 100644 --- a/src/gui/formmain.cpp +++ b/src/gui/formmain.cpp @@ -1,4 +1,5 @@ #include "gui/formmain.h" +#include "gui/formsettings.h" #include "core/settings.h" #include "qtsingleapplication/qtsingleapplication.h" @@ -32,6 +33,14 @@ void FormMain::createConnections() { // Menu "File" connections. connect(m_ui->m_actionQuit, &QAction::triggered, this, &FormMain::quit); + // Menu "Tools" connections. + connect(m_ui->m_actionSettings, &QAction::triggered, this, &FormMain::showSettings); + // General connections. connect(qApp, &QCoreApplication::aboutToQuit, this, &FormMain::cleanupResources); } + +void FormMain::showSettings() { + FormSettings form_settings(this); + form_settings.exec(); +} diff --git a/src/gui/formmain.h b/src/gui/formmain.h index 9739d2e29..c303e5a2a 100644 --- a/src/gui/formmain.h +++ b/src/gui/formmain.h @@ -22,6 +22,7 @@ class FormMain : public QMainWindow { protected slots: void cleanupResources(); + void showSettings(); private: Ui::FormMain *m_ui; diff --git a/src/gui/formmain.ui b/src/gui/formmain.ui index 6838ddbf1..7e92eecee 100644 --- a/src/gui/formmain.ui +++ b/src/gui/formmain.ui @@ -27,7 +27,9 @@ ... - + + + @@ -233,11 +235,18 @@ &View + + + &Tools + + + + - + &Import @@ -253,6 +262,11 @@ &Quit + + + &Settings + + diff --git a/src/gui/formsettings.cpp b/src/gui/formsettings.cpp new file mode 100644 index 000000000..91976b666 --- /dev/null +++ b/src/gui/formsettings.cpp @@ -0,0 +1,10 @@ +#include "gui/formsettings.h" + + +FormSettings::FormSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormSettings) { + m_ui->setupUi(this); +} + +FormSettings::~FormSettings() { + delete m_ui; +} diff --git a/src/gui/formsettings.h b/src/gui/formsettings.h new file mode 100644 index 000000000..055bf5ee7 --- /dev/null +++ b/src/gui/formsettings.h @@ -0,0 +1,24 @@ +#ifndef FORMSETTINGS_H +#define FORMSETTINGS_H + +#include + +#include "ui_formsettings.h" + + +namespace Ui { + class FormSettings; +} + +class FormSettings : public QDialog { + Q_OBJECT + + public: + explicit FormSettings(QWidget *parent = 0); + ~FormSettings(); + + private: + Ui::FormSettings *m_ui; +}; + +#endif // FORMSETTINGS_H diff --git a/src/gui/formsettings.ui b/src/gui/formsettings.ui new file mode 100644 index 000000000..7e2f0c0f0 --- /dev/null +++ b/src/gui/formsettings.ui @@ -0,0 +1,150 @@ + + + FormSettings + + + + 0 + 0 + 586 + 355 + + + + Dialog + + + + + + + 150 + 16777215 + + + + 0 + + + + General + + + + + User interface + + + + + + + + 0 + + + + + + + + QFrame::NoFrame + + + true + + + + + 0 + 0 + 394 + 290 + + + + + + + Icon theme + + + m_cmbIconTheme + + + + + + + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + m_buttonBox + accepted() + FormSettings + accept() + + + 248 + 254 + + + 157 + 274 + + + + + m_buttonBox + rejected() + FormSettings + reject() + + + 316 + 260 + + + 286 + 274 + + + + + m_listSettings + currentRowChanged(int) + m_stackedSettings + setCurrentIndex(int) + + + 83 + 162 + + + 370 + 162 + + + + + diff --git a/src/gui/themefactory.cpp b/src/gui/themefactory.cpp index e2a375be0..6045fa8ab 100644 --- a/src/gui/themefactory.cpp +++ b/src/gui/themefactory.cpp @@ -19,13 +19,17 @@ void ThemeFactory::setupSearchPaths() { // TODO: Load currently selected "real" icon theme name instead of // Qt default "", which stands for currently active system icon theme name on -// linux. On Windows, tiny "oxygen" version will be added. +// linux. On Windows, tiny "oxygen" version will be used as default icon theme. QString ThemeFactory::getSystemIconTheme() { #if defined(Q_OS_LINUX) // Empty string forces Qt to use icon theme from operating system. + // + // WARNING: We should realize that any visible list of available + // icon themes should replace empty string with "system" keyword. + // This needs to be done in FormSettings. return QString(); #else - // It is expected that mini-oxygen is provided as fall-back theme for + // NOTE: It is expected that mini-oxygen is provided as fall-back theme for // windows edition of RSS Guard. return "mini-oxygen"; #endif @@ -91,7 +95,3 @@ QStringList ThemeFactory::getInstalledIconThemes() { icon_theme_names.removeDuplicates(); return icon_theme_names; } - -// zjištění názvů témat dle d:\Programovani\Materiály\Qt\qt5\qtbase\src\gui\image\qiconloader.cpp, -// řádek 172, jak se prochází ty složky -// http://doublecmd.svn.sourceforge.net/viewvc/doublecmd/trunk/src/platform/unix/uunixicontheme.pas