Merge remote-tracking branch 'upstream/develop' into refactor-instanceview
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
commit
16844bdb4b
@ -218,9 +218,24 @@ void HttpMetaCache::Load()
|
||||
if (!index.open(QIODevice::ReadOnly))
|
||||
return;
|
||||
|
||||
QJsonDocument json = QJsonDocument::fromJson(index.readAll());
|
||||
QJsonParseError parseError;
|
||||
QJsonDocument json = QJsonDocument::fromJson(index.readAll(), &parseError);
|
||||
|
||||
auto root = Json::requireObject(json, "HttpMetaCache root");
|
||||
// Fail if the JSON is invalid.
|
||||
if (parseError.error != QJsonParseError::NoError) {
|
||||
qCritical() << QString("Failed to parse HttpMetaCache file: %1 at offset %2")
|
||||
.arg(parseError.errorString(), QString::number(parseError.offset))
|
||||
.toUtf8();
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure the root is an object.
|
||||
if (!json.isObject()) {
|
||||
qCritical() << "HttpMetaCache root should be an object.";
|
||||
return;
|
||||
}
|
||||
|
||||
auto root = json.object();
|
||||
|
||||
// check file version first
|
||||
auto version_val = Json::ensureString(root, "version");
|
||||
|
@ -1249,7 +1249,8 @@ void MainWindow::updateLaunchButton()
|
||||
launchMenu->clear();
|
||||
else
|
||||
launchMenu = new QMenu(this);
|
||||
m_selectedInstance->populateLaunchMenu(launchMenu);
|
||||
if (m_selectedInstance)
|
||||
m_selectedInstance->populateLaunchMenu(launchMenu);
|
||||
ui->actionLaunchInstance->setMenu(launchMenu);
|
||||
}
|
||||
|
||||
@ -2027,10 +2028,11 @@ void MainWindow::on_actionDeleteInstance_triggered()
|
||||
|
||||
if (APPLICATION->instances()->trashInstance(id)) {
|
||||
ui->actionUndoTrashInstance->setEnabled(APPLICATION->instances()->trashedSomething());
|
||||
return;
|
||||
} else {
|
||||
APPLICATION->instances()->deleteInstance(id);
|
||||
}
|
||||
|
||||
APPLICATION->instances()->deleteInstance(id);
|
||||
APPLICATION->settings()->set("SelectedInstance", QString());
|
||||
selectionBad();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionExportInstanceZip_triggered()
|
||||
@ -2345,10 +2347,6 @@ void MainWindow::instanceChanged(InstancePtr current, [[maybe_unused]] InstanceP
|
||||
connect(m_selectedInstance.get(), &BaseInstance::runningStatusChanged, this, &MainWindow::refreshCurrentInstance);
|
||||
connect(m_selectedInstance.get(), &BaseInstance::profilerChanged, this, &MainWindow::refreshCurrentInstance);
|
||||
} else {
|
||||
ui->instanceToolBar->setEnabled(false);
|
||||
setInstanceActionsEnabled(false);
|
||||
ui->actionLaunchInstance->setEnabled(false);
|
||||
ui->actionKillInstance->setEnabled(false);
|
||||
APPLICATION->settings()->set("SelectedInstance", QString());
|
||||
selectionBad();
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user