From be73eb3322b6bb5ab1144f9942ef9bd188c704a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 8 Jun 2014 21:26:48 +0200 Subject: Version revert logic improvements, colorful icons for mod lists and resource pack list. Icons are from Oxygen. --- gui/pages/LegacyJarModPage.cpp | 2 +- gui/pages/LegacyUpgradePage.cpp | 2 +- gui/pages/ResourcePackPage.h | 23 +++++++++++++++++++++++ gui/pages/TexturePackPage.h | 20 ++++++++++++++++++++ gui/pages/VersionPage.cpp | 28 ++++++++++++++++------------ 5 files changed, 61 insertions(+), 14 deletions(-) create mode 100644 gui/pages/ResourcePackPage.h create mode 100644 gui/pages/TexturePackPage.h (limited to 'gui') diff --git a/gui/pages/LegacyJarModPage.cpp b/gui/pages/LegacyJarModPage.cpp index 7ec53d80..f0f3d753 100644 --- a/gui/pages/LegacyJarModPage.cpp +++ b/gui/pages/LegacyJarModPage.cpp @@ -56,7 +56,7 @@ QString LegacyJarModPage::displayName() QIcon LegacyJarModPage::icon() { - return QIcon::fromTheme("settings"); + return QIcon::fromTheme("plugin-red"); } QString LegacyJarModPage::id() diff --git a/gui/pages/LegacyUpgradePage.cpp b/gui/pages/LegacyUpgradePage.cpp index 9aa97543..02729c79 100644 --- a/gui/pages/LegacyUpgradePage.cpp +++ b/gui/pages/LegacyUpgradePage.cpp @@ -8,7 +8,7 @@ QString LegacyUpgradePage::displayName() QIcon LegacyUpgradePage::icon() { - return QIcon::fromTheme("bug"); + return QIcon::fromTheme("checkupdate"); } QString LegacyUpgradePage::id() diff --git a/gui/pages/ResourcePackPage.h b/gui/pages/ResourcePackPage.h new file mode 100644 index 00000000..14321b9b --- /dev/null +++ b/gui/pages/ResourcePackPage.h @@ -0,0 +1,23 @@ +#pragma once +#include "ModFolderPage.h" + +class ResourcePackPage : public ModFolderPage +{ +public: + explicit ResourcePackPage(BaseInstance *instance, QWidget *parent = 0) + : ModFolderPage(instance->texturePackList(), "resourcepacks", "resourcepacks", + tr("Resource packs"), parent) + { + m_inst = instance; + } + + virtual ~ResourcePackPage() {}; + virtual bool shouldDisplay() override + { + return !m_inst->traits().contains("no-texturepacks") && + !m_inst->traits().contains("texturepacks"); + } + +private: + BaseInstance *m_inst; +}; diff --git a/gui/pages/TexturePackPage.h b/gui/pages/TexturePackPage.h new file mode 100644 index 00000000..ddb1fa49 --- /dev/null +++ b/gui/pages/TexturePackPage.h @@ -0,0 +1,20 @@ +#pragma once +#include "ModFolderPage.h" + +class TexturePackPage : public ModFolderPage +{ +public: + explicit TexturePackPage(BaseInstance *instance, QWidget *parent = 0) + : ModFolderPage(instance->texturePackList(), "texturepacks", "resourcepacks", + tr("Texture packs"), parent) + { + m_inst = instance; + } + virtual ~TexturePackPage() {}; + virtual bool shouldDisplay() override + { + return m_inst->traits().contains("texturepacks"); + } +private: + BaseInstance *m_inst; +}; diff --git a/gui/pages/VersionPage.cpp b/gui/pages/VersionPage.cpp index 74c3c2af..7cee0610 100644 --- a/gui/pages/VersionPage.cpp +++ b/gui/pages/VersionPage.cpp @@ -44,6 +44,7 @@ #include #include +#include #include #include @@ -57,7 +58,7 @@ QString VersionPage::displayName() QIcon VersionPage::icon() { - return QIcon::fromTheme("settings"); + return MMC->icons()->getIcon(m_inst->iconKey()); } QString VersionPage::id() @@ -157,7 +158,7 @@ void VersionPage::on_jarmodBtn_clicked() auto f = [&](QStandardPaths::StandardLocation l) { QString location = QStandardPaths::writableLocation(l); - if(!QFileInfo::exists(location)) + if (!QFileInfo::exists(location)) return; locations.insert(location); }; @@ -166,7 +167,7 @@ void VersionPage::on_jarmodBtn_clicked() f(QStandardPaths::DownloadLocation); f(QStandardPaths::HomeLocation); QList urls; - for(auto location: locations) + for (auto location : locations) { urls.append(QUrl::fromLocalFile(location)); } @@ -178,8 +179,9 @@ void VersionPage::on_jarmodBtn_clicked() w.setDirectory(modsFolder); w.setSidebarUrls(urls); - if(w.exec()); - m_version->installJarMods(w.selectedFiles()); + if (w.exec()) + ; + m_version->installJarMods(w.selectedFiles()); } void VersionPage::on_resetLibraryOrderBtn_clicked() @@ -292,15 +294,16 @@ void VersionPage::on_forgeBtn_clicked() m_version->removeFtbPack(); reloadInstanceVersion(); } - if (m_version->usesLegacyCustomJson()) + if (m_version->hasDeprecatedVersionFiles()) { if (QMessageBox::question(this, tr("Revert?"), - tr("This action will remove your custom.json. Continue?")) != + tr("This action will remove deprecated version files " + "(custom.json and version.json). Continue?")) != QMessageBox::Yes) { return; } - m_version->revertToVanilla(); + m_version->removeDeprecatedVersionFiles(); reloadInstanceVersion(); } VersionSelectDialog vselect(MMC->forgelist().get(), tr("Select Forge version"), this); @@ -329,15 +332,16 @@ void VersionPage::on_liteloaderBtn_clicked() m_version->removeFtbPack(); reloadInstanceVersion(); } - if (m_version->usesLegacyCustomJson()) + if (m_version->hasDeprecatedVersionFiles()) { if (QMessageBox::question(this, tr("Revert?"), - tr("This action will remove your custom.json. Continue?")) != + tr("This action will remove deprecated version files " + "(custom.json and version.json). Continue?")) != QMessageBox::Yes) { return; } - m_version->revertToVanilla(); + m_version->removeDeprecatedVersionFiles(); reloadInstanceVersion(); } VersionSelectDialog vselect(MMC->liteloaderlist().get(), tr("Select LiteLoader version"), @@ -369,7 +373,7 @@ void VersionPage::versionCurrent(const QModelIndex ¤t, const QModelIndex & ui->moveLibraryUpBtn->setEnabled(enabled); } QString selectedId = m_version->versionFileId(current.row()); - if(selectedId == "net.minecraft" || selectedId == "org.multimc.custom.json") + if (selectedId == "net.minecraft" || selectedId == "org.multimc.custom.json") { ui->changeMCVersionBtn->setEnabled(true); } -- cgit v1.2.3