Use json file based themes instead of code to create them (theme editor + theme mode settings)

This commit is contained in:
luisangelsm
2026-03-02 21:23:39 +01:00
parent 87fada611d
commit 547e48cc04
42 changed files with 2776 additions and 1145 deletions

View File

@ -0,0 +1,48 @@
#ifndef APPEARANCE_CONFIGURATION_H
#define APPEARANCE_CONFIGURATION_H
#include <QObject>
#include <QString>
enum class ThemeMode {
FollowSystem,
Light,
Dark,
ForcedTheme,
};
struct ThemeSelection {
ThemeMode mode = ThemeMode::FollowSystem;
QString lightThemeId = "builtin/light";
QString darkThemeId = "builtin/dark";
QString fixedThemeId = "builtin/classic";
};
// Persists theme selection settings to a QSettings INI file under the
// [Appearance] group. All access is on-demand (no persistent QSettings handle)
// so the caller does not need to manage a QSettings lifetime.
class AppearanceConfiguration : public QObject
{
Q_OBJECT
public:
explicit AppearanceConfiguration(const QString &settingsFilePath, QObject *parent = nullptr);
ThemeSelection selection() const { return sel; }
void setMode(ThemeMode mode);
void setLightThemeId(const QString &id);
void setDarkThemeId(const QString &id);
void setFixedThemeId(const QString &id);
signals:
void selectionChanged();
private:
QString path;
ThemeSelection sel;
void load();
void write(const QString &key, const QString &value);
};
#endif // APPEARANCE_CONFIGURATION_H