mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
bf5a5b839c
https://github.com/Neargye/semver * Use semver library for version downgrade checking * Add test validating our current version is valid semver
55 lines
1.1 KiB
C++
55 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <pajlada/signals/signal.hpp>
|
|
#include <QString>
|
|
|
|
namespace chatterino {
|
|
|
|
class Updates
|
|
{
|
|
Updates();
|
|
|
|
public:
|
|
enum Status {
|
|
None,
|
|
Searching,
|
|
UpdateAvailable,
|
|
NoUpdateAvailable,
|
|
SearchFailed,
|
|
Downloading,
|
|
DownloadFailed,
|
|
WriteFileFailed,
|
|
};
|
|
|
|
// fourtf: don't add this class to the application class
|
|
static Updates &instance();
|
|
|
|
static bool isDowngradeOf(const QString &online, const QString ¤t);
|
|
|
|
void checkForUpdates();
|
|
const QString &getCurrentVersion() const;
|
|
const QString &getOnlineVersion() const;
|
|
void installUpdates();
|
|
Status getStatus() const;
|
|
|
|
bool shouldShowUpdateButton() const;
|
|
bool isError() const;
|
|
bool isDowngrade() const;
|
|
|
|
pajlada::Signals::Signal<Status> statusUpdated;
|
|
|
|
private:
|
|
QString currentVersion_;
|
|
QString onlineVersion_;
|
|
Status status_ = None;
|
|
bool isDowngrade_{};
|
|
|
|
QString updateExe_;
|
|
QString updatePortable_;
|
|
QString updateGuideLink_;
|
|
|
|
void setStatus_(Status status);
|
|
};
|
|
|
|
} // namespace chatterino
|