DBLSQD Qt SDK
|
A dialog class for displaying and downloading update information. More...
Public Types | |
enum | Type { OnUpdateAvailable, OnLastWindowClosed, Manual, ManualChangelog } |
This flag determines the if and when the UpdateDialog is displayed automatically. More... | |
Public Slots | |
void | onButtonInstall () |
Default handler for the install button. More... | |
void | onButtonCustomInstall () |
void | skip () |
Skips the latest retrieved Release. More... | |
void | showIfUpdatesAvailable () |
Shows the dialog if there are available updates. | |
void | showIfUpdatesAvailableOrQuit () |
Shows the dialog if there are updates available or quits the application. | |
Signals | |
void | ready () |
void | installButtonClicked (QAbstractButton *button, QString filePath) |
void | linkActivated (QString link) |
Public Member Functions | |
UpdateDialog (Feed *feed, int=OnUpdateAvailable, QWidget *parent=0, QSettings *settings=new QSettings()) | |
Constructs a new UpdateDialog. More... | |
void | setIcon (QString fileName) |
void | setIcon (QPixmap pixmap) |
Sets the icon displayed in the update window. | |
void | addInstallButton (QAbstractButton *button) |
Adds a custom button for handling update installation. More... | |
void | setMinVersion (QString version) |
Sets the minimum version to be displayed in the changelog. Defaults to QApplication::applicationVersion() if not set. More... | |
void | setMaxVersion (QString version) |
Sets the maximum version to be displayed in the changelog. More... | |
void | setPreviousVersion (QString version) |
Convenience method for setting minimum and maximum version to be displayed in the changelog. maximumVersion is set to QApplication::applicationVersion() More... | |
void | setOpenExternalLinks (bool open) |
bool | openExternalLinks () |
Static Public Member Functions | |
static bool | autoDownloadEnabled (QVariant defaultValue, QSettings *settings=new QSettings) |
Returns true if automatic downloads are enabled. More... | |
static bool | autoDownloadEnabled (QSettings *settings=new QSettings()) |
static void | enableAutoDownload (bool enabled, QSettings *settings=new QSettings) |
Enables or disables automatic downloads. | |
A dialog class for displaying and downloading update information.
UpdateDialog is a drop-in class for adding a fully-functional auto-update component to an existing application.
The most simple integration is possible with just three lines of code:
The update dialog can also display an application icon which can be set with setIcon().
This flag determines the if and when the UpdateDialog is displayed automatically.
OnUpdateAvailable: Automatically display the dialog as soon as the Feed has been downloaded and parsed and if there is a newer version than the current version returned by QCoreApplication::applicationVersion().
OnLastWindowClosed: If there is a newer version available than the current version returned by QCoreApplication::applicationVersion(), the update dialog is displayed when QGuiApplication emits the lastWindowClosed() event. Note that when this flag is used, QGuiApplication::setQuitOnLastWindowClosed(false) will be called.
Manual: The dialog is only displayed when explicitly requested via show() or exec(). Note that update information might not be available instantly after constructing an UpdateDialog.
ManualChangelog: The dialog is only displayed when explicitly requested via show() or exec(). Instead of the full update interface, only the changelog will be shown.
|
explicit |
Constructs a new UpdateDialog.
A Feed object needs to be constructed first and passed to this constructor. Feed::load() does not need to be called on the Feed object.
The given UpdateDialog::Type flag determines when/if the dialog is shown automatically.
UpdateDialog uses QSettings to save information such as when a release was skipped by the users. If you want to use a specially initialized QSettings object, you may also pass it to this constructor.
void dblsqd::UpdateDialog::addInstallButton | ( | QAbstractButton * | button | ) |
Adds a custom button for handling update installation.
button | When the custom button is clicked after an update has been downloaded or when downloading an update that was started by clicking the button has finished, installButtonClicked(QAbstractButton* button, QString filePath) is emitted. |
|
static |
Returns true if automatic downloads are enabled.
If defaultValue is provided, it is stored if no other value has previously been set.
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
slot |
Default handler for the install button.
Closes the dialog if no other action (such as downloading or installing a Release) is required first.
bool dblsqd::UpdateDialog::openExternalLinks | ( | ) |
UpdateExternalLinks
Determines if links in the changelog should be opened automatically by QDesktopServices::openUrl() when a user clicks on them. If set to false, the linkActivated() signal is emitted instead.
The default value is true.
void dblsqd::UpdateDialog::setMaxVersion | ( | QString | version | ) |
Sets the maximum version to be displayed in the changelog.
version |
void dblsqd::UpdateDialog::setMinVersion | ( | QString | version | ) |
Sets the minimum version to be displayed in the changelog. Defaults to QApplication::applicationVersion() if not set.
version |
void dblsqd::UpdateDialog::setOpenExternalLinks | ( | bool | open | ) |
void dblsqd::UpdateDialog::setPreviousVersion | ( | QString | previousVersion | ) |
Convenience method for setting minimum and maximum version to be displayed in the changelog. maximumVersion is set to QApplication::applicationVersion()
previousVersion |
|
slot |
Skips the latest retrieved Release.
If a release has been skipped, UpdateDialog will not be displayed automatically when using Type::OnUpdateAvailable or Type::OnLastWindowClosed.