summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-04-21 18:06:43 +0300
committerAndrei Karas <akaras@inbox.ru>2016-04-21 18:06:43 +0300
commit20727e946194e9bf984fc9b4dd7687a59fc82fc1 (patch)
tree41ab0b6e2cc11be61c7306966815f6a821d905c3
parente787d4c803476b5d5969dd8578cb8a645a7443cb (diff)
downloadmv-20727e946194e9bf984fc9b4dd7687a59fc82fc1.tar.gz
mv-20727e946194e9bf984fc9b4dd7687a59fc82fc1.tar.bz2
mv-20727e946194e9bf984fc9b4dd7687a59fc82fc1.tar.xz
mv-20727e946194e9bf984fc9b4dd7687a59fc82fc1.zip
Convert chattabtype into strong typed enum.
-rw-r--r--src/enums/gui/chattabtype.h32
-rw-r--r--src/gui/popups/popupmenu.cpp4
-rw-r--r--src/gui/widgets/tabs/chat/chattab.cpp2
-rw-r--r--src/gui/widgets/tabs/chat/chattab.h6
-rw-r--r--src/gui/windows/chatwindow.cpp4
-rw-r--r--src/gui/windows/chatwindow.h2
6 files changed, 25 insertions, 25 deletions
diff --git a/src/enums/gui/chattabtype.h b/src/enums/gui/chattabtype.h
index 54f42e6cc..6bc92309e 100644
--- a/src/enums/gui/chattabtype.h
+++ b/src/enums/gui/chattabtype.h
@@ -21,22 +21,22 @@
#ifndef ENUMS_GUI_CHATTABTYPE_H
#define ENUMS_GUI_CHATTABTYPE_H
-namespace ChatTabType
+#include "enums/simpletypes/enumdefines.h"
+
+enumStart(ChatTabType)
{
- enum Type
- {
- UNKNOWN = 0,
- INPUT,
- WHISPER,
- PARTY,
- GUILD,
- DEBUG,
- TRADE,
- BATTLE,
- LANG,
- GM,
- CHANNEL
- };
-} // namespace ChatTabType
+ UNKNOWN = 0,
+ INPUT,
+ WHISPER,
+ PARTY,
+ GUILD,
+ DEBUG,
+ TRADE,
+ BATTLE,
+ LANG,
+ GM,
+ CHANNEL
+}
+enumEnd(ChatTabType);
#endif // ENUMS_GUI_CHATTABTYPE_H
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 1231a03d3..18f034e67 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -818,7 +818,7 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab)
mBrowserBox->clearRows();
- const ChatTabType::Type &type = tab->getType();
+ const ChatTabTypeT &type = tab->getType();
if (type == ChatTabType::WHISPER || type == ChatTabType::CHANNEL)
{
// TRANSLATORS: popup menu item
@@ -868,7 +868,7 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab)
mBrowserBox->addRow("disable away", _("Disable away"));
}
mBrowserBox->addRow("##3---");
- if (tab->getType() == CAST_S32(ChatTabType::PARTY))
+ if (type == ChatTabType::PARTY)
{
// TRANSLATORS: popup menu item
// TRANSLATORS: enable away messages in chat tab
diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp
index 82be62c8d..3bc323e92 100644
--- a/src/gui/widgets/tabs/chat/chattab.cpp
+++ b/src/gui/widgets/tabs/chat/chattab.cpp
@@ -67,7 +67,7 @@ ChatTab::ChatTab(const Widget2 *const widget,
const std::string &name,
const std::string &channel,
const std::string &logName,
- const ChatTabType::Type &type) :
+ const ChatTabTypeT &type) :
Tab(widget),
mTextOutput(new BrowserBox(this, BrowserBox::AUTO_WRAP, true,
"browserbox.xml")),
diff --git a/src/gui/widgets/tabs/chat/chattab.h b/src/gui/widgets/tabs/chat/chattab.h
index 2d40e5769..b1a988a8e 100644
--- a/src/gui/widgets/tabs/chat/chattab.h
+++ b/src/gui/widgets/tabs/chat/chattab.h
@@ -63,7 +63,7 @@ class ChatTab notfinal : public Tab
const std::string &name,
const std::string &channel,
const std::string &logName,
- const ChatTabType::Type &type);
+ const ChatTabTypeT &type);
A_DELETE_COPY(ChatTab)
@@ -138,7 +138,7 @@ class ChatTab notfinal : public Tab
/**
* Returns type of the being.
*/
- ChatTabType::Type getType() const A_WARN_UNUSED
+ ChatTabTypeT getType() const A_WARN_UNUSED
{ return mType; }
void saveToLogFile(const std::string &msg) const;
@@ -204,7 +204,7 @@ class ChatTab notfinal : public Tab
ScrollArea *mScrollArea;
std::string mChannelName;
std::string mLogName;
- ChatTabType::Type mType;
+ ChatTabTypeT mType;
bool mAllowHightlight;
bool mRemoveNames;
bool mNoAway;
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 5bed12f72..d6081f5c6 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -374,7 +374,7 @@ void ChatWindow::nextTab()
mChatTabs->setSelectedTabByIndex(tab);
}
-void ChatWindow::selectTabByType(const ChatTabType::Type &type)
+void ChatWindow::selectTabByType(const ChatTabTypeT &type)
{
if (!mChatTabs)
return;
@@ -401,7 +401,7 @@ void ChatWindow::closeTab() const
mChatTabs->getSelectedTabIndex()));
if (!tab)
return;
- const ChatTabType::Type &type = tab->getType();
+ const ChatTabTypeT &type = tab->getType();
if (type == ChatTabType::WHISPER || type == ChatTabType::CHANNEL)
tab->handleCommand("close", "");
}
diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h
index 76ca9af02..e8b0dc940 100644
--- a/src/gui/windows/chatwindow.h
+++ b/src/gui/windows/chatwindow.h
@@ -294,7 +294,7 @@ class ChatWindow final : public Window,
bool isTabPresent(const ChatTab *const tab) const A_WARN_UNUSED;
- void selectTabByType(const ChatTabType::Type &type);
+ void selectTabByType(const ChatTabTypeT &type);
void attributeChanged(const AttributesT id,
const int oldVal,