mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2025-03-23 22:43:33 +00:00
NOISSUE shortcut creation: reload pack profile before checking version
This commit is contained in:
parent
363588789e
commit
6faa0ef711
@ -7,6 +7,7 @@
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <BuildConfig.h>
|
||||
#include <QMessageBox>
|
||||
#include "CreateShortcutDialog.h"
|
||||
#include "ui_CreateShortcutDialog.h"
|
||||
#include "Application.h"
|
||||
@ -42,11 +43,23 @@ CreateShortcutDialog::CreateShortcutDialog(QWidget *parent, InstancePtr instance
|
||||
|
||||
if (m_instance->typeName() == "Minecraft")
|
||||
{
|
||||
MinecraftInstancePtr minecraftInstance = qobject_pointer_cast<MinecraftInstance>(m_instance);
|
||||
QString version = minecraftInstance->getPackProfile()->getComponentVersion("net.minecraft");
|
||||
bool enableJoinServer = !QRegExp(JOIN_SERVER_DISALLOWED_VERSIONS).exactMatch(version);
|
||||
ui->joinServerCheckBox->setEnabled(enableJoinServer);
|
||||
ui->joinServer->setEnabled(enableJoinServer);
|
||||
try
|
||||
{
|
||||
MinecraftInstancePtr minecraftInstance = qobject_pointer_cast<MinecraftInstance>(m_instance);
|
||||
minecraftInstance->getPackProfile()->reload(Net::Mode::Online);
|
||||
QString version = minecraftInstance->getPackProfile()->getComponentVersion("net.minecraft");
|
||||
bool enableJoinServer = !QRegExp(JOIN_SERVER_DISALLOWED_VERSIONS).exactMatch(version);
|
||||
ui->joinServerCheckBox->setEnabled(enableJoinServer);
|
||||
ui->joinServer->setEnabled(enableJoinServer);
|
||||
}
|
||||
catch (const Exception &e)
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), e.cause());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Failed to load pack profile to check version!"));
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_LINUX)
|
||||
|
Loading…
x
Reference in New Issue
Block a user