HulaLoop
Simple cross-platform audio loopback and recording.
Updater.h
1 #ifndef HL_UPDATER_H
2 #define HL_UPDATER_H
3 
4 #include <HulaVersion.h>
5 
6 #include <QFile>
7 #include <QNetworkAccessManager>
8 #include <QNetworkReply>
9 #include <QObject>
10 
11 namespace hula
12 {
13  class Updater : public QObject {
14  Q_OBJECT
15  Q_PROPERTY(QString updateHostUrl READ getUpdateHost WRITE setUpdateHost)
16  Q_PROPERTY(qint64 downloadSize READ getDownloadSize)
17  Q_PROPERTY(qint64 numBytesDownloaded READ getNumBytesDownloaded)
18 
19  private:
20  QNetworkAccessManager *manager;
21  QNetworkReply *reply;
22  QFile *file;
23 
24  QString updateHostUrl;
25  QString downloadHostUrl;
26  QString downloadFileName;
27 
28  qint64 numBytesDownloaded;
29  qint64 downloadSize;
30 
31  public:
32  explicit Updater(QObject *parent = nullptr);
33  ~Updater();
34 
35  void setUpdateHost(QString);
36  QString getUpdateHost();
37 
38  QString getDownloadFileName();
39  qint64 getNumBytesDownloaded();
40  qint64 getDownloadSize();
41 
42  QList<int> parseTagName(const QString &);
43 
44  Q_INVOKABLE bool checkForUpdate();
45  Q_INVOKABLE bool downloadUpdate();
46 
47  Q_INVOKABLE void startHulaLoopInstaller();
48  Q_INVOKABLE void startHulaLoopApp();
49 
50  signals:
51  void bytesDownloaded();
52 
53  };
54 }
55 
56 #endif // HL_UPDATER_H
Updater(QObject *parent=nullptr)
Construct a new instance of the Updater class.
Definition: Updater.cpp:22
QString getDownloadFileName()
Method to check the downloaded file name.
Definition: Updater.cpp:61
void setUpdateHost(QString)
Sets the update host for the Updater.
Definition: Updater.cpp:41
Q_INVOKABLE bool checkForUpdate()
Creates the network request using the updateHostUrl.
Definition: Updater.cpp:124
Q_INVOKABLE void startHulaLoopInstaller()
Opens the HulaLoop installer application.
Definition: Updater.cpp:296
qint64 getNumBytesDownloaded()
Method to check how many bytes have been downloaded.
Definition: Updater.cpp:71
Definition: Updater.h:13
QList< int > parseTagName(const QString &)
A method to parse the tag name returned from the GitHub Releases API.
Definition: Updater.cpp:92
qint64 getDownloadSize()
Method to check the size of the download.
Definition: Updater.cpp:81
QString getUpdateHost()
Method to check the downloaded file name.
Definition: Updater.cpp:51
Definition: Controller.h:11
Q_INVOKABLE bool downloadUpdate()
Creates the network request using the downloadHostUrl.
Definition: Updater.cpp:232
Q_INVOKABLE void startHulaLoopApp()
Opens the HulaLoop application.
Definition: Updater.cpp:314
~Updater()
Destroys the Updater object.
Definition: Updater.cpp:331