AppImage Updater Bridge Plugin Interface
A plugin interface is a specification of public slots and signals that can be used to access the functionality of the plugin itself. The interface is not bound to any specific programming language and easily translates to any Qt bindings and programming language.
All slots are reentrant and thread safe.
Please refer the C++ documentation for info on how the slots act.
IMPORTANT: You have to start your Qt event loop for AppImageUpdaterBridge to function.
A note on Data Types
Since plugins are not C++ specific, The data types are vaguely defined. In dynamic languages like python, you can just use native data types. (i.e) For QString, you can use str or QString from your Qt binding itself.
I'm not sure about other Qt bindings, So help is much welcomed.
Slots
Name | Description |
---|---|
start() | Starts the update. |
cancel() | Cancels current update process. |
setAppImage(QString) | Assume the given string as path to AppImage to update. |
setShowLog(bool) | If the given boolean is true then prints log. |
setOutputDirectory(QString) | Set the output directory as given string. |
setProxy(QNetworkProxy) | Use proxy as given in QNetworkProxy object. |
checkForUpdate() | Checks for new update. |
clear() | Clears internal cache and stores. |
Signals
Name | Description |
---|---|
started() | Emitted when the update is actually started. |
canceled() | Emitted when the update is canceled. |
finished(QJsonObject , QString) | Emitted when update finishes. |
updateAvailable(bool, QJsonObject) | Emitted when checkForUpdate() is called. |
error(short) | Emitted when some error occurs. |
progress(int, qint64, qint64, double, QString) | Emitted on progress of update. See here for more information. |
logger(QString, QString) | See here for more information. |
Documentation
start()
[SLOT]
Starts the updater. Emits started() signal when starts.
Minor Note: You don't have to worry about anything if you called checkForUpdate or getAppImageEmbededInformation slots before start , Don't worry about overheads too , Since when you call checkForUpdate slot , The information is cached and when start slot is called again , it will be faster than normal.
Important Note: You should also call clear and set the settings again if you want to clear the cache.
cancel()
[SLOT]
Cancels the update. Emits canceled() signal when cancel was successfull.
setAppImage(QString)
[SLOT]
Sets the AppImage Path as the given QString.
setShowLog(bool)
[SLOT]
Turns on and off the log printer.
Note: logger signal will be emitted all the time if the library is compiled with LOGGING_DISABLED undefined, setShowLog will not affect this activity at all, But setShowLog will print these log messages if set to true.
setOutputDirectory(QString)
[SLOT]
Writes the new version of the AppImage to the given Output directory , Assuming the given QString a directory path. The default is the old version AppImage's directory.
QNetworkProxy)
setProxy([SLOT]
Sets the given QNetworkProxy as the proxy
checkForUpdate()
[SLOT]
Checks update for the current operating AppImage. emits updateAvailable(bool , QJsonObject) , Where the bool will be true if the AppImage needs update. The QJsonObject in the signal will have the details of the current operating AppImage.
clear()
[SLOT]
Clears all internal cache and stores.
started()
[SIGNAL]
Emitted when the updater is started successfully.
canceled()
[SIGNAL]
Emitted when the update is canceled successfully.
finished(QJsonObject , QString)
[SIGNAL]
Emitted when the update is finished successfully. The given QJsonObject has the details of the new version of the AppImage and the given QString has the absolute path to the old versioin of the AppImage.
The QJsonObject will follow the folloing format with respect to json ,
{
"AbsolutePath" : "Absolute path of the new version of the AppImage" ,
"Sha1Hash" : "Sha1 hash of the new version of the AppImage"
}
Note: If the absolute path of the new version of the AppImage is same as the old version then it could mean that there were no updates needed , You can however listen to the updateAvailable signal to know the exact state of updates. You should call checkForUpdate and then call start if updates were really available.
updateAvailable(bool , QJsonObject)
[SIGNAL]
Emitted when checkForUpdate() is called. The given bool states if the operating AppImage needs update and the QJsonObject gives the details of the current operating AppImage.
The QJsonObject will follow the following format with respect to json ,
{
"AbsolutePath" : "The absolute path of the current operating AppImage" ,
"Sha1Hash" : "The Sha1 hash of the current operating AppImage" ,
"RemoteSha1Hash" : "The Sha1 hash of the lastest AppImage" ,
"ReleaseNotes" : "Release notes if available"
}
error(short)
[SIGNAL]
Emitted when the updater is errored. The given short integer is the error code. See error codes.
progress(int percentage , qint64 bytesReceived , qint64 bytesTotal , double speed , QString speedUnits)
[SIGNAL]
The updater's progress is emitted through this unified signal.
Where ,
Variable | Description |
---|---|
percentage | % Finished revising the latest AppImage. |
bytesReceived | The received bytes of the latest AppImage. |
bytesTotal | The total bytes of the latest AppImage. |
speed | The transfer speed value. |
speedUnit | The transfer speed unit(e.g. KiB/s , etc... ) for speed. |
logger(QString , QString)
[SIGNAL]
Emitted when the updater issues a log message with the first QString as the log message and the second QString as the path to the respective AppImage.