diff --git a/CMakeLists.txt b/CMakeLists.txt index aabf3ff72..8341c3085 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -248,7 +248,6 @@ endif(Qt5LinguistTools_FOUND) # Include additional directory paths. include_directories ( ${CMAKE_CURRENT_SOURCE_DIR}/src - # ${CMAKE_CURRENT_SOURCE_DIR}/src/muparserx ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/src ${Qt5Xml_INCLUDE_DIRS} diff --git a/resources/graphics/rssguard.png b/resources/graphics/rssguard.png new file mode 100644 index 000000000..9619fee6e Binary files /dev/null and b/resources/graphics/rssguard.png differ diff --git a/src/core/settings.h b/src/core/settings.h index 52243ab65..368ca013b 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -25,12 +25,12 @@ class Settings : public QSettings { const QString &key, const QVariant &value); + // Synchronises settings. + QSettings::Status checkSettings(); + protected: // Creates settings file in correct location. static QSettings::Status setupSettings(); - - // Synchronises settings. - QSettings::Status checkSettings(); }; #endif // SETTINGS_H diff --git a/src/gui/formmain.ui b/src/gui/formmain.ui index 7e92eecee..5d3e66432 100644 --- a/src/gui/formmain.ui +++ b/src/gui/formmain.ui @@ -81,8 +81,8 @@ - 16 - 16 + 20 + 20 @@ -213,7 +213,7 @@ 0 0 800 - 21 + 19 diff --git a/src/gui/formsettings.cpp b/src/gui/formsettings.cpp index 91976b666..6351af10e 100644 --- a/src/gui/formsettings.cpp +++ b/src/gui/formsettings.cpp @@ -1,10 +1,69 @@ #include "gui/formsettings.h" +#include "gui/themefactory.h" +#include "core/settings.h" FormSettings::FormSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormSettings) { m_ui->setupUi(this); + + // Set flags. + setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog); + + // Establish needed connections. + connect(this, &FormSettings::accepted, this, &FormSettings::saveSettings); + + // Load all settings. + loadInterface(); } FormSettings::~FormSettings() { delete m_ui; } + +void FormSettings::saveSettings() { + // Save all categories. + //saveGeneral(); + saveInterface(); + //saveLanguages(); + + // Make sure that settings is synced. + Settings::getInstance().checkSettings(); +} + +void FormSettings::loadInterface() { + QString current_theme = ThemeFactory::getCurrentIconTheme(); +#if defined(Q_OS_LINUX) + QString system_theme = ThemeFactory::getSystemIconTheme(); +#endif + + foreach (QString icon_theme_name, ThemeFactory::getInstalledIconThemes()) { +#if defined(Q_OS_LINUX) + if (icon_theme_name == system_theme) { + m_ui->m_cmbIconTheme->addItem(tr("system icon theme (default)"), + icon_theme_name); + } + else { +#endif + m_ui->m_cmbIconTheme->addItem(icon_theme_name, + icon_theme_name); +#if defined(Q_OS_LINUX) + } + if (current_theme == system_theme) { + // Because system icon theme lies at the index 0. + // See ThemeFactory::getInstalledIconThemes() for more info. + m_ui->m_cmbIconTheme->setCurrentIndex(0); + } + else { +#endif + // TODO: Display correct theme on linux. + m_ui->m_cmbIconTheme->setCurrentText(current_theme); +#if defined(Q_OS_LINUX) + } +#endif + } +} + +void FormSettings::saveInterface() { + // Save selected icon theme. + ThemeFactory::setCurrentIconTheme(m_ui->m_cmbIconTheme->itemData(m_ui->m_cmbIconTheme->currentIndex()).toString()); +} diff --git a/src/gui/formsettings.h b/src/gui/formsettings.h index 055bf5ee7..63131ab18 100644 --- a/src/gui/formsettings.h +++ b/src/gui/formsettings.h @@ -16,6 +16,14 @@ class FormSettings : public QDialog { public: explicit FormSettings(QWidget *parent = 0); ~FormSettings(); + + protected slots: + // Saves settings into global configuration. + void saveSettings(); + + // Load/save GUI settings. + void loadInterface(); + void saveInterface(); private: Ui::FormSettings *m_ui; diff --git a/src/gui/themefactory.h b/src/gui/themefactory.h index 12a66735d..f2c9ee793 100644 --- a/src/gui/themefactory.h +++ b/src/gui/themefactory.h @@ -9,6 +9,11 @@ class ThemeFactory { ThemeFactory(); public: + enum Type { + SYSTEM, + USER + }; + // Adds custom application path to be search for icons. static void setupSearchPaths();