Feature/check latest version (#876)

* Log latest version information
This commit is contained in:
Emil Axelsson
2019-05-21 00:13:56 +02:00
committed by Alexander Bock
parent d335ec0622
commit c08805745b
12 changed files with 260 additions and 2 deletions
+1
View File
@@ -65,6 +65,7 @@ struct Configuration {
};
DocumentationInfo documentation;
std::string versionCheckUrl;
bool useMultithreadedInitialization = false;
struct LoadingScreen {
+3
View File
@@ -46,6 +46,7 @@ class RenderEngine;
class ScreenSpaceRenderable;
class SyncEngine;
class TimeManager;
class VersionChecker;
class VirtualPropertyManager;
struct WindowDelegate;
namespace configuration { struct Configuration; }
@@ -81,6 +82,7 @@ RenderEngine& gRenderEngine();
std::vector<std::unique_ptr<ScreenSpaceRenderable>>& gScreenspaceRenderables();
SyncEngine& gSyncEngine();
TimeManager& gTimeManager();
VersionChecker& gVersionChecker();
VirtualPropertyManager& gVirtualPropertyManager();
WindowDelegate& gWindowDelegate();
configuration::Configuration& gConfiguration();
@@ -112,6 +114,7 @@ static std::vector<std::unique_ptr<ScreenSpaceRenderable>>& screenSpaceRenderabl
detail::gScreenspaceRenderables();
static SyncEngine& syncEngine = detail::gSyncEngine();
static TimeManager& timeManager = detail::gTimeManager();
static VersionChecker& versionChecker = detail::gVersionChecker();
static VirtualPropertyManager& virtualPropertyManager = detail::gVirtualPropertyManager();
static WindowDelegate& windowDelegate = detail::gWindowDelegate();
static configuration::Configuration& configuration = detail::gConfiguration();
@@ -28,6 +28,7 @@
#include <openspace/properties/stringproperty.h>
#include <openspace/util/keys.h>
#include <openspace/util/mouse.h>
#include <openspace/util/versionchecker.h>
#include <ghoul/glm.h>
#include <memory>
#include <string>
@@ -109,6 +110,7 @@ private:
std::unique_ptr<Scene> _scene;
std::unique_ptr<AssetManager> _assetManager;
std::unique_ptr<LoadingScreen> _loadingScreen;
std::unique_ptr<VersionChecker> _versionChecker;
bool _hasScheduledAssetLoading = false;
std::string _scheduledAssetPathToLoad;
+58
View File
@@ -0,0 +1,58 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___VERSIONCHECKER___H__
#define __OPENSPACE_CORE___VERSIONCHECKER___H__
#include <openspace/util/httprequest.h>
#include <memory>
#include <optional>
#include <string>
namespace openspace {
class VersionChecker {
public:
struct SemanticVersion {
int major;
int minor;
int patch;
};
void requestLatestVersion(const std::string& url);
bool hasLatestVersionInfo();
SemanticVersion latestVersion();
private:
std::unique_ptr<AsyncHttpMemoryDownload> _request;
std::optional<SemanticVersion> _latestVersion;
};
bool operator<(const VersionChecker::SemanticVersion a,
const VersionChecker::SemanticVersion b);
} // namespace openspace
#endif // __OPENSPACE_CORE___VERSIONCHECKER___H__