From 3bd0c7bd87344da6a9f291f9f44cd4d4c66add73 Mon Sep 17 00:00:00 2001 From: Leonardo Murillo Date: Wed, 10 Jun 2015 14:35:52 -0600 Subject: [PATCH] Code Review changes --- interface/CMakeLists.txt | 2 +- interface/src/Application.cpp | 8 +++---- interface/src/ui/UpdateDialog.cpp | 6 ++--- .../CMakeLists.txt | 2 +- .../src/AutoUpdater.cpp} | 22 +++++++++---------- .../src/AutoUpdater.h} | 12 +++++----- 6 files changed, 26 insertions(+), 26 deletions(-) rename libraries/{auto-update => auto-updater}/CMakeLists.txt (69%) rename libraries/{auto-update/src/AutoUpdate.cpp => auto-updater/src/AutoUpdater.cpp} (91%) rename libraries/{auto-update/src/AutoUpdate.h => auto-updater/src/AutoUpdater.h} (90%) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index b28c971298..00f6d4c3b2 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -140,7 +140,7 @@ target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES}) # link required hifi libraries link_hifi_libraries(shared octree environment gpu model render fbx networking entities avatars audio audio-client animation script-engine physics - render-utils entities-renderer ui auto-update) + render-utils entities-renderer ui auto-updater) add_dependency_external_projects(sdl2) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 88a8a274a3..560dccb238 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -59,7 +59,7 @@ #include #include #include -#include +#include #include #include #include @@ -295,7 +295,7 @@ bool setupEssentials(int& argc, char** argv) { auto discoverabilityManager = DependencyManager::set(); auto sceneScriptingInterface = DependencyManager::set(); auto offscreenUi = DependencyManager::set(); - auto autoUpdate = DependencyManager::set(); + auto autoUpdater = DependencyManager::set(); auto pathUtils = DependencyManager::set(); return true; @@ -624,8 +624,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : connect(ddeTracker.data(), &FaceTracker::muteToggled, this, &Application::faceTrackerMuteToggled); #endif - auto applicationUpdater = DependencyManager::get(); - connect(applicationUpdater.data(), &AutoUpdate::newVersionIsAvailable, dialogsManager.data(), &DialogsManager::showUpdateDialog); + auto applicationUpdater = DependencyManager::get(); + connect(applicationUpdater.data(), &AutoUpdater::newVersionIsAvailable, dialogsManager.data(), &DialogsManager::showUpdateDialog); applicationUpdater->checkForUpdate(); } diff --git a/interface/src/ui/UpdateDialog.cpp b/interface/src/ui/UpdateDialog.cpp index 61a7cb892c..69dfc343d9 100644 --- a/interface/src/ui/UpdateDialog.cpp +++ b/interface/src/ui/UpdateDialog.cpp @@ -11,7 +11,7 @@ #include "UpdateDialog.h" -#include +#include #include "DependencyManager.h" @@ -20,7 +20,7 @@ HIFI_QML_DEF(UpdateDialog) UpdateDialog::UpdateDialog(QQuickItem* parent) : OffscreenQmlDialog(parent) { - auto applicationUpdater = DependencyManager::get(); + auto applicationUpdater = DependencyManager::get(); int currentVersion = QCoreApplication::applicationVersion().toInt(); int latestVersion = applicationUpdater.data()->getBuildData().lastKey(); int versionsBehind = latestVersion - currentVersion; @@ -46,6 +46,6 @@ void UpdateDialog::hide() { } void UpdateDialog::triggerUpgrade() { - auto applicationUpdater = DependencyManager::get(); + auto applicationUpdater = DependencyManager::get(); applicationUpdater.data()->performAutoUpdate(applicationUpdater.data()->getBuildData().lastKey()); } \ No newline at end of file diff --git a/libraries/auto-update/CMakeLists.txt b/libraries/auto-updater/CMakeLists.txt similarity index 69% rename from libraries/auto-update/CMakeLists.txt rename to libraries/auto-updater/CMakeLists.txt index 0419048169..b3665af2cb 100644 --- a/libraries/auto-update/CMakeLists.txt +++ b/libraries/auto-updater/CMakeLists.txt @@ -1,3 +1,3 @@ -set(TARGET_NAME auto-update) +set(TARGET_NAME auto-updater) setup_hifi_library(Network) link_hifi_libraries(shared networking) diff --git a/libraries/auto-update/src/AutoUpdate.cpp b/libraries/auto-updater/src/AutoUpdater.cpp similarity index 91% rename from libraries/auto-update/src/AutoUpdate.cpp rename to libraries/auto-updater/src/AutoUpdater.cpp index 04bb294fec..445cdaec7b 100644 --- a/libraries/auto-update/src/AutoUpdate.cpp +++ b/libraries/auto-updater/src/AutoUpdater.cpp @@ -1,5 +1,5 @@ // -// AutoUpdate.cpp +// AutoUpdater.cpp // libraries/auto-update/src // // Created by Leonardo Murillo on 6/1/2015. @@ -9,12 +9,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "AutoUpdate.h" +#include "AutoUpdater.h" #include #include -AutoUpdate::AutoUpdate() { +AutoUpdater::AutoUpdater() { #if defined Q_OS_WIN32 _operatingSystem = "windows"; #elif defined Q_OS_MAC @@ -26,19 +26,19 @@ AutoUpdate::AutoUpdate() { connect(this, SIGNAL(latestVersionDataParsed()), this, SLOT(checkVersionAndNotify())); } -void AutoUpdate::checkForUpdate() { +void AutoUpdater::checkForUpdate() { this->getLatestVersionData(); } -void AutoUpdate::getLatestVersionData() { +void AutoUpdater::getLatestVersionData() { QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance(); QNetworkRequest latestVersionRequest(BUILDS_XML_URL); latestVersionRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT); QNetworkReply* reply = networkAccessManager.get(latestVersionRequest); - connect(reply, &QNetworkReply::finished, this, &AutoUpdate::parseLatestVersionData); + connect(reply, &QNetworkReply::finished, this, &AutoUpdater::parseLatestVersionData); } -void AutoUpdate::parseLatestVersionData() { +void AutoUpdater::parseLatestVersionData() { QNetworkReply* sender = qobject_cast(QObject::sender()); QXmlStreamReader xml(sender); @@ -103,7 +103,7 @@ void AutoUpdate::parseLatestVersionData() { emit latestVersionDataParsed(); } -void AutoUpdate::checkVersionAndNotify() { +void AutoUpdater::checkVersionAndNotify() { int latestVersionAvailable = _builds.lastKey(); if (QCoreApplication::applicationVersion() != "dev" && QCoreApplication::applicationVersion().toInt() < latestVersionAvailable) { @@ -111,7 +111,7 @@ void AutoUpdate::checkVersionAndNotify() { } } -void AutoUpdate::performAutoUpdate(int version) { +void AutoUpdater::performAutoUpdate(int version) { // NOTE: This is not yet auto updating - however this is a checkpoint towards that end // Next PR will handle the automatic download, upgrading and application restart const QMap& chosenVersion = _builds.value(version); @@ -120,11 +120,11 @@ void AutoUpdate::performAutoUpdate(int version) { QCoreApplication::quit(); } -void AutoUpdate::downloadUpdateVersion(int version) { +void AutoUpdater::downloadUpdateVersion(int version) { emit newVersionIsDownloaded(); } -void AutoUpdate::appendBuildData(int versionNumber, +void AutoUpdater::appendBuildData(int versionNumber, const QString& downloadURL, const QString& releaseTime, const QString& releaseNotes, diff --git a/libraries/auto-update/src/AutoUpdate.h b/libraries/auto-updater/src/AutoUpdater.h similarity index 90% rename from libraries/auto-update/src/AutoUpdate.h rename to libraries/auto-updater/src/AutoUpdater.h index 71b55095ee..a02ff11ca9 100644 --- a/libraries/auto-update/src/AutoUpdate.h +++ b/libraries/auto-updater/src/AutoUpdater.h @@ -1,5 +1,5 @@ // -// AutoUpdate.h +// AutoUpdater.h // libraries/auto-update/src // // Created by Leonardo Murillo on 6/1/2015. @@ -9,8 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#ifndef hifi_AutoUpdate_h -#define hifi_AutoUpdate_h +#ifndef hifi_AutoUpdater_h +#define hifi_AutoUpdater_h #include @@ -31,12 +31,12 @@ const QUrl BUILDS_XML_URL("https://highfidelity.com/builds.xml"); -class AutoUpdate : public QObject, public Dependency { +class AutoUpdater : public QObject, public Dependency { Q_OBJECT SINGLETON_DEPENDENCY public: - AutoUpdate(); + AutoUpdater(); void checkForUpdate(); const QMap> &getBuildData() { return _builds; } @@ -65,4 +65,4 @@ private slots: }; -#endif // _hifi_AutoUpdate_h +#endif // _hifi_AutoUpdater_h