summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-07-29 14:33:37 +0300
committerAndrei Karas <akaras@inbox.ru>2015-07-29 14:33:37 +0300
commitaae7a5ec7b6d962edd6620f1aedd468a6bc98e1a (patch)
tree4352a052e5254b0f16b56aab304dcb3ce107a59b
parentcd2a71bfc4d3339dd6cf18b5a311e57d58fb548c (diff)
downloadManaVerse-aae7a5ec7b6d962edd6620f1aedd468a6bc98e1a.tar.gz
ManaVerse-aae7a5ec7b6d962edd6620f1aedd468a6bc98e1a.tar.bz2
ManaVerse-aae7a5ec7b6d962edd6620f1aedd468a6bc98e1a.tar.xz
ManaVerse-aae7a5ec7b6d962edd6620f1aedd468a6bc98e1a.zip
Add ability to show badges under nick.
Add option for select how show badges.
-rw-r--r--src/being/being.cpp14
-rw-r--r--src/being/being.h3
-rw-r--r--src/defaults.cpp3
-rw-r--r--src/gui/widgets/tabs/setup_players.cpp28
-rw-r--r--src/gui/widgets/tabs/setup_players.h5
5 files changed, 37 insertions, 16 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 6cc8bae4b..f0cc40bd9 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -118,8 +118,7 @@ bool Being::mEnableReorderSprites = true;
bool Being::mHideErased = false;
Move Being::mMoveNames = Move_false;
bool Being::mUseDiagonal = true;
-bool Being::mShowBadges = true;
-bool Being::mShowBadgesTop = true;
+uint8_t Being::mShowBadges = 1;
int Being::mAwayEffect = -1;
std::list<BeingCacheEntry*> beingInfoCache;
@@ -1885,12 +1884,18 @@ void Being::drawEmotion(Graphics *const graphics,
{
int x;
int y;
- if (!mShowBadgesTop && mDispName && gui)
+ if (mShowBadges == 2 && mDispName && gui)
{
Font *const font = gui->getFont();
x = mDispName->getX() - offsetX + mDispName->getWidth();
y = mDispName->getY() - offsetY - font->getHeight();
}
+ else if (mShowBadges == 3 && mDispName && gui)
+ {
+ Font *const font = gui->getFont();
+ x = px + 8 - mBadgesCount * 8;
+ y = mDispName->getY() - offsetY;
+ }
else
{
x = px + 8 - mBadgesCount * 8;
@@ -2424,8 +2429,7 @@ void Being::reReadConfig()
mHideErased = config.getBoolValue("hideErased");
mMoveNames = fromBool(config.getBoolValue("moveNames"), Move);
mUseDiagonal = config.getBoolValue("useDiagonalSpeed");
- mShowBadges = config.getBoolValue("showBadges");
- mShowBadgesTop = config.getBoolValue("showBadgesTop");
+ mShowBadges = config.getIntValue("showBadges");
mUpdateConfigTime = cur_time;
}
diff --git a/src/being/being.h b/src/being/being.h
index 5d4c5d0ec..1f01001c3 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -1106,8 +1106,7 @@ class Being notfinal : public ActorSprite,
static bool mHideErased;
static Move mMoveNames;
static bool mUseDiagonal;
- static bool mShowBadges;
- static bool mShowBadgesTop;
+ static uint8_t mShowBadges;
static int mAwayEffect;
unsigned int mMoveTime;
diff --git a/src/defaults.cpp b/src/defaults.cpp
index 0a1983558..a7b2c14b7 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -380,8 +380,7 @@ DefaultsData* getConfigDefaults()
AddDEF("ignorelogpackets", "");
AddDEF("disableLoggingInGame", false);
AddDEF("sellShopName", "unnamed");
- AddDEF("showBadges", true);
- AddDEF("showBadgesTop", true);
+ AddDEF("showBadges", 1);
return configData;
}
diff --git a/src/gui/widgets/tabs/setup_players.cpp b/src/gui/widgets/tabs/setup_players.cpp
index 82f8b0115..cd28c8d69 100644
--- a/src/gui/widgets/tabs/setup_players.cpp
+++ b/src/gui/widgets/tabs/setup_players.cpp
@@ -22,6 +22,8 @@
#include "gui/widgets/tabs/setup_players.h"
+#include "gui/models/namesmodel.h"
+
#include "gui/widgets/containerplacer.h"
#include "gui/widgets/layouthelper.h"
#include "gui/widgets/scrollarea.h"
@@ -31,8 +33,23 @@
#include "debug.h"
+static const int badgesListSize = 4;
+
+static const char *const badgesList[] =
+{
+ // TRANSLATORS: screen badges type
+ N_("hide"),
+ // TRANSLATORS: screen badges type
+ N_("show at top"),
+ // TRANSLATORS: screen badges type
+ N_("show at right"),
+ // TRANSLATORS: screen badges type
+ N_("show at bottom"),
+};
+
Setup_Players::Setup_Players(const Widget2 *const widget) :
- SetupTabScroll(widget)
+ SetupTabScroll(widget),
+ mBadgesList(new NamesModel)
{
// TRANSLATORS: settings tab name
setName(_("Players"));
@@ -69,13 +86,10 @@ Setup_Players::Setup_Players(const Widget2 *const widget) :
new SetupItemCheckBox(_("Auto move names"), "",
"moveNames", this, "moveNamesEvent");
+ mBadgesList->fillFromArray(&badgesList[0], badgesListSize);
// TRANSLATORS: settings option
- new SetupItemCheckBox(_("Show badges"), "",
- "showBadges", this, "showBadgesEvent");
-
- // TRANSLATORS: settings option
- new SetupItemCheckBox(_("Show badges at top"), "",
- "showBadgesTop", this, "showBadgesTopEvent");
+ new SetupItemDropDown(_("Badges"), "",
+ "showBadges", this, "showBadgesEvent", mBadgesList, 150);
// TRANSLATORS: settings option
new SetupItemCheckBox(_("Secure trades"), "",
diff --git a/src/gui/widgets/tabs/setup_players.h b/src/gui/widgets/tabs/setup_players.h
index 7561e770c..801839649 100644
--- a/src/gui/widgets/tabs/setup_players.h
+++ b/src/gui/widgets/tabs/setup_players.h
@@ -25,12 +25,17 @@
#include "gui/widgets/tabs/setuptabscroll.h"
+class NamesModel;
+
class Setup_Players final : public SetupTabScroll
{
public:
explicit Setup_Players(const Widget2 *const widget);
A_DELETE_COPY(Setup_Players)
+
+ private:
+ NamesModel *mBadgesList;
};
#endif // GUI_WIDGETS_TABS_SETUP_PLAYERS_H