aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/Library/ml_wire/DownloadStatus.h
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Plugins/Library/ml_wire/DownloadStatus.h
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'Src/Plugins/Library/ml_wire/DownloadStatus.h')
-rw-r--r--Src/Plugins/Library/ml_wire/DownloadStatus.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/Src/Plugins/Library/ml_wire/DownloadStatus.h b/Src/Plugins/Library/ml_wire/DownloadStatus.h
new file mode 100644
index 00000000..be3dd896
--- /dev/null
+++ b/Src/Plugins/Library/ml_wire/DownloadStatus.h
@@ -0,0 +1,41 @@
+#ifndef NULLSOFT_DOWNLOADSTATUSH
+#define NULLSOFT_DOWNLOADSTATUSH
+
+#include "../nu/AutoLock.h"
+#include <map>
+
+
+class DownloadStatus
+{
+public:
+ class Status
+ {
+ public:
+ Status();
+ ~Status();
+ const Status &operator =(const Status &copy);
+ Status(size_t _downloaded, size_t _maxSize, const wchar_t *channel, const wchar_t *item, const wchar_t *path);
+ size_t downloaded, maxSize;
+
+ int killswitch;
+ wchar_t *channel;
+ wchar_t *item;
+ wchar_t *path;
+ private:
+
+ void Init();
+ void Reset();
+ };
+
+ void AddDownloadThread(DownloadToken token, const wchar_t *channel, const wchar_t *item, const wchar_t *path);
+ void DownloadThreadDone(DownloadToken token);
+ bool UpdateStatus(DownloadToken token, size_t downloaded, size_t maxSize);
+ bool CurrentlyDownloading();
+ void GetStatusString(wchar_t *status, size_t len);
+ typedef std::map<DownloadToken, Status> Downloads;
+ Downloads downloads;
+ Nullsoft::Utility::LockGuard statusLock;
+};
+
+extern DownloadStatus downloadStatus;
+#endif \ No newline at end of file