[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
22 changed files with 509 additions and 25 deletions

View File

@@ -15,7 +15,6 @@
MainWindow::MainWindow(QApplication* app, QWidget* parent) : QMainWindow(parent), keyboardMappings(InputMappings::defaultKeyboardMappings()) {
setWindowTitle("Alber");
setWindowIcon(QIcon(":/docs/img/rpog_icon.png"));
// Enable drop events for loading ROMs
setAcceptDrops(true);
@@ -81,7 +80,6 @@ MainWindow::MainWindow(QApplication* app, QWidget* parent) : QMainWindow(parent)
// Set up misc objects
aboutWindow = new AboutWindow(nullptr);
configWindow = new ConfigWindow(this);
cheatsEditor = new CheatsWindow(emu, {}, this);
patchWindow = new PatchWindow(this);
luaEditor = new TextEditorWindow(this, "script.lua", "");
@@ -92,6 +90,14 @@ MainWindow::MainWindow(QApplication* app, QWidget* parent) : QMainWindow(parent)
shaderEditor->setText(emu->getRenderer()->getUbershader());
}
configWindow = new ConfigWindow(
[&]() {
EmulatorMessage message{.type = MessageType::UpdateConfig};
sendMessage(message);
},
[&](const QString& icon) { setWindowIcon(QIcon(icon)); }, emu->getConfig(), this
);
auto args = QCoreApplication::arguments();
if (args.size() > 1) {
auto romPath = std::filesystem::current_path() / args.at(1).toStdU16String();
@@ -410,6 +416,14 @@ void MainWindow::dispatchMessage(const EmulatorMessage& message) {
screen->resizeSurface(width, height);
break;
}
case MessageType::UpdateConfig:
emu->getConfig() = configWindow->getConfig();
emu->reloadSettings();
// Save new settings to disk
emu->getConfig().save();
break;
}
}