Code Review changes

This commit is contained in:
Leonardo Murillo 2015-06-10 14:35:52 -06:00
parent 3708f5ec96
commit 3bd0c7bd87
6 changed files with 26 additions and 26 deletions

View file

@ -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)

View file

@ -59,7 +59,7 @@
#include <AddressManager.h>
#include <AmbientOcclusionEffect.h>
#include <AudioInjector.h>
#include <AutoUpdate.h>
#include <AutoUpdater.h>
#include <DeferredLightingEffect.h>
#include <DependencyManager.h>
#include <EntityScriptingInterface.h>
@ -295,7 +295,7 @@ bool setupEssentials(int& argc, char** argv) {
auto discoverabilityManager = DependencyManager::set<DiscoverabilityManager>();
auto sceneScriptingInterface = DependencyManager::set<SceneScriptingInterface>();
auto offscreenUi = DependencyManager::set<OffscreenUi>();
auto autoUpdate = DependencyManager::set<AutoUpdate>();
auto autoUpdater = DependencyManager::set<AutoUpdater>();
auto pathUtils = DependencyManager::set<PathUtils>();
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<AutoUpdate>();
connect(applicationUpdater.data(), &AutoUpdate::newVersionIsAvailable, dialogsManager.data(), &DialogsManager::showUpdateDialog);
auto applicationUpdater = DependencyManager::get<AutoUpdater>();
connect(applicationUpdater.data(), &AutoUpdater::newVersionIsAvailable, dialogsManager.data(), &DialogsManager::showUpdateDialog);
applicationUpdater->checkForUpdate();
}

View file

@ -11,7 +11,7 @@
#include "UpdateDialog.h"
#include <AutoUpdate.h>
#include <AutoUpdater.h>
#include "DependencyManager.h"
@ -20,7 +20,7 @@ HIFI_QML_DEF(UpdateDialog)
UpdateDialog::UpdateDialog(QQuickItem* parent) :
OffscreenQmlDialog(parent)
{
auto applicationUpdater = DependencyManager::get<AutoUpdate>();
auto applicationUpdater = DependencyManager::get<AutoUpdater>();
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<AutoUpdate>();
auto applicationUpdater = DependencyManager::get<AutoUpdater>();
applicationUpdater.data()->performAutoUpdate(applicationUpdater.data()->getBuildData().lastKey());
}

View file

@ -1,3 +1,3 @@
set(TARGET_NAME auto-update)
set(TARGET_NAME auto-updater)
setup_hifi_library(Network)
link_hifi_libraries(shared networking)

View file

@ -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 <NetworkAccessManager.h>
#include <SharedUtil.h>
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<QNetworkReply*>(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<QString, QString>& 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,

View file

@ -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 <QtCore/QSettings>
@ -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<int, QMap<QString, QString>> &getBuildData() { return _builds; }
@ -65,4 +65,4 @@ private slots:
};
#endif // _hifi_AutoUpdate_h
#endif // _hifi_AutoUpdater_h