Make the DownloadManager not a singleton (closing #43)

This commit is contained in:
Alexander Bock
2016-06-30 00:43:03 +02:00
parent 5de58e2d31
commit e40d393824
6 changed files with 24 additions and 17 deletions

View File

@@ -130,6 +130,7 @@ OpenSpaceEngine::OpenSpaceEngine(std::string programName,
, _console(new LuaConsole)
, _moduleEngine(new ModuleEngine)
, _settingsEngine(new SettingsEngine)
, _downloadManager(nullptr)
#ifdef OPENSPACE_MODULE_ONSCREENGUI_ENABLED
, _gui(new gui::GUI)
#endif
@@ -364,8 +365,9 @@ bool OpenSpaceEngine::initialize() {
std::string requestURL = "";
bool success = configurationManager().getValue(ConfigurationManager::KeyDownloadRequestURL, requestURL);
if (success)
DownloadManager::initialize(requestURL, DownloadVersion);
if (success) {
_downloadManager = std::make_unique<DownloadManager>(requestURL, DownloadVersion);
}
// Load SPICE time kernel
success = loadSpiceKernels();
@@ -1006,4 +1008,10 @@ ghoul::fontrendering::FontManager& OpenSpaceEngine::fontManager() {
return *_fontManager;
}
DownloadManager& OpenSpaceEngine::downloadManager() {
ghoul_assert(_downloadManager, "Download Manager must not be nullptr");
return *_downloadManager;
}
} // namespace openspace