summaryrefslogtreecommitdiffstats
path: root/logic/notifications/NotificationChecker.h
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-02-04 21:10:10 +0100
committerPetr Mrázek <peterix@gmail.com>2015-04-12 20:57:17 +0200
commit141e0a02a0a0c4bbc4cc2e900560db5048366104 (patch)
treed61b0ac7fedc656d2906f084b9a384b8047e8617 /logic/notifications/NotificationChecker.h
parent473971b6e7a79ed38fa68dffacd207fda874fdc0 (diff)
downloadMultiMC-141e0a02a0a0c4bbc4cc2e900560db5048366104.tar
MultiMC-141e0a02a0a0c4bbc4cc2e900560db5048366104.tar.gz
MultiMC-141e0a02a0a0c4bbc4cc2e900560db5048366104.tar.lz
MultiMC-141e0a02a0a0c4bbc4cc2e900560db5048366104.tar.xz
MultiMC-141e0a02a0a0c4bbc4cc2e900560db5048366104.zip
SCRATCH move things to the right places
Diffstat (limited to 'logic/notifications/NotificationChecker.h')
-rw-r--r--logic/notifications/NotificationChecker.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/logic/notifications/NotificationChecker.h b/logic/notifications/NotificationChecker.h
new file mode 100644
index 00000000..915ee54d
--- /dev/null
+++ b/logic/notifications/NotificationChecker.h
@@ -0,0 +1,54 @@
+#pragma once
+
+#include <QObject>
+
+#include "logic/net/NetJob.h"
+#include "logic/net/CacheDownload.h"
+
+class NotificationChecker : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit NotificationChecker(QObject *parent = 0);
+
+ QUrl notificationsUrl() const;
+ void setNotificationsUrl(const QUrl &notificationsUrl);
+
+ struct NotificationEntry
+ {
+ int id;
+ QString message;
+ enum
+ {
+ Critical,
+ Warning,
+ Information
+ } type;
+ QString channel;
+ QString platform;
+ QString from;
+ QString to;
+ bool applies() const;
+ static bool versionLessThan(const QString &v1, const QString &v2);
+ };
+
+ QList<NotificationEntry> notificationEntries() const;
+
+public
+slots:
+ void checkForNotifications();
+
+private
+slots:
+ void downloadSucceeded(int);
+
+signals:
+ void notificationCheckFinished();
+
+private:
+ QList<NotificationEntry> m_entries;
+ QUrl m_notificationsUrl;
+ NetJobPtr m_checkJob;
+ CacheDownloadPtr m_download;
+};