History

Checkpoint auto updater

Leonardo Murillo committed 11 years ago

Commit cefdbc31 parent faf91209 files · +158 −295Browse files

Showing the changes to interface/src/Application.cpp (1 of 9 files). Show all

Unified · Split

interface/src/Application.cpp+4−68
@@ -59,6 +59,7 @@ · 58 unmodified lines
5959 #include <AddressManager.h>
6060 #include <AmbientOcclusionEffect.h>
6161 #include <AudioInjector.h>
62+#include <AutoUpdate.h>
6263 #include <DeferredLightingEffect.h>
6364 #include <DependencyManager.h>
6465 #include <EntityScriptingInterface.h>
@@ -539,8 +540,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 474 unmodified lines
539540 // allow you to move an entity around in your hand
540541 _entityEditSender.setPacketsPerSecond(3000); // super high!!
541542
542− checkVersion();
543−
544543 _overlays.init(); // do this before scripts load
545544
546545 _runningScriptsWidget->setRunningScripts(getRunningScripts());
@@ -612,6 +611,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 65 unmodified lines
612611 ddeTracker->init();
613612 connect(ddeTracker.data(), &FaceTracker::muteToggled, this, &Application::faceTrackerMuteToggled);
614613 #endif
614+
615+ AutoUpdate* applicationUpdater = new AutoUpdate;
616+ applicationUpdater->checkForUpdate();
615617 }
616618
617619
@@ -4404,72 +4406,6 @@ void Application::toggleLogDialog() { · 3786 unmodified lines
44044406 }
44054407 }
44064408
4407−void Application::checkVersion() {
4408− QNetworkRequest latestVersionRequest((QUrl(CHECK_VERSION_URL)));
4409− latestVersionRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
4410− latestVersionRequest.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache);
4411− QNetworkReply* reply = NetworkAccessManager::getInstance().get(latestVersionRequest);
4412− connect(reply, SIGNAL(finished()), SLOT(parseVersionXml()));
4413−}
4414−
4415−void Application::parseVersionXml() {
4416−
4417− #ifdef Q_OS_WIN32
4418− QString operatingSystem("win");
4419− #endif
4420−
4421− #ifdef Q_OS_MAC
4422− QString operatingSystem("mac");
4423− #endif
4424−
4425− #ifdef Q_OS_LINUX
4426− QString operatingSystem("ubuntu");
4427− #endif
4428−
4429− QString latestVersion;
4430− QUrl downloadUrl;
4431− QString releaseNotes("Unavailable");
4432− QNetworkReply* sender = qobject_cast<QNetworkReply*>(QObject::sender());
4433−
4434− QXmlStreamReader xml(sender);
4435−
4436− while (!xml.atEnd() && !xml.hasError()) {
4437− if (xml.tokenType() == QXmlStreamReader::StartElement && xml.name() == operatingSystem) {
4438− while (!(xml.tokenType() == QXmlStreamReader::EndElement && xml.name() == operatingSystem)) {
4439− if (xml.tokenType() == QXmlStreamReader::StartElement && xml.name().toString() == "version") {
4440− xml.readNext();
4441− latestVersion = xml.text().toString();
4442− }
4443− if (xml.tokenType() == QXmlStreamReader::StartElement && xml.name().toString() == "url") {
4444− xml.readNext();
4445− downloadUrl = QUrl(xml.text().toString());
4446− }
4447− xml.readNext();
4448− }
4449− }
4450− xml.readNext();
4451− }
4452−
4453− if (!shouldSkipVersion(latestVersion) && applicationVersion() != latestVersion) {
4454− new UpdateDialog(_glWidget, releaseNotes, latestVersion, downloadUrl);
4455− }
4456− sender->deleteLater();
4457−}
4458−
4459−bool Application::shouldSkipVersion(QString latestVersion) {
4460− QFile skipFile(SKIP_FILENAME);
4461− skipFile.open(QIODevice::ReadWrite);
4462− QString skipVersion(skipFile.readAll());
4463− return (skipVersion == latestVersion || applicationVersion() == "dev");
4464−}
4465−
4466−void Application::skipVersion(QString latestVersion) {
4467− QFile skipFile(SKIP_FILENAME);
4468− skipFile.open(QIODevice::WriteOnly | QIODevice::Truncate);
4469− skipFile.seek(0);
4470− skipFile.write(latestVersion.toStdString().c_str());
4471−}
4472−
44734409 void Application::takeSnapshot() {
44744410 QMediaPlayer* player = new QMediaPlayer();
44754411 QFileInfo inf = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav");

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t