summaryrefslogtreecommitdiff
path: root/src/gui/popups
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-06-06 14:49:47 +0300
committerAndrei Karas <akaras@inbox.ru>2014-06-06 14:49:47 +0300
commitc649cf883480071c9b93909c4ea4ee5ec98155b2 (patch)
tree71022fd2db59c643c19c78c5524ffcd038e35a7f /src/gui/popups
parent4cab6fc78e19799f223d951d5ccc9afb303b65f2 (diff)
downloadmanaplus-c649cf883480071c9b93909c4ea4ee5ec98155b2.tar.gz
manaplus-c649cf883480071c9b93909c4ea4ee5ec98155b2.tar.bz2
manaplus-c649cf883480071c9b93909c4ea4ee5ec98155b2.tar.xz
manaplus-c649cf883480071c9b93909c4ea4ee5ec98155b2.zip
Remove some duplicate code.
Diffstat (limited to 'src/gui/popups')
-rw-r--r--src/gui/popups/popupmenu.cpp51
-rw-r--r--src/gui/popups/popupmenu.h2
2 files changed, 23 insertions, 30 deletions
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 00cae3ee3..5d0f32f19 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -2521,6 +2521,25 @@ void PopupMenu::showPopup(int x, int y)
requestMoveToTop();
}
+void PopupMenu::addNormalRelations()
+{
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: add player to disregarded list
+ mBrowserBox->addRow("disregard", _("Disregard"));
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: add player to ignore list
+ mBrowserBox->addRow("ignore", _("Ignore"));
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: add player to black list
+ mBrowserBox->addRow("blacklist", _("Black list"));
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: add player to enemy list
+ mBrowserBox->addRow("enemy", _("Set as enemy"));
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: add player to erased list
+ mBrowserBox->addRow("erase", _("Erase"));
+}
+
void PopupMenu::addPlayerRelation(const std::string &name)
{
switch (player_relations.getRelation(name))
@@ -2529,39 +2548,11 @@ void PopupMenu::addPlayerRelation(const std::string &name)
// TRANSLATORS: popup menu item
// TRANSLATORS: add player to friends list
mBrowserBox->addRow("friend", _("Be friend"));
- // TRANSLATORS: popup menu item
- // TRANSLATORS: add player to disregarded list
- mBrowserBox->addRow("disregard", _("Disregard"));
- // TRANSLATORS: popup menu item
- // TRANSLATORS: add player to ignore list
- mBrowserBox->addRow("ignore", _("Ignore"));
- // TRANSLATORS: popup menu item
- // TRANSLATORS: add player to black list
- mBrowserBox->addRow("blacklist", _("Black list"));
- // TRANSLATORS: popup menu item
- // TRANSLATORS: add player to enemy list
- mBrowserBox->addRow("enemy", _("Set as enemy"));
- // TRANSLATORS: popup menu item
- // TRANSLATORS: add player to erased list
- mBrowserBox->addRow("erase", _("Erase"));
+ addNormalRelations();
break;
case PlayerRelation::FRIEND:
- // TRANSLATORS: popup menu item
- // TRANSLATORS: add player to disregarded list
- mBrowserBox->addRow("disregard", _("Disregard"));
- // TRANSLATORS: popup menu item
- // TRANSLATORS: add player to ignore list
- mBrowserBox->addRow("ignore", _("Ignore"));
- // TRANSLATORS: popup menu item
- // TRANSLATORS: add player to black list
- mBrowserBox->addRow("blacklist", _("Black list"));
- // TRANSLATORS: popup menu item
- // TRANSLATORS: add player to enemy list
- mBrowserBox->addRow("enemy", _("Set as enemy"));
- // TRANSLATORS: popup menu item
- // TRANSLATORS: add player to erased list
- mBrowserBox->addRow("erase", _("Erase"));
+ addNormalRelations();
break;
case PlayerRelation::BLACKLISTED:
diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h
index 72c16ce50..69ca3c17b 100644
--- a/src/gui/popups/popupmenu.h
+++ b/src/gui/popups/popupmenu.h
@@ -170,6 +170,8 @@ class PopupMenu final : public Popup, public LinkHandler
void addGmCommands();
+ void addNormalRelations();
+
void showGMPopup();
BrowserBox *mBrowserBox;