diff options
author | Nadia Holmquist Pedersen <nadia@nhp.sh> | 2024-02-07 20:12:23 +0100 |
---|---|---|
committer | Nadia Holmquist Pedersen <nadia@nhp.sh> | 2024-02-07 20:20:54 +0100 |
commit | a7575ec7b3112eff56bbcde6113ab07d90a24265 (patch) | |
tree | 0cd18ba81973f1b6d0ea0740764da72331c30386 /src/frontend/qt_sdl/main.cpp | |
parent | d48e5f2da0439c7109c7ed5c003fa00d58dadbe9 (diff) |
Allow the user to choose the UI theme
Mainly useful for those who want dark mode on Windows.
Diffstat (limited to 'src/frontend/qt_sdl/main.cpp')
-rw-r--r-- | src/frontend/qt_sdl/main.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp index 3a5c1a1..7e34e6a 100644 --- a/src/frontend/qt_sdl/main.cpp +++ b/src/frontend/qt_sdl/main.cpp @@ -114,6 +114,7 @@ QStringList NdsRomExtensions { ".nds", ".srl", ".dsi", ".ids" }; QString GbaRomMimeType = "application/x-gba-rom"; QStringList GbaRomExtensions { ".gba", ".agb" }; +QString* systemThemeName; // This list of supported archive formats is based on libarchive(3) version 3.6.2 (2022-12-09). QStringList ArchiveMimeTypes @@ -292,6 +293,11 @@ int main(int argc, char** argv) qputenv("QT_SCALE_FACTOR", "1"); +#if QT_VERSION_MAJOR == 6 && defined(__WIN32__) + // Allow using the system dark theme palette on Windows + qputenv("QT_QPA_PLATFORM", "windows:darkmode=2"); +#endif + printf("melonDS " MELONDS_VERSION "\n"); printf(MELONDS_URL "\n"); @@ -360,6 +366,12 @@ int main(int argc, char** argv) camManager[0]->setXFlip(Config::Camera[0].XFlip); camManager[1]->setXFlip(Config::Camera[1].XFlip); + systemThemeName = new QString(QApplication::style()->objectName()); + + if (!Config::UITheme.empty()) + { + QApplication::setStyle(QString::fromStdString(Config::UITheme)); + } Input::JoystickID = Config::JoystickID; Input::OpenJoystick(); |