feat: Add themes and their logic.

Signed-off-by: leo78913 <leo3758@riseup.net>
This commit is contained in:
leo78913 2022-11-14 19:59:26 -03:00 committed by Redson
parent 1e4ee02cbc
commit 0e916244f0
No known key found for this signature in database
GPG Key ID: A55CD2880240ABD7

View File

@ -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);
}