1 #ifndef DBLSQD_UPDATE_DIALOG_H 2 #define DBLSQD_UPDATE_DIALOG_H 4 #include "dblsqd/feed.h" 5 #include "ui_update_dialog.h" 7 #include <QTemporaryFile> 10 #include <QDesktopServices> 19 enum Type {OnUpdateAvailable, OnLastWindowClosed, Manual, ManualChangelog};
20 explicit UpdateDialog(
Feed* feed,
int = OnUpdateAvailable, QWidget* parent = 0, QSettings* settings =
new QSettings());
23 void setIcon(QString fileName);
24 void setIcon(QPixmap pixmap);
31 static bool autoDownloadEnabled(QVariant defaultValue, QSettings* settings =
new QSettings);
40 void installButtonClicked(QAbstractButton* button, QString filePath);
41 void linkActivated(QString link);
45 void onButtonCustomInstall();
56 void replaceAppVars(QString&
string);
57 QString generateChangelogDocument();
59 void disableButtons(
bool disable =
true);
61 void setupLoadingUi();
63 void setupChangelogUi();
64 void setupNoUpdatesUi();
65 void adjustDialogSize();
68 virtual void startUpdate();
71 bool isDownloadFinished;
72 QString updateFilePath;
73 QList<Release> releases;
74 QList<Release> updates;
76 QList<QAbstractButton*> installButtons;
77 QAbstractButton* acceptedInstallButton;
78 bool _openExternalLinks;
81 QString _previousVersion;
83 static void setSettingsValue(QString key, QVariant value, QSettings* settings =
new QSettings());
84 static QVariant settingsValue(QString key, QVariant defaultValue = QVariant(), QSettings* settings =
new QSettings());
85 static void removeSetting(QString key, QSettings* settings =
new QSettings());
86 static void setDefaultSettingsValue(QString key, QVariant value, QSettings* settings =
new QSettings());
89 void handleFeedReady();
90 void handleDownloadFinished();
91 void handleDownloadError(QString);
92 void updateProgressBar(qint64, qint64);
93 void autoDownloadCheckboxToggled(
bool enabled =
true);
94 void onLinkActivated(QString link);
99 #endif // DBLSQD_UPDATE_DIALOG_H Type
This flag determines the if and when the UpdateDialog is displayed automatically. ...
Definition: update_dialog.h:19
A dialog class for displaying and downloading update information.
Definition: update_dialog.h:14
The Feed class provides methods for accessing DBLSQD Feeds and downloading Releases.
Definition: feed.h:10
void addInstallButton(QAbstractButton *button)
Adds a custom button for handling update installation.
Definition: update_dialog.cpp:175
void skip()
Skips the latest retrieved Release.
Definition: update_dialog.cpp:245
void showIfUpdatesAvailableOrQuit()
Shows the dialog if there are updates available or quits the application.
Definition: update_dialog.cpp:269
Definition: ui_update_dialog.h:311
bool openExternalLinks()
Definition: update_dialog.cpp:193
void onButtonInstall()
Default handler for the install button.
Definition: update_dialog.cpp:215
void setPreviousVersion(QString version)
Convenience method for setting minimum and maximum version to be displayed in the changelog...
Definition: update_dialog.cpp:160
void showIfUpdatesAvailable()
Shows the dialog if there are available updates.
Definition: update_dialog.cpp:258
static bool autoDownloadEnabled(QVariant defaultValue, QSettings *settings=new QSettings)
Returns true if automatic downloads are enabled.
Definition: update_dialog.cpp:317
static void enableAutoDownload(bool enabled, QSettings *settings=new QSettings)
Enables or disables automatic downloads.
Definition: update_dialog.cpp:308
void setMinVersion(QString version)
Sets the minimum version to be displayed in the changelog. Defaults to QApplication::applicationVersi...
Definition: update_dialog.cpp:141
void setOpenExternalLinks(bool open)
Definition: update_dialog.cpp:200
void setMaxVersion(QString version)
Sets the maximum version to be displayed in the changelog.
Definition: update_dialog.cpp:150
This class is used to represent information about a single Release from a Feed.
Definition: release.h:10
UpdateDialog(Feed *feed, int=OnUpdateAvailable, QWidget *parent=0, QSettings *settings=new QSettings())
Constructs a new UpdateDialog.
Definition: update_dialog.cpp:63