void init() { cleanFiles(); signal(SIGINT, catchCtrl); itemCount = 0; canCatch = 1; firstInstruction = NULL; lastInstruction = NULL; mainMenu(); }
UpdaterDialog::~UpdaterDialog(void) { if(!m_thread.isNull()) { if(!m_thread->wait(5000)) { m_thread->terminate(); m_thread->wait(); } } cleanFiles(); delete ui; }
void UpdaterDialog::initUpdate(void) { //Clean up files from previous attempt if(!m_binaries.isEmpty()) { cleanFiles(); } //Check binary files QString wgetBin, gpgvBin; if(!checkBinaries(wgetBin, gpgvBin)) { ui->buttonCancel->setEnabled(true); const QString message = QString("%1<br><br><nobr><a href=\"%2\">%3</a></nobr><br>").arg(tr("At least one file required by the web-update tool is missing or corrupted.<br>Please re-install this application and then try again!"), QString::fromLatin1(m_updateUrl), QString::fromLatin1(m_updateUrl).replace("-", "−")); if(QMessageBox::critical(this, tr("File Error"), message, tr("Download Latest Version"), tr("Discard")) == 0) { QDesktopServices::openUrl(QUrl(QString::fromLatin1(m_updateUrl))); } close(); return; } //Make sure user does have admin access if(!MUtils::OS::user_is_admin()) { qWarning("User is not in the \"admin\" group, cannot update!"); QString message; message += QString("<nobr>%1</nobr><br>").arg(tr("Sorry, but only users in the \"Administrators\" group can install updates.")); message += QString("<nobr>%1</nobr>").arg(tr("Please start application from an administrator account and try again!")); if(QMessageBox::critical(this, this->windowTitle(), message, tr("Discard"), tr("Ignore")) != 1) { ui->buttonCancel->setEnabled(true); close(); return; } } //Create and setup thread if(!m_thread) { m_thread.reset(new MUtils::UpdateChecker(m_binaries.value("wget.exe"), m_binaries.value("gpgv.exe"), m_binaries.value("gpgv.gpg"), "Simple x264 Launcher", x264_version_build(), false)); connect(m_thread.data(), SIGNAL(statusChanged(int)), this, SLOT(threadStatusChanged(int))); connect(m_thread.data(), SIGNAL(finished()), this, SLOT(threadFinished())); connect(m_thread.data(), SIGNAL(terminated()), this, SLOT(threadFinished())); connect(m_thread.data(), SIGNAL(messageLogged(QString)), this, SLOT(threadMessageLogged(QString))); }