2018-04-19 22:16:55 +02:00
|
|
|
#pragma once
|
|
|
|
|
2018-05-06 14:16:41 +02:00
|
|
|
#include <QString>
|
2018-04-19 22:16:55 +02:00
|
|
|
#include <pajlada/signals/signal.hpp>
|
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
namespace singletons {
|
|
|
|
|
|
|
|
class UpdateManager
|
|
|
|
{
|
|
|
|
UpdateManager();
|
|
|
|
|
|
|
|
public:
|
2018-06-21 22:02:35 +02:00
|
|
|
enum UpdateStatus {
|
|
|
|
None,
|
|
|
|
Searching,
|
|
|
|
UpdateAvailable,
|
|
|
|
NoUpdateAvailable,
|
|
|
|
SearchFailed,
|
|
|
|
Downloading,
|
|
|
|
DownloadFailed,
|
|
|
|
WriteFileFailed,
|
|
|
|
};
|
2018-06-01 14:20:46 +02:00
|
|
|
|
|
|
|
// fourtf: don't add this class to the application class
|
2018-04-19 22:16:55 +02:00
|
|
|
static UpdateManager &getInstance();
|
|
|
|
|
|
|
|
void checkForUpdates();
|
|
|
|
const QString &getCurrentVersion() const;
|
|
|
|
const QString &getOnlineVersion() const;
|
2018-06-01 14:20:46 +02:00
|
|
|
void installUpdates();
|
|
|
|
UpdateStatus getStatus() const;
|
2018-04-19 22:16:55 +02:00
|
|
|
|
2018-06-01 14:20:46 +02:00
|
|
|
pajlada::Signals::Signal<UpdateStatus> statusUpdated;
|
2018-04-19 22:16:55 +02:00
|
|
|
|
|
|
|
private:
|
2018-06-01 14:20:46 +02:00
|
|
|
QString currentVersion_;
|
|
|
|
QString onlineVersion_;
|
|
|
|
UpdateStatus status_ = None;
|
|
|
|
|
2018-06-21 22:02:35 +02:00
|
|
|
QString updateUrl_;
|
|
|
|
|
2018-06-01 14:20:46 +02:00
|
|
|
void setStatus_(UpdateStatus status);
|
2018-04-19 22:16:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace singletons
|
|
|
|
} // namespace chatterino
|