diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-08-15 01:57:55 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-08-15 02:18:03 +0300 |
commit | 47f0e16e34cf22701b7c0670297bb7288a55310d (patch) | |
tree | d2b89f146e42a11d88e3e3b99685aa4a93c124c4 | |
parent | 0c7a728ea5c63769c59e7cdbd13fc56cf3dd63fc (diff) | |
download | manaplus-47f0e16e34cf22701b7c0670297bb7288a55310d.tar.gz manaplus-47f0e16e34cf22701b7c0670297bb7288a55310d.tar.bz2 manaplus-47f0e16e34cf22701b7c0670297bb7288a55310d.tar.xz manaplus-47f0e16e34cf22701b7c0670297bb7288a55310d.zip |
Add option to hide ip addresses on screenshots.
-rw-r--r-- | src/defaults.cpp | 1 | ||||
-rw-r--r-- | src/game.cpp | 14 | ||||
-rw-r--r-- | src/graphics.cpp | 3 | ||||
-rw-r--r-- | src/graphics.h | 7 | ||||
-rw-r--r-- | src/gui/setup_players.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/avatarlistbox.cpp | 46 |
6 files changed, 59 insertions, 15 deletions
diff --git a/src/defaults.cpp b/src/defaults.cpp index 3824aafc9..e614a489b 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -214,6 +214,7 @@ DefaultsData* getConfigDefaults() AddDEF(configData, "disableAdvBeingCaching", false); AddDEF(configData, "disableBeingCaching", false); AddDEF(configData, "enableReorderSprites", true); + AddDEF(configData, "showip", false); return configData; } diff --git a/src/game.cpp b/src/game.cpp index 4e7345340..8457cf079 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -431,8 +431,20 @@ Game::~Game() static bool saveScreenshot() { static unsigned int screenshotCount = 0; + SDL_Surface *screenshot = 0; + + if (!config.getBoolValue("showip")) + { + graphics->setSecure(true); + gui->draw(); + screenshot = graphics->getScreenshot(); + graphics->setSecure(false); + } + else + { + screenshot = graphics->getScreenshot(); + } - SDL_Surface *screenshot = graphics->getScreenshot(); if (!screenshot) return false; diff --git a/src/graphics.cpp b/src/graphics.cpp index a86ac7fd0..c5dc38b72 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -48,7 +48,8 @@ Graphics::Graphics(): mHWAccel(false), mBlitMode(BLIT_NORMAL), mRedraw(false), - mDoubleBuffer(false) + mDoubleBuffer(false), + mSecure(false) { mRect.x = 0; mRect.y = 0; diff --git a/src/graphics.h b/src/graphics.h index 237d16dc2..a2e25b5a8 100644 --- a/src/graphics.h +++ b/src/graphics.h @@ -269,6 +269,12 @@ class Graphics : public gcn::SDLGraphics bool getRedraw() { return mRedraw; } + void setSecure(bool n) + { mSecure = n; } + + bool getSecure() + { return mSecure; } + int mWidth; int mHeight; @@ -283,6 +289,7 @@ class Graphics : public gcn::SDLGraphics bool mRedraw; bool mDoubleBuffer; SDL_Rect mRect; + bool mSecure; }; extern Graphics *graphics; diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp index d2664adbd..acc6b3d3c 100644 --- a/src/gui/setup_players.cpp +++ b/src/gui/setup_players.cpp @@ -75,6 +75,9 @@ Setup_Players::Setup_Players() new SetupItemCheckBox(_("Show statuses"), "", "showPlayersStatus", this, "showPlayersStatusEvent"); + new SetupItemCheckBox(_("Show ip addresses on screenshots"), "", + "showip", this, "showipEvent"); + setDimension(gcn::Rectangle(0, 0, 550, 350)); } diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 5ac6721a5..0d35ad188 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -242,25 +242,45 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics) } } - if (mShowGender) + if (graphics->getSecure()) { - switch (a->getGender()) + if (mShowGender) { - case GENDER_FEMALE: - text += strprintf(" \u2640 %s", - a->getAdditionString().c_str()); - break; - case GENDER_MALE: - text += strprintf(" \u2642 %s", - a->getAdditionString().c_str()); - break; - default: - break; + switch (a->getGender()) + { + case GENDER_FEMALE: + text += strprintf(" \u2640 "); + break; + case GENDER_MALE: + text += strprintf(" \u2642 "); + break; + default: + break; + } } } else { - text += a->getAdditionString(); + if (mShowGender) + { + switch (a->getGender()) + { + case GENDER_FEMALE: + text += strprintf(" \u2640 %s", + a->getAdditionString().c_str()); + break; + case GENDER_MALE: + text += strprintf(" \u2642 %s", + a->getAdditionString().c_str()); + break; + default: + break; + } + } + else + { + text += a->getAdditionString(); + } } graphics->setColor(Theme::getThemeColor(Theme::TEXT)); |