[WIP] Qt: Add config window controls (#655)

* Qt: Add config window controls

* Fix Windows build

* Fix audio slider

* Qt configs: Make thread-safe, properly update audio enable & renderdoc settings

* Qt configs: Add `connectCheckbox` function

* Qt configs: Add `connectCheckbox` function

* Rename spuLayout

* Add Discord RPC reloading

* Allow configuring the app icon

* Qt: Serialize icon & theme, properly set them

* Add rnap and rcow icons

* Qt: Fix forceShadergen config

---------

Co-authored-by: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com>
This commit is contained in:
Jonian Guveli 2024-12-01 23:06:47 +02:00 committed by GitHub
parent c2b479889c
commit 156328fbfb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 509 additions and 25 deletions

View file

@ -1,30 +1,56 @@
#pragma once
#include <QApplication>
#include <QCheckBox>
#include <QComboBox>
#include <QDialog>
#include <QListWidget>
#include <QPalette>
#include <QStackedWidget>
#include <QTextEdit>
#include <QWidget>
#include <QtWidgets>
#include <array>
#include <functional>
#include <utility>
#include "emulator.hpp"
#include "frontend_settings.hpp"
class ConfigWindow : public QDialog {
Q_OBJECT
private:
enum class Theme : int {
System = 0,
Light = 1,
Dark = 2,
GreetingsCat = 3,
Cream = 4,
};
using ConfigCallback = std::function<void()>;
using IconCallback = std::function<void(const QString&)>;
Theme currentTheme;
QComboBox* themeSelect = nullptr;
using Theme = FrontendSettings::Theme;
using WindowIcon = FrontendSettings::WindowIcon;
void setTheme(Theme theme);
QTextEdit* helpText = nullptr;
QListWidget* widgetList = nullptr;
QStackedWidget* widgetContainer = nullptr;
static constexpr size_t settingWidgetCount = 6;
std::array<QString, settingWidgetCount> helpTexts;
// 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(FrontendSettings::Theme theme);
void setIcon(FrontendSettings::WindowIcon icon);
public:
ConfigWindow(QWidget* parent = nullptr);
ConfigWindow(ConfigCallback configCallback, IconCallback iconCallback, const EmulatorConfig& config, QWidget* parent = nullptr);
~ConfigWindow();
EmulatorConfig& getConfig() { return config; }
private:
Emulator* emu;
};