Skip to content

Commit

Permalink
Updater: Parsing response from the website
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed May 24, 2012
1 parent e9bc9d3 commit 6a1593e
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions doomsday/engine/portable/src/updater.cpp
Expand Up @@ -81,10 +81,14 @@ struct Updater::Instance
Channel channel; ///< What kind of updates to check for.
QDateTime lastCheckTime;///< Time of last check (automatic or manual).
bool onlyCheckManually; ///< Should only check when manually requested.
bool deleteAfterUpdate; ///< Downloaded file is deleted afterwards.
bool deleteAfterUpdate; ///< Downloaded file is deleted afterwards.
QString downloadPath; ///< Path where the downloaded file is saved.
QString latestVersion;
int latestBuild;
QString latestPackageUri;
QString latestNotesUri;

Instance(Updater* up) : self(up)
Instance(Updater* up) : self(up), latestBuild(0)
{
// Fetch the current settings.
QSettings st;
Expand Down Expand Up @@ -133,7 +137,19 @@ struct Updater::Instance
reply->deleteLater(); // make sure it gets deleted

QVariant result = parseJSON(QString::fromUtf8(reply->readAll()));
qDebug() << result;
if(!result.isValid()) return;

QVariantMap map = result.toMap();
latestBuild = map["build_uniqueid"].toInt();
latestVersion = map["version"].toString();
latestPackageUri = map["direct_download_uri"].toString();
latestNotesUri = map["release_notesuri"].toString();

LOG_VERBOSE("Received latest version information:\n"
" - version: %s build %i\n"
" - package: %s\n"
" - notes: %s")
<< latestVersion << latestBuild << latestPackageUri << latestNotesUri;
}
};

Expand Down

0 comments on commit 6a1593e

Please sign in to comment.