summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-06-01 17:48:11 +0300
committerAndrei Karas <akaras@inbox.ru>2015-06-01 17:48:11 +0300
commit6b15e62c1fefe8838bbc56cb314f3ab24ccebbc4 (patch)
treed158a975756cdd5983632af8ff34229dbb9007d9
parent41d9ca028de0740fd23a3dabaece8d1fd1bf93c1 (diff)
downloadmanaverse-6b15e62c1fefe8838bbc56cb314f3ab24ccebbc4.tar.gz
manaverse-6b15e62c1fefe8838bbc56cb314f3ab24ccebbc4.tar.bz2
manaverse-6b15e62c1fefe8838bbc56cb314f3ab24ccebbc4.tar.xz
manaverse-6b15e62c1fefe8838bbc56cb314f3ab24ccebbc4.zip
Convert DownloadStatus enum into strong typed enum.
-rw-r--r--src/actions/actions.cpp2
-rw-r--r--src/enums/net/downloadstatus.h22
-rw-r--r--src/gui/windows/serverdialog.cpp6
-rw-r--r--src/gui/windows/serverdialog.h6
-rw-r--r--src/gui/windows/updaterwindow.cpp6
-rw-r--r--src/gui/windows/updaterwindow.h6
-rw-r--r--src/net/download.h6
7 files changed, 32 insertions, 22 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index a3c17cb1d..66ad410ee 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -118,7 +118,7 @@ namespace Actions
{
static int uploadUpdate(void *ptr,
- DownloadStatus::Type status,
+ DownloadStatusT status,
size_t total A_UNUSED,
size_t remaining A_UNUSED)
{
diff --git a/src/enums/net/downloadstatus.h b/src/enums/net/downloadstatus.h
index a217e7a78..9a4730fba 100644
--- a/src/enums/net/downloadstatus.h
+++ b/src/enums/net/downloadstatus.h
@@ -22,17 +22,17 @@
#ifndef ENUMS_NET_DOWNLOADSTATUS_H
#define ENUMS_NET_DOWNLOADSTATUS_H
-namespace DownloadStatus
+#include "enums/simpletypes/enumdefines.h"
+
+enumStart(DownloadStatus)
{
- enum Type
- {
- Cancelled = -3,
- ThreadError = -2,
- Error = -1,
- Starting = 0,
- Idle = 1,
- Complete = 2
- };
-} // namespace DownloadStatus
+ Cancelled = -3,
+ ThreadError = -2,
+ Error = -1,
+ Starting = 0,
+ Idle = 1,
+ Complete = 2
+}
+enumEnd(DownloadStatus);
#endif // ENUMS_NET_DOWNLOADSTATUS_H
diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp
index 26b12b0d1..8bd1dceb3 100644
--- a/src/gui/windows/serverdialog.cpp
+++ b/src/gui/windows/serverdialog.cpp
@@ -701,8 +701,10 @@ void ServerDialog::saveCustomServers(const ServerInfo &currentServer,
config.setValue("MostUsedServerName" + toString(savedServerCount), "");
}
-int ServerDialog::downloadUpdate(void *ptr, DownloadStatus::Type status,
- size_t total, size_t remaining)
+int ServerDialog::downloadUpdate(void *ptr,
+ DownloadStatusT status,
+ size_t total,
+ size_t remaining)
{
if (!ptr || status == DownloadStatus::Cancelled)
return -1;
diff --git a/src/gui/windows/serverdialog.h b/src/gui/windows/serverdialog.h
index e64177591..59105dd47 100644
--- a/src/gui/windows/serverdialog.h
+++ b/src/gui/windows/serverdialog.h
@@ -118,8 +118,10 @@ class ServerDialog final : public Window,
bool needUpdateServers() const;
- static int downloadUpdate(void *ptr, DownloadStatus::Type status,
- size_t total, size_t remaining);
+ static int downloadUpdate(void *ptr,
+ DownloadStatusT status,
+ size_t total,
+ size_t remaining);
Mutex mMutex;
ServerInfos mServers;
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp
index 1a6a75093..b8ead9549 100644
--- a/src/gui/windows/updaterwindow.cpp
+++ b/src/gui/windows/updaterwindow.cpp
@@ -478,8 +478,10 @@ void UpdaterWindow::loadPatch()
mScrollArea->setVerticalScrollAmount(0);
}
-int UpdaterWindow::updateProgress(void *ptr, DownloadStatus::Type status,
- size_t dt, size_t dn)
+int UpdaterWindow::updateProgress(void *ptr,
+ DownloadStatusT status,
+ size_t dt,
+ size_t dn)
{
UpdaterWindow *const uw = reinterpret_cast<UpdaterWindow *>(ptr);
if (!uw)
diff --git a/src/gui/windows/updaterwindow.h b/src/gui/windows/updaterwindow.h
index 93922a7a9..06f707528 100644
--- a/src/gui/windows/updaterwindow.h
+++ b/src/gui/windows/updaterwindow.h
@@ -158,8 +158,10 @@ class UpdaterWindow final : public Window,
/**
* A download callback for progress updates.
*/
- static int updateProgress(void *ptr, DownloadStatus::Type status,
- size_t dt, size_t dn);
+ static int updateProgress(void *ptr,
+ DownloadStatusT status,
+ size_t dt,
+ size_t dn);
/**
* A libcurl callback for writing to memory.
diff --git a/src/net/download.h b/src/net/download.h
index c4cd8bbca..ed7c2580d 100644
--- a/src/net/download.h
+++ b/src/net/download.h
@@ -29,8 +29,10 @@
#include "localconsts.h"
-typedef int (*DownloadUpdate)(void *ptr, DownloadStatus::Type status,
- size_t total, size_t remaining);
+typedef int (*DownloadUpdate)(void *ptr,
+ DownloadStatusT status,
+ size_t total,
+ size_t remaining);
// Matches what CURL expects
typedef size_t (*WriteFunction)( void *ptr, size_t size, size_t nmemb,