Make openUrl() public

This commit is contained in:
Alex Spataru 2016-10-22 14:40:37 -05:00
parent 388ca91143
commit a47c3b346e
4 changed files with 27 additions and 2 deletions

View File

@ -79,6 +79,7 @@ class QSU_DECL QSimpleUpdater : public QObject {
bool getDownloaderEnabled (const QString& url) const;
bool usesCustomInstallProcedures (const QString& url) const;
QString getOpenUrl (const QString& url) const;
QString getChangelog (const QString& url) const;
QString getModuleName (const QString& url) const;
QString getDownloadUrl (const QString& url) const;

View File

@ -106,6 +106,19 @@ bool QSimpleUpdater::usesCustomInstallProcedures (const QString& url) const {
return getUpdater (url)->useCustomInstallProcedures();
}
/**
* Returns the URL to open in a web browser of the \c Updater instance
* registered with the given \a url.
*
* \note If the module name is empty, then the \c Updater will use the
* application name as its module name.
* \note If an \c Updater instance registered with the given \a url is not
* found, that \c Updater instance will be initialized automatically
*/
QString QSimpleUpdater::getOpenUrl (const QString &url) const {
return getUpdater (url)->openUrl();
}
/**
* Returns the changelog of the \c Updater instance registered with the given
* \a url.

View File

@ -82,6 +82,16 @@ QString Updater::url() const {
return m_url;
}
/**
* Returns the URL that the update definitions file wants us to open in
* a web browser.
*
* \warning You should call \c checkForUpdates() before using this functio
*/
QString Updater::openUrl() const {
return m_openUrl;
}
/**
* Returns the changelog defined by the update definitions file.
* \warning You should call \c checkForUpdates() before using this function
@ -308,8 +318,8 @@ void Updater::setUpdateAvailable (const bool& available) {
box.setDefaultButton (QMessageBox::Yes);
if (box.exec() == QMessageBox::Yes) {
if (!m_openUrl.isEmpty())
QDesktopServices::openUrl (QUrl (m_openUrl));
if (!openUrl().isEmpty())
QDesktopServices::openUrl (QUrl (openUrl()));
else if (downloaderEnabled())
m_downloader->startDownload (QUrl (downloadUrl()));

View File

@ -54,6 +54,7 @@ class QSU_DECL Updater : public QObject {
~Updater();
QString url() const;
QString openUrl() const;
QString changelog() const;
QString moduleName() const;
QString downloadUrl() const;