mirror of
https://github.com/martinrotter/rssguard.git
synced 2024-12-26 16:13:32 +01:00
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_directories (
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
# ${CMAKE_CURRENT_SOURCE_DIR}/src/muparserx
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src
|
||||
${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 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
|
||||
|
@ -81,8 +81,8 @@
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
@ -213,7 +213,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>21</height>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="m_menuFile">
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -9,6 +9,11 @@ class ThemeFactory {
|
||||
ThemeFactory();
|
||||
|
||||
public:
|
||||
enum Type {
|
||||
SYSTEM,
|
||||
USER
|
||||
};
|
||||
|
||||
// Adds custom application path to be search for icons.
|
||||
static void setupSearchPaths();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user