Version revert logic improvements, colorful icons for mod lists and resource pack list.
Icons are from Oxygen.
@ -56,7 +56,7 @@ QString LegacyJarModPage::displayName()
|
||||
|
||||
QIcon LegacyJarModPage::icon()
|
||||
{
|
||||
return QIcon::fromTheme("settings");
|
||||
return QIcon::fromTheme("plugin-red");
|
||||
}
|
||||
|
||||
QString LegacyJarModPage::id()
|
||||
|
@ -8,7 +8,7 @@ QString LegacyUpgradePage::displayName()
|
||||
|
||||
QIcon LegacyUpgradePage::icon()
|
||||
{
|
||||
return QIcon::fromTheme("bug");
|
||||
return QIcon::fromTheme("checkupdate");
|
||||
}
|
||||
|
||||
QString LegacyUpgradePage::id()
|
||||
|
23
gui/pages/ResourcePackPage.h
Normal file
@ -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;
|
||||
};
|
20
gui/pages/TexturePackPage.h
Normal file
@ -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;
|
||||
};
|
@ -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,7 +179,8 @@ void VersionPage::on_jarmodBtn_clicked()
|
||||
w.setDirectory(modsFolder);
|
||||
w.setSidebarUrls(urls);
|
||||
|
||||
if(w.exec());
|
||||
if (w.exec())
|
||||
;
|
||||
m_version->installJarMods(w.selectedFiles());
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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()
|
||||
|
@ -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();
|
||||
|
BIN
resources/multimc/16x16/plugin-blue.png
Normal file
After Width: | Height: | Size: 731 B |
BIN
resources/multimc/16x16/plugin-green.png
Normal file
After Width: | Height: | Size: 702 B |
BIN
resources/multimc/16x16/plugin-red.png
Normal file
After Width: | Height: | Size: 693 B |
BIN
resources/multimc/16x16/resourcepacks.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
resources/multimc/24x24/plugin-blue.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
resources/multimc/24x24/plugin-green.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
resources/multimc/24x24/plugin-red.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
resources/multimc/24x24/resourcepacks.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
resources/multimc/32x32/plugin-blue.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
resources/multimc/32x32/plugin-green.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
resources/multimc/32x32/plugin-red.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
resources/multimc/32x32/resourcepacks.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
resources/multimc/64x64/plugin-blue.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
resources/multimc/64x64/plugin-green.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
resources/multimc/64x64/plugin-red.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
resources/multimc/64x64/resourcepacks.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
@ -103,6 +103,30 @@
|
||||
<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>
|
||||
<file>22x22/refresh.png</file>
|
||||
|