add support for multiple custom themes

also moved theme related code from Application.cpp to new ui/themes/ThemeManager.cpp, this class should cleanly isolate theme related functions and help avoid code duplication in future theme related additions.
Themes can now be just qss or css files, they won't have color pallette information with them in that case

Signed-off-by: Tayou <tayou@gmx.net>
This commit is contained in:
Tayou
2022-10-29 19:27:20 +02:00
parent 04b39294ba
commit fef60a9da0
8 changed files with 445 additions and 126 deletions

View File

@ -1,7 +1,8 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
* PolyMC - Minecraft Launcher
* Prism Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
* Copyright (C) 2022 Tayou <tayou@gmx.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -44,6 +45,8 @@
#include <QUrl>
#include <updater/GoUpdate.h>
#include "ui/themes/ThemeManager.h"
#include <BaseInstance.h>
#include "minecraft/launch/MinecraftServerTarget.h"
@ -198,6 +201,8 @@ public:
void ShowGlobalSettings(class QWidget * parent, QString open_page = QString());
ThemeManager* getThemeManager();
signals:
void updateAllowedChanged(bool status);
void globalSettingsAboutToOpen();
@ -255,9 +260,9 @@ private:
std::shared_ptr<JavaInstallList> m_javalist;
std::shared_ptr<TranslationsModel> m_translations;
std::shared_ptr<GenericPageProvider> m_globalSettingsProvider;
std::map<QString, std::unique_ptr<ITheme>> m_themes;
std::unique_ptr<MCEditTool> m_mcedit;
QSet<QString> m_features;
ThemeManager* m_themeManager;
QMap<QString, std::shared_ptr<BaseProfilerFactory>> m_profilers;