UpdateWorker
class UpdateWorker : public QObject
The UpdateWorker class is a class providing API to check for current Cutter version and download specific version of one.
Public Functions
explicit 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.
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.
Public Slots
void abortDownload()
Stops current process of downloading.
See
download(QDir downloadDir, QString version)
Note
UpdateWorker::downloadFinished(QString filename) is not send after this function.
Signals
void checkComplete(const QVersionNumber &currVerson, const QString &errorMsg)
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)
void downloadProcess(size_t bytesReceived, size_t bytesTotal)
The signal is emitted each time when some amount of bytes was downloaded. May be used as indicator of download progress.
void downloadFinished(QString filename)
The signal is emitted as soon as downloading completes.
void downloadError(QString errorStr)
The signal is emitted when error occures during download.
Public Static Functions
static QVersionNumber currentVersionNumber()
Returns
the version of this Cutter binary, derived from CUTTER_VERSION_MAJOR, CUTTER_VERSION_MINOR and CUTTER_VERSION_PATCH.