summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/enums/gui/serverdialogdonwloadstatus.h40
-rw-r--r--src/gui/windows/serverdialog.cpp20
-rw-r--r--src/gui/windows/serverdialog.h15
5 files changed, 55 insertions, 22 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f3f8608c9..a6c964f07 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1254,6 +1254,7 @@ SET(SRCS
enums/gui/dialogtype.h
enums/gui/gradienttype.h
enums/gui/progresscolorid.h
+ enums/gui/serverdialogdonwloadstatus.h
enums/gui/themecolorid.h
enums/gui/usercolorid.h
listeners/errorlistener.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index 3ba8baefe..a8b7c604a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -108,6 +108,7 @@ SRC += events/actionevent.h \
enums/gui/dialogtype.h \
enums/gui/gradienttype.h \
enums/gui/progresscolorid.h \
+ enums/gui/serverdialogdonwloadstatus.h \
enums/gui/themecolorid.h \
enums/gui/usercolorid.h \
listeners/errorlistener.cpp \
diff --git a/src/enums/gui/serverdialogdonwloadstatus.h b/src/enums/gui/serverdialogdonwloadstatus.h
new file mode 100644
index 000000000..9038e9886
--- /dev/null
+++ b/src/enums/gui/serverdialogdonwloadstatus.h
@@ -0,0 +1,40 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2004-2009 The Mana World Development Team
+ * Copyright (C) 2009-2010 The Mana Developers
+ * Copyright (C) 2011-2016 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef ENUMS_GUI_SERVERDIALOGDOWNLOADSTATUS_H
+#define ENUMS_GUI_SERVERDIALOGDOWNLOADSTATUS_H
+
+#include "enums/simpletypes/enumdefines.h"
+
+enumStart(ServerDialogDownloadStatus)
+{
+ UNKNOWN = 0,
+ ERROR,
+ PREPARING,
+ IDLE,
+ IN_PROGRESS,
+ COMPLETE,
+ OVER
+}
+enumEnd(ServerDialogDownloadStatus);
+
+#endif // ENUMS_GUI_SERVERDIALOGDOWNLOADSTATUS_H
diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp
index 82d44c1b0..93512e053 100644
--- a/src/gui/windows/serverdialog.cpp
+++ b/src/gui/windows/serverdialog.cpp
@@ -123,7 +123,7 @@ ServerDialog::ServerDialog(ServerInfo *const serverInfo,
mServerInfo(serverInfo),
mPersistentIPCheckBox(nullptr),
mDownloadProgress(-1.0F),
- mDownloadStatus(DOWNLOADING_UNKNOWN)
+ mDownloadStatus(ServerDialogDownloadStatus::UNKNOWN)
{
if (isSafeMode)
{
@@ -390,28 +390,28 @@ void ServerDialog::logic()
BLOCK_START("ServerDialog::logic")
{
MutexLocker tempLock(&mMutex);
- if (mDownloadStatus == DOWNLOADING_COMPLETE)
+ if (mDownloadStatus == ServerDialogDownloadStatus::COMPLETE)
{
- mDownloadStatus = DOWNLOADING_OVER;
+ mDownloadStatus = ServerDialogDownloadStatus::OVER;
mDescription->setCaption(std::string());
}
- else if (mDownloadStatus == DOWNLOADING_IN_PROGRESS)
+ else if (mDownloadStatus == ServerDialogDownloadStatus::IN_PROGRESS)
{
// TRANSLATORS: servers dialog label
mDescription->setCaption(strprintf(_("Downloading server list..."
"%2.2f%%"), static_cast<double>(mDownloadProgress * 100)));
}
- else if (mDownloadStatus == DOWNLOADING_IDLE)
+ else if (mDownloadStatus == ServerDialogDownloadStatus::IDLE)
{
// TRANSLATORS: servers dialog label
mDescription->setCaption(_("Waiting for server..."));
}
- else if (mDownloadStatus == DOWNLOADING_PREPARING)
+ else if (mDownloadStatus == ServerDialogDownloadStatus::PREPARING)
{
// TRANSLATORS: servers dialog label
mDescription->setCaption(_("Preparing download"));
}
- else if (mDownloadStatus == DOWNLOADING_ERROR)
+ else if (mDownloadStatus == ServerDialogDownloadStatus::ERROR)
{
// TRANSLATORS: servers dialog label
mDescription->setCaption(_("Error retreiving server list!"));
@@ -764,7 +764,7 @@ int ServerDialog::downloadUpdate(void *ptr,
{
logger->log("Error retreiving server list: %s\n",
sd->mDownload->getError());
- sd->mDownloadStatus = DOWNLOADING_ERROR;
+ sd->mDownloadStatus = ServerDialogDownloadStatus::ERROR;
}
else
{
@@ -778,7 +778,7 @@ int ServerDialog::downloadUpdate(void *ptr,
progress = 1.0F;
MutexLocker lock1(&sd->mMutex);
- sd->mDownloadStatus = DOWNLOADING_IN_PROGRESS;
+ sd->mDownloadStatus = ServerDialogDownloadStatus::IN_PROGRESS;
sd->mDownloadProgress = progress;
}
@@ -786,7 +786,7 @@ int ServerDialog::downloadUpdate(void *ptr,
{
sd->loadServers();
MutexLocker lock1(&sd->mMutex);
- sd->mDownloadStatus = DOWNLOADING_COMPLETE;
+ sd->mDownloadStatus = ServerDialogDownloadStatus::COMPLETE;
}
return 0;
diff --git a/src/gui/windows/serverdialog.h b/src/gui/windows/serverdialog.h
index 348f1f1f0..e273b7809 100644
--- a/src/gui/windows/serverdialog.h
+++ b/src/gui/windows/serverdialog.h
@@ -25,6 +25,8 @@
#include "gui/widgets/window.h"
+#include "enums/gui/serverdialogdonwloadstatus.h"
+
#include "enums/net/downloadstatus.h"
#include "net/serverinfo.h"
@@ -136,23 +138,12 @@ class ServerDialog final : public Window,
ServersListModel *mServersListModel A_NONNULLPOINTER;
ListBox *mServersList A_NONNULLPOINTER;
- enum ServerDialogDownloadStatus
- {
- DOWNLOADING_UNKNOWN = 0,
- DOWNLOADING_ERROR,
- DOWNLOADING_PREPARING,
- DOWNLOADING_IDLE,
- DOWNLOADING_IN_PROGRESS,
- DOWNLOADING_COMPLETE,
- DOWNLOADING_OVER
- };
-
/** Status of the current download. */
Net::Download *mDownload;
ServerInfo *mServerInfo;
CheckBox *mPersistentIPCheckBox;
float mDownloadProgress;
- ServerDialogDownloadStatus mDownloadStatus;
+ ServerDialogDownloadStatusT mDownloadStatus;
};
#endif // GUI_WINDOWS_SERVERDIALOG_H