summaryrefslogtreecommitdiff
path: root/ui/updateinfo.h
diff options
context:
space:
mode:
authorkat <kat@vector35.com>2024-02-06 19:28:16 -0500
committerkat <kat@vector35.com>2024-02-06 19:28:16 -0500
commit75ee61e20cea015448771efe816b841bb2147f34 (patch)
tree846b09fffc5dc7529fafe5a8d22a3f411e2d44cb /ui/updateinfo.h
parent7264a843e47cd11aa3252bf5886719f8bda93a04 (diff)
New Tab Redesign
- Adds some fixes for Animation, an Update info support class and other small things required
Diffstat (limited to 'ui/updateinfo.h')
-rw-r--r--ui/updateinfo.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/ui/updateinfo.h b/ui/updateinfo.h
new file mode 100644
index 00000000..55102870
--- /dev/null
+++ b/ui/updateinfo.h
@@ -0,0 +1,70 @@
+#pragma once
+
+#include "uitypes.h"
+#include <QString>
+#include <QObject>
+#include <QVersionNumber>
+#include <QDateTime>
+#include "binaryninjaapi.h"
+
+class BINARYNINJAUIAPI UpdateInfoFetcher : public QObject
+{
+ Q_OBJECT
+
+public:
+ struct Version
+ {
+ QString versionStringToGiveToMainWindow;
+ QVersionNumber version;
+ QDateTime date;
+ bool isCurrent = false;
+ Version(BNUpdateVersionNew);
+ };
+ struct ChangelogEntryItem
+ {
+ QString author;
+ QString commit;
+ QString body;
+ ChangelogEntryItem(const QString& author = "", const QString& commit = "", const QString& body = "")
+ : author(author), commit(commit), body(body) {};
+ /// In-struct cache for wrapped text
+ mutable QString bodyWrapCache;
+ };
+ struct ChangelogEntry
+ {
+ QVersionNumber version;
+ QDateTime date;
+ bool isNew = false;
+ std::vector<ChangelogEntryItem> entryItems;
+ ChangelogEntry(BNChangelogEntry);
+ };
+ struct Channel
+ {
+ QString name;
+ QString description;
+ std::vector<Version> versions;
+ std::vector<ChangelogEntry> changelog;
+ Channel(BNUpdateChannelFullInfo);
+ Channel() {};
+ };
+ enum FetchError
+ {
+ NoError,
+ ConnectionError,
+ DeserError
+ };
+
+private:
+ std::vector<Channel> m_channels;
+ std::mutex m_infoMutex;
+ std::atomic<bool> m_done = false;
+
+public:
+ UpdateInfoFetcher() {};
+ bool done() { return m_done; }
+ void startFetch();
+ const std::vector<Channel>& getChannels();
+ const Channel* getActiveChannel();
+signals:
+ void fetchCompleted(const FetchError& error);
+}; \ No newline at end of file