void Downloader::installUpdate() { if (useCustomInstallProcedures()) return; QMessageBox box; box.setIcon (QMessageBox::Question); box.setDefaultButton (QMessageBox::Ok); box.setStandardButtons (QMessageBox::Ok | QMessageBox::Cancel); box.setInformativeText (tr ("Click \"OK\" to begin installing the update")); box.setText ("<h3>" + tr ("In order to install the update, you may need to " "quit the application.") + "</h3>"); if (box.exec() == QMessageBox::Ok) { if (!useCustomInstallProcedures()) openDownload(); } else { m_ui->openButton->setEnabled (true); m_ui->openButton->setVisible (true); m_ui->timeLabel->setText (tr ("Click the \"Open\" button to " "apply the update")); } }
/** * Instructs the OS to open the downloaded file. * * \note If \c useCustomInstallProcedures() returns \c true, the function will * not instruct the OS to open the downloaded file. You can use the * signals fired by the \c QSimpleUpdater to install the update with your * own implementations/code. */ void Downloader::installUpdate() { if (useCustomInstallProcedures()) return; /* Update labels */ m_ui->stopButton->setText (tr ("Close")); m_ui->downloadLabel->setText (tr ("Download complete!")); m_ui->timeLabel->setText (tr ("The installer will open separately") + "..."); /* Ask the user to install the download */ QMessageBox box; box.setIcon (QMessageBox::Question); box.setDefaultButton (QMessageBox::Ok); box.setStandardButtons (QMessageBox::Ok | QMessageBox::Cancel); box.setInformativeText (tr ("Click \"OK\" to begin installing the update")); QString text = tr ("In order to install the update, you may need to " "quit the application."); if(m_mandatoryUpdate) text = tr ("In order to install the update, you may need to " "quit the application. This is a mandatory update, exiting now will close the application"); box.setText ("<h3>" + text + "</h3>"); /* User wants to install the download */ if (box.exec() == QMessageBox::Ok) { if (!useCustomInstallProcedures()) openDownload(); } /* Wait */ else { if(m_mandatoryUpdate) QApplication::quit(); m_ui->openButton->setEnabled (true); m_ui->openButton->setVisible (true); m_ui->timeLabel->setText (tr ("Click the \"Open\" button to " "apply the update")); } }