summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-31 22:26:28 +0300
committerAndrei Karas <akaras@inbox.ru>2015-10-31 22:26:28 +0300
commitec9116cd7f52e61afc4267b21e35325f4e7fc705 (patch)
tree4daea73098e216464c0de6953733080058ead1c8
parent8c11a0235e6ed4e3ed6370014cff3cd0322ed6c5 (diff)
downloadmv-ec9116cd7f52e61afc4267b21e35325f4e7fc705.tar.gz
mv-ec9116cd7f52e61afc4267b21e35325f4e7fc705.tar.bz2
mv-ec9116cd7f52e61afc4267b21e35325f4e7fc705.tar.xz
mv-ec9116cd7f52e61afc4267b21e35325f4e7fc705.zip
Add strong typed bool enum separator.
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/enums/simpletypes/separator.h28
-rw-r--r--src/gui/widgets/setupitem.cpp4
-rw-r--r--src/gui/widgets/setupitem.h5
-rw-r--r--src/gui/widgets/tabs/setup_mods.cpp3
6 files changed, 37 insertions, 5 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7032922e5..ced451f85 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1123,6 +1123,7 @@ SET(SRCS
enums/simpletypes/npcnames.h
enums/simpletypes/online.h
enums/simpletypes/protected.h
+ enums/simpletypes/separator.h
enums/simpletypes/sfx.h
enums/simpletypes/showcenter.h
enums/simpletypes/showemptyrows.h
diff --git a/src/Makefile.am b/src/Makefile.am
index d5695a327..277b33976 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -586,6 +586,7 @@ SRC += events/actionevent.h \
enums/simpletypes/npcnames.h \
enums/simpletypes/online.h \
enums/simpletypes/protected.h \
+ enums/simpletypes/separator.h \
enums/simpletypes/sfx.h \
enums/simpletypes/showcenter.h \
enums/simpletypes/showemptyrows.h \
diff --git a/src/enums/simpletypes/separator.h b/src/enums/simpletypes/separator.h
new file mode 100644
index 000000000..2de51496b
--- /dev/null
+++ b/src/enums/simpletypes/separator.h
@@ -0,0 +1,28 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2015 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_SIMPLETYPES_SEPARATOR_H
+#define ENUMS_SIMPLETYPES_SEPARATOR_H
+
+#include "enums/simpletypes/booldefines.h"
+
+defBoolEnum(Separator);
+
+#endif // ENUMS_SIMPLETYPES_SEPARATOR_H
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index 6e9e2bf96..94e6231f9 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -576,7 +576,7 @@ void SetupItemIntTextField::apply(const std::string &eventName)
SetupItemLabel::SetupItemLabel(const std::string &restrict text,
const std::string &restrict description,
SetupTabScroll *restrict const parent,
- const bool separator) :
+ const Separator separator) :
SetupItem(text, description, "", parent, "", "", MainConfig_true),
mLabel(nullptr),
mIsSeparator(separator)
@@ -593,7 +593,7 @@ SetupItemLabel::~SetupItemLabel()
void SetupItemLabel::createControls()
{
- if (mIsSeparator)
+ if (mIsSeparator == Separator_true)
{
const std::string str(" \342\200\225\342\200\225\342\200\225"
"\342\200\225\342\200\225 ");
diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h
index 80b7658ba..0d817a4b4 100644
--- a/src/gui/widgets/setupitem.h
+++ b/src/gui/widgets/setupitem.h
@@ -23,6 +23,7 @@
#include "enums/simpletypes/mainconfig.h"
#include "enums/simpletypes/usebase64.h"
+#include "enums/simpletypes/separator.h"
#include "gui/widgets/widget2.h"
@@ -284,7 +285,7 @@ class SetupItemLabel final : public SetupItem
SetupItemLabel(const std::string &restrict text,
const std::string &restrict description,
SetupTabScroll *restrict const parent,
- const bool separator = true);
+ const Separator separator = Separator_true);
A_DELETE_COPY(SetupItemLabel)
@@ -302,7 +303,7 @@ class SetupItemLabel final : public SetupItem
protected:
Label *mLabel;
- bool mIsSeparator;
+ Separator mIsSeparator;
};
class SetupItemDropDown final : public SetupItem
diff --git a/src/gui/widgets/tabs/setup_mods.cpp b/src/gui/widgets/tabs/setup_mods.cpp
index 71d1a865a..538555d04 100644
--- a/src/gui/widgets/tabs/setup_mods.cpp
+++ b/src/gui/widgets/tabs/setup_mods.cpp
@@ -74,7 +74,8 @@ void Setup_Mods::loadMods()
if (mods.empty())
{
// TRANSLATORS: settings label
- new SetupItemLabel(_("No mods present"), "", this, false);
+ new SetupItemLabel(_("No mods present"), "", this,
+ Separator_false);
return;
}