GH-2087 remove the revert to vanilla functionality, add file download button to version page
This commit is contained in:
parent
ee341b78ba
commit
0636c03d7c
@ -743,42 +743,6 @@ Component * ComponentList::getComponent(int index)
|
|||||||
return d->components[index].get();
|
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
|
QVariant ComponentList::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
|
@ -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.
|
/// call this to explicitly mark the component list as loaded - this is used to build a new component list from scratch.
|
||||||
void buildingFromScratch();
|
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
|
/// install more jar mods
|
||||||
void installJarMods(QStringList selectedFiles);
|
void installJarMods(QStringList selectedFiles);
|
||||||
|
|
||||||
|
@ -398,14 +398,8 @@ QStringList MinecraftInstance::processMinecraftArgs(AuthSessionPtr session) cons
|
|||||||
|
|
||||||
// blatant self-promotion.
|
// blatant self-promotion.
|
||||||
token_mapping["profile_name"] = token_mapping["version_name"] = "MultiMC5";
|
token_mapping["profile_name"] = token_mapping["version_name"] = "MultiMC5";
|
||||||
if(m_components->isVanilla())
|
|
||||||
{
|
token_mapping["version_type"] = profile->getMinecraftVersionType();
|
||||||
token_mapping["version_type"] = profile->getMinecraftVersionType();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
token_mapping["version_type"] = "custom";
|
|
||||||
}
|
|
||||||
|
|
||||||
QString absRootDir = QDir(minecraftRoot()).absolutePath();
|
QString absRootDir = QDir(minecraftRoot()).absolutePath();
|
||||||
token_mapping["game_directory"] = absRootDir;
|
token_mapping["game_directory"] = absRootDir;
|
||||||
|
@ -324,6 +324,19 @@ void VersionPage::on_changeVersionBtn_clicked()
|
|||||||
if (!vselect.exec() || !vselect.selectedVersion())
|
if (!vselect.exec() || !vselect.selectedVersion())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
qDebug() << "Change" << uid << "to" << vselect.selectedVersion()->descriptor();
|
||||||
|
bool important = false;
|
||||||
|
if(uid == "net.minecraft")
|
||||||
|
{
|
||||||
|
important = true;
|
||||||
|
}
|
||||||
|
m_profile->setComponentVersion(uid, vselect.selectedVersion()->descriptor(), important);
|
||||||
|
m_profile->resolve(Net::Mode::Online);
|
||||||
|
m_container->refreshContainer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VersionPage::on_downloadBtn_clicked()
|
||||||
|
{
|
||||||
if (!MMC->accounts()->anyAccountIsValid())
|
if (!MMC->accounts()->anyAccountIsValid())
|
||||||
{
|
{
|
||||||
CustomMessageBox::selectable(
|
CustomMessageBox::selectable(
|
||||||
@ -334,44 +347,16 @@ void VersionPage::on_changeVersionBtn_clicked()
|
|||||||
return;
|
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_container->refreshContainer();
|
|
||||||
}
|
|
||||||
|
|
||||||
int VersionPage::doUpdate()
|
|
||||||
{
|
|
||||||
auto updateTask = m_inst->createUpdateTask(Net::Mode::Online);
|
auto updateTask = m_inst->createUpdateTask(Net::Mode::Online);
|
||||||
if (!updateTask)
|
if (!updateTask)
|
||||||
{
|
{
|
||||||
return 1;
|
return;
|
||||||
}
|
}
|
||||||
ProgressDialog tDialog(this);
|
ProgressDialog tDialog(this);
|
||||||
connect(updateTask.get(), SIGNAL(failed(QString)), SLOT(onGameUpdateError(QString)));
|
connect(updateTask.get(), SIGNAL(failed(QString)), SLOT(onGameUpdateError(QString)));
|
||||||
int ret = tDialog.execWithTask(updateTask.get());
|
int ret = tDialog.execWithTask(updateTask.get());
|
||||||
updateButtons();
|
updateButtons();
|
||||||
m_container->refreshContainer();
|
m_container->refreshContainer();
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VersionPage::on_forgeBtn_clicked()
|
void VersionPage::on_forgeBtn_clicked()
|
||||||
|
@ -62,6 +62,7 @@ private slots:
|
|||||||
void on_editBtn_clicked();
|
void on_editBtn_clicked();
|
||||||
void on_modBtn_clicked();
|
void on_modBtn_clicked();
|
||||||
void on_customizeBtn_clicked();
|
void on_customizeBtn_clicked();
|
||||||
|
void on_downloadBtn_clicked();
|
||||||
|
|
||||||
void updateVersionControls();
|
void updateVersionControls();
|
||||||
void disableVersionControls();
|
void disableVersionControls();
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>693</width>
|
<width>870</width>
|
||||||
<height>833</height>
|
<height>1008</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
@ -234,6 +234,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
<item>
|
||||||
<spacer name="verticalSpacer_7">
|
<spacer name="verticalSpacer_7">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -300,6 +310,7 @@
|
|||||||
<tabstop>jarBtn</tabstop>
|
<tabstop>jarBtn</tabstop>
|
||||||
<tabstop>addEmptyBtn</tabstop>
|
<tabstop>addEmptyBtn</tabstop>
|
||||||
<tabstop>reloadBtn</tabstop>
|
<tabstop>reloadBtn</tabstop>
|
||||||
|
<tabstop>downloadBtn</tabstop>
|
||||||
<tabstop>tabWidget</tabstop>
|
<tabstop>tabWidget</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
Loading…
Reference in New Issue
Block a user