2022-10-29 18:27:20 +01:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
/*
|
2022-11-03 03:54:57 +00:00
|
|
|
* Prism Launcher - Minecraft Launcher
|
2022-10-29 18:27:20 +01:00
|
|
|
* 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 14:41:08 +00:00
|
|
|
#pragma once
|
2022-10-29 18:27:20 +01:00
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
#include "ui/MainWindow.h"
|
2022-11-03 04:05:07 +00:00
|
|
|
#include "ui/themes/ITheme.h"
|
2022-10-29 18:27:20 +01:00
|
|
|
|
2022-11-03 04:05:07 +00:00
|
|
|
inline auto themeDebugLog()
|
|
|
|
{
|
|
|
|
return qDebug() << "[Theme]";
|
2022-11-01 14:41:08 +00:00
|
|
|
}
|
2022-11-03 04:05:07 +00:00
|
|
|
inline auto themeWarningLog()
|
|
|
|
{
|
|
|
|
return qWarning() << "[Theme]";
|
2022-11-01 14:41:08 +00:00
|
|
|
}
|
2022-10-29 18:27:20 +01:00
|
|
|
|
|
|
|
class ThemeManager {
|
2022-11-03 04:05:07 +00:00
|
|
|
public:
|
2022-10-29 18:27:20 +01:00
|
|
|
ThemeManager(MainWindow* mainWindow);
|
2022-11-01 14:41:08 +00:00
|
|
|
|
|
|
|
// maybe make private? Or put in ctor?
|
2022-10-29 18:27:20 +01:00
|
|
|
void InitializeThemes();
|
|
|
|
|
2022-11-01 14:41:08 +00:00
|
|
|
QList<ITheme*> getValidApplicationThemes();
|
2022-10-29 18:27:20 +01:00
|
|
|
void setIconTheme(const QString& name);
|
|
|
|
void applyCurrentlySelectedTheme();
|
|
|
|
void setApplicationTheme(const QString& name, bool initial);
|
|
|
|
|
2022-11-03 04:05:07 +00:00
|
|
|
private:
|
2022-10-29 18:27:20 +01:00
|
|
|
std::map<QString, std::unique_ptr<ITheme>> m_themes;
|
|
|
|
MainWindow* m_mainWindow;
|
|
|
|
|
2022-11-01 14:41:08 +00:00
|
|
|
QString AddTheme(std::unique_ptr<ITheme> theme);
|
2022-10-29 18:27:20 +01:00
|
|
|
ITheme* GetTheme(QString themeId);
|
|
|
|
};
|