void LauncherWindow::showUpdateManagerDialog() {
    UpdateDialog* d = new UpdateDialog(this);
    d->exec();

    Settings* settings = Settings::instance();
    ui->clientCombo->setCurrentIndex(settings->loadActiveClientId());
}
void RouterKeygen::onNetworkReply(QNetworkReply* reply){
    const unsigned int RESPONSE_OK = 200;
    if ( !automaticUpdateCheck ){
        cleanLoadingAnimation();
        enableUI(true);
    }
    if(reply->error() == QNetworkReply::NoError)
    {
        unsigned int httpstatuscode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toUInt();
        switch(httpstatuscode)
        {
        case RESPONSE_OK:
            if (reply->isReadable())
            {
                 QByteArray result;
                 result = reply->readAll();

                 QScriptValue sc;
                 QScriptEngine engine;
                 sc = engine.evaluate("(" +QString(result) + ")");
                 QString version = sc.property("version").toString();
                if ( version == QApplication::applicationVersion() ){
                    if ( !automaticUpdateCheck ){
                        ui->statusBar->showMessage(tr("The application is already at the latest version."));
                    }
                }
                else{
                    //TODO: when the final website is sc.property("url").toString()
                    UpdateDialog * updateDialog = new UpdateDialog(QString("https://code.google.com/p/android-thomson-key-solver/downloads/list"),
                                                                   version, this);
                    updateDialog->show();
                }
            }
            break;
        default:
            if ( !automaticUpdateCheck ){
                ui->statusBar->showMessage(tr("Error while checking for updates"));
            }
            break;
        }
    }
    else {
        if ( !automaticUpdateCheck ){
            ui->statusBar->showMessage(tr("Error while checking for updates"));
        }
    }
    automaticUpdateCheck = false;
    reply->deleteLater();
}
示例#3
0
void MainWindow::updateAvailable(QString repo, QString versionName, int versionId)
{
	UpdateDialog dlg;
	UpdateAction action = (UpdateAction)dlg.exec();
	switch (action)
	{
	case UPDATE_LATER:
		QLOG_INFO() << "Update will be installed later.";
		break;
	case UPDATE_NOW:
		downloadUpdates(repo, versionId);
		break;
	case UPDATE_ONEXIT:
		downloadUpdates(repo, versionId, true);
		break;
	}
}