summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-09-06 19:09:39 +0300
committerAndrei Karas <akaras@inbox.ru>2015-09-06 19:09:39 +0300
commitf96861c0115f6808d8246b3e6defc828ab3a255e (patch)
tree76fa7c407187399e638cc514a59263d0468066e4 /src
parent548bcd5e5450afefbbe2625da16aa23333e6b69a (diff)
downloadmv-f96861c0115f6808d8246b3e6defc828ab3a255e.tar.gz
mv-f96861c0115f6808d8246b3e6defc828ab3a255e.tar.bz2
mv-f96861c0115f6808d8246b3e6defc828ab3a255e.tar.xz
mv-f96861c0115f6808d8246b3e6defc828ab3a255e.zip
Add option for creating screenshots on each complete trade.
Diffstat (limited to 'src')
-rw-r--r--src/defaults.cpp1
-rw-r--r--src/gui/widgets/tabs/setup_players.cpp4
-rw-r--r--src/gui/windows/tradewindow.cpp9
-rw-r--r--src/gui/windows/tradewindow.h2
-rw-r--r--src/net/ea/traderecv.cpp5
5 files changed, 17 insertions, 4 deletions
diff --git a/src/defaults.cpp b/src/defaults.cpp
index ca2b31e04..9e178014d 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -381,6 +381,7 @@ DefaultsData* getConfigDefaults()
AddDEF("disableLoggingInGame", false);
AddDEF("sellShopName", "unnamed");
AddDEF("showBadges", 1);
+ AddDEF("tradescreenshot", false);
return configData;
}
diff --git a/src/gui/widgets/tabs/setup_players.cpp b/src/gui/widgets/tabs/setup_players.cpp
index 4b04568ee..2f8039b6a 100644
--- a/src/gui/widgets/tabs/setup_players.cpp
+++ b/src/gui/widgets/tabs/setup_players.cpp
@@ -125,6 +125,10 @@ Setup_Players::Setup_Players(const Widget2 *const widget) :
"", "useDiagonalSpeed", this, "useDiagonalSpeedEvent");
// TRANSLATORS: settings option
+ new SetupItemCheckBox(_("Create screenshots for each complete trades"),
+ "", "tradescreenshot", this, "tradescreenshotEvent");
+
+ // TRANSLATORS: settings option
new SetupItemCheckBox(_("Emulate right mouse button by long mouse click"
" (useful for touch interfaces)"),
"", "longmouseclick", this, "longmouseclickEvent");
diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp
index 7a835b686..edd685f30 100644
--- a/src/gui/windows/tradewindow.cpp
+++ b/src/gui/windows/tradewindow.cpp
@@ -23,6 +23,7 @@
#include "gui/windows/tradewindow.h"
#include "configuration.h"
+#include "game.h"
#include "item.h"
#include "units.h"
@@ -296,6 +297,14 @@ void TradeWindow::receivedOk(const bool own)
setStatus(ACCEPTING);
}
+void TradeWindow::completeTrade()
+{
+ if (config.getBoolValue("tradescreenshot"))
+ Game::createScreenshot();
+ setVisible(Visible_false);
+ reset();
+}
+
void TradeWindow::tradeItem(const Item *const item, const int quantity,
const bool check) const
{
diff --git a/src/gui/windows/tradewindow.h b/src/gui/windows/tradewindow.h
index d82714816..8ad021cd6 100644
--- a/src/gui/windows/tradewindow.h
+++ b/src/gui/windows/tradewindow.h
@@ -164,6 +164,8 @@ class TradeWindow final : public Window,
bool isInpupFocused() const A_WARN_UNUSED;
+ void completeTrade();
+
private:
enum Status
{
diff --git a/src/net/ea/traderecv.cpp b/src/net/ea/traderecv.cpp
index 006c3a41f..df9ed0531 100644
--- a/src/net/ea/traderecv.cpp
+++ b/src/net/ea/traderecv.cpp
@@ -135,10 +135,7 @@ void TradeRecv::processTradeComplete(Net::MessageIn &msg A_UNUSED)
{
NotifyManager::notify(NotifyTypes::TRADE_COMPLETE);
if (tradeWindow)
- {
- tradeWindow->setVisible(Visible_false);
- tradeWindow->reset();
- }
+ tradeWindow->completeTrade();
PlayerInfo::setTrading(Trading_false);
}