UpdateWorker

class UpdateWorker

The UpdateWorker class is a class providing API to check for current Cutter version and download specific version of one.

Inherits from QObject

Public Functions

UpdateWorker(QObject *parent = nullptr)
void checkCurrentVersion(time_t timeoutMs)

Sends request to determine current version of Cutter. If there is no response in timeoutMs milliseconds, emits

void download(QString filename, QString version)

Downloads provided version of Cutter into downloadDir.

See
downloadProcess(size_t bytesReceived, size_t bytesTotal)

void showUpdateDialog(bool showDontCheckForUpdatesButton)

Shows dialog that allows user to either download latest version of Cutter from website or download it by clicking on a button. This dialog also has “Don’t check for updates” button which disables on-start update checks if showDontCheckForUpdatesButton is true.

See
downloadProcess(size_t bytesReceived, size_t bytesTotal)

Public Slots

void abortDownload()

Stops current process of downloading.

Note
UpdateWorker::downloadFinished(QString filename) is not send after this function.
See
download(QDir downloadDir, QString version)

Signal

signal UpdateWorker::checkComplete

with timeout error message.

The signal is emitted when check has been done with an empty errorMsg string. In case of an error currVerson is null and errorMsg contains description of error.

See
checkComplete(const QString& verson, const QString& errorMsg)

signal UpdateWorker::downloadProcess

The signal is emitted each time when some amount of bytes was downloaded. May be used as indicator of download progress.

signal UpdateWorker::downloadFinished

The signal is emitted as soon as downloading completes.

signal UpdateWorker::downloadError

The signal is emitted when error occures during download.

Public Static Functions

QVersionNumber currentVersionNumber()

Return
the version of this Cutter binary, derived from CUTTER_VERSION_MAJOR, CUTTER_VERSION_MINOR and CUTTER_VERSION_PATCH.