Showing the changes to interface/src/Application.cpp (1 of 9 files). Show all
Unified · Split
| @@ -59,6 +59,7 @@ · 58 unmodified lines | ||
| 59 | 59 | #include <AddressManager.h> |
| 60 | 60 | #include <AmbientOcclusionEffect.h> |
| 61 | 61 | #include <AudioInjector.h> |
| 62 | +#include <AutoUpdate.h> | |
| 62 | 63 | #include <DeferredLightingEffect.h> |
| 63 | 64 | #include <DependencyManager.h> |
| 64 | 65 | #include <EntityScriptingInterface.h> |
| @@ -539,8 +540,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 474 unmodified lines | ||
| 539 | 540 | // allow you to move an entity around in your hand |
| 540 | 541 | _entityEditSender.setPacketsPerSecond(3000); // super high!! |
| 541 | 542 | |
| 542 | − checkVersion(); | |
| 543 | − | |
| 544 | 543 | _overlays.init(); // do this before scripts load |
| 545 | 544 | |
| 546 | 545 | _runningScriptsWidget->setRunningScripts(getRunningScripts()); |
| @@ -612,6 +611,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 65 unmodified lines | ||
| 612 | 611 | ddeTracker->init(); |
| 613 | 612 | connect(ddeTracker.data(), &FaceTracker::muteToggled, this, &Application::faceTrackerMuteToggled); |
| 614 | 613 | #endif |
| 614 | + | |
| 615 | + AutoUpdate* applicationUpdater = new AutoUpdate; | |
| 616 | + applicationUpdater->checkForUpdate(); | |
| 615 | 617 | } |
| 616 | 618 | |
| 617 | 619 | |
| @@ -4404,72 +4406,6 @@ void Application::toggleLogDialog() { · 3786 unmodified lines | ||
| 4404 | 4406 | } |
| 4405 | 4407 | } |
| 4406 | 4408 | |
| 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 | − | |
| 4473 | 4409 | void Application::takeSnapshot() { |
| 4474 | 4410 | QMediaPlayer* player = new QMediaPlayer(); |
| 4475 | 4411 | QFileInfo inf = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav"); |