summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-03-31 00:19:43 +0200
committerPetr Mrázek <peterix@gmail.com>2014-03-31 00:19:43 +0200
commit29b00eab311064a6ae1512c3c35144c33e7f8ac3 (patch)
treee4134b1e8c1eeb9b18920097187cbbc7bff207ef
parenta3c95d9bcc581d74e3d8bfa6e1d3db0478b209f9 (diff)
downloadMultiMC-29b00eab311064a6ae1512c3c35144c33e7f8ac3.tar
MultiMC-29b00eab311064a6ae1512c3c35144c33e7f8ac3.tar.gz
MultiMC-29b00eab311064a6ae1512c3c35144c33e7f8ac3.tar.lz
MultiMC-29b00eab311064a6ae1512c3c35144c33e7f8ac3.tar.xz
MultiMC-29b00eab311064a6ae1512c3c35144c33e7f8ac3.zip
Fix FTB-related issues0.3.1
-rw-r--r--CMakeLists.txt2
-rw-r--r--changelog.yaml3
-rw-r--r--gui/dialogs/OneSixModEditDialog.cpp23
-rw-r--r--logic/InstanceFactory.cpp10
-rw-r--r--logic/OneSixInstance.cpp11
-rw-r--r--logic/OneSixInstance.h2
-rw-r--r--logic/VersionFinal.cpp26
-rw-r--r--logic/VersionFinal.h6
8 files changed, 80 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5febd904..91b45478 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -94,7 +94,7 @@ SET(MultiMC_NEWS_RSS_URL "http://multimc.org/rss.xml" CACHE STRING "URL to fetch
######## Set version numbers ########
SET(MultiMC_VERSION_MAJOR 0)
SET(MultiMC_VERSION_MINOR 3)
-SET(MultiMC_VERSION_HOTFIX 0)
+SET(MultiMC_VERSION_HOTFIX 1)
# Build number
SET(MultiMC_VERSION_BUILD -1 CACHE STRING "Build number. -1 for no build number.")
diff --git a/changelog.yaml b/changelog.yaml
index bcc367d0..a56645ba 100644
--- a/changelog.yaml
+++ b/changelog.yaml
@@ -54,3 +54,6 @@
- Fix logging when the system language is not en_US
- Setting PermGen to 64 will now omit the java parameter because it is the default
- Fix encoding of escape sequences (tabs and newlines) in config files
+0.3.1:
+ - Fix copying of FTB instances (instance type is changed properly now)
+ - Customizing FTB pack versions will remove the FTB pack patch file
diff --git a/gui/dialogs/OneSixModEditDialog.cpp b/gui/dialogs/OneSixModEditDialog.cpp
index 2d459001..d7791d71 100644
--- a/gui/dialogs/OneSixModEditDialog.cpp
+++ b/gui/dialogs/OneSixModEditDialog.cpp
@@ -199,7 +199,17 @@ void OneSixModEditDialog::on_moveLibraryDownBtn_clicked()
void OneSixModEditDialog::on_forgeBtn_clicked()
{
// FIXME: use actual model, not reloading. Move logic to model.
-
+ if (m_version->hasFtbPack())
+ {
+ if (QMessageBox::question(this, tr("Revert?"),
+ tr("This action will remove the FTB pack version patch. Continue?")) !=
+ QMessageBox::Yes)
+ {
+ return;
+ }
+ m_version->removeFtbPack();
+ reloadInstanceVersion();
+ }
if (m_version->isCustom())
{
if (QMessageBox::question(this, tr("Revert?"),
@@ -224,6 +234,17 @@ void OneSixModEditDialog::on_forgeBtn_clicked()
void OneSixModEditDialog::on_liteloaderBtn_clicked()
{
+ if (m_version->hasFtbPack())
+ {
+ if (QMessageBox::question(this, tr("Revert?"),
+ tr("This action will remove the FTB pack version patch. Continue?")) !=
+ QMessageBox::Yes)
+ {
+ return;
+ }
+ m_version->removeFtbPack();
+ reloadInstanceVersion();
+ }
if (m_version->isCustom())
{
if (QMessageBox::question(this, tr("Revert?"),
diff --git a/logic/InstanceFactory.cpp b/logic/InstanceFactory.cpp
index 4f65221c..95fd855b 100644
--- a/logic/InstanceFactory.cpp
+++ b/logic/InstanceFactory.cpp
@@ -174,6 +174,15 @@ InstanceFactory::InstCreateError InstanceFactory::copyInstance(InstancePtr &newI
return InstanceFactory::CantCreateDir;
}
+ INISettingsObject settings_obj(PathCombine(instDir, "instance.cfg"));
+ settings_obj.registerSetting("InstanceType", "Legacy");
+ QString inst_type = settings_obj.get("InstanceType").toString();
+
+ if (inst_type == "OneSixFTB")
+ settings_obj.set("InstanceType", "OneSix");
+ if (inst_type == "LegacyFTB")
+ settings_obj.set("InstanceType", "Legacy");
+
oldInstance->copy(instDir);
auto error = loadInstance(newInstance, instDir);
@@ -190,5 +199,4 @@ InstanceFactory::InstCreateError InstanceFactory::copyInstance(InstancePtr &newI
rootDir.removeRecursively();
return UnknownCreateError;
}
- return UnknownCreateError;
}
diff --git a/logic/OneSixInstance.cpp b/logic/OneSixInstance.cpp
index ccc25845..24d54446 100644
--- a/logic/OneSixInstance.cpp
+++ b/logic/OneSixInstance.cpp
@@ -320,6 +320,17 @@ bool OneSixInstance::versionIsCustom()
|| QFile::exists(PathCombine(instanceRoot(), "user.json"));
}
+bool OneSixInstance::versionIsFTBPack()
+{
+ I_D(const OneSixInstance);
+ auto ver = d->version;
+ if(ver)
+ {
+ return ver->hasFtbPack();
+ }
+ return false;
+}
+
QString OneSixInstance::currentVersionId() const
{
return intendedVersionId();
diff --git a/logic/OneSixInstance.h b/logic/OneSixInstance.h
index 677459ae..4e9d62a1 100644
--- a/logic/OneSixInstance.h
+++ b/logic/OneSixInstance.h
@@ -68,6 +68,8 @@ public:
std::shared_ptr<VersionFinal> getVanillaVersion() const;
/// is the current version original, or custom?
virtual bool versionIsCustom() override;
+ /// does this instance have an FTB pack patch inside?
+ bool versionIsFTBPack();
virtual QString defaultBaseJar() const override;
virtual QString defaultCustomBaseJar() const override;
diff --git a/logic/VersionFinal.cpp b/logic/VersionFinal.cpp
index ed90c148..10e3ec82 100644
--- a/logic/VersionFinal.cpp
+++ b/logic/VersionFinal.cpp
@@ -70,6 +70,7 @@ bool VersionFinal::canRemove(const int index) const
}
return false;
}
+
bool VersionFinal::remove(const int index)
{
if (canRemove(index) && QFile::remove(versionFiles.at(index)->filename))
@@ -83,6 +84,20 @@ bool VersionFinal::remove(const int index)
return false;
}
+bool VersionFinal::remove(const QString id)
+{
+ int i = 0;
+ for (auto file : versionFiles)
+ {
+ if (file->fileId == id)
+ {
+ return remove(i);
+ }
+ i++;
+ }
+ return false;
+}
+
QString VersionFinal::versionFileId(const int index) const
{
if (index < 0 || index >= versionFiles.size())
@@ -91,6 +106,7 @@ QString VersionFinal::versionFileId(const int index) const
}
return versionFiles.at(index)->fileId;
}
+
VersionFilePtr VersionFinal::versionFile(const QString &id)
{
for (auto file : versionFiles)
@@ -103,6 +119,16 @@ VersionFilePtr VersionFinal::versionFile(const QString &id)
return 0;
}
+bool VersionFinal::hasFtbPack()
+{
+ return versionFile("org.multimc.ftb.pack.json") != nullptr;
+}
+
+bool VersionFinal::removeFtbPack()
+{
+ return remove("org.multimc.ftb.pack.json");
+}
+
QList<std::shared_ptr<OneSixLibrary> > VersionFinal::getActiveNormalLibs()
{
QList<std::shared_ptr<OneSixLibrary> > output;
diff --git a/logic/VersionFinal.h b/logic/VersionFinal.h
index 0bf95707..41fd23bd 100644
--- a/logic/VersionFinal.h
+++ b/logic/VersionFinal.h
@@ -49,6 +49,11 @@ public:
bool isCustom();
// remove custom.json
bool revertToBase();
+ // does this instance have an FTB pack patch file?
+ bool hasFtbPack();
+ // remove FTB pack
+ bool removeFtbPack();
+
enum MoveDirection { MoveUp, MoveDown };
void move(const int index, const MoveDirection direction);
@@ -61,6 +66,7 @@ public:
public
slots:
bool remove(const int index);
+ bool remove(const QString id);
public:
QList<std::shared_ptr<OneSixLibrary>> getActiveNormalLibs();