Allow configuring the app icon

This commit is contained in:
wheremyfoodat 2024-12-01 20:08:47 +02:00
parent 4b841e6343
commit 95cc79e0a3
3 changed files with 39 additions and 9 deletions
include/panda_qt

View file

@ -21,6 +21,7 @@ class ConfigWindow : public QDialog {
private:
using ConfigCallback = std::function<void()>;
using IconCallback = std::function<void(const QString&)>;
enum class Theme : int {
System = 0,
@ -30,7 +31,14 @@ class ConfigWindow : public QDialog {
Cream = 4,
};
enum class WindowIcon : int {
Rpog = 0,
Rsyn = 1,
};
Theme currentTheme;
WindowIcon currentIcon;
QTextEdit* helpText = nullptr;
QListWidget* widgetList = nullptr;
QStackedWidget* widgetContainer = nullptr;
@ -41,13 +49,16 @@ class ConfigWindow : public QDialog {
// The config class holds a copy of the emulator config which it edits and sends
// over to the emulator in a thread-safe manner
EmulatorConfig config;
ConfigCallback updateConfig;
IconCallback updateIcon;
void addWidget(QWidget* widget, QString title, QString icon, QString helpText);
void setTheme(Theme theme);
void setIcon(WindowIcon icon);
public:
ConfigWindow(ConfigCallback callback, const EmulatorConfig& config, QWidget* parent = nullptr);
ConfigWindow(ConfigCallback configCallback, IconCallback iconCallback, const EmulatorConfig& config, QWidget* parent = nullptr);
~ConfigWindow();
EmulatorConfig& getConfig() { return config; }