GH-2026 implement changes necessary to support 1.13 snapshots
This commit is contained in:
@ -192,7 +192,7 @@ void LaunchController::launchInstance()
|
||||
Q_ASSERT_X(m_instance != NULL, "launchInstance", "instance is NULL");
|
||||
Q_ASSERT_X(m_session.get() != nullptr, "launchInstance", "session is NULL");
|
||||
|
||||
if(!m_instance->reload())
|
||||
if(!m_instance->reloadSettings())
|
||||
{
|
||||
QMessageBox::critical(m_parentWidget, tr("Error"), tr("Couldn't load the instance profile."));
|
||||
emitFailed(tr("Couldn't load the instance profile."));
|
||||
|
@ -1303,7 +1303,7 @@ void MainWindow::finalizeInstance(InstancePtr inst)
|
||||
if (MMC->accounts()->anyAccountIsValid())
|
||||
{
|
||||
ProgressDialog loadDialog(this);
|
||||
auto update = inst->createUpdateTask();
|
||||
auto update = inst->createUpdateTask(Net::Mode::Online);
|
||||
connect(update.get(), &Task::failed, [this](QString reason)
|
||||
{
|
||||
QString error = QString("Instance load failed: %1").arg(reason);
|
||||
|
@ -71,7 +71,7 @@ NewInstanceDialog::NewInstanceDialog(const QString & initialGroup, const QString
|
||||
}
|
||||
else
|
||||
{
|
||||
vlist->load();
|
||||
vlist->load(Net::Mode::Online);
|
||||
auto task = vlist->getLoadTask();
|
||||
if(vlist->isLoaded())
|
||||
{
|
||||
|
@ -106,15 +106,15 @@ bool CoreModFolderPage::shouldDisplay() const
|
||||
auto version = inst->getComponentList();
|
||||
if (!version)
|
||||
return true;
|
||||
if(!version->versionPatch("net.minecraftforge"))
|
||||
if(!version->getComponent("net.minecraftforge"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(!version->versionPatch("net.minecraft"))
|
||||
if(!version->getComponent("net.minecraft"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(version->versionPatch("net.minecraft")->getReleaseDateTime() < g_VersionFilterData.legacyCutoffDate)
|
||||
if(version->getComponent("net.minecraft")->getReleaseDateTime() < g_VersionFilterData.legacyCutoffDate)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -103,10 +103,10 @@ VersionPage::VersionPage(MinecraftInstance *inst, QWidget *parent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->tabWidget->tabBar()->hide();
|
||||
m_profile = m_inst->getComponentList();
|
||||
|
||||
reloadComponentList();
|
||||
|
||||
m_profile = m_inst->getComponentList();
|
||||
if (m_profile)
|
||||
{
|
||||
auto proxy = new IconProxy(ui->packageView);
|
||||
@ -142,7 +142,7 @@ void VersionPage::packageCurrent(const QModelIndex ¤t, const QModelIndex &
|
||||
return;
|
||||
}
|
||||
int row = current.row();
|
||||
auto patch = m_profile->versionPatch(row);
|
||||
auto patch = m_profile->getComponent(row);
|
||||
auto severity = patch->getProblemSeverity();
|
||||
switch(severity)
|
||||
{
|
||||
@ -196,7 +196,7 @@ bool VersionPage::reloadComponentList()
|
||||
{
|
||||
try
|
||||
{
|
||||
m_inst->reloadProfile();
|
||||
m_profile->reload(Net::Mode::Online);
|
||||
return true;
|
||||
}
|
||||
catch (Exception &e)
|
||||
@ -262,19 +262,6 @@ void VersionPage::on_jarBtn_clicked()
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
void VersionPage::on_resetOrderBtn_clicked()
|
||||
{
|
||||
try
|
||||
{
|
||||
m_profile->resetOrder();
|
||||
}
|
||||
catch (Exception &e)
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), e.cause());
|
||||
}
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
void VersionPage::on_moveUpBtn_clicked()
|
||||
{
|
||||
try
|
||||
@ -308,7 +295,7 @@ void VersionPage::on_changeVersionBtn_clicked()
|
||||
{
|
||||
return;
|
||||
}
|
||||
auto patch = m_profile->versionPatch(versionRow);
|
||||
auto patch = m_profile->getComponent(versionRow);
|
||||
auto name = patch->getName();
|
||||
auto list = patch->getVersionList();
|
||||
if(!list)
|
||||
@ -331,8 +318,10 @@ void VersionPage::on_changeVersionBtn_clicked()
|
||||
}
|
||||
|
||||
qDebug() << "Change" << uid << "to" << vselect.selectedVersion()->descriptor();
|
||||
bool important = false;
|
||||
if(uid == "net.minecraft")
|
||||
{
|
||||
important = true;
|
||||
if (!m_profile->isVanilla())
|
||||
{
|
||||
auto result = CustomMessageBox::selectable(
|
||||
@ -348,14 +337,14 @@ void VersionPage::on_changeVersionBtn_clicked()
|
||||
reloadComponentList();
|
||||
}
|
||||
}
|
||||
m_inst->setComponentVersion(uid, vselect.selectedVersion()->descriptor());
|
||||
m_profile->setComponentVersion(uid, vselect.selectedVersion()->descriptor(), important);
|
||||
doUpdate();
|
||||
m_container->refreshContainer();
|
||||
}
|
||||
|
||||
int VersionPage::doUpdate()
|
||||
{
|
||||
auto updateTask = m_inst->createUpdateTask();
|
||||
auto updateTask = m_inst->createUpdateTask(Net::Mode::Online);
|
||||
if (!updateTask)
|
||||
{
|
||||
return 1;
|
||||
@ -376,20 +365,58 @@ void VersionPage::on_forgeBtn_clicked()
|
||||
return;
|
||||
}
|
||||
VersionSelectDialog vselect(vlist.get(), tr("Select Forge version"), this);
|
||||
vselect.setExactFilter(BaseVersionList::ParentVersionRole, m_inst->getComponentVersion("net.minecraft"));
|
||||
vselect.setEmptyString(tr("No Forge versions are currently available for Minecraft ") + m_inst->getComponentVersion("net.minecraft"));
|
||||
vselect.setExactFilter(BaseVersionList::ParentVersionRole, m_profile->getComponentVersion("net.minecraft"));
|
||||
vselect.setEmptyString(tr("No Forge versions are currently available for Minecraft ") + m_profile->getComponentVersion("net.minecraft"));
|
||||
vselect.setEmptyErrorString(tr("Couldn't load or download the Forge version lists!"));
|
||||
if (vselect.exec() && vselect.selectedVersion())
|
||||
{
|
||||
auto vsn = vselect.selectedVersion();
|
||||
m_inst->setComponentVersion("net.minecraftforge", vsn->descriptor());
|
||||
m_profile->reload();
|
||||
m_profile->setComponentVersion("net.minecraftforge", vsn->descriptor());
|
||||
m_profile->resolve(Net::Mode::Online);
|
||||
// m_profile->installVersion();
|
||||
preselect(m_profile->rowCount(QModelIndex())-1);
|
||||
m_container->refreshContainer();
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: use something like this... except the final decision of what to show has to be deferred until the lists are known
|
||||
/*
|
||||
void VersionPage::on_liteloaderBtn_clicked()
|
||||
{
|
||||
QString uid = "com.mumfrey.liteloader";
|
||||
auto vlist = ENV.metadataIndex()->get(uid);
|
||||
if(!vlist)
|
||||
{
|
||||
return;
|
||||
}
|
||||
VersionSelectDialog vselect(vlist.get(), tr("Select %1 version").arg(vlist->name()), this);
|
||||
auto parentUid = vlist->parentUid();
|
||||
if(!parentUid.isEmpty())
|
||||
{
|
||||
auto parentvlist = ENV.metadataIndex()->get(parentUid);
|
||||
vselect.setExactFilter(BaseVersionList::ParentVersionRole, m_profile->getComponentVersion(parentUid));
|
||||
vselect.setEmptyString(
|
||||
tr("No %1 versions are currently available for %2 %3")
|
||||
.arg(vlist->name())
|
||||
.arg(parentvlist->name())
|
||||
.arg(m_profile->getComponentVersion(parentUid)));
|
||||
}
|
||||
else
|
||||
{
|
||||
vselect.setEmptyString(tr("No %1 versions are currently available"));
|
||||
}
|
||||
vselect.setEmptyErrorString(tr("Couldn't load or download the %1 version lists!").arg(vlist->name()));
|
||||
if (vselect.exec() && vselect.selectedVersion())
|
||||
{
|
||||
auto vsn = vselect.selectedVersion();
|
||||
m_profile->setComponentVersion(uid, vsn->descriptor());
|
||||
m_profile->resolve();
|
||||
preselect(m_profile->rowCount(QModelIndex())-1);
|
||||
m_container->refreshContainer();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void VersionPage::on_liteloaderBtn_clicked()
|
||||
{
|
||||
auto vlist = ENV.metadataIndex()->get("com.mumfrey.liteloader");
|
||||
@ -398,14 +425,14 @@ void VersionPage::on_liteloaderBtn_clicked()
|
||||
return;
|
||||
}
|
||||
VersionSelectDialog vselect(vlist.get(), tr("Select LiteLoader version"), this);
|
||||
vselect.setExactFilter(BaseVersionList::ParentVersionRole, m_inst->getComponentVersion("net.minecraft"));
|
||||
vselect.setEmptyString(tr("No LiteLoader versions are currently available for Minecraft ") + m_inst->getComponentVersion("net.minecraft"));
|
||||
vselect.setExactFilter(BaseVersionList::ParentVersionRole, m_profile->getComponentVersion("net.minecraft"));
|
||||
vselect.setEmptyString(tr("No LiteLoader versions are currently available for Minecraft ") + m_profile->getComponentVersion("net.minecraft"));
|
||||
vselect.setEmptyErrorString(tr("Couldn't load or download the LiteLoader version lists!"));
|
||||
if (vselect.exec() && vselect.selectedVersion())
|
||||
{
|
||||
auto vsn = vselect.selectedVersion();
|
||||
m_inst->setComponentVersion("com.mumfrey.liteloader", vsn->descriptor());
|
||||
m_profile->reload();
|
||||
m_profile->setComponentVersion("com.mumfrey.liteloader", vsn->descriptor());
|
||||
m_profile->resolve(Net::Mode::Online);
|
||||
// m_profile->installVersion(vselect.selectedVersion());
|
||||
preselect(m_profile->rowCount(QModelIndex())-1);
|
||||
m_container->refreshContainer();
|
||||
@ -441,7 +468,7 @@ void VersionPage::updateButtons(int row)
|
||||
{
|
||||
if(row == -1)
|
||||
row = currentRow();
|
||||
auto patch = m_profile->versionPatch(row);
|
||||
auto patch = m_profile->getComponent(row);
|
||||
if (!patch)
|
||||
{
|
||||
ui->removeBtn->setDisabled(true);
|
||||
@ -470,14 +497,14 @@ void VersionPage::onGameUpdateError(QString error)
|
||||
QMessageBox::Warning)->show();
|
||||
}
|
||||
|
||||
ProfilePatchPtr VersionPage::current()
|
||||
ComponentPtr VersionPage::current()
|
||||
{
|
||||
auto row = currentRow();
|
||||
if(row < 0)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
return m_profile->versionPatch(row);
|
||||
return m_profile->getComponent(row);
|
||||
}
|
||||
|
||||
int VersionPage::currentRow()
|
||||
@ -496,7 +523,7 @@ void VersionPage::on_customizeBtn_clicked()
|
||||
{
|
||||
return;
|
||||
}
|
||||
auto patch = m_profile->versionPatch(version);
|
||||
auto patch = m_profile->getComponent(version);
|
||||
if(!patch->getVersionFile())
|
||||
{
|
||||
// TODO: wait for the update task to finish here...
|
||||
|
@ -53,7 +53,6 @@ private slots:
|
||||
void on_liteloaderBtn_clicked();
|
||||
void on_reloadBtn_clicked();
|
||||
void on_removeBtn_clicked();
|
||||
void on_resetOrderBtn_clicked();
|
||||
void on_moveUpBtn_clicked();
|
||||
void on_moveDownBtn_clicked();
|
||||
void on_jarmodBtn_clicked();
|
||||
@ -68,7 +67,7 @@ private slots:
|
||||
void on_changeVersionBtn_clicked();
|
||||
|
||||
private:
|
||||
ProfilePatchPtr current();
|
||||
ComponentPtr current();
|
||||
int currentRow();
|
||||
void updateButtons(int row = -1);
|
||||
void preselect(int row = 0);
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>693</width>
|
||||
<height>788</height>
|
||||
<height>833</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
@ -217,16 +217,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="resetOrderBtn">
|
||||
<property name="toolTip">
|
||||
<string>Reset apply order of packages.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reset order</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="reloadBtn">
|
||||
<property name="toolTip">
|
||||
@ -300,7 +290,6 @@
|
||||
<tabstop>liteloaderBtn</tabstop>
|
||||
<tabstop>modBtn</tabstop>
|
||||
<tabstop>jarmodBtn</tabstop>
|
||||
<tabstop>resetOrderBtn</tabstop>
|
||||
<tabstop>reloadBtn</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
|
@ -38,10 +38,17 @@ static QString formatRequires(const VersionPtr &version)
|
||||
auto iter = reqs.begin();
|
||||
while (iter != reqs.end())
|
||||
{
|
||||
auto &uid = iter.key();
|
||||
auto &version = iter.value();
|
||||
auto &uid = iter->uid;
|
||||
auto &version = iter->equalsVersion;
|
||||
const QString readable = ENV.metadataIndex()->hasUid(uid) ? ENV.metadataIndex()->get(uid)->humanReadable() : uid;
|
||||
lines.append(QString("%1 (%2)").arg(readable, version));
|
||||
if(!version.isEmpty())
|
||||
{
|
||||
lines.append(QString("%1 (%2)").arg(readable, version));
|
||||
}
|
||||
else
|
||||
{
|
||||
lines.append(QString("%1").arg(readable));
|
||||
}
|
||||
iter++;
|
||||
}
|
||||
return lines.join('\n');
|
||||
@ -95,7 +102,7 @@ QIcon PackagesPage::icon() const
|
||||
|
||||
void PackagesPage::on_refreshIndexBtn_clicked()
|
||||
{
|
||||
ENV.metadataIndex()->load();
|
||||
ENV.metadataIndex()->load(Net::Mode::Online);
|
||||
}
|
||||
void PackagesPage::on_refreshFileBtn_clicked()
|
||||
{
|
||||
@ -104,7 +111,7 @@ void PackagesPage::on_refreshFileBtn_clicked()
|
||||
{
|
||||
return;
|
||||
}
|
||||
list->load();
|
||||
list->load(Net::Mode::Online);
|
||||
}
|
||||
void PackagesPage::on_refreshVersionBtn_clicked()
|
||||
{
|
||||
@ -113,7 +120,7 @@ void PackagesPage::on_refreshVersionBtn_clicked()
|
||||
{
|
||||
return;
|
||||
}
|
||||
version->load();
|
||||
version->load(Net::Mode::Online);
|
||||
}
|
||||
|
||||
void PackagesPage::on_fileSearchEdit_textChanged(const QString &search)
|
||||
@ -156,7 +163,7 @@ void PackagesPage::updateCurrentVersionList(const QModelIndex &index)
|
||||
ui->fileName->setText(list->name());
|
||||
m_versionProxy->setSourceModel(list.get());
|
||||
ui->refreshFileBtn->setText(tr("Refresh %1").arg(list->humanReadable()));
|
||||
list->load();
|
||||
list->load(Net::Mode::Offline);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -213,5 +220,5 @@ void PackagesPage::updateVersion()
|
||||
|
||||
void PackagesPage::opened()
|
||||
{
|
||||
ENV.metadataIndex()->load();
|
||||
ENV.metadataIndex()->load(Net::Mode::Offline);
|
||||
}
|
||||
|
Reference in New Issue
Block a user