MCPcopy Create free account
hub / github.com/OpenBoard-org/OpenBoard / downloadJsonFinished

Method downloadJsonFinished

src/core/UBApplicationController.cpp:562–593  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

560
561
562void 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
595void UBApplicationController::checkAtLaunch()
596{

Callers

nothing calls this directly

Calls 4

toUIntMethod · 0.80
yesNoQuestionMethod · 0.80
informationMethod · 0.80
valueMethod · 0.45

Tested by

no test coverage detected