summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-06-08 21:26:48 +0200
committerPetr Mrázek <peterix@gmail.com>2014-06-09 01:38:31 +0200
commitbe73eb3322b6bb5ab1144f9942ef9bd188c704a1 (patch)
tree8df6bfa84a62fc17d9842d30134c6a71fd4cb3f1
parentbf7b07050873770bd0b2ed5d73965b5a88d7a351 (diff)
downloadMultiMC-be73eb3322b6bb5ab1144f9942ef9bd188c704a1.tar
MultiMC-be73eb3322b6bb5ab1144f9942ef9bd188c704a1.tar.gz
MultiMC-be73eb3322b6bb5ab1144f9942ef9bd188c704a1.tar.lz
MultiMC-be73eb3322b6bb5ab1144f9942ef9bd188c704a1.tar.xz
MultiMC-be73eb3322b6bb5ab1144f9942ef9bd188c704a1.zip
Version revert logic improvements, colorful icons for mod lists and resource pack list.
Icons are from Oxygen.
-rw-r--r--gui/pages/LegacyJarModPage.cpp2
-rw-r--r--gui/pages/LegacyUpgradePage.cpp2
-rw-r--r--gui/pages/ResourcePackPage.h23
-rw-r--r--gui/pages/TexturePackPage.h20
-rw-r--r--gui/pages/VersionPage.cpp28
-rw-r--r--logic/LegacyInstance.cpp4
-rw-r--r--logic/OneSixInstance.cpp4
-rw-r--r--logic/minecraft/InstanceVersion.cpp58
-rw-r--r--logic/minecraft/InstanceVersion.h8
-rw-r--r--resources/multimc/16x16/plugin-blue.pngbin0 -> 731 bytes
-rw-r--r--resources/multimc/16x16/plugin-green.pngbin0 -> 702 bytes
-rw-r--r--resources/multimc/16x16/plugin-red.pngbin0 -> 693 bytes
-rw-r--r--resources/multimc/16x16/resourcepacks.pngbin0 -> 1207 bytes
-rw-r--r--resources/multimc/24x24/plugin-blue.pngbin0 -> 1240 bytes
-rw-r--r--resources/multimc/24x24/plugin-green.pngbin0 -> 1281 bytes
-rw-r--r--resources/multimc/24x24/plugin-red.pngbin0 -> 1170 bytes
-rw-r--r--resources/multimc/24x24/resourcepacks.pngbin0 -> 2000 bytes
-rw-r--r--resources/multimc/32x32/plugin-blue.pngbin0 -> 1708 bytes
-rw-r--r--resources/multimc/32x32/plugin-green.pngbin0 -> 1758 bytes
-rw-r--r--resources/multimc/32x32/plugin-red.pngbin0 -> 1566 bytes
-rw-r--r--resources/multimc/32x32/resourcepacks.pngbin0 -> 2818 bytes
-rw-r--r--resources/multimc/64x64/plugin-blue.pngbin0 -> 4406 bytes
-rw-r--r--resources/multimc/64x64/plugin-green.pngbin0 -> 5036 bytes
-rw-r--r--resources/multimc/64x64/plugin-red.pngbin0 -> 4003 bytes
-rw-r--r--resources/multimc/64x64/resourcepacks.pngbin0 -> 6805 bytes
-rw-r--r--resources/multimc/multimc.qrc24
26 files changed, 150 insertions, 23 deletions
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 <QAbstractItemModel>
#include <logic/Mod.h>
+#include <logic/icons/IconList.h>
#include <QMessageBox>
#include <QListView>
@@ -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<QUrl> 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 &current, 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);
}
diff --git a/logic/LegacyInstance.cpp b/logic/LegacyInstance.cpp
index 15332c41..378c058b 100644
--- a/logic/LegacyInstance.cpp
+++ b/logic/LegacyInstance.cpp
@@ -49,8 +49,8 @@ QList<BasePage *> LegacyInstance::getPages()
QList<BasePage *> values;
values.append(new LegacyUpgradePage(this));
values.append(new LegacyJarModPage(this));
- values.append(new ModFolderPage(loaderModList(), "mods", "centralmods", tr("Loader Mods")));
- values.append(new ModFolderPage(coreModList(), "coremods", "viewfolder", tr("Core Mods")));
+ values.append(new ModFolderPage(loaderModList(), "mods", "plugin-blue", tr("Loader Mods")));
+ values.append(new ModFolderPage(coreModList(), "coremods", "plugin-green", tr("Core Mods")));
values.append(new TexturePackPage(this));
return values;
}
diff --git a/logic/OneSixInstance.cpp b/logic/OneSixInstance.cpp
index d306470c..6de789df 100644
--- a/logic/OneSixInstance.cpp
+++ b/logic/OneSixInstance.cpp
@@ -60,8 +60,8 @@ QList<BasePage *> OneSixInstance::getPages()
{
QList<BasePage *> values;
values.append(new VersionPage(this));
- values.append(new ModFolderPage(loaderModList(), "mods", "centralmods", tr("Loader Mods")));
- values.append(new ModFolderPage(coreModList(), "coremods", "viewfolder", tr("Core Mods")));
+ values.append(new ModFolderPage(loaderModList(), "mods", "plugin-blue", tr("Loader Mods")));
+ values.append(new ModFolderPage(coreModList(), "coremods", "plugin-green", tr("Core Mods")));
values.append(new ResourcePackPage(this));
values.append(new TexturePackPage(this));
return values;
diff --git a/logic/minecraft/InstanceVersion.cpp b/logic/minecraft/InstanceVersion.cpp
index 73beceb3..baf34404 100644
--- a/logic/minecraft/InstanceVersion.cpp
+++ b/logic/minecraft/InstanceVersion.cpp
@@ -161,12 +161,35 @@ bool InstanceVersion::isVanilla()
return false;
if(QFile::exists(PathCombine(m_instance->instanceRoot(), "custom.json")))
return false;
+ if(QFile::exists(PathCombine(m_instance->instanceRoot(), "version.json")))
+ return false;
return true;
}
bool InstanceVersion::revertToVanilla()
{
beginResetModel();
+ // remove custom.json, if present
+ QString customPath = PathCombine(m_instance->instanceRoot(), "custom.json");
+ if(QFile::exists(customPath))
+ {
+ if(!QFile::remove(customPath))
+ {
+ endResetModel();
+ return false;
+ }
+ }
+ // remove version.json, if present
+ QString versionPath = PathCombine(m_instance->instanceRoot(), "version.json");
+ if(QFile::exists(versionPath))
+ {
+ if(!QFile::remove(versionPath))
+ {
+ endResetModel();
+ return false;
+ }
+ }
+ // remove patches, if present
auto it = VersionPatches.begin();
while (it != VersionPatches.end())
{
@@ -195,9 +218,40 @@ bool InstanceVersion::revertToVanilla()
return true;
}
-bool InstanceVersion::usesLegacyCustomJson()
+bool InstanceVersion::hasDeprecatedVersionFiles()
{
- return QFile::exists(PathCombine(m_instance->instanceRoot(), "custom.json"));
+ if(QFile::exists(PathCombine(m_instance->instanceRoot(), "custom.json")))
+ return true;
+ if(QFile::exists(PathCombine(m_instance->instanceRoot(), "version.json")))
+ return true;
+ return false;
+}
+
+bool InstanceVersion::removeDeprecatedVersionFiles()
+{
+ beginResetModel();
+ // remove custom.json, if present
+ QString customPath = PathCombine(m_instance->instanceRoot(), "custom.json");
+ if(QFile::exists(customPath))
+ {
+ if(!QFile::remove(customPath))
+ {
+ endResetModel();
+ return false;
+ }
+ }
+ // remove version.json, if present
+ QString versionPath = PathCombine(m_instance->instanceRoot(), "version.json");
+ if(QFile::exists(versionPath))
+ {
+ if(!QFile::remove(versionPath))
+ {
+ endResetModel();
+ return false;
+ }
+ }
+ endResetModel();
+ return true;
}
QList<std::shared_ptr<OneSixLibrary> > InstanceVersion::getActiveNormalLibs()
diff --git a/logic/minecraft/InstanceVersion.h b/logic/minecraft/InstanceVersion.h
index 60df59df..6b69ab47 100644
--- a/logic/minecraft/InstanceVersion.h
+++ b/logic/minecraft/InstanceVersion.h
@@ -51,6 +51,11 @@ public:
// remove any customizations on top of vanilla
bool revertToVanilla();
+ // does this version consist of obsolete files?
+ bool hasDeprecatedVersionFiles();
+ // remove obsolete files
+ bool removeDeprecatedVersionFiles();
+
// does this version have an FTB pack patch file?
bool hasFtbPack();
// remove FTB pack
@@ -61,9 +66,6 @@ public:
void installJarMods(QStringList selectedFiles);
void installJarModByFilename(QString filepath);
- // does this version still use a legacy custom.json file?
- bool usesLegacyCustomJson();
-
enum MoveDirection { MoveUp, MoveDown };
void move(const int index, const MoveDirection direction);
void resetOrder();
diff --git a/resources/multimc/16x16/plugin-blue.png b/resources/multimc/16x16/plugin-blue.png
new file mode 100644
index 00000000..b5ab3fce
--- /dev/null
+++ b/resources/multimc/16x16/plugin-blue.png
Binary files differ
diff --git a/resources/multimc/16x16/plugin-green.png b/resources/multimc/16x16/plugin-green.png
new file mode 100644
index 00000000..af0f1166
--- /dev/null
+++ b/resources/multimc/16x16/plugin-green.png
Binary files differ
diff --git a/resources/multimc/16x16/plugin-red.png b/resources/multimc/16x16/plugin-red.png
new file mode 100644
index 00000000..1a97c9c0
--- /dev/null
+++ b/resources/multimc/16x16/plugin-red.png
Binary files differ
diff --git a/resources/multimc/16x16/resourcepacks.png b/resources/multimc/16x16/resourcepacks.png
new file mode 100644
index 00000000..d862f5ca
--- /dev/null
+++ b/resources/multimc/16x16/resourcepacks.png
Binary files differ
diff --git a/resources/multimc/24x24/plugin-blue.png b/resources/multimc/24x24/plugin-blue.png
new file mode 100644
index 00000000..250a6260
--- /dev/null
+++ b/resources/multimc/24x24/plugin-blue.png
Binary files differ
diff --git a/resources/multimc/24x24/plugin-green.png b/resources/multimc/24x24/plugin-green.png
new file mode 100644
index 00000000..90603d24
--- /dev/null
+++ b/resources/multimc/24x24/plugin-green.png
Binary files differ
diff --git a/resources/multimc/24x24/plugin-red.png b/resources/multimc/24x24/plugin-red.png
new file mode 100644
index 00000000..68cb8e9d
--- /dev/null
+++ b/resources/multimc/24x24/plugin-red.png
Binary files differ
diff --git a/resources/multimc/24x24/resourcepacks.png b/resources/multimc/24x24/resourcepacks.png
new file mode 100644
index 00000000..68359d39
--- /dev/null
+++ b/resources/multimc/24x24/resourcepacks.png
Binary files differ
diff --git a/resources/multimc/32x32/plugin-blue.png b/resources/multimc/32x32/plugin-blue.png
new file mode 100644
index 00000000..c4ca12e2
--- /dev/null
+++ b/resources/multimc/32x32/plugin-blue.png
Binary files differ
diff --git a/resources/multimc/32x32/plugin-green.png b/resources/multimc/32x32/plugin-green.png
new file mode 100644
index 00000000..770d695e
--- /dev/null
+++ b/resources/multimc/32x32/plugin-green.png
Binary files differ
diff --git a/resources/multimc/32x32/plugin-red.png b/resources/multimc/32x32/plugin-red.png
new file mode 100644
index 00000000..5cda173a
--- /dev/null
+++ b/resources/multimc/32x32/plugin-red.png
Binary files differ
diff --git a/resources/multimc/32x32/resourcepacks.png b/resources/multimc/32x32/resourcepacks.png
new file mode 100644
index 00000000..c14759ef
--- /dev/null
+++ b/resources/multimc/32x32/resourcepacks.png
Binary files differ
diff --git a/resources/multimc/64x64/plugin-blue.png b/resources/multimc/64x64/plugin-blue.png
new file mode 100644
index 00000000..24618fd0
--- /dev/null
+++ b/resources/multimc/64x64/plugin-blue.png
Binary files differ
diff --git a/resources/multimc/64x64/plugin-green.png b/resources/multimc/64x64/plugin-green.png
new file mode 100644
index 00000000..668be334
--- /dev/null
+++ b/resources/multimc/64x64/plugin-green.png
Binary files differ
diff --git a/resources/multimc/64x64/plugin-red.png b/resources/multimc/64x64/plugin-red.png
new file mode 100644
index 00000000..55d1a42a
--- /dev/null
+++ b/resources/multimc/64x64/plugin-red.png
Binary files differ
diff --git a/resources/multimc/64x64/resourcepacks.png b/resources/multimc/64x64/resourcepacks.png
new file mode 100644
index 00000000..fb874e7d
--- /dev/null
+++ b/resources/multimc/64x64/resourcepacks.png
Binary files differ
diff --git a/resources/multimc/multimc.qrc b/resources/multimc/multimc.qrc
index 1df22c29..887e94ac 100644
--- a/resources/multimc/multimc.qrc
+++ b/resources/multimc/multimc.qrc
@@ -102,6 +102,30 @@
<file>32x32/status-good.png</file>
<file>48x48/status-good.png</file>
<file>64x64/status-good.png</file>
+
+ <!-- Plugin (blue recolor), CC-BY-SA 3.0, Oxygen icons. -->
+ <file>16x16/plugin-blue.png</file>
+ <file>24x24/plugin-blue.png</file>
+ <file>32x32/plugin-blue.png</file>
+ <file>64x64/plugin-blue.png</file>
+
+ <!-- Plugin (red recolor), CC-BY-SA 3.0, Oxygen icons. -->
+ <file>16x16/plugin-red.png</file>
+ <file>24x24/plugin-red.png</file>
+ <file>32x32/plugin-red.png</file>
+ <file>64x64/plugin-red.png</file>
+
+ <!-- Plugin (green original), CC-BY-SA 3.0, Oxygen icons. -->
+ <file>16x16/plugin-green.png</file>
+ <file>24x24/plugin-green.png</file>
+ <file>32x32/plugin-green.png</file>
+ <file>64x64/plugin-green.png</file>
+
+ <!-- Resource packs, CC-BY-SA 3.0, Oxygen icons. -->
+ <file>16x16/resourcepacks.png</file>
+ <file>24x24/resourcepacks.png</file>
+ <file>32x32/resourcepacks.png</file>
+ <file>64x64/resourcepacks.png</file>
<!-- Refresh, CC-BY-SA 3.0, Oxygen icons. -->
<file>16x16/refresh.png</file>