2022-10-29 22:57:20 +05:30
|
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
/*
|
2022-11-03 09:24:57 +05:30
|
|
|
* Prism Launcher - Minecraft Launcher
|
2022-10-29 22:57:20 +05:30
|
|
|
* 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
|
|
|
|
* the Free Software Foundation, version 3.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2022-11-01 20:11:08 +05:30
|
|
|
#pragma once
|
2022-10-29 22:57:20 +05:30
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
#include "ui/themes/ITheme.h"
|
|
|
|
#include "ui/MainWindow.h"
|
|
|
|
|
2022-11-01 20:11:08 +05:30
|
|
|
inline auto themeDebugLog() {
|
|
|
|
return qDebug() << "[Theme]";
|
|
|
|
}
|
|
|
|
inline auto themeWarningLog() {
|
|
|
|
return qWarning() << "[Theme]";
|
|
|
|
}
|
2022-10-29 22:57:20 +05:30
|
|
|
|
|
|
|
class ThemeManager {
|
|
|
|
public:
|
|
|
|
ThemeManager(MainWindow* mainWindow);
|
2022-11-01 20:11:08 +05:30
|
|
|
|
|
|
|
// maybe make private? Or put in ctor?
|
2022-10-29 22:57:20 +05:30
|
|
|
void InitializeThemes();
|
|
|
|
|
2022-11-01 20:11:08 +05:30
|
|
|
QList<ITheme*> getValidApplicationThemes();
|
2022-10-29 22:57:20 +05:30
|
|
|
void setIconTheme(const QString& name);
|
|
|
|
void applyCurrentlySelectedTheme();
|
|
|
|
void setApplicationTheme(const QString& name, bool initial);
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::map<QString, std::unique_ptr<ITheme>> m_themes;
|
|
|
|
MainWindow* m_mainWindow;
|
|
|
|
|
2022-11-01 20:11:08 +05:30
|
|
|
QString AddTheme(std::unique_ptr<ITheme> theme);
|
2022-10-29 22:57:20 +05:30
|
|
|
ITheme* GetTheme(QString themeId);
|
|
|
|
};
|
|
|
|
|