LogViewer
A modern log viewer with AI-assisted analysis (Qt 6)
Loading...
Searching...
No Matches
ui::qt::UpdateChecker Class Reference

Asynchronous update checker using Qt6::Network. More...

#include <UpdateChecker.hpp>

Inheritance diagram for ui::qt::UpdateChecker:
Inheritance graph
Collaboration diagram for ui::qt::UpdateChecker:
Collaboration graph

Signals

void UpdateCheckComplete (updates::UpdateCheckResult result)
 
void UpdateCheckFailed (QString errorMessage)
 
void PluginDownloadProgress (QString pluginId, qint64 bytesReceived, qint64 bytesTotal)
 
void PluginDownloadComplete (QString pluginId, QString tempFilePath)
 
void PluginDownloadFailed (QString pluginId, QString errorMessage)
 

Public Member Functions

 UpdateChecker (QObject *parent=nullptr)
 
void CheckAsync ()
 Start an asynchronous update check.
 
void DownloadPlugin (const updates::PluginUpdateInfo &info)
 Download a plugin ZIP to a temp location then verify its checksum.
 
bool IsChecking () const
 True while an update check is in progress.
 

Private Slots

void OnReleaseReply (QNetworkReply *reply)
 
void OnManifestReply (QNetworkReply *reply)
 

Private Member Functions

void DoPluginDownload (const updates::PluginUpdateInfo &info, QNetworkReply *reply)
 
void OnSslErrors (QNetworkReply *reply, const QList< QSslError > &errors)
 

Static Private Member Functions

static QString PlatformId ()
 
static bool IsPluginCompatible (const updates::PluginUpdateInfo &info)
 Returns true when manifest apiVersion and minAppVersion are compatible with the running application.
 
static std::string StripV (const QString &tagName)
 
static bool VersionGreater (const std::string &a, const std::string &b)
 Semantic version comparison: returns true when a > b. Handles "major.minor.patch" strings.
 

Private Attributes

QNetworkAccessManager m_net
 
updates::UpdateCheckResult m_pending
 Assembled during the two-step check.
 
bool m_checking {false}
 

Static Private Attributes

static constexpr const char * kGitHubApiUrl
 

Detailed Description

Asynchronous update checker using Qt6::Network.

Queries the GitHub Releases API for bula173/LogViewer and optionally downloads the plugins_manifest.json asset listed in that release to enumerate available plugin updates.

Usage:

auto* checker = new UpdateChecker(this);
connect(checker, &UpdateChecker::UpdateCheckComplete, this, &MyClass::OnUpdateResult);
checker->CheckAsync();
Asynchronous update checker using Qt6::Network.
Definition UpdateChecker.hpp:27
void UpdateCheckComplete(updates::UpdateCheckResult result)

Constructor & Destructor Documentation

◆ UpdateChecker()

ui::qt::UpdateChecker::UpdateChecker ( QObject *  parent = nullptr)
explicit
Here is the call graph for this function:

Member Function Documentation

◆ CheckAsync()

void ui::qt::UpdateChecker::CheckAsync ( )

Start an asynchronous update check.

Emits either UpdateCheckComplete or UpdateCheckFailed when finished. Safe to call from the main thread.

Here is the call graph for this function:

◆ DoPluginDownload()

void ui::qt::UpdateChecker::DoPluginDownload ( const updates::PluginUpdateInfo &  info,
QNetworkReply *  reply 
)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DownloadPlugin()

void ui::qt::UpdateChecker::DownloadPlugin ( const updates::PluginUpdateInfo &  info)

Download a plugin ZIP to a temp location then verify its checksum.

Emits PluginDownloadProgress, then PluginDownloadComplete or PluginDownloadFailed when done.

Parameters
infoPlugin update info including downloadUrl and sha256.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsChecking()

bool ui::qt::UpdateChecker::IsChecking ( ) const
inline

True while an update check is in progress.

◆ IsPluginCompatible()

bool ui::qt::UpdateChecker::IsPluginCompatible ( const updates::PluginUpdateInfo &  info)
staticprivate

Returns true when manifest apiVersion and minAppVersion are compatible with the running application.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnManifestReply

void ui::qt::UpdateChecker::OnManifestReply ( QNetworkReply *  reply)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnReleaseReply

void ui::qt::UpdateChecker::OnReleaseReply ( QNetworkReply *  reply)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnSslErrors()

void ui::qt::UpdateChecker::OnSslErrors ( QNetworkReply *  reply,
const QList< QSslError > &  errors 
)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PlatformId()

QString ui::qt::UpdateChecker::PlatformId ( )
staticprivate

Returns "linux", "windows", or "macos" based on the build target.

Here is the caller graph for this function:

◆ PluginDownloadComplete

void ui::qt::UpdateChecker::PluginDownloadComplete ( QString  pluginId,
QString  tempFilePath 
)
signal
Here is the caller graph for this function:

◆ PluginDownloadFailed

void ui::qt::UpdateChecker::PluginDownloadFailed ( QString  pluginId,
QString  errorMessage 
)
signal
Here is the caller graph for this function:

◆ PluginDownloadProgress

void ui::qt::UpdateChecker::PluginDownloadProgress ( QString  pluginId,
qint64  bytesReceived,
qint64  bytesTotal 
)
signal
Here is the caller graph for this function:

◆ StripV()

std::string ui::qt::UpdateChecker::StripV ( const QString &  tagName)
staticprivate

Strip leading 'v' from a GitHub tag name ("v1.2.0" → "1.2.0").

Here is the caller graph for this function:

◆ UpdateCheckComplete

void ui::qt::UpdateChecker::UpdateCheckComplete ( updates::UpdateCheckResult  result)
signal
Here is the caller graph for this function:

◆ UpdateCheckFailed

void ui::qt::UpdateChecker::UpdateCheckFailed ( QString  errorMessage)
signal
Here is the caller graph for this function:

◆ VersionGreater()

bool ui::qt::UpdateChecker::VersionGreater ( const std::string &  a,
const std::string &  b 
)
staticprivate

Semantic version comparison: returns true when a > b. Handles "major.minor.patch" strings.

Here is the caller graph for this function:

Member Data Documentation

◆ kGitHubApiUrl

constexpr const char* ui::qt::UpdateChecker::kGitHubApiUrl
staticconstexprprivate
Initial value:
=
"https://api.github.com/repos/bula173/LogViewer/releases/latest"

◆ m_checking

bool ui::qt::UpdateChecker::m_checking {false}
private

◆ m_net

QNetworkAccessManager ui::qt::UpdateChecker::m_net
private

◆ m_pending

updates::UpdateCheckResult ui::qt::UpdateChecker::m_pending
private

Assembled during the two-step check.


The documentation for this class was generated from the following files: