| 560 | |
| 561 | |
| 562 | void UBApplicationController::downloadJsonFinished(QString currentJson) |
| 563 | { |
| 564 | /* |
| 565 | The .json files simply specify the latest version number available, and |
| 566 | the URL to send the user to, so they can download it. |
| 567 | |
| 568 | They look like: |
| 569 | |
| 570 | { |
| 571 | "version": "1.3.5", |
| 572 | "url": "http://openboard.ch" |
| 573 | } |
| 574 | */ |
| 575 | |
| 576 | QJsonObject jsonObject = QJsonDocument::fromJson(currentJson.toUtf8()).object(); |
| 577 | |
| 578 | UBVersion installedVersion (qApp->applicationVersion()); |
| 579 | UBVersion jsonVersion (jsonObject.value("version").toString()); |
| 580 | |
| 581 | qDebug() << "json version: " << jsonVersion.toUInt(); |
| 582 | qDebug() << "installed version: " << installedVersion.toUInt(); |
| 583 | |
| 584 | if (jsonVersion > installedVersion) { |
| 585 | if (UBApplication::mainWindow->yesNoQuestion(tr("Update available"), tr ("New update available, would you go to the web page ?"))){ |
| 586 | QUrl url(jsonObject.value("url").toString()); |
| 587 | QDesktopServices::openUrl(url); |
| 588 | } |
| 589 | } |
| 590 | else if (isNoUpdateDisplayed) { |
| 591 | mMainWindow->information(tr("Update"), tr("No update available")); |
| 592 | } |
| 593 | } |
| 594 | |
| 595 | void UBApplicationController::checkAtLaunch() |
| 596 | { |
nothing calls this directly
no test coverage detected