diff options
author | Petr Mrázek <peterix@gmail.com> | 2018-01-05 04:26:46 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2018-01-05 04:26:46 +0100 |
commit | 0636c03d7c08a90de5180e20dd6106c4cac34a23 (patch) | |
tree | 0e969118c1ae557dbdc2377452638ee9460f94a8 | |
parent | ee341b78baf679ba7eac868ce72e313c8e49775f (diff) | |
download | MultiMC-0636c03d7c08a90de5180e20dd6106c4cac34a23.tar MultiMC-0636c03d7c08a90de5180e20dd6106c4cac34a23.tar.gz MultiMC-0636c03d7c08a90de5180e20dd6106c4cac34a23.tar.lz MultiMC-0636c03d7c08a90de5180e20dd6106c4cac34a23.tar.xz MultiMC-0636c03d7c08a90de5180e20dd6106c4cac34a23.zip |
GH-2087 remove the revert to vanilla functionality, add file download button to version page
-rw-r--r-- | api/logic/minecraft/ComponentList.cpp | 36 | ||||
-rw-r--r-- | api/logic/minecraft/ComponentList.h | 6 | ||||
-rw-r--r-- | api/logic/minecraft/MinecraftInstance.cpp | 10 | ||||
-rw-r--r-- | application/pages/VersionPage.cpp | 41 | ||||
-rw-r--r-- | application/pages/VersionPage.h | 1 | ||||
-rw-r--r-- | application/pages/VersionPage.ui | 15 |
6 files changed, 29 insertions, 80 deletions
diff --git a/api/logic/minecraft/ComponentList.cpp b/api/logic/minecraft/ComponentList.cpp index b4ab2151..dc7f3614 100644 --- a/api/logic/minecraft/ComponentList.cpp +++ b/api/logic/minecraft/ComponentList.cpp @@ -743,42 +743,6 @@ Component * ComponentList::getComponent(int index) return d->components[index].get(); } -bool ComponentList::isVanilla() -{ - for(auto patchptr: d->components) - { - if(patchptr->isCustom()) - return false; - } - return true; -} - -bool ComponentList::revertToVanilla() -{ - // remove patches, if present - auto VersionPatchesCopy = d->components; - for(auto & it: VersionPatchesCopy) - { - if (!it->isCustom()) - { - continue; - } - if(it->isRevertible() || it->isRemovable()) - { - if(!remove(it->getID())) - { - qWarning() << "Couldn't remove" << it->getID() << "from profile!"; - invalidateLaunchProfile(); - scheduleSave(); - return false; - } - } - } - invalidateLaunchProfile(); - scheduleSave(); - return true; -} - QVariant ComponentList::data(const QModelIndex &index, int role) const { if (!index.isValid()) diff --git a/api/logic/minecraft/ComponentList.h b/api/logic/minecraft/ComponentList.h index 3b53a9fe..6d380fe9 100644 --- a/api/logic/minecraft/ComponentList.h +++ b/api/logic/minecraft/ComponentList.h @@ -59,12 +59,6 @@ public: /// call this to explicitly mark the component list as loaded - this is used to build a new component list from scratch. void buildingFromScratch(); - /// is this version unchanged by the user? - bool isVanilla(); - - /// remove any customizations on top of whatever 'vanilla' means - bool revertToVanilla(); - /// install more jar mods void installJarMods(QStringList selectedFiles); diff --git a/api/logic/minecraft/MinecraftInstance.cpp b/api/logic/minecraft/MinecraftInstance.cpp index 49db5b75..2fda79bf 100644 --- a/api/logic/minecraft/MinecraftInstance.cpp +++ b/api/logic/minecraft/MinecraftInstance.cpp @@ -398,14 +398,8 @@ QStringList MinecraftInstance::processMinecraftArgs(AuthSessionPtr session) cons // blatant self-promotion. token_mapping["profile_name"] = token_mapping["version_name"] = "MultiMC5"; - if(m_components->isVanilla()) - { - token_mapping["version_type"] = profile->getMinecraftVersionType(); - } - else - { - token_mapping["version_type"] = "custom"; - } + + token_mapping["version_type"] = profile->getMinecraftVersionType(); QString absRootDir = QDir(minecraftRoot()).absolutePath(); token_mapping["game_directory"] = absRootDir; diff --git a/application/pages/VersionPage.cpp b/application/pages/VersionPage.cpp index 50cc825f..57e1709b 100644 --- a/application/pages/VersionPage.cpp +++ b/application/pages/VersionPage.cpp @@ -324,54 +324,39 @@ void VersionPage::on_changeVersionBtn_clicked() if (!vselect.exec() || !vselect.selectedVersion()) return; - if (!MMC->accounts()->anyAccountIsValid()) - { - CustomMessageBox::selectable( - this, tr("Error"), - tr("MultiMC cannot download Minecraft or update instances unless you have at least " - "one account added.\nPlease add your Mojang or Minecraft account."), - QMessageBox::Warning)->show(); - return; - } - qDebug() << "Change" << uid << "to" << vselect.selectedVersion()->descriptor(); bool important = false; if(uid == "net.minecraft") { important = true; - if (!m_profile->isVanilla()) - { - auto result = CustomMessageBox::selectable( - this, tr("Are you sure?"), - tr("This will remove any library/version customization you did previously. " - "This includes things like Forge install and similar."), - QMessageBox::Warning, QMessageBox::Ok | QMessageBox::Abort, - QMessageBox::Abort)->exec(); - - if (result != QMessageBox::Ok) - return; - m_profile->revertToVanilla(); - reloadComponentList(); - } } m_profile->setComponentVersion(uid, vselect.selectedVersion()->descriptor(), important); - doUpdate(); + m_profile->resolve(Net::Mode::Online); m_container->refreshContainer(); } -int VersionPage::doUpdate() +void VersionPage::on_downloadBtn_clicked() { + if (!MMC->accounts()->anyAccountIsValid()) + { + CustomMessageBox::selectable( + this, tr("Error"), + tr("MultiMC cannot download Minecraft or update instances unless you have at least " + "one account added.\nPlease add your Mojang or Minecraft account."), + QMessageBox::Warning)->show(); + return; + } + auto updateTask = m_inst->createUpdateTask(Net::Mode::Online); if (!updateTask) { - return 1; + return; } ProgressDialog tDialog(this); connect(updateTask.get(), SIGNAL(failed(QString)), SLOT(onGameUpdateError(QString))); int ret = tDialog.execWithTask(updateTask.get()); updateButtons(); m_container->refreshContainer(); - return ret; } void VersionPage::on_forgeBtn_clicked() diff --git a/application/pages/VersionPage.h b/application/pages/VersionPage.h index d4b65983..0003fe69 100644 --- a/application/pages/VersionPage.h +++ b/application/pages/VersionPage.h @@ -62,6 +62,7 @@ private slots: void on_editBtn_clicked(); void on_modBtn_clicked(); void on_customizeBtn_clicked(); + void on_downloadBtn_clicked(); void updateVersionControls(); void disableVersionControls(); diff --git a/application/pages/VersionPage.ui b/application/pages/VersionPage.ui index 1d2adff7..d54dd840 100644 --- a/application/pages/VersionPage.ui +++ b/application/pages/VersionPage.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>693</width> - <height>833</height> + <width>870</width> + <height>1008</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout"> @@ -235,6 +235,16 @@ </widget> </item> <item> + <widget class="QPushButton" name="downloadBtn"> + <property name="toolTip"> + <string>Download the files needed to launch the instance now.</string> + </property> + <property name="text"> + <string>Download All</string> + </property> + </widget> + </item> + <item> <spacer name="verticalSpacer_7"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -300,6 +310,7 @@ <tabstop>jarBtn</tabstop> <tabstop>addEmptyBtn</tabstop> <tabstop>reloadBtn</tabstop> + <tabstop>downloadBtn</tabstop> <tabstop>tabWidget</tabstop> </tabstops> <resources/> |