SaveTool: add a conversion operator.

This commit is contained in:
Guillaume Jacquemin 2022-01-03 12:10:20 +01:00
parent bd05a98820
commit 96768c1aab

View file

@ -399,6 +399,9 @@ void SaveTool::updateCheckEvent(SDL_Event& event) {
return ( major * 10000 + minor * 100 + patch) > return ( major * 10000 + minor * 100 + patch) >
(other.major * 10000 + other.minor * 100 + other.patch); (other.major * 10000 + other.minor * 100 + other.patch);
} }
operator std::string() const {
return Utility::formatString("{}.{}.{}", major, minor, patch);
}
}; };
static const Version current_ver{SAVETOOL_VERSION}; static const Version current_ver{SAVETOOL_VERSION};
@ -414,7 +417,7 @@ void SaveTool::updateCheckEvent(SDL_Event& event) {
_queue.addToast(Toast::Type::Warning, "Your version is out of date.\nCheck the settings for more information.", _queue.addToast(Toast::Type::Warning, "Your version is out of date.\nCheck the settings for more information.",
std::chrono::milliseconds{5000}); std::chrono::milliseconds{5000});
_updateAvailable = true; _updateAvailable = true;
_latestVersion = Utility::formatString("{}.{}.{}", latest_ver.major, latest_ver.minor, latest_ver.patch); _latestVersion = latest_ver;
_releaseLink = response[0]["html_url"]; _releaseLink = response[0]["html_url"];
_downloadLink = response[0]["assets"][0]["browser_download_url"]; _downloadLink = response[0]["assets"][0]["browser_download_url"];
} }
@ -427,7 +430,6 @@ void SaveTool::updateCheckEvent(SDL_Event& event) {
break; break;
} }
} }
void SaveTool::initialiseConfiguration() { void SaveTool::initialiseConfiguration() {