From 6ccc7e77f918503125c363eb8ac9455aa9fc095e Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Mon, 19 Jun 2023 22:42:27 +0100 Subject: Basic, unfinished & broken impl Signed-off-by: TheKodeToad --- launcher/resources/multimc/multimc.qrc | 4 ++ .../resources/multimc/scalable/fabric-loader.svg | 1 + .../resources/multimc/scalable/forge-loader.svg | 1 + .../resources/multimc/scalable/quilt-loader.svg | 70 ++++++++++++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 launcher/resources/multimc/scalable/fabric-loader.svg create mode 100644 launcher/resources/multimc/scalable/forge-loader.svg create mode 100644 launcher/resources/multimc/scalable/quilt-loader.svg (limited to 'launcher/resources/multimc') diff --git a/launcher/resources/multimc/multimc.qrc b/launcher/resources/multimc/multimc.qrc index 2c00f28f..f018e874 100644 --- a/launcher/resources/multimc/multimc.qrc +++ b/launcher/resources/multimc/multimc.qrc @@ -347,5 +347,9 @@ scalable/export.svg scalable/launch.svg scalable/server.svg + + scalable/fabric-loader.svg + scalable/quilt-loader.svg + scalable/forge-loader.svg diff --git a/launcher/resources/multimc/scalable/fabric-loader.svg b/launcher/resources/multimc/scalable/fabric-loader.svg new file mode 100644 index 00000000..06aa7801 --- /dev/null +++ b/launcher/resources/multimc/scalable/fabric-loader.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/launcher/resources/multimc/scalable/forge-loader.svg b/launcher/resources/multimc/scalable/forge-loader.svg new file mode 100644 index 00000000..b73360b8 --- /dev/null +++ b/launcher/resources/multimc/scalable/forge-loader.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/launcher/resources/multimc/scalable/quilt-loader.svg b/launcher/resources/multimc/scalable/quilt-loader.svg new file mode 100644 index 00000000..fd6faea4 --- /dev/null +++ b/launcher/resources/multimc/scalable/quilt-loader.svg @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + -- cgit From a389983d7dfb78a2bf6c1b85e5837dcdac789070 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Tue, 20 Jun 2023 00:28:42 +0100 Subject: Just use the old ordering Signed-off-by: TheKodeToad --- launcher/resources/multimc/multimc.qrc | 2 +- launcher/ui/dialogs/InstallLoaderDialog.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'launcher/resources/multimc') diff --git a/launcher/resources/multimc/multimc.qrc b/launcher/resources/multimc/multimc.qrc index f018e874..13052760 100644 --- a/launcher/resources/multimc/multimc.qrc +++ b/launcher/resources/multimc/multimc.qrc @@ -348,8 +348,8 @@ scalable/launch.svg scalable/server.svg + scalable/forge-loader.svg scalable/fabric-loader.svg scalable/quilt-loader.svg - scalable/forge-loader.svg diff --git a/launcher/ui/dialogs/InstallLoaderDialog.cpp b/launcher/ui/dialogs/InstallLoaderDialog.cpp index 1b003e52..5df27dba 100644 --- a/launcher/ui/dialogs/InstallLoaderDialog.cpp +++ b/launcher/ui/dialogs/InstallLoaderDialog.cpp @@ -107,12 +107,12 @@ InstallLoaderDialog::InstallLoaderDialog(std::shared_ptr profile, Q QList InstallLoaderDialog::getPages() { - return { // Fabric + return { // Forge + new LoaderPage("net.minecraftforge", "forge-loader", tr("Forge"), false, m_profile, this), + // Fabric new LoaderPage("net.fabricmc.fabric-loader", "fabric-loader", tr("Fabric"), true, m_profile, this), // Quilt new LoaderPage("org.quiltmc.quilt-loader", "quilt-loader", tr("Quilt"), true, m_profile, this), - // Forge - new LoaderPage("net.minecraftforge", "forge-loader", tr("Forge"), false, m_profile, this), // LiteLoader new LoaderPage("com.mumfrey.liteloader", "liteloader", tr("LiteLoader"), false, m_profile, this) }; -- cgit From 94510edd722b72e375011c6d4a6629c478728c72 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Tue, 20 Jun 2023 19:57:15 +0100 Subject: Rework icons (Fabric is blurry now but looks better) Signed-off-by: TheKodeToad --- .../multimc/128x128/instances/fabricmc.png | Bin 0 -> 4839 bytes .../multimc/128x128/instances/liteloader.png | Bin 0 -> 20337 bytes .../resources/multimc/22x22/fabricmc-small.png | Bin 0 -> 5672 bytes launcher/resources/multimc/multimc.qrc | 8 +- .../resources/multimc/scalable/fabric-loader.svg | 1 - .../resources/multimc/scalable/forge-loader.svg | 1 - .../resources/multimc/scalable/instances/forge.svg | 43 +++++++++ .../multimc/scalable/instances/quiltmc.svg | 98 +++++++++++++++++++++ .../resources/multimc/scalable/quilt-loader.svg | 70 --------------- launcher/ui/dialogs/InstallLoaderDialog.cpp | 8 +- 10 files changed, 150 insertions(+), 79 deletions(-) create mode 100644 launcher/resources/multimc/128x128/instances/fabricmc.png create mode 100644 launcher/resources/multimc/128x128/instances/liteloader.png create mode 100644 launcher/resources/multimc/22x22/fabricmc-small.png delete mode 100644 launcher/resources/multimc/scalable/fabric-loader.svg delete mode 100644 launcher/resources/multimc/scalable/forge-loader.svg create mode 100644 launcher/resources/multimc/scalable/instances/forge.svg create mode 100644 launcher/resources/multimc/scalable/instances/quiltmc.svg delete mode 100644 launcher/resources/multimc/scalable/quilt-loader.svg (limited to 'launcher/resources/multimc') diff --git a/launcher/resources/multimc/128x128/instances/fabricmc.png b/launcher/resources/multimc/128x128/instances/fabricmc.png new file mode 100644 index 00000000..c78543ae Binary files /dev/null and b/launcher/resources/multimc/128x128/instances/fabricmc.png differ diff --git a/launcher/resources/multimc/128x128/instances/liteloader.png b/launcher/resources/multimc/128x128/instances/liteloader.png new file mode 100644 index 00000000..88295e64 Binary files /dev/null and b/launcher/resources/multimc/128x128/instances/liteloader.png differ diff --git a/launcher/resources/multimc/22x22/fabricmc-small.png b/launcher/resources/multimc/22x22/fabricmc-small.png new file mode 100644 index 00000000..e21ae9e8 Binary files /dev/null and b/launcher/resources/multimc/22x22/fabricmc-small.png differ diff --git a/launcher/resources/multimc/multimc.qrc b/launcher/resources/multimc/multimc.qrc index 13052760..907fbb5d 100644 --- a/launcher/resources/multimc/multimc.qrc +++ b/launcher/resources/multimc/multimc.qrc @@ -348,8 +348,10 @@ scalable/launch.svg scalable/server.svg - scalable/forge-loader.svg - scalable/fabric-loader.svg - scalable/quilt-loader.svg + scalable/instances/forge.svg + scalable/instances/quiltmc.svg + 22x22/fabricmc-small.png + 128x128/instances/fabricmc.png + 128x128/instances/liteloader.png diff --git a/launcher/resources/multimc/scalable/fabric-loader.svg b/launcher/resources/multimc/scalable/fabric-loader.svg deleted file mode 100644 index 06aa7801..00000000 --- a/launcher/resources/multimc/scalable/fabric-loader.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/launcher/resources/multimc/scalable/forge-loader.svg b/launcher/resources/multimc/scalable/forge-loader.svg deleted file mode 100644 index b73360b8..00000000 --- a/launcher/resources/multimc/scalable/forge-loader.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/launcher/resources/multimc/scalable/instances/forge.svg b/launcher/resources/multimc/scalable/instances/forge.svg new file mode 100644 index 00000000..ea402c5b --- /dev/null +++ b/launcher/resources/multimc/scalable/instances/forge.svg @@ -0,0 +1,43 @@ + + diff --git a/launcher/resources/multimc/scalable/instances/quiltmc.svg b/launcher/resources/multimc/scalable/instances/quiltmc.svg new file mode 100644 index 00000000..a7aaca53 --- /dev/null +++ b/launcher/resources/multimc/scalable/instances/quiltmc.svg @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + diff --git a/launcher/resources/multimc/scalable/quilt-loader.svg b/launcher/resources/multimc/scalable/quilt-loader.svg deleted file mode 100644 index fd6faea4..00000000 --- a/launcher/resources/multimc/scalable/quilt-loader.svg +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - diff --git a/launcher/ui/dialogs/InstallLoaderDialog.cpp b/launcher/ui/dialogs/InstallLoaderDialog.cpp index 5df27dba..a9d08fc5 100644 --- a/launcher/ui/dialogs/InstallLoaderDialog.cpp +++ b/launcher/ui/dialogs/InstallLoaderDialog.cpp @@ -42,7 +42,7 @@ class LoaderPage : public VersionSelectWidget, public BasePage { : VersionSelectWidget(parent), m_id(std::move(id)), m_icon(std::move(icon)), m_name(std::move(name)) { const QString minecraftVersion = profile->getComponentVersion("net.minecraft"); - setEmptyErrorString(tr("No versions are currently available for Minecraft %1").arg(minecraftVersion)); + setEmptyString(tr("No versions are currently available for Minecraft %1").arg(minecraftVersion)); if (!lightweight) setExactFilter(BaseVersionList::ParentVersionRole, minecraftVersion); @@ -108,11 +108,11 @@ InstallLoaderDialog::InstallLoaderDialog(std::shared_ptr profile, Q QList InstallLoaderDialog::getPages() { return { // Forge - new LoaderPage("net.minecraftforge", "forge-loader", tr("Forge"), false, m_profile, this), + new LoaderPage("net.minecraftforge", "forge", tr("Forge"), false, m_profile, this), // Fabric - new LoaderPage("net.fabricmc.fabric-loader", "fabric-loader", tr("Fabric"), true, m_profile, this), + new LoaderPage("net.fabricmc.fabric-loader", "fabricmc-small", tr("Fabric"), true, m_profile, this), // Quilt - new LoaderPage("org.quiltmc.quilt-loader", "quilt-loader", tr("Quilt"), true, m_profile, this), + new LoaderPage("org.quiltmc.quilt-loader", "quiltmc", tr("Quilt"), true, m_profile, this), // LiteLoader new LoaderPage("com.mumfrey.liteloader", "liteloader", tr("LiteLoader"), false, m_profile, this) }; -- cgit From 0e5c37768084cf0772ca2598b4554bf262cb581b Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Mon, 3 Jul 2023 17:32:59 +0100 Subject: Various tweaks Signed-off-by: TheKodeToad --- .../resources/multimc/128x128/instances/forge.png | Bin 0 -> 3229 bytes launcher/resources/multimc/multimc.qrc | 2 +- .../resources/multimc/scalable/instances/forge.svg | 43 ------------ launcher/ui/dialogs/InstallLoaderDialog.cpp | 78 ++++++++++++--------- launcher/ui/dialogs/InstallLoaderDialog.h | 7 +- launcher/ui/widgets/PageContainer.cpp | 2 +- launcher/ui/widgets/PageContainer.h | 2 +- 7 files changed, 53 insertions(+), 81 deletions(-) create mode 100644 launcher/resources/multimc/128x128/instances/forge.png delete mode 100644 launcher/resources/multimc/scalable/instances/forge.svg (limited to 'launcher/resources/multimc') diff --git a/launcher/resources/multimc/128x128/instances/forge.png b/launcher/resources/multimc/128x128/instances/forge.png new file mode 100644 index 00000000..d8ff79a5 Binary files /dev/null and b/launcher/resources/multimc/128x128/instances/forge.png differ diff --git a/launcher/resources/multimc/multimc.qrc b/launcher/resources/multimc/multimc.qrc index 907fbb5d..4a407d95 100644 --- a/launcher/resources/multimc/multimc.qrc +++ b/launcher/resources/multimc/multimc.qrc @@ -348,9 +348,9 @@ scalable/launch.svg scalable/server.svg - scalable/instances/forge.svg scalable/instances/quiltmc.svg 22x22/fabricmc-small.png + 128x128/instances/forge.png 128x128/instances/fabricmc.png 128x128/instances/liteloader.png diff --git a/launcher/resources/multimc/scalable/instances/forge.svg b/launcher/resources/multimc/scalable/instances/forge.svg deleted file mode 100644 index ea402c5b..00000000 --- a/launcher/resources/multimc/scalable/instances/forge.svg +++ /dev/null @@ -1,43 +0,0 @@ - - diff --git a/launcher/ui/dialogs/InstallLoaderDialog.cpp b/launcher/ui/dialogs/InstallLoaderDialog.cpp index acef60c6..31d6f9ab 100644 --- a/launcher/ui/dialogs/InstallLoaderDialog.cpp +++ b/launcher/ui/dialogs/InstallLoaderDialog.cpp @@ -38,7 +38,7 @@ class InstallLoaderPage : public VersionSelectWidget, public BasePage { // "lightweight" loaders are independent to any game version const bool lightweight, const std::shared_ptr profile) - : VersionSelectWidget(nullptr), m_id(id), m_icon(icon), m_name(name) + : VersionSelectWidget(nullptr), uid(id), iconName(icon), name(name) { const QString minecraftVersion = profile->getComponentVersion("net.minecraft"); setEmptyString(tr("No versions are currently available for Minecraft %1").arg(minecraftVersion)); @@ -49,21 +49,21 @@ class InstallLoaderPage : public VersionSelectWidget, public BasePage { setCurrentVersion(currentVersion); } - QString id() const override { return m_id; } - QString displayName() const override { return m_name; } - QIcon icon() const override { return APPLICATION->getThemedIcon(m_icon); } + QString id() const override { return uid; } + QString displayName() const override { return name; } + QIcon icon() const override { return APPLICATION->getThemedIcon(iconName); } void openedImpl() override { - if (m_loaded) + if (loaded) return; - const auto versions = APPLICATION->metadataIndex()->get(m_id); + const auto versions = APPLICATION->metadataIndex()->get(uid); if (!versions) return; initialize(versions.get()); - m_loaded = true; + loaded = true; } void setParentContainer(BasePageContainer* container) override @@ -73,13 +73,13 @@ class InstallLoaderPage : public VersionSelectWidget, public BasePage { } private: - const QString m_id; - const QString m_icon; - const QString m_name; - bool m_loaded = false; + const QString uid; + const QString iconName; + const QString name; + bool loaded = false; }; -InstallLoaderPage* pageCast(BasePage* page) +static InstallLoaderPage* pageCast(BasePage* page) { auto result = dynamic_cast(page); Q_ASSERT(result != nullptr); @@ -87,46 +87,55 @@ InstallLoaderPage* pageCast(BasePage* page) } InstallLoaderDialog::InstallLoaderDialog(std::shared_ptr profile, const QString& uid, QWidget* parent) - : QDialog(parent), m_profile(profile), m_container(new PageContainer(this, QString(), this)), m_buttons(new QDialogButtonBox(this)) + : QDialog(parent), profile(std::move(profile)), container(new PageContainer(this, QString(), this)), buttons(new QDialogButtonBox(this)) { auto layout = new QVBoxLayout(this); - m_container->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); - layout->addWidget(m_container); + container->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); + layout->addWidget(container); auto buttonLayout = new QHBoxLayout(this); auto refreshButton = new QPushButton(tr("&Refresh"), this); - connect(refreshButton, &QPushButton::pressed, this, [this] { pageCast(m_container->selectedPage())->loadList(); }); + connect(refreshButton, &QPushButton::pressed, this, [this] { pageCast(container->selectedPage())->loadList(); }); buttonLayout->addWidget(refreshButton); - m_buttons->setOrientation(Qt::Horizontal); - m_buttons->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok); - connect(m_buttons, &QDialogButtonBox::accepted, this, &QDialog::accept); - connect(m_buttons, &QDialogButtonBox::rejected, this, &QDialog::reject); - buttonLayout->addWidget(m_buttons); + buttons->setOrientation(Qt::Horizontal); + buttons->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok); + connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject); + buttonLayout->addWidget(buttons); layout->addLayout(buttonLayout); setWindowTitle(dialogTitle()); - resize(650, 400); + setWindowModality(Qt::WindowModal); + resize(520, 347); - pageCast(m_container->selectedPage())->selectSearch(); - for (BasePage* page : m_container->getPages()) + for (BasePage* page : container->getPages()) { if (page->id() == uid) - m_container->selectPage(page->id()); + container->selectPage(page->id()); + + connect(pageCast(page), &VersionSelectWidget::selectedVersionChanged, this, [this, page] { + if (page->id() == container->selectedPage()->id()) + validate(container->selectedPage()); + }); + } + connect(container, &PageContainer::selectedPageChanged, this, [this](BasePage* previous, BasePage* current) { validate(current); }); + pageCast(container->selectedPage())->selectSearch(); + validate(container->selectedPage()); } QList InstallLoaderDialog::getPages() { return { // Forge - new InstallLoaderPage("net.minecraftforge", "forge", tr("Forge"), false, m_profile), + new InstallLoaderPage("net.minecraftforge", "forge", tr("Forge"), false, profile), // Fabric - new InstallLoaderPage("net.fabricmc.fabric-loader", "fabricmc-small", tr("Fabric"), true, m_profile), + new InstallLoaderPage("net.fabricmc.fabric-loader", "fabricmc-small", tr("Fabric"), true, profile), // Quilt - new InstallLoaderPage("org.quiltmc.quilt-loader", "quiltmc", tr("Quilt"), true, m_profile), + new InstallLoaderPage("org.quiltmc.quilt-loader", "quiltmc", tr("Quilt"), true, profile), // LiteLoader - new InstallLoaderPage("com.mumfrey.liteloader", "liteloader", tr("LiteLoader"), false, m_profile) + new InstallLoaderPage("com.mumfrey.liteloader", "liteloader", tr("LiteLoader"), false, profile) }; } @@ -135,13 +144,18 @@ QString InstallLoaderDialog::dialogTitle() return tr("Install Loader"); } +void InstallLoaderDialog::validate(BasePage* page) +{ + buttons->button(QDialogButtonBox::Ok)->setEnabled(pageCast(page)->selectedVersion() != nullptr); +} + void InstallLoaderDialog::done(int result) { if (result == Accepted) { - auto* page = pageCast(m_container->selectedPage()); + auto* page = pageCast(container->selectedPage()); if (page->selectedVersion()) { - m_profile->setComponentVersion(page->id(), page->selectedVersion()->descriptor()); - m_profile->resolve(Net::Mode::Online); + profile->setComponentVersion(page->id(), page->selectedVersion()->descriptor()); + profile->resolve(Net::Mode::Online); } } diff --git a/launcher/ui/dialogs/InstallLoaderDialog.h b/launcher/ui/dialogs/InstallLoaderDialog.h index 09d84777..cdcba2b9 100644 --- a/launcher/ui/dialogs/InstallLoaderDialog.h +++ b/launcher/ui/dialogs/InstallLoaderDialog.h @@ -35,10 +35,11 @@ class InstallLoaderDialog final : public QDialog, public BasePageProvider { QList getPages() override; QString dialogTitle() override; + void validate(BasePage* page); void done(int result) override; private: - std::shared_ptr m_profile; - PageContainer* m_container; - QDialogButtonBox* m_buttons; + std::shared_ptr profile; + PageContainer* container; + QDialogButtonBox* buttons; }; diff --git a/launcher/ui/widgets/PageContainer.cpp b/launcher/ui/widgets/PageContainer.cpp index 0a8a0544..dbbed36a 100644 --- a/launcher/ui/widgets/PageContainer.cpp +++ b/launcher/ui/widgets/PageContainer.cpp @@ -147,7 +147,7 @@ BasePage* PageContainer::selectedPage() const return m_currentPage; } -const QList PageContainer::getPages() const +const QList& PageContainer::getPages() const { return m_model->pages(); } diff --git a/launcher/ui/widgets/PageContainer.h b/launcher/ui/widgets/PageContainer.h index bb365c82..eac59723 100644 --- a/launcher/ui/widgets/PageContainer.h +++ b/launcher/ui/widgets/PageContainer.h @@ -82,7 +82,7 @@ public: bool selectPage(QString pageId) override; BasePage* selectedPage() const override; BasePage* getPage(QString pageId) override; - const QList getPages() const; + const QList& getPages() const; void refreshContainer() override; virtual void setParentContainer(BasePageContainer * container) -- cgit From 97662f5c8ecdf32403939e427c74310f9175fb9e Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Tue, 18 Jul 2023 22:50:43 +0100 Subject: Multiple icon themes! Signed-off-by: TheKodeToad --- launcher/Application.cpp | 5 + launcher/Application.h | 3 + launcher/CMakeLists.txt | 2 + launcher/resources/multimc/index.theme | 2 +- launcher/resources/pe_blue/index.theme | 2 +- launcher/resources/pe_colored/index.theme | 2 +- launcher/resources/pe_dark/index.theme | 2 +- launcher/resources/pe_light/index.theme | 2 +- launcher/ui/themes/IconTheme.cpp | 35 +++++++ launcher/ui/themes/IconTheme.h | 18 ++++ launcher/ui/themes/ThemeManager.cpp | 121 +++++++++++++++-------- launcher/ui/themes/ThemeManager.h | 8 ++ launcher/ui/widgets/ThemeCustomizationWidget.cpp | 22 +++-- launcher/ui/widgets/ThemeCustomizationWidget.h | 19 +--- 14 files changed, 173 insertions(+), 70 deletions(-) create mode 100644 launcher/ui/themes/IconTheme.cpp create mode 100644 launcher/ui/themes/IconTheme.h (limited to 'launcher/resources/multimc') diff --git a/launcher/Application.cpp b/launcher/Application.cpp index d6c135de..df8a2363 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -1163,6 +1163,11 @@ QList Application::getValidApplicationThemes() return m_themeManager->getValidApplicationThemes(); } +QList Application::getValidIconThemes() +{ + return m_themeManager->getValidIconThemes(); +} + void Application::applyCurrentlySelectedTheme(bool initial) { m_themeManager->applyCurrentlySelectedTheme(initial); diff --git a/launcher/Application.h b/launcher/Application.h index 527c536b..0b953f0a 100644 --- a/launcher/Application.h +++ b/launcher/Application.h @@ -70,6 +70,7 @@ class TranslationsModel; class ITheme; class MCEditTool; class ThemeManager; +class IconTheme; namespace Meta { class Index; @@ -124,6 +125,8 @@ public: QList getValidApplicationThemes(); + QList getValidIconThemes(); + void setApplicationTheme(const QString& name); shared_qobject_ptr updater() { diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 7cba97b4..89fc901b 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -759,6 +759,8 @@ SET(LAUNCHER_SOURCES ui/themes/ITheme.h ui/themes/SystemTheme.cpp ui/themes/SystemTheme.h + ui/themes/IconTheme.cpp + ui/themes/IconTheme.h ui/themes/ThemeManager.cpp ui/themes/ThemeManager.h diff --git a/launcher/resources/multimc/index.theme b/launcher/resources/multimc/index.theme index 070e23f1..4da8072d 100644 --- a/launcher/resources/multimc/index.theme +++ b/launcher/resources/multimc/index.theme @@ -1,5 +1,5 @@ [Icon Theme] -Name=multimc +Name=Legacy Comment=Default Icons Inherits=default Directories=8x8,16x16,22x22,24x24,32x32,32x32/instances,48x48,50x50/instances,64x64,128x128/instances,256x256,scalable,scalable/instances diff --git a/launcher/resources/pe_blue/index.theme b/launcher/resources/pe_blue/index.theme index c9e0d93a..6d842b5d 100644 --- a/launcher/resources/pe_blue/index.theme +++ b/launcher/resources/pe_blue/index.theme @@ -1,5 +1,5 @@ [Icon Theme] -Name=pe_blue +Name=Simple (Blue) Comment=Icons by pexner (blue) Inherits=multimc Directories=scalable diff --git a/launcher/resources/pe_colored/index.theme b/launcher/resources/pe_colored/index.theme index b757bbd7..bca5494f 100644 --- a/launcher/resources/pe_colored/index.theme +++ b/launcher/resources/pe_colored/index.theme @@ -1,5 +1,5 @@ [Icon Theme] -Name=pe_colored +Name=Simple (Colored) Comment=Icons by pexner (colored) Inherits=multimc Directories=scalable diff --git a/launcher/resources/pe_dark/index.theme b/launcher/resources/pe_dark/index.theme index b7d1ad01..4cfbf09c 100644 --- a/launcher/resources/pe_dark/index.theme +++ b/launcher/resources/pe_dark/index.theme @@ -1,5 +1,5 @@ [Icon Theme] -Name=pe_dark +Name=Simple (Dark) Comment=Icons by pexner (dark) Inherits=multimc Directories=scalable diff --git a/launcher/resources/pe_light/index.theme b/launcher/resources/pe_light/index.theme index c106acc8..87b76d13 100644 --- a/launcher/resources/pe_light/index.theme +++ b/launcher/resources/pe_light/index.theme @@ -1,5 +1,5 @@ [Icon Theme] -Name=pe_light +Name=Simple (Light) Comment=Icons by pexner (light) Inherits=multimc Directories=scalable diff --git a/launcher/ui/themes/IconTheme.cpp b/launcher/ui/themes/IconTheme.cpp new file mode 100644 index 00000000..ef245505 --- /dev/null +++ b/launcher/ui/themes/IconTheme.cpp @@ -0,0 +1,35 @@ +#include "IconTheme.h" + +#include +#include + +IconTheme::IconTheme(const QString& id, const QString& path) : m_id(id), m_path(path) {} + +bool IconTheme::load() +{ + QString path = m_path + "/index.theme"; + + if (!QFile::exists(path)) + return false; + + QSettings settings(path, QSettings::IniFormat); + settings.beginGroup("Icon Theme"); + m_name = settings.value("Name").toString(); + settings.endGroup(); + return !m_name.isNull(); +} + +QString IconTheme::id() +{ + return m_id; +} + +QString IconTheme::path() +{ + return m_path; +} + +QString IconTheme::name() +{ + return m_name; +} \ No newline at end of file diff --git a/launcher/ui/themes/IconTheme.h b/launcher/ui/themes/IconTheme.h new file mode 100644 index 00000000..cb05d8c7 --- /dev/null +++ b/launcher/ui/themes/IconTheme.h @@ -0,0 +1,18 @@ +#pragma once + +#include + +class IconTheme { + public: + IconTheme(const QString& id, const QString& path); + + bool load(); + QString id(); + QString path(); + QString name(); + + private: + QString m_id; + QString m_path; + QString m_name; +}; \ No newline at end of file diff --git a/launcher/ui/themes/ThemeManager.cpp b/launcher/ui/themes/ThemeManager.cpp index b50c6157..3453a246 100644 --- a/launcher/ui/themes/ThemeManager.cpp +++ b/launcher/ui/themes/ThemeManager.cpp @@ -55,50 +55,84 @@ ITheme* ThemeManager::getTheme(QString themeId) void ThemeManager::initializeThemes() { // Icon themes - { - // TODO: icon themes and instance icons do not mesh well together. Rearrange and fix discrepancies! - // set icon theme search path! - auto searchPaths = QIcon::themeSearchPaths(); - searchPaths.append("iconthemes"); - QIcon::setThemeSearchPaths(searchPaths); - themeDebugLog() << "<> Icon themes initialized."; - } + initializeIcons(); // Initialize widget themes - { - themeDebugLog() << "<> Initializing Widget Themes"; - themeDebugLog() << "Loading Built-in Theme:" << addTheme(std::make_unique()); - auto darkThemeId = addTheme(std::make_unique()); - themeDebugLog() << "Loading Built-in Theme:" << darkThemeId; - themeDebugLog() << "Loading Built-in Theme:" << addTheme(std::make_unique()); - - // TODO: need some way to differentiate same name themes in different subdirectories (maybe smaller grey text next to theme name in - // dropdown?) - QString themeFolder = QDir("./themes/").absoluteFilePath(""); - themeDebugLog() << "Theme Folder Path: " << themeFolder; - - QDirIterator directoryIterator(themeFolder, QDir::Dirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); - while (directoryIterator.hasNext()) { - QDir dir(directoryIterator.next()); - QFileInfo themeJson(dir.absoluteFilePath("theme.json")); - if (themeJson.exists()) { - // Load "theme.json" based themes - themeDebugLog() << "Loading JSON Theme from:" << themeJson.absoluteFilePath(); - addTheme(std::make_unique(getTheme(darkThemeId), themeJson, true)); - } else { - // Load pure QSS Themes - QDirIterator stylesheetFileIterator(dir.absoluteFilePath(""), { "*.qss", "*.css" }, QDir::Files); - while (stylesheetFileIterator.hasNext()) { - QFile customThemeFile(stylesheetFileIterator.next()); - QFileInfo customThemeFileInfo(customThemeFile); - themeDebugLog() << "Loading QSS Theme from:" << customThemeFileInfo.absoluteFilePath(); - addTheme(std::make_unique(getTheme(darkThemeId), customThemeFileInfo, false)); - } - } + initializeWidgets(); +} + +void ThemeManager::initializeIcons() +{ + // TODO: icon themes and instance icons do not mesh well together. Rearrange and fix discrepancies! + // set icon theme search path! + + QString themeFolder = "iconthemes"; + + auto searchPaths = QIcon::themeSearchPaths(); + searchPaths.append(themeFolder); + QIcon::setThemeSearchPaths(searchPaths); + + themeDebugLog() << "<> Initializing Icon Themes"; + + for (const QString& id : builtinIcons) { + IconTheme theme(id, QString(":/icons/%1").arg(id)); + if (!theme.load()) { + themeWarningLog() << "Couldn't load built-in icon theme" << id; + continue; } - themeDebugLog() << "<> Widget themes initialized."; + m_icons.append(theme); + themeDebugLog() << "Loaded Built-In Icon Theme" << id; + } + + QDirIterator directoryIterator(themeFolder, QDir::Dirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); + while (directoryIterator.hasNext()) { + QDir dir(directoryIterator.next()); + IconTheme theme(dir.dirName(), dir.path()); + if (!theme.load()) + continue; + + m_icons.append(theme); + themeDebugLog() << "Loaded Custom Icon Theme from" << dir.path(); + } + + themeDebugLog() << "<> Icon themes initialized."; +} + +void ThemeManager::initializeWidgets() +{ + themeDebugLog() << "<> Initializing Widget Themes"; + themeDebugLog() << "Loading Built-in Theme:" << addTheme(std::make_unique()); + auto darkThemeId = addTheme(std::make_unique()); + themeDebugLog() << "Loading Built-in Theme:" << darkThemeId; + themeDebugLog() << "Loading Built-in Theme:" << addTheme(std::make_unique()); + + // TODO: need some way to differentiate same name themes in different subdirectories (maybe smaller grey text next to theme name in + // dropdown?) + QString themeFolder = QDir("./themes/").absoluteFilePath(""); + themeDebugLog() << "Theme Folder Path: " << themeFolder; + + QDirIterator directoryIterator(themeFolder, QDir::Dirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); + while (directoryIterator.hasNext()) { + QDir dir(directoryIterator.next()); + QFileInfo themeJson(dir.absoluteFilePath("theme.json")); + if (themeJson.exists()) { + // Load "theme.json" based themes + themeDebugLog() << "Loading JSON Theme from:" << themeJson.absoluteFilePath(); + addTheme(std::make_unique(getTheme(darkThemeId), themeJson, true)); + } else { + // Load pure QSS Themes + QDirIterator stylesheetFileIterator(dir.absoluteFilePath(""), { "*.qss", "*.css" }, QDir::Files); + while (stylesheetFileIterator.hasNext()) { + QFile customThemeFile(stylesheetFileIterator.next()); + QFileInfo customThemeFileInfo(customThemeFile); + themeDebugLog() << "Loading QSS Theme from:" << customThemeFileInfo.absoluteFilePath(); + addTheme(std::make_unique(getTheme(darkThemeId), customThemeFileInfo, false)); + } + } } + + themeDebugLog() << "<> Widget themes initialized."; } QList ThemeManager::getValidApplicationThemes() @@ -111,6 +145,15 @@ QList ThemeManager::getValidApplicationThemes() return ret; } +QList ThemeManager::getValidIconThemes() +{ + QList ret; + ret.reserve(m_icons.size()); + for (IconTheme& theme : m_icons) + ret.append(&theme); + return ret; +} + void ThemeManager::setIconTheme(const QString& name) { QIcon::setThemeName(name); diff --git a/launcher/ui/themes/ThemeManager.h b/launcher/ui/themes/ThemeManager.h index d2a6fb70..7509377c 100644 --- a/launcher/ui/themes/ThemeManager.h +++ b/launcher/ui/themes/ThemeManager.h @@ -19,6 +19,7 @@ #include +#include "IconTheme.h" #include "ui/MainWindow.h" #include "ui/themes/ITheme.h" @@ -36,6 +37,7 @@ class ThemeManager { ThemeManager(MainWindow* mainWindow); QList getValidApplicationThemes(); + QList getValidIconThemes(); void setIconTheme(const QString& name); void applyCurrentlySelectedTheme(bool initial = false); void setApplicationTheme(const QString& name, bool initial = false); @@ -49,9 +51,15 @@ class ThemeManager { private: std::map> m_themes; + QList m_icons; MainWindow* m_mainWindow; void initializeThemes(); QString addTheme(std::unique_ptr theme); ITheme* getTheme(QString themeId); + void initializeIcons(); + void initializeWidgets(); + + const QStringList builtinIcons{ "pe_colored", "pe_light", "pe_dark", "pe_blue", "breeze_light", "breeze_dark", + "OSX", "iOS", "flat", "flat_white", "multimc" }; }; diff --git a/launcher/ui/widgets/ThemeCustomizationWidget.cpp b/launcher/ui/widgets/ThemeCustomizationWidget.cpp index 3bfcd821..455cbb7b 100644 --- a/launcher/ui/widgets/ThemeCustomizationWidget.cpp +++ b/launcher/ui/widgets/ThemeCustomizationWidget.cpp @@ -73,10 +73,9 @@ void ThemeCustomizationWidget::showFeatures(ThemeFields features) { void ThemeCustomizationWidget::applyIconTheme(int index) { auto settings = APPLICATION->settings(); auto originalIconTheme = settings->get("IconTheme").toString(); - auto& newIconTheme = m_iconThemeOptions[index].first; - settings->set("IconTheme", newIconTheme); - + auto newIconTheme = ui->iconsComboBox->currentData().toString(); if (originalIconTheme != newIconTheme) { + settings->set("IconTheme", newIconTheme); APPLICATION->applyCurrentlySelectedTheme(); } @@ -112,12 +111,17 @@ void ThemeCustomizationWidget::loadSettings() { auto settings = APPLICATION->settings(); - auto iconTheme = settings->get("IconTheme").toString(); - for (auto& iconThemeFromList : m_iconThemeOptions) { - QIcon iconForComboBox = QIcon(QString(":/icons/%1/scalable/settings").arg(iconThemeFromList.first)); - ui->iconsComboBox->addItem(iconForComboBox, iconThemeFromList.second); - if (iconTheme == iconThemeFromList.first) { - ui->iconsComboBox->setCurrentIndex(ui->iconsComboBox->count() - 1); + { + auto currentIconTheme = settings->get("IconTheme").toString(); + auto iconThemes = APPLICATION->getValidIconThemes(); + int idx = 0; + for (auto iconTheme : iconThemes) { + QIcon iconForComboBox = QIcon(iconTheme->path() + "/scalable/settings"); + ui->iconsComboBox->addItem(iconForComboBox, iconTheme->name(), iconTheme->id()); + if (currentIconTheme == iconTheme->id()) { + ui->iconsComboBox->setCurrentIndex(idx); + } + idx++; } } diff --git a/launcher/ui/widgets/ThemeCustomizationWidget.h b/launcher/ui/widgets/ThemeCustomizationWidget.h index 6c33c3c5..976ede43 100644 --- a/launcher/ui/widgets/ThemeCustomizationWidget.h +++ b/launcher/ui/widgets/ThemeCustomizationWidget.h @@ -31,7 +31,7 @@ class ThemeCustomizationWidget : public QWidget { public: explicit ThemeCustomizationWidget(QWidget* parent = nullptr); - ~ThemeCustomizationWidget(); + ~ThemeCustomizationWidget() override; void showFeatures(ThemeFields features); @@ -53,22 +53,7 @@ class ThemeCustomizationWidget : public QWidget { private: Ui::ThemeCustomizationWidget* ui; - //TODO finish implementing - QList> m_iconThemeOptions{ - { "pe_colored", QObject::tr("Simple (Colored Icons)") }, - { "pe_light", QObject::tr("Simple (Light Icons)") }, - { "pe_dark", QObject::tr("Simple (Dark Icons)") }, - { "pe_blue", QObject::tr("Simple (Blue Icons)") }, - { "breeze_light", QObject::tr("Breeze Light") }, - { "breeze_dark", QObject::tr("Breeze Dark") }, - { "OSX", QObject::tr("OSX") }, - { "iOS", QObject::tr("iOS") }, - { "flat", QObject::tr("Flat") }, - { "flat_white", QObject::tr("Flat (White)") }, - { "multimc", QObject::tr("Legacy") }, - { "custom", QObject::tr("Custom") } - }; - QList> m_catOptions{ + QList> m_catOptions{ { "kitteh", QObject::tr("Background Cat (from MultiMC)") }, { "rory", QObject::tr("Rory ID 11 (drawn by Ashtaka)") }, { "rory-flat", QObject::tr("Rory ID 11 (flat edition, drawn by Ashtaka)") }, -- cgit From 99fd1e622c4ab0218c206abed5876dbb273f5110 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Sun, 6 Aug 2023 17:43:30 +0200 Subject: chore: replace fabricmc icons with SVG Signed-off-by: Sefa Eyeoglu --- .../multimc/128x128/instances/fabricmc.png | Bin 4839 -> 0 bytes .../resources/multimc/22x22/fabricmc-small.png | Bin 5672 -> 0 bytes launcher/resources/multimc/multimc.qrc | 3 +- .../multimc/scalable/instances/fabricmc.svg | 71 +++++++++++++++++++++ launcher/ui/dialogs/InstallLoaderDialog.cpp | 2 +- 5 files changed, 73 insertions(+), 3 deletions(-) delete mode 100644 launcher/resources/multimc/128x128/instances/fabricmc.png delete mode 100644 launcher/resources/multimc/22x22/fabricmc-small.png create mode 100644 launcher/resources/multimc/scalable/instances/fabricmc.svg (limited to 'launcher/resources/multimc') diff --git a/launcher/resources/multimc/128x128/instances/fabricmc.png b/launcher/resources/multimc/128x128/instances/fabricmc.png deleted file mode 100644 index c78543ae..00000000 Binary files a/launcher/resources/multimc/128x128/instances/fabricmc.png and /dev/null differ diff --git a/launcher/resources/multimc/22x22/fabricmc-small.png b/launcher/resources/multimc/22x22/fabricmc-small.png deleted file mode 100644 index e21ae9e8..00000000 Binary files a/launcher/resources/multimc/22x22/fabricmc-small.png and /dev/null differ diff --git a/launcher/resources/multimc/multimc.qrc b/launcher/resources/multimc/multimc.qrc index 4a407d95..bdf3495b 100644 --- a/launcher/resources/multimc/multimc.qrc +++ b/launcher/resources/multimc/multimc.qrc @@ -349,9 +349,8 @@ scalable/server.svg scalable/instances/quiltmc.svg - 22x22/fabricmc-small.png + scalable/instances/fabricmc.svg 128x128/instances/forge.png - 128x128/instances/fabricmc.png 128x128/instances/liteloader.png diff --git a/launcher/resources/multimc/scalable/instances/fabricmc.svg b/launcher/resources/multimc/scalable/instances/fabricmc.svg new file mode 100644 index 00000000..7bfc7548 --- /dev/null +++ b/launcher/resources/multimc/scalable/instances/fabricmc.svg @@ -0,0 +1,71 @@ + + + + diff --git a/launcher/ui/dialogs/InstallLoaderDialog.cpp b/launcher/ui/dialogs/InstallLoaderDialog.cpp index 6302cadb..840a328f 100644 --- a/launcher/ui/dialogs/InstallLoaderDialog.cpp +++ b/launcher/ui/dialogs/InstallLoaderDialog.cpp @@ -132,7 +132,7 @@ QList InstallLoaderDialog::getPages() return { // Forge new InstallLoaderPage("net.minecraftforge", "forge", tr("Forge"), {}, profile), // Fabric - new InstallLoaderPage("net.fabricmc.fabric-loader", "fabricmc-small", tr("Fabric"), Version("1.14"), profile), + new InstallLoaderPage("net.fabricmc.fabric-loader", "fabricmc", tr("Fabric"), Version("1.14"), profile), // Quilt new InstallLoaderPage("org.quiltmc.quilt-loader", "quiltmc", tr("Quilt"), Version("1.14"), profile), // LiteLoader -- cgit From d67277a668410e46a86870b3f9ab6bfdb90b4be4 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Thu, 10 Aug 2023 20:18:16 +0200 Subject: chore: replace LiteLoader logo with high quality version Signed-off-by: Sefa Eyeoglu --- .../multimc/128x128/instances/liteloader.png | Bin 20337 -> 7619 bytes 1 file changed, 0 insertions(+), 0 deletions(-) (limited to 'launcher/resources/multimc') diff --git a/launcher/resources/multimc/128x128/instances/liteloader.png b/launcher/resources/multimc/128x128/instances/liteloader.png index 88295e64..646217de 100644 Binary files a/launcher/resources/multimc/128x128/instances/liteloader.png and b/launcher/resources/multimc/128x128/instances/liteloader.png differ -- cgit From 8140374e26dc97c7b1752f1018991bf19ee86f7c Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Thu, 10 Aug 2023 20:18:28 +0200 Subject: chore: add licensing info to loader logos Signed-off-by: Sefa Eyeoglu --- launcher/resources/multimc/multimc.qrc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'launcher/resources/multimc') diff --git a/launcher/resources/multimc/multimc.qrc b/launcher/resources/multimc/multimc.qrc index bdf3495b..8f079bb3 100644 --- a/launcher/resources/multimc/multimc.qrc +++ b/launcher/resources/multimc/multimc.qrc @@ -348,9 +348,9 @@ scalable/launch.svg scalable/server.svg - scalable/instances/quiltmc.svg - scalable/instances/fabricmc.svg - 128x128/instances/forge.png - 128x128/instances/liteloader.png + scalable/instances/quiltmc.svg + scalable/instances/fabricmc.svg + 128x128/instances/forge.png + 128x128/instances/liteloader.png -- cgit