summaryrefslogtreecommitdiffstats
path: root/logic
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-09-20 01:21:48 +0200
committerPetr Mrázek <peterix@gmail.com>2013-09-20 01:21:48 +0200
commitc2c7293083de8e8d40190992ccd6a65b613a4d06 (patch)
treea43112766db65c7fa8f456566b66c4e384d624a6 /logic
parent930b07afd4229e952d0cd47ca62cd94235499a0c (diff)
downloadMultiMC-c2c7293083de8e8d40190992ccd6a65b613a4d06.tar
MultiMC-c2c7293083de8e8d40190992ccd6a65b613a4d06.tar.gz
MultiMC-c2c7293083de8e8d40190992ccd6a65b613a4d06.tar.lz
MultiMC-c2c7293083de8e8d40190992ccd6a65b613a4d06.tar.xz
MultiMC-c2c7293083de8e8d40190992ccd6a65b613a4d06.zip
Things... and stuff... with 1.6 modding. Maybe.
Diffstat (limited to 'logic')
-rw-r--r--logic/OneSixInstance.cpp24
-rw-r--r--logic/OneSixInstance.h4
-rw-r--r--logic/lists/ForgeVersionList.cpp4
3 files changed, 32 insertions, 0 deletions
diff --git a/logic/OneSixInstance.cpp b/logic/OneSixInstance.cpp
index 7b038c46..8124b4a0 100644
--- a/logic/OneSixInstance.cpp
+++ b/logic/OneSixInstance.cpp
@@ -226,6 +226,30 @@ QString OneSixInstance::currentVersionId() const
return intendedVersionId();
}
+bool OneSixInstance::customizeVersion()
+{
+ if(!versionIsCustom())
+ {
+ auto pathCustom = PathCombine(instanceRoot(), "custom.json");
+ auto pathOrig = PathCombine(instanceRoot(), "version.json");
+ QFile::copy(pathOrig, pathCustom);
+ return reloadFullVersion();
+ }
+ else return true;
+}
+
+bool OneSixInstance::revertCustomVersion()
+{
+ if(versionIsCustom())
+ {
+ auto path = PathCombine(instanceRoot(), "custom.json");
+ QFile::remove(path);
+ return reloadFullVersion();
+ }
+ else return true;
+}
+
+
bool OneSixInstance::reloadFullVersion()
{
I_D(OneSixInstance);
diff --git a/logic/OneSixInstance.h b/logic/OneSixInstance.h
index 72bde630..0139b645 100644
--- a/logic/OneSixInstance.h
+++ b/logic/OneSixInstance.h
@@ -41,6 +41,10 @@ public:
bool reloadFullVersion();
/// get the current full version info
QSharedPointer<OneSixVersion> getFullVersion();
+ /// revert the current custom version back to base
+ bool revertCustomVersion();
+ /// customize the current base version
+ bool customizeVersion();
/// is the current version original, or custom?
bool versionIsCustom();
diff --git a/logic/lists/ForgeVersionList.cpp b/logic/lists/ForgeVersionList.cpp
index 412c04fe..492849ee 100644
--- a/logic/lists/ForgeVersionList.cpp
+++ b/logic/lists/ForgeVersionList.cpp
@@ -220,6 +220,7 @@ void ForgeListLoadTask::list_downloaded()
QJsonArray files = obj.value("files").toArray();
QString url, jobbuildver, mcver, buildtype, filename;
QString changelog_url, installer_url;
+ QString installer_filename;
bool valid = false;
for(int j = 0; j < files.count(); j++)
{
@@ -246,6 +247,8 @@ void ForgeListLoadTask::list_downloaded()
else if(buildtype == "installer")
{
installer_url = file.value("url").toString();
+ int lastSlash = installer_url.lastIndexOf('/');
+ installer_filename = installer_url.mid(lastSlash+1);
}
}
if(valid)
@@ -258,6 +261,7 @@ void ForgeListLoadTask::list_downloaded()
fVersion->jobbuildver = jobbuildver;
fVersion->mcver = mcver;
fVersion->filename = filename;
+ fVersion->filename = installer_filename;
fVersion->m_buildnr = build_nr;
tempList.append(fVersion);
}