Offer to restart Companion after install on linux

This commit is contained in:
elecpower
2022-09-06 09:29:41 +10:00
committed by Peter Feerick
parent caa5100077
commit d86e60c45a
+14 -10
View File
@@ -69,15 +69,9 @@ UpdateCompanion::UpdateCompanion(QWidget * parent) :
ap.flags = dfltParams->data.flags;
}
#ifndef OS_SUPPORTED_INSTALLER
bool UpdateCompanion::asyncInstall()
{
QMessageBox::warning(parentWidget(), CPN_STR_APP_NAME, OS_INSTALL_MSG);
return true;
}
#else
bool UpdateCompanion::asyncInstall()
{
#ifdef OS_SUPPORTED_INSTALLER
//reportProgress(tr("Run application installer: %1").arg(g.runAppInstaller() ? tr("true") : tr("false")), QtDebugMsg);
if (!g.runAppInstaller())
@@ -139,8 +133,13 @@ bool UpdateCompanion::asyncInstall()
return false;
}
return true;
if (QMessageBox::question(parentWidget(), CPN_STR_APP_NAME, "Restart Companion?", QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
QProcess::startDetached(fileName);
qApp->exit();
}
#else
int ret = QMessageBox::question(parentWidget(), CPN_STR_APP_NAME, OS_INSTALL_QUESTION, QMessageBox::Yes | QMessageBox::No);
if (ret == QMessageBox::Yes) {
@@ -148,10 +147,15 @@ bool UpdateCompanion::asyncInstall()
qApp->exit();
}
#endif // defined(__linux__) || defined(__linux)
return true;
#endif
#else
QMessageBox::warning(parentWidget(), CPN_STR_APP_NAME, OS_INSTALL_MSG);
return true;
#endif // OS_SUPPORTED_INSTALLER
}
#endif
const QString UpdateCompanion::currentRelease()
{