game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
RunnerDownloadService Class Reference

Service for downloading and managing compatibility tools. More...

#include <runner_download_service.h>

Classes

struct  Impl

Public Types

using ProgressCallback = std::function<void(const DownloadProgress&)>
using ReleaseCallback = std::function<void(const std::vector<RunnerRelease>&)>

Public Member Functions

 RunnerDownloadService ()
 ~RunnerDownloadService ()
void cancelDownload (RunnerType type)
 Cancel an ongoing download.
int cleanupOldVersions (RunnerType type, int keepCount=3)
 Clean up old versions, keeping newest N.
void clearCache ()
 Clear the releases cache.
bool downloadRunner (const RunnerRelease &release, const ProgressCallback &progressCallback=nullptr)
 Download and install a runner.
std::future< bool > downloadRunnerAsync (const RunnerRelease &release, const ProgressCallback &progressCallback=nullptr)
 Download and install a runner asynchronously.
std::vector< RunnerRelease > getAvailableReleases (RunnerType type, bool includePrerelease=false, int maxResults=20)
 Get available releases for a runner type.
void getAvailableReleasesAsync (RunnerType type, const ReleaseCallback &callback, bool includePrerelease=false)
 Get available releases asynchronously.
std::vector< InstalledRunner > getInstalledRunners () const
 Get all installed runners.
std::vector< InstalledRunner > getInstalledRunners (RunnerType type) const
 Get installed runners of a specific type.
std::optional< RunnerRelease > getLatestRelease (RunnerType type, bool includePrerelease=false)
 Get the latest release for a runner type.
bool isDownloading (RunnerType type) const
 Check if a download is in progress.
bool isInstalled (RunnerType type, const std::string &version) const
 Check if a specific version is installed.
void refreshInstalled ()
 Refresh installed runners list.
void setInstallPath (RunnerType type, const std::filesystem::path &path)
 Set custom installation directory.
bool uninstallRunner (RunnerType type, const std::string &version)
 Uninstall a runner version.

Static Public Member Functions

static std::filesystem::path getDefaultInstallPath (RunnerType type)
 Get default installation directory for a runner type.

Detailed Description

Service for downloading and managing compatibility tools.

Provides a unified interface for downloading, installing, and managing various Windows compatibility layers like Proton-GE and Wine-GE.

Usage Example

// Get available releases
auto releases = service.getAvailableReleases(RunnerType::ProtonGE);
// Download latest
if (!releases.empty()) {
service.downloadRunner(releases[0], [](const DownloadProgress& p) {
std::cout << p.percentComplete << "%" << std::endl;
});
}
bool downloadRunner(const RunnerRelease &release, const ProgressCallback &progressCallback=nullptr)
Download and install a runner.
std::vector< RunnerRelease > getAvailableReleases(RunnerType type, bool includePrerelease=false, int maxResults=20)
Get available releases for a runner type.
@ ProtonGE
GloriousEggroll Proton builds (active).
Progress information for downloads.

Definition at line 183 of file runner_download_service.h.

Member Typedef Documentation

◆ ProgressCallback

using RunnerDownloadService::ProgressCallback = std::function<void(const DownloadProgress&)>

Definition at line 186 of file runner_download_service.h.

◆ ReleaseCallback

using RunnerDownloadService::ReleaseCallback = std::function<void(const std::vector<RunnerRelease>&)>

Definition at line 187 of file runner_download_service.h.

Constructor & Destructor Documentation

◆ RunnerDownloadService()

RunnerDownloadService::RunnerDownloadService ( )

Definition at line 459 of file runner_download_service.cpp.

◆ ~RunnerDownloadService()

RunnerDownloadService::~RunnerDownloadService ( )

Definition at line 479 of file runner_download_service.cpp.

Member Function Documentation

◆ cancelDownload()

void RunnerDownloadService::cancelDownload ( RunnerType type)

Cancel an ongoing download.

Parameters
typeRunner type to cancel

Definition at line 1355 of file runner_download_service.cpp.

References Logger::info(), and runnerTypeName().

◆ cleanupOldVersions()

int RunnerDownloadService::cleanupOldVersions ( RunnerType type,
int keepCount = 3 )

Clean up old versions, keeping newest N.

Parameters
typeRunner type
keepCountNumber of versions to keep
Returns
Number of versions removed

Definition at line 1594 of file runner_download_service.cpp.

References getInstalledRunners(), and uninstallRunner().

◆ clearCache()

void RunnerDownloadService::clearCache ( )

Clear the releases cache.

Definition at line 1615 of file runner_download_service.cpp.

◆ downloadRunner()

◆ downloadRunnerAsync()

