More work on ThemeFactory, fixed highlighting of icon theme on Linux.
This commit is contained in:
parent
bb420269fe
commit
9257df1935
@ -248,7 +248,6 @@ endif(Qt5LinguistTools_FOUND)
|
|||||||
# Include additional directory paths.
|
# Include additional directory paths.
|
||||||
include_directories (
|
include_directories (
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
# ${CMAKE_CURRENT_SOURCE_DIR}/src/muparserx
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/src
|
${CMAKE_CURRENT_BINARY_DIR}/src
|
||||||
${Qt5Xml_INCLUDE_DIRS}
|
${Qt5Xml_INCLUDE_DIRS}
|
||||||
|
BIN
resources/graphics/rssguard.png
Normal file
BIN
resources/graphics/rssguard.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 66 KiB |
@ -25,12 +25,12 @@ class Settings : public QSettings {
|
|||||||
const QString &key,
|
const QString &key,
|
||||||
const QVariant &value);
|
const QVariant &value);
|
||||||
|
|
||||||
|
// Synchronises settings.
|
||||||
|
QSettings::Status checkSettings();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Creates settings file in correct location.
|
// Creates settings file in correct location.
|
||||||
static QSettings::Status setupSettings();
|
static QSettings::Status setupSettings();
|
||||||
|
|
||||||
// Synchronises settings.
|
|
||||||
QSettings::Status checkSettings();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SETTINGS_H
|
#endif // SETTINGS_H
|
||||||
|
@ -81,8 +81,8 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
<width>16</width>
|
<width>20</width>
|
||||||
<height>16</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
@ -213,7 +213,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>800</width>
|
||||||
<height>21</height>
|
<height>19</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="m_menuFile">
|
<widget class="QMenu" name="m_menuFile">
|
||||||
|
@ -1,10 +1,69 @@
|
|||||||
#include "gui/formsettings.h"
|
#include "gui/formsettings.h"
|
||||||
|
#include "gui/themefactory.h"
|
||||||
|
#include "core/settings.h"
|
||||||
|
|
||||||
|
|
||||||
FormSettings::FormSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormSettings) {
|
FormSettings::FormSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormSettings) {
|
||||||
m_ui->setupUi(this);
|
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() {
|
FormSettings::~FormSettings() {
|
||||||
delete m_ui;
|
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());
|
||||||
|
}
|
||||||
|
@ -16,6 +16,14 @@ class FormSettings : public QDialog {
|
|||||||
public:
|
public:
|
||||||
explicit FormSettings(QWidget *parent = 0);
|
explicit FormSettings(QWidget *parent = 0);
|
||||||
~FormSettings();
|
~FormSettings();
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
// Saves settings into global configuration.
|
||||||
|
void saveSettings();
|
||||||
|
|
||||||
|
// Load/save GUI settings.
|
||||||
|
void loadInterface();
|
||||||
|
void saveInterface();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::FormSettings *m_ui;
|
Ui::FormSettings *m_ui;
|
||||||
|
@ -9,6 +9,11 @@ class ThemeFactory {
|
|||||||
ThemeFactory();
|
ThemeFactory();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
enum Type {
|
||||||
|
SYSTEM,
|
||||||
|
USER
|
||||||
|
};
|
||||||
|
|
||||||
// Adds custom application path to be search for icons.
|
// Adds custom application path to be search for icons.
|
||||||
static void setupSearchPaths();
|
static void setupSearchPaths();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user