Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
UpdateChecker.hpp
Go to the documentation of this file.
1
8
9#pragma once
10
11#include <optional>
12#include <string>
13
14class AppWindow;
15
16namespace correlation::app {
17
23 std::string tag_name;
24 std::string html_url;
25};
26
32public:
39 static void checkForUpdatesAsync(AppWindow &window, const std::string &current_version);
40
47 static bool isNewerVersion(const std::string &remote_ver, const std::string &current_ver);
48
53 static void openUrlInBrowser(const std::string &url);
54
59 static std::optional<ReleaseInfo> fetchLatestRelease();
60
66 static std::optional<ReleaseInfo> parseReleaseJson(const std::string &json);
67};
68
69} // namespace correlation::app
Checks for new releases asynchronously on GitHub without interrupting the user.
Definition UpdateChecker.hpp:31
static void checkForUpdatesAsync(AppWindow &window, const std::string &current_version)
Spawns an asynchronous background thread to check for new releases on GitHub. If a newer version is f...
Definition UpdateChecker.cpp:292
static std::optional< ReleaseInfo > fetchLatestRelease()
Queries the GitHub API for the latest release metadata.
Definition UpdateChecker.cpp:179
static bool isNewerVersion(const std::string &remote_ver, const std::string &current_ver)
Compares two semantic version strings (e.g. "v3.9.1" vs "3.9.0").
Definition UpdateChecker.cpp:116
static std::optional< ReleaseInfo > parseReleaseJson(const std::string &json)
Parses the tag_name and html_url fields from GitHub release JSON string.
Definition UpdateChecker.cpp:124
static void openUrlInBrowser(const std::string &url)
Opens a URL in the user's default system browser.
Definition UpdateChecker.cpp:240
Definition AppController.hpp:27
Holds metadata for a GitHub release.
Definition UpdateChecker.hpp:22
std::string tag_name
The release tag (e.g. "v3.9.1").
Definition UpdateChecker.hpp:23
std::string html_url
Web page URL for the release download.
Definition UpdateChecker.hpp:24