std::future< bool > RunnerDownloadService::downloadRunnerAsync ( const RunnerRelease & release,
const ProgressCallback & progressCallback = nullptr )

Download and install a runner asynchronously.

Parameters
releaseRelease to install
progressCallbackProgress updates
Returns
Future that resolves to success/failure

Definition at line 1348 of file runner_download_service.cpp.

References downloadRunner().

◆ getAvailableReleases()

std::vector< RunnerRelease > RunnerDownloadService::getAvailableReleases ( RunnerType type,
bool includePrerelease = false,
int maxResults = 20 )

Get available releases for a runner type.

Parameters
typeType of runner
includePrereleaseInclude pre-release versions
maxResultsMaximum number of releases to return
Returns
Vector of available releases, newest first

Definition at line 820 of file runner_download_service.cpp.

References Archived, RunnerDownloadService::Impl::CACHE_VALIDITY_SEC, Logger::error(), Logger::info(), RunnerRelease::isArchived, ManualOnly, runnerStatus(), and runnerTypeName().

Referenced by getAvailableReleasesAsync(), and getLatestRelease().

◆ getAvailableReleasesAsync()

void RunnerDownloadService::getAvailableReleasesAsync ( RunnerType type,
const ReleaseCallback & callback,
bool includePrerelease = false )

Get available releases asynchronously.

Parameters
typeType of runner
callbackCallback with releases when complete
includePrereleaseInclude pre-release versions

Definition at line 882 of file runner_download_service.cpp.

References getAvailableReleases().

◆ getDefaultInstallPath()

fs::path RunnerDownloadService::getDefaultInstallPath ( RunnerType type)
static

Get default installation directory for a runner type.

Parameters
typeRunner type
Returns
Default installation path

Definition at line 1380 of file runner_download_service.cpp.

References DXVK, Logger::error(), Luxtorpeda, ProtonGE, ProtonTKG, UMU, VKD3DProton, and WineGE.

◆ getInstalledRunners() [1/2]

std::vector< InstalledRunner > RunnerDownloadService::getInstalledRunners ( ) const

Get all installed runners.

Returns
Vector of installed runners

Definition at line 1431 of file runner_download_service.cpp.

References DXVK, getInstalledRunners(), Luxtorpeda, ProtonGE, ProtonTKG, UMU, VKD3DProton, and WineGE.

Referenced by cleanupOldVersions(), getInstalledRunners(), and isInstalled().

◆ getInstalledRunners() [2/2]

std::vector< InstalledRunner > RunnerDownloadService::getInstalledRunners ( RunnerType type) const

Get installed runners of a specific type.

Parameters
typeRunner type to filter by
Returns
Vector of installed runners of that type

Definition at line 1447 of file runner_download_service.cpp.

References DXVK, Logger::error(), InstalledRunner::installDate, InstalledRunner::name, InstalledRunner::path, ProtonGE, ProtonTKG, InstalledRunner::sizeBytes, InstalledRunner::type, InstalledRunner::version, VKD3DProton, and WineGE.

◆ getLatestRelease()

std::optional< RunnerRelease > RunnerDownloadService::getLatestRelease ( RunnerType type,
bool includePrerelease = false )

Get the latest release for a runner type.

Parameters
typeType of runner
includePrereleaseInclude pre-release versions
Returns
Latest release if available

Definition at line 897 of file runner_download_service.cpp.

References getAvailableReleases().

◆ isDownloading()

bool RunnerDownloadService::isDownloading ( RunnerType type) const

Check if a download is in progress.

Parameters
typeRunner type to check

Definition at line 1370 of file runner_download_service.cpp.

◆ isInstalled()

bool RunnerDownloadService::isInstalled ( RunnerType type,
const std::string & version ) const

Check if a specific version is installed.

Parameters
typeRunner type
versionVersion string
Returns
True if installed

Definition at line 1532 of file runner_download_service.cpp.

References getInstalledRunners().

◆ refreshInstalled()

void RunnerDownloadService::refreshInstalled ( )

Refresh installed runners list.

Definition at line 1622 of file runner_download_service.cpp.

◆ setInstallPath()

void RunnerDownloadService::setInstallPath ( RunnerType type,
const std::filesystem::path & path )

Set custom installation directory.

Parameters
typeRunner type
pathCustom path

Definition at line 1424 of file runner_download_service.cpp.

◆ uninstallRunner()

bool RunnerDownloadService::uninstallRunner ( RunnerType type,
const std::string & version )

Uninstall a runner version.

Parameters
typeRunner type
versionVersion to uninstall
Returns
True on success

Definition at line 1539 of file runner_download_service.cpp.

References Logger::error(), Logger::info(), ProtonCache::invalidate(), and runnerTypeName().

Referenced by cleanupOldVersions().


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