mirror of https://github.com/mgba-emu/mgba.git
Qt: Use appropriate update dialog for if stuff can auto-update
This commit is contained in:
parent
3402c151e6
commit
9335a82afb
|
@ -23,8 +23,15 @@ ApplicationUpdatePrompt::ApplicationUpdatePrompt(QWidget* parent)
|
||||||
|
|
||||||
ApplicationUpdater* updater = GBAApp::app()->updater();
|
ApplicationUpdater* updater = GBAApp::app()->updater();
|
||||||
ApplicationUpdater::UpdateInfo info = updater->updateInfo();
|
ApplicationUpdater::UpdateInfo info = updater->updateInfo();
|
||||||
m_ui.text->setText(tr("An update to %1 is available.\nDo you want to download and install it now? You will need to restart the emulator when the download is complete.")
|
QString updateText(tr("An update to %1 is available.\n").arg(QLatin1String(projectName)));
|
||||||
.arg(QLatin1String(projectName)));
|
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
||||||
|
updateText += tr("\nDo you want to download and install it now? You will need to restart the emulator when the download is complete.");
|
||||||
|
m_okDownload = connect(m_ui.buttonBox, &QDialogButtonBox::accepted, this, &ApplicationUpdatePrompt::startUpdate);
|
||||||
|
#else
|
||||||
|
updateText += tr("\nAuto-update is not available on this platform. If you wish to update you will need to do it manually.");
|
||||||
|
connect(m_ui.buttonBox, &QDialogButtonBox::accepted, this, &QWidget::close);
|
||||||
|
#endif
|
||||||
|
m_ui.text->setText(updateText);
|
||||||
m_ui.details->setText(tr("Current version: %1\nNew version: %2\nDownload size: %3")
|
m_ui.details->setText(tr("Current version: %1\nNew version: %2\nDownload size: %3")
|
||||||
.arg(QLatin1String(projectVersion))
|
.arg(QLatin1String(projectVersion))
|
||||||
.arg(info)
|
.arg(info)
|
||||||
|
@ -34,7 +41,6 @@ ApplicationUpdatePrompt::ApplicationUpdatePrompt(QWidget* parent)
|
||||||
connect(updater, &AbstractUpdater::updateProgress, this, [this](float progress) {
|
connect(updater, &AbstractUpdater::updateProgress, this, [this](float progress) {
|
||||||
m_ui.progressBar->setValue(progress * 100);
|
m_ui.progressBar->setValue(progress * 100);
|
||||||
});
|
});
|
||||||
m_okDownload = connect(m_ui.buttonBox, &QDialogButtonBox::accepted, this, &ApplicationUpdatePrompt::startUpdate);
|
|
||||||
connect(updater, &AbstractUpdater::updateDone, this, &ApplicationUpdatePrompt::promptRestart);
|
connect(updater, &AbstractUpdater::updateDone, this, &ApplicationUpdatePrompt::promptRestart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,12 +44,10 @@ ApplicationUpdater::ApplicationUpdater(ConfigController* config, QObject* parent
|
||||||
config->setQtOption("lastUpdateCheck", m_lastCheck);
|
config->setQtOption("lastUpdateCheck", m_lastCheck);
|
||||||
|
|
||||||
if (available && currentVersion() < updateInfo()) {
|
if (available && currentVersion() < updateInfo()) {
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
|
||||||
ApplicationUpdatePrompt* prompt = new ApplicationUpdatePrompt;
|
ApplicationUpdatePrompt* prompt = new ApplicationUpdatePrompt;
|
||||||
connect(prompt, &QDialog::accepted, GBAApp::app(), &GBAApp::restartForUpdate);
|
connect(prompt, &QDialog::accepted, GBAApp::app(), &GBAApp::restartForUpdate);
|
||||||
prompt->setAttribute(Qt::WA_DeleteOnClose);
|
prompt->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
prompt->show();
|
prompt->show();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue