Sandboxie/SandboxiePlus/SandMan/OnlineUpdater.h

62 lines
1.4 KiB
C
Raw Normal View History

2022-08-09 17:19:46 +01:00
#pragma once
#include <QObject>
#include "../MiscHelpers/Common/NetworkAccessManager.h"
#include "SbiePlusAPI.h"
2022-08-11 23:09:35 +01:00
class CGetUpdatesJob : public QObject
{
Q_OBJECT
protected:
friend class COnlineUpdater;
CGetUpdatesJob(const QVariantMap& Params, QObject* parent = nullptr) : QObject(parent) { m_Params = Params; }
virtual ~CGetUpdatesJob() {}
QVariantMap m_Params;
signals:
void UpdateData(const QVariantMap& Data, const QVariantMap& Params);
};
2022-08-09 17:19:46 +01:00
class COnlineUpdater : public QObject
{
Q_OBJECT
public:
COnlineUpdater(QObject* parent);
static COnlineUpdater* Instance();
static void Process();
2022-08-11 23:09:35 +01:00
void GetUpdates(QObject* receiver, const char* member, const QVariantMap& Params = QVariantMap());
2022-08-22 20:06:43 +01:00
void DownloadUpdate();
2022-08-09 17:19:46 +01:00
void InstallUpdate();
void UpdateCert();
2022-08-22 20:06:43 +01:00
void CheckPendingUpdate();
void CheckForUpdates(bool bManual = true, bool bDownload = false);
2022-08-09 17:19:46 +01:00
void DownloadUpdates(const QString& DownloadUrl, bool bManual);
private slots:
2022-08-11 23:09:35 +01:00
void OnUpdateData(const QVariantMap& Data, const QVariantMap& Params);
2022-08-09 17:19:46 +01:00
void OnUpdateCheck();
void OnUpdateProgress(qint64 bytes, qint64 bytesTotal);
void OnUpdateDownload();
void OnCertCheck();
protected:
2022-08-22 20:06:43 +01:00
bool IsVersionNewer(const QString& VersionStr);
2022-08-09 17:19:46 +01:00
CNetworkAccessManager* m_RequestManager;
CSbieProgressPtr m_pUpdateProgress;
2022-08-11 23:09:35 +01:00
QMap<QNetworkReply*, CGetUpdatesJob*> m_JobQueue;
2022-08-09 17:19:46 +01:00
};