added requested changes
Signed-off-by: Tayou <tayou@gmx.net>
This commit is contained in:
parent
afcdf4b9cf
commit
e9bfd43ff7
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
/*
|
/*
|
||||||
* Prism Launcher
|
* Prism Launcher - Minecraft Launcher
|
||||||
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
||||||
* Copyright (C) 2022 Lenny McLennington <lenny@sneed.church>
|
* Copyright (C) 2022 Lenny McLennington <lenny@sneed.church>
|
||||||
* Copyright (C) 2022 Tayou <tayou@gmx.net>
|
* Copyright (C) 2022 Tayou <tayou@gmx.net>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
/*
|
/*
|
||||||
* Prism Launcher
|
* Prism Launcher - Minecraft Launcher
|
||||||
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
||||||
* Copyright (C) 2022 Tayou <tayou@gmx.net>
|
* Copyright (C) 2022 Tayou <tayou@gmx.net>
|
||||||
*
|
*
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
/*
|
/*
|
||||||
* PolyMC - Minecraft Launcher
|
* Prism Launcher - Minecraft Launcher
|
||||||
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
|
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
|
||||||
* Copyright (c) 2022 dada513 <dada513@protonmail.com>
|
* Copyright (c) 2022 dada513 <dada513@protonmail.com>
|
||||||
|
* Copyright (C) 2022 Tayou <tayou@gmx.net>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
/*
|
/*
|
||||||
* Prism Launcher
|
* Prism Launcher - Minecraft Launcher
|
||||||
* Copyright (C) 2022 Tayou <tayou@gmx.net>
|
* Copyright (C) 2022 Tayou <tayou@gmx.net>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -20,10 +20,6 @@
|
|||||||
*
|
*
|
||||||
* Copyright 2013-2021 MultiMC Contributors
|
* Copyright 2013-2021 MultiMC Contributors
|
||||||
*
|
*
|
||||||
* Authors: Andrew Okin
|
|
||||||
* Peterix
|
|
||||||
* Orochimarufan <orochimarufan.x3@gmail.com>
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
@ -56,7 +52,6 @@ static bool readThemeJson(const QString &path, QPalette &palette, double &fadeAm
|
|||||||
name = Json::requireString(root, "name", "Theme name");
|
name = Json::requireString(root, "name", "Theme name");
|
||||||
widgets = Json::requireString(root, "widgets", "Qt widget theme");
|
widgets = Json::requireString(root, "widgets", "Qt widget theme");
|
||||||
qssFilePath = Json::ensureString(root, "qssFilePath", "themeStyle.css");
|
qssFilePath = Json::ensureString(root, "qssFilePath", "themeStyle.css");
|
||||||
//auto colorFileList = Json::ensureArray(root, "colorFiles");
|
|
||||||
auto colorsRoot = Json::requireObject(root, "colors", "colors object");
|
auto colorsRoot = Json::requireObject(root, "colors", "colors object");
|
||||||
auto readColor = [&](QString colorName) -> QColor
|
auto readColor = [&](QString colorName) -> QColor
|
||||||
{
|
{
|
||||||
@ -165,7 +160,6 @@ static bool writeThemeJson(const QString &path, const QPalette &palette, double
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief
|
|
||||||
/// @param baseTheme Base Theme
|
/// @param baseTheme Base Theme
|
||||||
/// @param fileInfo FileInfo object for file to load
|
/// @param fileInfo FileInfo object for file to load
|
||||||
/// @param isManifest whether to load a theme manifest or a qss file
|
/// @param isManifest whether to load a theme manifest or a qss file
|
||||||
@ -199,8 +193,6 @@ CustomTheme::CustomTheme(ITheme* baseTheme, QFileInfo& fileInfo, bool isManifest
|
|||||||
m_fadeAmount = baseTheme->fadeAmount();
|
m_fadeAmount = baseTheme->fadeAmount();
|
||||||
m_widgets = baseTheme->qtTheme();
|
m_widgets = baseTheme->qtTheme();
|
||||||
m_qssFilePath = "themeStyle.css";
|
m_qssFilePath = "themeStyle.css";
|
||||||
|
|
||||||
QFileInfo info(themeFilePath);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -212,18 +204,18 @@ CustomTheme::CustomTheme(ITheme* baseTheme, QFileInfo& fileInfo, bool isManifest
|
|||||||
writeThemeJson(fileInfo.absoluteFilePath(), m_palette, m_fadeAmount, m_fadeColor, m_name, m_widgets, m_qssFilePath);
|
writeThemeJson(fileInfo.absoluteFilePath(), m_palette, m_fadeAmount, m_fadeColor, m_name, m_widgets, m_qssFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto cssFilePath = FS::PathCombine(path, m_qssFilePath);
|
auto qssFilePath = FS::PathCombine(path, m_qssFilePath);
|
||||||
QFileInfo info (cssFilePath);
|
QFileInfo info (qssFilePath);
|
||||||
if(info.isFile())
|
if(info.isFile())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// TODO: validate css?
|
// TODO: validate css?
|
||||||
m_styleSheet = QString::fromUtf8(FS::read(cssFilePath));
|
m_styleSheet = QString::fromUtf8(FS::read(qssFilePath));
|
||||||
}
|
}
|
||||||
catch (const Exception &e)
|
catch (const Exception &e)
|
||||||
{
|
{
|
||||||
themeWarningLog() << "Couldn't load css:" << e.cause() << "from" << cssFilePath;
|
themeWarningLog() << "Couldn't load css:" << e.cause() << "from" << qssFilePath;
|
||||||
m_styleSheet = baseTheme->appStyleSheet();
|
m_styleSheet = baseTheme->appStyleSheet();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -233,11 +225,11 @@ CustomTheme::CustomTheme(ITheme* baseTheme, QFileInfo& fileInfo, bool isManifest
|
|||||||
m_styleSheet = baseTheme->appStyleSheet();
|
m_styleSheet = baseTheme->appStyleSheet();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FS::write(cssFilePath, m_styleSheet.toUtf8());
|
FS::write(qssFilePath, m_styleSheet.toUtf8());
|
||||||
}
|
}
|
||||||
catch (const Exception &e)
|
catch (const Exception &e)
|
||||||
{
|
{
|
||||||
themeWarningLog() << "Couldn't write css:" << e.cause() << "to" << cssFilePath;
|
themeWarningLog() << "Couldn't write css:" << e.cause() << "to" << qssFilePath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
/*
|
/*
|
||||||
* Prism Launcher
|
* Prism Launcher - Minecraft Launcher
|
||||||
* Copyright (C) 2022 Tayou <tayou@gmx.net>
|
* Copyright (C) 2022 Tayou <tayou@gmx.net>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -20,10 +20,6 @@
|
|||||||
*
|
*
|
||||||
* Copyright 2013-2021 MultiMC Contributors
|
* Copyright 2013-2021 MultiMC Contributors
|
||||||
*
|
*
|
||||||
* Authors: Andrew Okin
|
|
||||||
* Peterix
|
|
||||||
* Orochimarufan <orochimarufan.x3@gmail.com>
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
/*
|
/*
|
||||||
* Prism Launcher
|
* Prism Launcher - Minecraft Launcher
|
||||||
* Copyright (C) 2022 Tayou <tayou@gmx.net>
|
* Copyright (C) 2022 Tayou <tayou@gmx.net>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -20,10 +20,6 @@
|
|||||||
*
|
*
|
||||||
* Copyright 2013-2021 MultiMC Contributors
|
* Copyright 2013-2021 MultiMC Contributors
|
||||||
*
|
*
|
||||||
* Authors: Andrew Okin
|
|
||||||
* Peterix
|
|
||||||
* Orochimarufan <orochimarufan.x3@gmail.com>
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
/*
|
/*
|
||||||
* Prism Launcher
|
* Prism Launcher - Minecraft Launcher
|
||||||
* Copyright (C) 2022 Tayou <tayou@gmx.net>
|
* Copyright (C) 2022 Tayou <tayou@gmx.net>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
/*
|
/*
|
||||||
* Prism Launcher
|
* Prism Launcher - Minecraft Launcher
|
||||||
* Copyright (C) 2022 Tayou <tayou@gmx.net>
|
* Copyright (C) 2022 Tayou <tayou@gmx.net>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
Loading…
Reference in New Issue
Block a user