From 0e916244f03cd8bd296f6cc4fe2be34a745ecab4 Mon Sep 17 00:00:00 2001 From: leo78913 Date: Mon, 14 Nov 2022 19:59:26 -0300 Subject: [PATCH] feat: Add themes and their logic. Signed-off-by: leo78913 --- launcher/ui/MainWindow.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp index 8d5e0c83..cbdb2b8f 100644 --- a/launcher/ui/MainWindow.cpp +++ b/launcher/ui/MainWindow.cpp @@ -106,6 +106,7 @@ #include "ui/dialogs/UpdateDialog.h" #include "ui/dialogs/EditAccountDialog.h" #include "ui/dialogs/ExportInstanceDialog.h" +#include "ui/themes/ITheme.h" #include "UpdateController.h" #include "KonamiCode.h" @@ -1313,6 +1314,25 @@ void MainWindow::updateThemeMenu() themeMenu = new QMenu(this); } + auto themes = APPLICATION->getValidApplicationThemes(); + + QActionGroup* ThemesGroup = new QActionGroup( this ); + + for (int i = 0; i < themes.size(); i++) + { + + auto *theme = themes[i]; + QAction * themeAction = themeMenu->addAction(theme->name()); + + themeAction->setCheckable(true); + themeAction->setActionGroup(ThemesGroup); + + connect(themeAction, &QAction::triggered, [theme]() { + APPLICATION->setApplicationTheme(theme->name().toLower(),false); + + }); + } + ui->actionChangeTheme->setMenu(themeMenu); }