Files
sqlitebrowser/src/Settings.h
mgrojo cc67969d73 Update preference colours when the application style is changed
In order to have matching colours in all the preferences, the individual
colour settings in Data Browser and SQL tabs are reset to default values
matching the corresponding style setting (dark stylesheet or follow desktop,
which could be dark or light as always).

Additionally, several problems with colour settings in QScintilla have
been fixed:
- We don't use indentation guides
- both sets of lexer colour settings must be used, otherwise the result is
inconsistant and unpredictable:
    * lexer->setDefaultColor|Paper and lexer->setColor|Paper
2019-02-28 00:02:47 +01:00

36 lines
1.1 KiB
C++

#ifndef SETTINGS_H
#define SETTINGS_H
#include <QHash>
#include <QVariant>
class Settings
{
friend class PreferencesDialog;
public:
enum AppStyle {
FollowDesktopStyle,
DarkStyle
};
static QVariant getValue(const QString& group, const QString& name);
static void setValue(const QString& group, const QString& name, const QVariant& value, bool dont_save_to_disk = false);
static void restoreDefaults();
private:
Settings() { } // class is fully static
// This works similar to getValue but returns the default value instead of the value set by the user
static QVariant getDefaultValue(const QString& group, const QString& name);
// This works similar to getDefaultValue but returns the default color value based on the passed application style
// instead of the current palette.
static QColor getDefaultColorValue(const QString& group, const QString& name, AppStyle style);
// Cache for storing the settings to avoid repeatedly reading the settings file all the time
static QHash<QString, QVariant> m_hCache;
};
#endif