[App/Theme] Palette Editor (#6877)

* [App/Theme] Palette Editor

Took 1 minute

Took 1 hour 47 minutes

Took 6 seconds

Took 3 minutes

Took 5 minutes


Took 3 minutes

* Add oracle, add palette files and configs.

Took 10 minutes

* Fix a stupid include mistake, thanks IDE

Took 3 minutes

Took 20 seconds

* Includes.

Took 4 minutes

* Fix ampersand not displaying correctly.

Took 14 minutes

* Longer variable names.

Took 10 minutes

Took 5 seconds

* Change ampersand everywhere

Took 23 seconds

* Doxygen properly.

Took 1 minute

* Remove namespace, fold I/O into structs.

Took 12 minutes

* Remove namespace, fold I/O into structs.

Took 33 seconds

* Alphabetize.

Took 35 seconds

* Lint.

Took 49 seconds

* Add a combo box to quick switch settings.

Took 19 minutes

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2026-05-17 10:08:00 +02:00 committed by GitHub
parent 989a5be23b
commit 117ea543c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 1874 additions and 232 deletions

View file

@ -7,6 +7,8 @@
#ifndef THEMEMANAGER_H
#define THEMEMANAGER_H
#include "theme_config.h"
#include <QBrush>
#include <QDir>
#include <QLoggingCategory>
@ -41,6 +43,7 @@ public:
private:
QString defaultStyleName;
QString currentThemePath;
std::array<QBrush, Role::MaxRole + 1> brushes;
QStringMap availableThemes;
/*
@ -52,11 +55,31 @@ protected:
void ensureThemeDirectoryExists();
QBrush loadBrush(QString fileName, QColor fallbackColor);
QBrush loadExtraBrush(QString fileName, QBrush &fallbackBrush);
void applyStyleAndPalette(const QString &themeName,
const ThemeConfig &themeCfg,
const PaletteConfig &palCfg,
const QString &activeScheme);
public:
bool isBuiltInTheme();
bool isDarkMode();
bool isDarkMode(const QString &themeDirPath);
QStringMap &getAvailableThemes();
// Returns the path to the currently active theme directory (empty = default)
QString getCurrentThemePath() const
{
return currentThemePath;
}
// Load the global theme settings (style + color scheme preference)
static ThemeConfig loadGlobalConfig(const QString &themeDirPath);
static bool saveGlobalConfig(const QString &themeDirPath, const ThemeConfig &cfg);
// Load/save per-scheme palette colors
static PaletteConfig loadPaletteConfig(const QString &themeDirPath, const QString &colorScheme);
static bool savePaletteConfig(const QString &themeDirPath, const QString &colorScheme, const PaletteConfig &cfg);
void setColorScheme(const QString &scheme);
void reloadCurrentTheme();
void previewPalette(const PaletteConfig &cfg, const QString &scheme);
QBrush &getBgBrush(Role zone);
QBrush getExtraBgBrush(Role zone, int zoneId = 0);