QSimpleUpdater
A simple auto-updater system for Qt applications
QSimpleUpdater.h
1 /*
2  * Copyright (c) 2014-2016 Alex Spataru <alex_spataru@outlook.com>
3  *
4  * This file is part of the QSimpleUpdater library, which is released under
5  * the DBAD license, you can read a copy of it below:
6  *
7  * DON'T BE A DICK PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING,
8  * DISTRIBUTION AND MODIFICATION:
9  *
10  * Do whatever you like with the original work, just don't be a dick.
11  * Being a dick includes - but is not limited to - the following instances:
12  *
13  * 1a. Outright copyright infringement - Don't just copy this and change the
14  * name.
15  * 1b. Selling the unmodified original with no work done what-so-ever, that's
16  * REALLY being a dick.
17  * 1c. Modifying the original work to contain hidden harmful content.
18  * That would make you a PROPER dick.
19  *
20  * If you become rich through modifications, related works/services, or
21  * supporting the original work, share the love.
22  * Only a dick would make loads off this work and not buy the original works
23  * creator(s) a pint.
24  *
25  * Code is provided with no warranty. Using somebody else's code and bitching
26  * when it goes wrong makes you a DONKEY dick.
27  * Fix the problem yourself. A non-dick would submit the fix back.
28  */
29 
30 #ifndef _QSIMPLEUPDATER_MAIN_H
31 #define _QSIMPLEUPDATER_MAIN_H
32 
33 #include <QUrl>
34 #include <QList>
35 #include <QObject>
36 
37 #if defined (QSU_SHARED)
38  #define QSU_DECL Q_DECL_EXPORT
39 #elif defined (QSU_IMPORT)
40  #define QSU_DECL Q_DECL_IMPORT
41 #else
42  #define QSU_DECL
43 #endif
44 
45 class Updater;
46 
66 class QSU_DECL QSimpleUpdater : public QObject {
67  Q_OBJECT
68 
69  signals:
70  void checkingFinished (const QString& url);
71  void downloadFinished (const QString& url, const QString& filepath);
72 
73  public:
74  static QSimpleUpdater* getInstance();
75 
76  bool getNotifyOnUpdate (const QString& url) const;
77  bool getNotifyOnFinish (const QString& url) const;
78  bool getUpdateAvailable (const QString& url) const;
79  bool getDownloaderEnabled (const QString& url) const;
80  bool usesCustomInstallProcedures (const QString& url) const;
81 
82  QString getChangelog (const QString& url) const;
83  QString getModuleName (const QString& url) const;
84  QString getDownloadUrl (const QString& url) const;
85  QString getPlatformKey (const QString& url) const;
86  QString getLatestVersion (const QString& url) const;
87  QString getModuleVersion (const QString& url) const;
88 
89  public slots:
90  void checkForUpdates (const QString& url);
91  void setModuleName (const QString& url, const QString& name);
92  void setNotifyOnUpdate (const QString& url, const bool& notify);
93  void setNotifyOnFinish (const QString& url, const bool& notify);
94  void setPlatformKey (const QString& url, const QString& platform);
95  void setModuleVersion (const QString& url, const QString& version);
96  void setDownloaderEnabled (const QString& url, const bool& enabled);
97  void setUseCustomInstallProcedures (const QString& url, const bool& custom);
98 
99  protected:
100  ~QSimpleUpdater();
101 
102  private:
103  Updater* getUpdater (const QString& url) const;
104 };
105 
106 #endif
Downloads and interprests the update definition file.
Definition: Updater.h:45
Manages the updater instances.
Definition: QSimpleUpdater.h:66