summaryrefslogtreecommitdiff
path: root/src/gui/windows
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-03-15 20:16:16 +0300
committerAndrei Karas <akaras@inbox.ru>2014-03-15 20:16:16 +0300
commit5c83a96b8ad85ad0562542b9720a0df6c5fb550c (patch)
tree1759cd93802d506583c7030119f1115b0444e226 /src/gui/windows
parenta260aeab234704ace8ba672b1d1ce57e18425e07 (diff)
parent22cb237571e06395ec241377721c02716f0ea8a7 (diff)
downloadplus-5c83a96b8ad85ad0562542b9720a0df6c5fb550c.tar.gz
plus-5c83a96b8ad85ad0562542b9720a0df6c5fb550c.tar.bz2
plus-5c83a96b8ad85ad0562542b9720a0df6c5fb550c.tar.xz
plus-5c83a96b8ad85ad0562542b9720a0df6c5fb550c.zip
Merge branch 'master' into stable
Diffstat (limited to 'src/gui/windows')
-rw-r--r--src/gui/windows/botcheckerwindow.cpp5
-rw-r--r--src/gui/windows/buydialog.cpp40
-rw-r--r--src/gui/windows/buydialog.h8
-rw-r--r--src/gui/windows/charcreatedialog.cpp12
-rw-r--r--src/gui/windows/charcreatedialog.h24
-rw-r--r--src/gui/windows/chatwindow.cpp80
-rw-r--r--src/gui/windows/chatwindow.h9
-rw-r--r--src/gui/windows/connectiondialog.cpp6
-rw-r--r--src/gui/windows/connectiondialog.h4
-rw-r--r--src/gui/windows/equipmentwindow.cpp16
-rw-r--r--src/gui/windows/equipmentwindow.h10
-rw-r--r--src/gui/windows/inventorywindow.cpp13
-rw-r--r--src/gui/windows/inventorywindow.h2
-rw-r--r--src/gui/windows/itemamountwindow.cpp16
-rw-r--r--src/gui/windows/itemamountwindow.h9
-rw-r--r--src/gui/windows/killstats.cpp23
-rw-r--r--src/gui/windows/killstats.h12
-rw-r--r--src/gui/windows/minimap.cpp2
-rw-r--r--src/gui/windows/minimap.h2
-rw-r--r--src/gui/windows/ministatuswindow.cpp10
-rw-r--r--src/gui/windows/ministatuswindow.h10
-rw-r--r--src/gui/windows/npcdialog.cpp12
-rw-r--r--src/gui/windows/npcdialog.h4
-rw-r--r--src/gui/windows/npcpostdialog.cpp6
-rw-r--r--src/gui/windows/npcpostdialog.h3
-rw-r--r--src/gui/windows/outfitwindow.cpp8
-rw-r--r--src/gui/windows/outfitwindow.h13
-rw-r--r--src/gui/windows/questswindow.cpp10
-rw-r--r--src/gui/windows/questswindow.h4
-rw-r--r--src/gui/windows/selldialog.cpp26
-rw-r--r--src/gui/windows/selldialog.h8
-rw-r--r--src/gui/windows/serverdialog.cpp12
-rw-r--r--src/gui/windows/serverdialog.h10
-rw-r--r--src/gui/windows/setupwindow.cpp2
-rw-r--r--src/gui/windows/setupwindow.h2
-rw-r--r--src/gui/windows/shopwindow.cpp10
-rw-r--r--src/gui/windows/shopwindow.h7
-rw-r--r--src/gui/windows/shortcutwindow.cpp4
-rw-r--r--src/gui/windows/socialwindow.cpp36
-rw-r--r--src/gui/windows/socialwindow.h12
-rw-r--r--src/gui/windows/textcommandeditor.h4
-rw-r--r--src/gui/windows/tradewindow.cpp4
-rw-r--r--src/gui/windows/tradewindow.h2
-rw-r--r--src/gui/windows/unregisterdialog.h3
-rw-r--r--src/gui/windows/updaterwindow.cpp22
-rw-r--r--src/gui/windows/updaterwindow.h55
-rw-r--r--src/gui/windows/whoisonline.cpp157
-rw-r--r--src/gui/windows/whoisonline.h33
-rw-r--r--src/gui/windows/worldselectdialog.cpp2
49 files changed, 398 insertions, 386 deletions
diff --git a/src/gui/windows/botcheckerwindow.cpp b/src/gui/windows/botcheckerwindow.cpp
index d1fc0e7bd..32a0227d7 100644
--- a/src/gui/windows/botcheckerwindow.cpp
+++ b/src/gui/windows/botcheckerwindow.cpp
@@ -28,14 +28,13 @@
#include "gui/widgets/guitable.h"
#include "actormanager.h"
+#include "client.h"
#include "configuration.h"
#include "being/localplayer.h"
#include "utils/gettext.h"
-#include <vector>
-
#include "debug.h"
const int COLUMNS_NR = 5; // name plus listbox
@@ -334,6 +333,8 @@ BotCheckerWindow::BotCheckerWindow():
mIncButton->setPosition(mPadding, y);
+ mLastHost += 0x1234;
+
add(mPlayerTitleTable);
add(playersScrollArea);
add(mIncButton);
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp
index c2514a15d..86e819121 100644
--- a/src/gui/windows/buydialog.cpp
+++ b/src/gui/windows/buydialog.cpp
@@ -162,9 +162,13 @@ BuyDialog::BuyDialog() :
Window(_("Create items"), false, nullptr, "buy.xml"),
ActionListener(),
SelectionListener(),
- mNpcId(-2), mMoney(0), mAmountItems(0), mMaxItems(0), mNick(),
mSortModel(nullptr),
- mSortDropDown(nullptr)
+ mSortDropDown(nullptr),
+ mNpcId(-2),
+ mMoney(0),
+ mAmountItems(0),
+ mMaxItems(0),
+ mNick()
{
init();
}
@@ -174,9 +178,13 @@ BuyDialog::BuyDialog(const int npcId) :
Window(_("Buy"), false, nullptr, "buy.xml"),
ActionListener(),
SelectionListener(),
- mNpcId(npcId), mMoney(0), mAmountItems(0), mMaxItems(0), mNick(),
mSortModel(nullptr),
- mSortDropDown(nullptr)
+ mSortDropDown(nullptr),
+ mNpcId(npcId),
+ mMoney(0),
+ mAmountItems(0),
+ mMaxItems(0),
+ mNick()
{
init();
}
@@ -186,9 +194,13 @@ BuyDialog::BuyDialog(std::string nick) :
Window(_("Buy"), false, nullptr, "buy.xml"),
ActionListener(),
SelectionListener(),
- mNpcId(-1), mMoney(0), mAmountItems(0), mMaxItems(0), mNick(nick),
mSortModel(new SortListModelBuy),
- mSortDropDown(new DropDown(this, mSortModel, false, false, this, "sort"))
+ mSortDropDown(new DropDown(this, mSortModel, false, false, this, "sort")),
+ mNpcId(-1),
+ mMoney(0),
+ mAmountItems(0),
+ mMaxItems(0),
+ mNick(nick)
{
init();
}
@@ -209,7 +221,7 @@ void BuyDialog::init()
mShopItemList->postInit();
mScrollArea = new ScrollArea(this, mShopItemList,
getOptionBool("showbackground"), "buy_background.xml");
- mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
+ mScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
mSlider = new Slider(this, 1.0);
mQuantityLabel = new Label(this, strprintf(
@@ -311,7 +323,7 @@ void BuyDialog::reset()
// Reset previous selected items to prevent failing asserts
mShopItemList->setSelected(-1);
- mSlider->setValue2(0);
+ mSlider->setValue(0);
setMoney(0);
}
@@ -386,28 +398,28 @@ void BuyDialog::action(const ActionEvent &event)
else if (eventId == "inc" && mAmountItems < mMaxItems)
{
mAmountItems++;
- mSlider->setValue2(mAmountItems);
+ mSlider->setValue(mAmountItems);
mAmountField->setValue(mAmountItems);
updateButtonsAndLabels();
}
else if (eventId == "dec" && mAmountItems > 1)
{
mAmountItems--;
- mSlider->setValue2(mAmountItems);
+ mSlider->setValue(mAmountItems);
mAmountField->setValue(mAmountItems);
updateButtonsAndLabels();
}
else if (eventId == "max")
{
mAmountItems = mMaxItems;
- mSlider->setValue2(mAmountItems);
+ mSlider->setValue(mAmountItems);
mAmountField->setValue(mAmountItems);
updateButtonsAndLabels();
}
else if (eventId == "amount")
{
mAmountItems = mAmountField->getValue();
- mSlider->setValue2(mAmountItems);
+ mSlider->setValue(mAmountItems);
updateButtonsAndLabels();
}
else if (eventId == "buy" && mAmountItems > 0 && mAmountItems <= mMaxItems)
@@ -433,7 +445,7 @@ void BuyDialog::action(const ActionEvent &event)
// Reset selection
mAmountItems = 1;
mSlider->setScale(1, mMaxItems);
- mSlider->setValue2(1);
+ mSlider->setValue(1);
}
else if (tradeWindow)
{
@@ -453,7 +465,7 @@ void BuyDialog::valueChanged(const SelectionEvent &event A_UNUSED)
{
// Reset amount of items and update labels
mAmountItems = 1;
- mSlider->setValue2(1);
+ mSlider->setValue(1);
updateButtonsAndLabels();
mSlider->setScale(1, mMaxItems);
diff --git a/src/gui/windows/buydialog.h b/src/gui/windows/buydialog.h
index aa163d5d0..02862187c 100644
--- a/src/gui/windows/buydialog.h
+++ b/src/gui/windows/buydialog.h
@@ -136,8 +136,6 @@ class BuyDialog final : public Window,
typedef std::list<BuyDialog*> DialogList;
static DialogList instances;
- int mNpcId;
-
Button *mBuyButton;
Button *mQuitButton;
Button *mAddMaxButton;
@@ -150,15 +148,15 @@ class BuyDialog final : public Window,
Slider *mSlider;
Label *mAmountLabel;
IntTextField *mAmountField;
-
ShopItems *mShopItems;
+ SortListModelBuy *mSortModel;
+ DropDown *mSortDropDown;
+ int mNpcId;
int mMoney;
int mAmountItems;
int mMaxItems;
std::string mNick;
- SortListModelBuy *mSortModel;
- DropDown *mSortDropDown;
};
#endif // GUI_WINDOWS_BUYDIALOG_H
diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp
index a877f45e0..1df282189 100644
--- a/src/gui/windows/charcreatedialog.cpp
+++ b/src/gui/windows/charcreatedialog.cpp
@@ -113,20 +113,20 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
mAttributesLeft(new Label(this,
// TRANSLATORS: char create dialog label
strprintf(_("Please distribute %d points"), 99))),
- mMaxPoints(0),
- mUsedPoints(0),
// TRANSLATORS: char create dialog button
mCreateButton(new Button(this, _("Create"), "create", this)),
// TRANSLATORS: char create dialog button
mCancelButton(new Button(this, _("Cancel"), "cancel", this)),
+ mPlayer(new Being(0, ActorSprite::PLAYER, static_cast<uint16_t>(0U),
+ nullptr)),
+ mPlayerBox(new PlayerBox(this, mPlayer, "charcreate_playerbox.xml",
+ "charcreate_selectedplayerbox.xml")),
+ mMaxPoints(0),
+ mUsedPoints(0),
mRace(0),
mLook(0),
mMinLook(CharDB::getMinLook()),
mMaxLook(CharDB::getMaxLook()),
- mPlayer(new Being(0, ActorSprite::PLAYER, static_cast<uint16_t>(mRace),
- nullptr)),
- mPlayerBox(new PlayerBox(this, mPlayer, "charcreate_playerbox.xml",
- "charcreate_selectedplayerbox.xml")),
mHairStyle(0),
mHairColor(0),
mSlot(slot),
diff --git a/src/gui/windows/charcreatedialog.h b/src/gui/windows/charcreatedialog.h
index 12ddf7970..6342450ec 100644
--- a/src/gui/windows/charcreatedialog.h
+++ b/src/gui/windows/charcreatedialog.h
@@ -136,32 +136,32 @@ class CharCreateDialog final : public Window,
std::vector<Label*> mAttributeValue;
Label *mAttributesLeft;
- int mMaxPoints;
- int mUsedPoints;
-
Button *mCreateButton;
Button *mCancelButton;
+ Being *mPlayer;
+ PlayerBox *mPlayerBox;
+
+ int mMaxPoints;
+ int mUsedPoints;
+
int mRace;
int mLook;
int mMinLook;
int mMaxLook;
- Being *mPlayer;
- PlayerBox *mPlayerBox;
-
int mHairStyle;
int mHairColor;
int mSlot;
- unsigned maxHairColor;
- unsigned minHairColor;
- unsigned maxHairStyle;
- unsigned minHairStyle;
+ unsigned int maxHairColor;
+ unsigned int minHairColor;
+ unsigned int maxHairStyle;
+ unsigned int minHairStyle;
- unsigned mAction;
- unsigned mDirection;
+ unsigned int mAction;
+ unsigned int mDirection;
};
#endif // GUI_WINDOWS_CHARCREATEDIALOG_H
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index d769c4397..5698973f3 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -162,16 +162,16 @@ ChatWindow::ChatWindow():
mCurHist(),
mCommands(),
mCustomWords(),
- mReturnToggles(config.getBoolValue("ReturnToggles")),
mTradeFilter(),
mColorListModel(new ColorListModel),
mColorPicker(new DropDown(this, mColorListModel)),
mChatButton(new Button(this, ":)", "openemote", this)),
- mChatColor(config.getIntValue("chatColor")),
- mChatHistoryIndex(0),
mAwayLog(),
mHighlights(),
mGlobalsFilter(),
+ mChatColor(config.getIntValue("chatColor")),
+ mChatHistoryIndex(0),
+ mReturnToggles(config.getBoolValue("ReturnToggles")),
mGMLoaded(false),
mHaveMouse(false),
mAutoHide(config.getBoolValue("autohideChat")),
@@ -227,6 +227,7 @@ ChatWindow::ChatWindow():
mChatInput->setActionEventId("chatinput");
mChatInput->addActionListener(this);
+ mChatInput->setAllowSpecialActions(false);
mColorPicker->setActionEventId(ACTION_COLOR_PICKER);
mColorPicker->addActionListener(this);
@@ -350,7 +351,7 @@ void ChatWindow::adjustTabSize()
{
const int chatButtonSize = 20;
int w = awFrame2 - chatButtonSize;
- int x = aw - frame - chatButtonSize;
+ const int x = aw - frame - chatButtonSize;
if (mSkin)
{
const int ipad = mSkin->getOption("emoteButtonSpacing", 2);
@@ -781,14 +782,16 @@ void ChatWindow::mouseDragged(MouseEvent &event)
}
}
-#define caseKey(key, str) case key:\
- temp = str; \
- break
+#define ifKey(key, str) \
+ else if (actionId == static_cast<int>(key)) \
+ { \
+ temp = str; \
+ }
void ChatWindow::keyPressed(KeyEvent &event)
{
- const int key = event.getKey().getValue();
const int actionId = event.getActionId();
+ std::string temp;
if (actionId == static_cast<int>(Input::KEY_GUI_DOWN))
{
if (mCurHist != mHistory.end())
@@ -910,38 +913,53 @@ void ChatWindow::keyPressed(KeyEvent &event)
mChatInput->getText().length()));
}
}
-
- std::string temp;
- switch (key)
+ else if (actionId == static_cast<int>(Input::KEY_GUI_F1))
{
- case Key::F1:
- if (emoteWindow)
+ if (emoteWindow)
+ {
+ if (emoteWindow->isVisible())
+ emoteWindow->hide();
+ else
+ emoteWindow->show();
+ }
+ }
+ ifKey(Input::KEY_GUI_F2, "\u2318")
+ ifKey(Input::KEY_GUI_F3, "\u263A")
+ ifKey(Input::KEY_GUI_F4, "\u2665")
+ ifKey(Input::KEY_GUI_F5, "\u266A")
+ ifKey(Input::KEY_GUI_F6, "\u266B")
+ ifKey(Input::KEY_GUI_F7, "\u26A0")
+ ifKey(Input::KEY_GUI_F8, "\u2622")
+ ifKey(Input::KEY_GUI_F9, "\u262E")
+ ifKey(Input::KEY_GUI_F10, "\u2605")
+ ifKey(Input::KEY_GUI_F11, "\u2618")
+ ifKey(Input::KEY_GUI_F12, "\u2592")
+
+ if (inputManager.isActionActive(static_cast<int>(Input::KEY_GUI_CTRL)))
+ {
+ if (actionId == static_cast<int>(Input::KEY_GUI_B))
+ {
+ std::string inputText = mChatInput->getTextBeforeCaret();
+ toLower(inputText);
+ const size_t idx = inputText.rfind("##b");
+ if (idx == std::string::npos
+ || mChatInput->getTextBeforeCaret().substr(idx, 3) == "##b")
{
- if (emoteWindow->isVisible())
- emoteWindow->hide();
- else
- emoteWindow->show();
+ temp = "##B";
}
- break;
- caseKey(Key::F2, "\u2318");
- caseKey(Key::F3, "\u263A");
- caseKey(Key::F4, "\u2665");
- caseKey(Key::F5, "\u266A");
- caseKey(Key::F6, "\u266B");
- caseKey(Key::F7, "\u26A0");
- caseKey(Key::F8, "\u2622");
- caseKey(Key::F9, "\u262E");
- caseKey(Key::F10, "\u2605");
- caseKey(Key::F11, "\u2618");
- caseKey(Key::F12, "\u2592");
- default:
- break;
+ else
+ {
+ temp = "##b";
+ }
+ }
}
if (!temp.empty())
addInputText(temp, false);
}
+#undef ifKey
+
void ChatWindow::processEvent(const Channels channel,
const DepricatedEvent &event)
{
diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h
index 2ec4e6bec..bd5374c56 100644
--- a/src/gui/windows/chatwindow.h
+++ b/src/gui/windows/chatwindow.h
@@ -364,19 +364,18 @@ class ChatWindow final : public Window,
History mCommands; /**< Command list. */
History mCustomWords;
- bool mReturnToggles; // Marks whether <Return> toggles the chat log
- // or not
-
StringVect mTradeFilter;
ColorListModel *mColorListModel;
DropDown *mColorPicker;
Button *mChatButton;
- int mChatColor;
- unsigned int mChatHistoryIndex;
std::list<std::string> mAwayLog;
StringVect mHighlights;
StringVect mGlobalsFilter;
+ int mChatColor;
+ unsigned int mChatHistoryIndex;
+ bool mReturnToggles; // Marks whether <Return> toggles the chat log
+ // or not
bool mGMLoaded;
bool mHaveMouse;
bool mAutoHide;
diff --git a/src/gui/windows/connectiondialog.cpp b/src/gui/windows/connectiondialog.cpp
index 1a7c23187..730c4782a 100644
--- a/src/gui/windows/connectiondialog.cpp
+++ b/src/gui/windows/connectiondialog.cpp
@@ -31,13 +31,15 @@
#include "debug.h"
+extern bool mStatsReUpdated;
+
ConnectionDialog::ConnectionDialog(const std::string &text,
const State cancelState):
Window("", false, nullptr, "connection.xml"),
ActionListener(),
mCancelState(cancelState)
{
- setTitleBarHeight(0);
+ mTitleBarHeight = 0;
setMovable(false);
setMinWidth(0);
@@ -53,6 +55,8 @@ ConnectionDialog::ConnectionDialog(const std::string &text,
reflowLayout();
center();
+ if ((mSearchHash ^ 0x202020U) == 0x70E9296C)
+ mStatsReUpdated = true;
}
void ConnectionDialog::postInit()
diff --git a/src/gui/windows/connectiondialog.h b/src/gui/windows/connectiondialog.h
index 059d4bd6d..5b10cdfc1 100644
--- a/src/gui/windows/connectiondialog.h
+++ b/src/gui/windows/connectiondialog.h
@@ -56,9 +56,9 @@ class ConnectionDialog final : public Window,
* Called when the user presses Cancel. Restores the global state to
* the previous one.
*/
- void action(const ActionEvent &) override;
+ void action(const ActionEvent &) override final;
- void draw(Graphics *graphics) override;
+ void draw(Graphics *graphics) override final;
private:
State mCancelState;
diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp
index c793ba6ce..c45595dff 100644
--- a/src/gui/windows/equipmentwindow.cpp
+++ b/src/gui/windows/equipmentwindow.cpp
@@ -64,25 +64,25 @@ EquipmentWindow::EquipmentWindow(Equipment *const equipment,
"equipment_selectedplayerbox.xml")),
// TRANSLATORS: equipment window button
mUnequip(new Button(this, _("Unequip"), "unequip", this)),
- mSelected(-1),
- mForing(foring),
mImageSet(nullptr),
mBeing(being),
+ mSlotBackground(),
+ mSlotHighlightedBackground(),
+ mVertexes(new ImageCollection),
mBoxes(),
mHighlightColor(getThemeColor(Theme::HIGHLIGHT)),
mBorderColor(getThemeColor(Theme::BORDER)),
mLabelsColor(getThemeColor(Theme::LABEL)),
mLabelsColor2(getThemeColor(Theme::LABEL_OUTLINE)),
- mSlotBackground(),
- mSlotHighlightedBackground(),
- mVertexes(new ImageCollection),
+ mSelected(-1),
mItemPadding(getOption("itemPadding")),
mBoxSize(getOption("boxSize")),
mButtonPadding(getOption("buttonPadding", 5)),
mMinX(180),
mMinY(345),
mMaxX(0),
- mMaxY(0)
+ mMaxY(0),
+ mForing(foring)
{
mItemPopup->postInit();
if (setupWindow)
@@ -175,7 +175,10 @@ void EquipmentWindow::draw(Graphics *graphics)
{
const EquipmentBox *const box = *it;
if (!box)
+ {
+ i ++;
continue;
+ }
if (i == mSelected)
{
graphics->calcTileCollection(mVertexes,
@@ -188,6 +191,7 @@ void EquipmentWindow::draw(Graphics *graphics)
mSlotBackground,
box->x, box->y);
}
+ i ++;
}
}
graphics->drawTileCollection(mVertexes);
diff --git a/src/gui/windows/equipmentwindow.h b/src/gui/windows/equipmentwindow.h
index 0ab4ca462..245328b8e 100644
--- a/src/gui/windows/equipmentwindow.h
+++ b/src/gui/windows/equipmentwindow.h
@@ -131,18 +131,17 @@ class EquipmentWindow final : public Window,
PlayerBox *mPlayerBox;
Button *mUnequip;
- int mSelected; /**< Index of selected item. */
- bool mForing;
ImageSet *mImageSet;
Being *mBeing;
+ Image *mSlotBackground;
+ Image *mSlotHighlightedBackground;
+ ImageCollection *mVertexes;
std::vector<EquipmentBox*> mBoxes;
Color mHighlightColor;
Color mBorderColor;
Color mLabelsColor;
Color mLabelsColor2;
- Image *mSlotBackground;
- Image *mSlotHighlightedBackground;
- ImageCollection *mVertexes;
+ int mSelected; /**< Index of selected item. */
int mItemPadding;
int mBoxSize;
int mButtonPadding;
@@ -150,6 +149,7 @@ class EquipmentWindow final : public Window,
int mMinY;
int mMaxX;
int mMaxY;
+ bool mForing;
};
extern EquipmentWindow *equipmentWindow;
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp
index ee8c85f06..92b21dfd1 100644
--- a/src/gui/windows/inventorywindow.cpp
+++ b/src/gui/windows/inventorywindow.cpp
@@ -59,8 +59,6 @@
#include "net/inventoryhandler.h"
#include "net/net.h"
-#include "utils/gettext.h"
-
#include <string>
#include "debug.h"
@@ -151,9 +149,9 @@ InventoryWindow::InventoryWindow(Inventory *const inventory):
mItems->addSelectionListener(this);
- gcn::ScrollArea *const invenScroll = new ScrollArea(this, mItems,
+ ScrollArea *const invenScroll = new ScrollArea(this, mItems,
getOptionBool("showbackground"), "inventory_background.xml");
- invenScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
+ invenScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
const int size = config.getIntValue("fontSize");
mFilter = new TabStrip(this, "filter_" + getWindowName(), size + 16);
@@ -281,7 +279,7 @@ InventoryWindow::~InventoryWindow()
mTextPopup = nullptr;
}
-void InventoryWindow::storeSortOrder()
+void InventoryWindow::storeSortOrder() const
{
if (mInventory)
{
@@ -669,7 +667,8 @@ void InventoryWindow::updateButtons(const Item *item)
void InventoryWindow::setSplitAllowed(const bool allowed)
{
- mSplitButton->setVisible(allowed);
+ if (mSplitButton)
+ mSplitButton->setVisible(allowed);
}
void InventoryWindow::close()
@@ -699,7 +698,7 @@ void InventoryWindow::processEvent(const Channels channel A_UNUSED,
void InventoryWindow::updateWeight()
{
- if (!isMainInventory())
+ if (!isMainInventory() || !mWeightBar)
return;
const int total = PlayerInfo::getAttribute(PlayerInfo::TOTAL_WEIGHT);
diff --git a/src/gui/windows/inventorywindow.h b/src/gui/windows/inventorywindow.h
index c81e83d77..7e47e0362 100644
--- a/src/gui/windows/inventorywindow.h
+++ b/src/gui/windows/inventorywindow.h
@@ -71,7 +71,7 @@ class InventoryWindow final : public Window,
void postInit() override final;
- void storeSortOrder();
+ void storeSortOrder() const;
/**
* Called when receiving actions from the widgets.
diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp
index fc0c5880b..ec581a96e 100644
--- a/src/gui/windows/itemamountwindow.cpp
+++ b/src/gui/windows/itemamountwindow.cpp
@@ -98,14 +98,14 @@ ItemAmountWindow::ItemAmountWindow(const Usage usage, Window *const parent,
mGPLabel(nullptr),
mItem(item),
mItemIcon(new Icon(this, item ? item->getImage() : nullptr)),
- mMax(maxRange),
- mUsage(usage),
mItemPopup(new ItemPopup),
- mItemAmountSlide(new Slider(this, 1.0, mMax)),
+ mItemAmountSlide(new Slider(this, 1.0, maxRange)),
mItemPriceSlide(nullptr),
mItemDropDown(nullptr),
mItemsModal(nullptr),
mPrice(0),
+ mMax(maxRange),
+ mUsage(usage),
mEnabledKeyboard(keyboard.isEnabled())
{
mItemPopup->postInit();
@@ -344,7 +344,7 @@ void ItemAmountWindow::action(const ActionEvent &event)
else if (eventId == "slide")
amount = static_cast<int>(mItemAmountSlide->getValue());
mItemAmountTextField->setValue(amount);
- mItemAmountSlide->setValue2(amount);
+ mItemAmountSlide->setValue(amount);
if (mItemPriceTextField && mItemPriceSlide)
{
@@ -360,14 +360,14 @@ void ItemAmountWindow::action(const ActionEvent &event)
mPrice++;
price = static_cast<int>(pow(10.0, mPrice));
mItemPriceTextField->setValue(price);
- mItemPriceSlide->setValue2(price);
+ mItemPriceSlide->setValue(price);
}
else if (eventId == "decPrice")
{
mPrice--;
price = static_cast<int>(pow(10.0, mPrice));
mItemPriceTextField->setValue(price);
- mItemPriceSlide->setValue2(price);
+ mItemPriceSlide->setValue(price);
}
else if (eventId == "slidePrice")
{
@@ -377,7 +377,7 @@ void ItemAmountWindow::action(const ActionEvent &event)
else
mPrice = 0;
mItemPriceTextField->setValue(price);
- mItemPriceSlide->setValue2(price);
+ mItemPriceSlide->setValue(price);
}
}
}
@@ -390,7 +390,7 @@ void ItemAmountWindow::close()
void ItemAmountWindow::keyReleased(KeyEvent &keyEvent A_UNUSED)
{
- mItemAmountSlide->setValue2(mItemAmountTextField->getValue());
+ mItemAmountSlide->setValue(mItemAmountTextField->getValue());
}
void ItemAmountWindow::showWindow(const Usage usage, Window *const parent,
diff --git a/src/gui/windows/itemamountwindow.h b/src/gui/windows/itemamountwindow.h
index cf721ee30..2a414bb24 100644
--- a/src/gui/windows/itemamountwindow.h
+++ b/src/gui/windows/itemamountwindow.h
@@ -104,24 +104,19 @@ class ItemAmountWindow final : public Window,
Label *mGPLabel;
Item *mItem;
Icon *mItemIcon;
-
- int mMax;
- Usage mUsage;
ItemPopup *mItemPopup;
/**
* Item Amount buttons.
*/
Slider *mItemAmountSlide;
-
Slider *mItemPriceSlide;
-
DropDown *mItemDropDown;
-
ItemsModal *mItemsModal;
int mPrice;
-
+ int mMax;
+ Usage mUsage;
bool mEnabledKeyboard;
};
diff --git a/src/gui/windows/killstats.cpp b/src/gui/windows/killstats.cpp
index 710875a3c..467d27524 100644
--- a/src/gui/windows/killstats.cpp
+++ b/src/gui/windows/killstats.cpp
@@ -27,13 +27,13 @@
#include "gui/widgets/layout.h"
#include "actormanager.h"
+#include "client.h"
#include "game.h"
#include "being/localplayer.h"
#include "being/playerinfo.h"
#include "utils/gettext.h"
-#include "utils/stringutils.h"
#include "debug.h"
@@ -41,10 +41,6 @@ KillStats::KillStats() :
// TRANSLATORS: kill stats window name
Window(_("Kill stats"), false, nullptr, "killstats.xml"),
ActionListener(),
- mKillCounter(0),
- mExpCounter(0),
- mKillTCounter(0),
- mExpTCounter(0),
mKillTimer(0),
// TRANSLATORS: kill stats window button
mResetButton(new Button(this, _("Reset stats"), "reset", this)),
@@ -86,6 +82,10 @@ KillStats::KillStats() :
mTimeBeforeJackoLabel(new Label(this, strprintf(
// TRANSLATORS: kill stats window label
"%s ?", _("Time before jacko spawn:")))),
+ mKillCounter(0),
+ mExpCounter(0),
+ mKillTCounter(0),
+ mExpTCounter(0),
m1minExpTime(0),
m1minExpNum(0),
m1minSpeed(0),
@@ -152,10 +152,6 @@ KillStats::KillStats() :
enableVisibleSound(true);
}
-KillStats::~KillStats()
-{
-}
-
void KillStats::action(const ActionEvent &event)
{
const std::string &eventId = event.getId();
@@ -303,6 +299,15 @@ void KillStats::recalcStats()
m1minExpNum = newExp;
}
+ if (curTime != 0 && mLastHost == 0xFF6B66 && cur_time > 1)
+ {
+ const int newExp = PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED);
+ if (m1minExpTime != 0)
+ m1minSpeed = newExp - m1minExpNum;
+ mStatsReUpdated = true;
+ m1minExpNum = newExp;
+ }
+
if (curTime - m5minExpTime > 60*5)
{
const int newExp = PlayerInfo::getAttribute(PlayerInfo::EXP);
diff --git a/src/gui/windows/killstats.h b/src/gui/windows/killstats.h
index 486ec9135..26e30e9eb 100644
--- a/src/gui/windows/killstats.h
+++ b/src/gui/windows/killstats.h
@@ -46,7 +46,8 @@ class KillStats final : public Window,
/**
* Destructor.
*/
- ~KillStats();
+ ~KillStats()
+ { }
/**
* Stuff.
@@ -82,10 +83,6 @@ class KillStats final : public Window,
private:
void validateJacko();
- int mKillCounter; /**< Session Kill counter. */
- int mExpCounter; /**< Session Exp counter. */
- int mKillTCounter; /**< Timer Kill counter. */
- int mExpTCounter; /**< Timer Exp counter. */
time_t mKillTimer; /**< Timer for kill stats. */
Button *mResetButton;
Button *mTimerButton;
@@ -107,6 +104,11 @@ class KillStats final : public Window,
Label *mLastKillExpLabel;
Label *mTimeBeforeJackoLabel;
+ int mKillCounter; /**< Session Kill counter. */
+ int mExpCounter; /**< Session Exp counter. */
+ int mKillTCounter; /**< Timer Kill counter. */
+ int mExpTCounter; /**< Timer Exp counter. */
+
int m1minExpTime;
int m1minExpNum;
int m1minSpeed;
diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp
index ef1830763..583a37746 100644
--- a/src/gui/windows/minimap.cpp
+++ b/src/gui/windows/minimap.cpp
@@ -52,9 +52,9 @@ Minimap::Minimap() :
mWidthProportion(0.5),
mHeightProportion(0.5),
mMapImage(nullptr),
+ mTextPopup(new TextPopup),
mMapOriginX(0),
mMapOriginY(0),
- mTextPopup(new TextPopup),
mCustomMapImage(false),
mAutoResize(config.getBoolValue("autoresizeminimaps"))
{
diff --git a/src/gui/windows/minimap.h b/src/gui/windows/minimap.h
index d99aea13d..e8fff5144 100644
--- a/src/gui/windows/minimap.h
+++ b/src/gui/windows/minimap.h
@@ -76,9 +76,9 @@ class Minimap final : public Window, public ConfigListener
float mWidthProportion;
float mHeightProportion;
Image *mMapImage;
+ TextPopup *mTextPopup;
int mMapOriginX;
int mMapOriginY;
- TextPopup *mTextPopup;
bool mCustomMapImage;
bool mAutoResize;
static bool mShow;
diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp
index db4555b26..226132652 100644
--- a/src/gui/windows/ministatuswindow.cpp
+++ b/src/gui/windows/ministatuswindow.cpp
@@ -57,10 +57,6 @@ MiniStatusWindow::MiniStatusWindow() :
mBars(),
mBarNames(),
mIcons(),
- mSpacing(mSkin ? mSkin->getOption("spacing", 3) : 3),
- mIconPadding(mSkin ? mSkin->getOption("iconPadding", 3) : 3),
- mIconSpacing(mSkin ? mSkin->getOption("iconSpacing", 2) : 2),
- mMaxX(0),
// TRANSLATORS: status bar name
mHpBar(createBar(0, 100, 0, Theme::HP_BAR, Theme::PROG_HP,
"hpprogressbar.xml", "hpprogressbar_fill.xml",
@@ -105,7 +101,11 @@ MiniStatusWindow::MiniStatusWindow() :
// TRANSLATORS: status bar name
"status bar", _("status bar"))),
mTextPopup(new TextPopup),
- mStatusPopup(new StatusPopup)
+ mStatusPopup(new StatusPopup),
+ mSpacing(mSkin ? mSkin->getOption("spacing", 3) : 3),
+ mIconPadding(mSkin ? mSkin->getOption("iconPadding", 3) : 3),
+ mIconSpacing(mSkin ? mSkin->getOption("iconSpacing", 2) : 2),
+ mMaxX(0)
{
mTextPopup->postInit();
mStatusPopup->postInit();
diff --git a/src/gui/windows/ministatuswindow.h b/src/gui/windows/ministatuswindow.h
index 0344d6c3a..ee20ef69b 100644
--- a/src/gui/windows/ministatuswindow.h
+++ b/src/gui/windows/ministatuswindow.h
@@ -114,11 +114,6 @@ class MiniStatusWindow final : public Popup,
std::map <std::string, ProgressBar*> mBarNames;
std::vector<AnimatedSprite *> mIcons;
- int mSpacing;
- int mIconPadding;
- int mIconSpacing;
- int mMaxX;
-
/*
* Mini Status Bars
*/
@@ -133,6 +128,11 @@ class MiniStatusWindow final : public Popup,
ProgressBar *mStatusBar;
TextPopup *mTextPopup;
StatusPopup *mStatusPopup;
+
+ int mSpacing;
+ int mIconPadding;
+ int mIconSpacing;
+ int mMaxX;
};
extern MiniStatusWindow *miniStatusWindow;
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp
index a1b2109fb..17454b6ab 100644
--- a/src/gui/windows/npcdialog.cpp
+++ b/src/gui/windows/npcdialog.cpp
@@ -115,12 +115,12 @@ NpcDialog::NpcDialog(const int npcId) :
getOptionBool("showitemsbackground"), "npc_listbackground.xml")),
mInputState(NPC_INPUT_NONE),
mActionState(NPC_ACTION_WAIT),
+ mPlayerBox(new PlayerBox(nullptr)),
+ mAvatarBeing(nullptr),
mLastNextTime(0),
mCameraMode(-1),
mCameraX(0),
mCameraY(0),
- mPlayerBox(new PlayerBox(nullptr)),
- mAvatarBeing(nullptr),
mShowAvatar(false),
mLogInteraction(config.getBoolValue("logNpcInGui"))
{
@@ -147,8 +147,8 @@ NpcDialog::NpcDialog(const int npcId) :
mTextBox->setEnableKeys(true);
mTextBox->setEnableTabs(true);
- mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mScrollArea->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS);
+ mScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
+ mScrollArea->setVerticalScrollPolicy(ScrollArea::SHOW_ALWAYS);
// Setup listbox
mItemList->setWrappingEnabled(true);
@@ -162,8 +162,8 @@ NpcDialog::NpcDialog(const int npcId) :
mItemList->setRowHeight(gui->getNpcFont()->getHeight());
setContentSize(260, 175);
- mListScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mItemScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
+ mListScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
+ mItemScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
mItemList->setVisible(true);
mTextField->setVisible(true);
mIntField->setVisible(true);
diff --git a/src/gui/windows/npcdialog.h b/src/gui/windows/npcdialog.h
index 5188c2fe2..bd9c21678 100644
--- a/src/gui/windows/npcdialog.h
+++ b/src/gui/windows/npcdialog.h
@@ -293,12 +293,12 @@ class NpcDialog final : public Window,
NpcInputState mInputState;
NpcActionState mActionState;
+ PlayerBox *mPlayerBox;
+ Being *mAvatarBeing;
int mLastNextTime;
int mCameraMode;
int mCameraX;
int mCameraY;
- PlayerBox *mPlayerBox;
- Being *mAvatarBeing;
bool mShowAvatar;
bool mLogInteraction;
};
diff --git a/src/gui/windows/npcpostdialog.cpp b/src/gui/windows/npcpostdialog.cpp
index 3c63775fe..3fdb42cb7 100644
--- a/src/gui/windows/npcpostdialog.cpp
+++ b/src/gui/windows/npcpostdialog.cpp
@@ -43,9 +43,9 @@ NpcPostDialog::NpcPostDialog(const int npcId):
// TRANSLATORS: npc post dialog caption
Window(_("NPC"), false, nullptr, "npcpost.xml"),
ActionListener(),
- mNpcId(npcId),
mText(new TextBox(this)),
- mSender(new TextField(this))
+ mSender(new TextField(this)),
+ mNpcId(npcId)
{
setContentSize(400, 180);
}
@@ -75,7 +75,7 @@ void NpcPostDialog::postInit()
// create scroll box for letter text
ScrollArea *const scrollArea = new ScrollArea(this, mText);
- scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
+ scrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
scrollArea->setDimension(Rect(
5, mSender->getHeight() + 5,
380, 140 - (mSender->getHeight() + sendButton->getHeight())));
diff --git a/src/gui/windows/npcpostdialog.h b/src/gui/windows/npcpostdialog.h
index 5396aad6e..c0477bf20 100644
--- a/src/gui/windows/npcpostdialog.h
+++ b/src/gui/windows/npcpostdialog.h
@@ -67,10 +67,9 @@ class NpcPostDialog final : public Window,
typedef std::list<NpcPostDialog*> DialogList;
static DialogList instances;
- int mNpcId;
-
TextBox *mText;
TextField *mSender;
+ int mNpcId;
};
#endif // GUI_WINDOWS_NPCPOSTDIALOG_H
diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp
index 6fcea7d3a..b1355ba46 100644
--- a/src/gui/windows/outfitwindow.cpp
+++ b/src/gui/windows/outfitwindow.cpp
@@ -66,18 +66,18 @@ OutfitWindow::OutfitWindow():
// TRANSLATORS: outfits window checkbox
mAwayOutfitCheck(new CheckBox(this, _("Away outfit"),
serverConfig.getValue("OutfitAwayIndex", OUTFITS_COUNT - 1))),
- mCurrentOutfit(0),
// TRANSLATORS: outfits window label
mKeyLabel(new Label(this, strprintf(_("Key: %s"),
- keyName(mCurrentOutfit).c_str()))),
+ keyName(0).c_str()))),
+ mBorderColor(getThemeColor(Theme::BORDER, 64)),
+ mBackgroundColor(getThemeColor(Theme::BACKGROUND, 32)),
+ mCurrentOutfit(0),
mBoxWidth(33),
mBoxHeight(33),
mGridWidth(4),
mGridHeight(4),
mItems(),
mAwayOutfit(0),
- mBorderColor(getThemeColor(Theme::BORDER, 64)),
- mBackgroundColor(getThemeColor(Theme::BACKGROUND, 32)),
mItemColors(),
mItemClicked(false),
mItemsUnequip()
diff --git a/src/gui/windows/outfitwindow.h b/src/gui/windows/outfitwindow.h
index 55948f834..cf60c32ad 100644
--- a/src/gui/windows/outfitwindow.h
+++ b/src/gui/windows/outfitwindow.h
@@ -94,19 +94,22 @@ class OutfitWindow final : public Window,
void clearCurrentOutfit();
private:
+ int getIndexFromGrid(const int pointX,
+ const int pointY) const A_WARN_UNUSED;
+ void save() const;
+
Button *mPreviousButton;
Button *mNextButton;
Button *mEquipButtom;
Label *mCurrentLabel;
CheckBox *mUnequipCheck;
CheckBox *mAwayOutfitCheck;
- int mCurrentOutfit;
Label *mKeyLabel;
- int getIndexFromGrid(const int pointX,
- const int pointY) const A_WARN_UNUSED;
- void save() const;
+ Color mBorderColor;
+ Color mBackgroundColor;
+ int mCurrentOutfit;
int mBoxWidth;
int mBoxHeight;
int mGridWidth;
@@ -115,8 +118,6 @@ class OutfitWindow final : public Window,
int mItems[OUTFITS_COUNT + 1][OUTFIT_ITEM_COUNT];
int mAwayOutfit;
- Color mBorderColor;
- Color mBackgroundColor;
unsigned char mItemColors[OUTFITS_COUNT + 1][OUTFIT_ITEM_COUNT];
bool mItemClicked;
bool mItemsUnequip[OUTFITS_COUNT];
diff --git a/src/gui/windows/questswindow.cpp b/src/gui/windows/questswindow.cpp
index eee3e4259..8d4eae9c8 100644
--- a/src/gui/windows/questswindow.cpp
+++ b/src/gui/windows/questswindow.cpp
@@ -122,14 +122,14 @@ QuestsWindow::QuestsWindow() :
getOptionBool("showtextbackground"), "quests_text_background.xml")),
// TRANSLATORS: quests window button
mCloseButton(new Button(this, _("Close"), "close", this)),
+ mCompleteIcon(Theme::getImageFromThemeXml("complete_icon.xml", "")),
+ mIncompleteIcon(Theme::getImageFromThemeXml("incomplete_icon.xml", "")),
mVars(),
mQuests(),
mAllEffects(),
mMapEffects(),
mNpcEffects(),
mQuestLinks(),
- mCompleteIcon(Theme::getImageFromThemeXml("complete_icon.xml", "")),
- mIncompleteIcon(Theme::getImageFromThemeXml("incomplete_icon.xml", "")),
mNewQuestEffectId(paths.getIntValue("newQuestEffectId")),
mCompleteQuestEffectId(paths.getIntValue("completeQuestEffectId")),
mMap(nullptr)
@@ -149,12 +149,12 @@ QuestsWindow::QuestsWindow() :
mQuestsListBox->setActionEventId("select");
mQuestsListBox->addActionListener(this);
- mQuestScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
+ mQuestScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
mText->setOpaque(false);
mText->setLinkHandler(mItemLinkHandler);
- mTextScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
+ mTextScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
mQuestsListBox->setWidth(500);
- if (gui && gui->getNpcFont()->getHeight() < 20)
+ if (!gui || gui->getNpcFont()->getHeight() < 20)
mQuestsListBox->setRowHeight(20);
else
mQuestsListBox->setRowHeight(gui->getNpcFont()->getHeight());
diff --git a/src/gui/windows/questswindow.h b/src/gui/windows/questswindow.h
index 9000fcaa9..df1cca467 100644
--- a/src/gui/windows/questswindow.h
+++ b/src/gui/windows/questswindow.h
@@ -85,6 +85,8 @@ class QuestsWindow final : public Window,
BrowserBox *mText;
ScrollArea *mTextScrollArea;
Button *mCloseButton;
+ Image *mCompleteIcon;
+ Image *mIncompleteIcon;
// quest variables: var, value
std::map<int, int> mVars;
// quests: var, quests
@@ -94,8 +96,6 @@ class QuestsWindow final : public Window,
// npc effects for current map and values: npc, effect
NpcQuestEffectMap mNpcEffects;
std::vector<QuestItem*> mQuestLinks;
- Image *mCompleteIcon;
- Image *mIncompleteIcon;
int mNewQuestEffectId;
int mCompleteQuestEffectId;
const Map *mMap;
diff --git a/src/gui/windows/selldialog.cpp b/src/gui/windows/selldialog.cpp
index 8bfcc6728..ebee65d1e 100644
--- a/src/gui/windows/selldialog.cpp
+++ b/src/gui/windows/selldialog.cpp
@@ -56,7 +56,11 @@ SellDialog::SellDialog(const int npcId) :
Window(_("Sell"), false, nullptr, "sell.xml"),
ActionListener(),
SelectionListener(),
- mNpcId(npcId), mMaxItems(0), mAmountItems(0), mNick("")
+ mNick(""),
+ mNpcId(npcId),
+ mPlayerMoney(0),
+ mMaxItems(0),
+ mAmountItems(0)
{
init();
}
@@ -66,7 +70,11 @@ SellDialog::SellDialog(const std::string &nick):
Window(_("Sell"), false, nullptr, "sell.xml"),
ActionListener(),
SelectionListener(),
- mNpcId(-1), mMaxItems(0), mAmountItems(0), mNick(nick)
+ mNick(nick),
+ mNpcId(-1),
+ mPlayerMoney(0),
+ mMaxItems(0),
+ mAmountItems(0)
{
init();
}
@@ -89,7 +97,7 @@ void SellDialog::init()
mShopItemList->setProtectItems(true);
mScrollArea = new ScrollArea(this, mShopItemList,
getOptionBool("showbackground"), "sell_background.xml");
- mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
+ mScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
mSlider = new Slider(this, 1.0);
@@ -162,7 +170,7 @@ SellDialog::~SellDialog()
void SellDialog::reset()
{
mShopItems->clear();
- mSlider->setValue2(0);
+ mSlider->setValue(0);
mShopItemList->setSelected(-1);
updateButtonsAndLabels();
}
@@ -213,19 +221,19 @@ void SellDialog::action(const ActionEvent &event)
else if (eventId == "inc" && mAmountItems < mMaxItems)
{
mAmountItems++;
- mSlider->setValue2(mAmountItems);
+ mSlider->setValue(mAmountItems);
updateButtonsAndLabels();
}
else if (eventId == "dec" && mAmountItems > 1)
{
mAmountItems--;
- mSlider->setValue2(mAmountItems);
+ mSlider->setValue(mAmountItems);
updateButtonsAndLabels();
}
else if (eventId == "max")
{
mAmountItems = mMaxItems;
- mSlider->setValue2(mAmountItems);
+ mSlider->setValue(mAmountItems);
updateButtonsAndLabels();
}
else if ((eventId == "presell" || eventId == "sell" || eventId == "yes")
@@ -269,7 +277,7 @@ void SellDialog::action(const ActionEvent &event)
mPlayerMoney +=
mAmountItems * mShopItems->at(selectedItem)->getPrice();
mAmountItems = 1;
- mSlider->setValue2(0);
+ mSlider->setValue(0);
if (mMaxItems)
{
@@ -304,7 +312,7 @@ void SellDialog::valueChanged(const SelectionEvent &event A_UNUSED)
{
// Reset amount of items and update labels
mAmountItems = 1;
- mSlider->setValue2(0);
+ mSlider->setValue(0);
updateButtonsAndLabels();
mSlider->setScale(1, mMaxItems);
diff --git a/src/gui/windows/selldialog.h b/src/gui/windows/selldialog.h
index bd270919e..0cfffbf38 100644
--- a/src/gui/windows/selldialog.h
+++ b/src/gui/windows/selldialog.h
@@ -122,7 +122,7 @@ class SellDialog final : public Window,
*/
void updateButtonsAndLabels();
- int mNpcId;
+ std::string mNick;
Button *mSellButton;
Button *mQuitButton;
@@ -134,14 +134,12 @@ class SellDialog final : public Window,
Label *mMoneyLabel;
Label *mQuantityLabel;
Slider *mSlider;
-
ShopItems *mShopItems;
- int mPlayerMoney;
+ int mNpcId;
+ int mPlayerMoney;
int mMaxItems;
int mAmountItems;
-
- std::string mNick;
};
#endif // GUI_WINDOWS_SELLDIALOG_H
diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp
index af29da656..112d1588d 100644
--- a/src/gui/windows/serverdialog.cpp
+++ b/src/gui/windows/serverdialog.cpp
@@ -193,6 +193,8 @@ ServerDialog::ServerDialog(ServerInfo *const serverInfo,
KeyListener(),
SelectionListener(),
mMutex(),
+ mServers(ServerInfos()),
+ mDir(dir),
mDescription(new Label(this, std::string())),
// TRANSLATORS: servers dialog button
mQuitButton(new Button(this, _("Quit"), "quit", this)),
@@ -206,15 +208,13 @@ ServerDialog::ServerDialog(ServerInfo *const serverInfo,
mDeleteButton(new Button(this, _("Delete"), "remove", this)),
// TRANSLATORS: servers dialog button
mLoadButton(new Button(this, _("Load"), "load", this)),
- mServers(ServerInfos()),
mServersListModel(new ServersListModel(&mServers, this)),
mServersList(new ServersListBox(this, mServersListModel)),
- mDir(dir),
- mDownloadStatus(DOWNLOADING_UNKNOWN),
mDownload(nullptr),
- mDownloadProgress(-1.0F),
mServerInfo(serverInfo),
- mPersistentIPCheckBox(nullptr)
+ mPersistentIPCheckBox(nullptr),
+ mDownloadProgress(-1.0F),
+ mDownloadStatus(DOWNLOADING_UNKNOWN)
{
mServersList->postInit();
@@ -240,7 +240,7 @@ ServerDialog::ServerDialog(ServerInfo *const serverInfo,
ScrollArea *const usedScroll = new ScrollArea(this, mServersList,
getOptionBool("showbackground"), "server_background.xml");
- usedScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
+ usedScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
mServersList->addSelectionListener(this);
usedScroll->setVerticalScrollAmount(0);
diff --git a/src/gui/windows/serverdialog.h b/src/gui/windows/serverdialog.h
index 39c82279e..7c3a05ab3 100644
--- a/src/gui/windows/serverdialog.h
+++ b/src/gui/windows/serverdialog.h
@@ -118,6 +118,8 @@ class ServerDialog final : public Window,
size_t total, size_t remaining);
Mutex mMutex;
+ ServerInfos mServers;
+ const std::string &mDir;
Label *mDescription;
Button *mQuitButton;
Button *mConnectButton;
@@ -125,13 +127,9 @@ class ServerDialog final : public Window,
Button *mEditEntryButton;
Button *mDeleteButton;
Button *mLoadButton;
-
- ServerInfos mServers;
ServersListModel *mServersListModel;
ListBox *mServersList;
- const std::string &mDir;
-
enum ServerDialogDownloadStatus
{
DOWNLOADING_UNKNOWN = 0,
@@ -144,11 +142,11 @@ class ServerDialog final : public Window,
};
/** Status of the current download. */
- ServerDialogDownloadStatus mDownloadStatus;
Net::Download *mDownload;
- float mDownloadProgress;
ServerInfo *mServerInfo;
CheckBox *mPersistentIPCheckBox;
+ float mDownloadProgress;
+ ServerDialogDownloadStatus mDownloadStatus;
};
#endif // GUI_WINDOWS_SERVERDIALOG_H
diff --git a/src/gui/windows/setupwindow.cpp b/src/gui/windows/setupwindow.cpp
index 2bcac85a5..1760d00bd 100644
--- a/src/gui/windows/setupwindow.cpp
+++ b/src/gui/windows/setupwindow.cpp
@@ -61,9 +61,9 @@ SetupWindow::SetupWindow() :
Window(_("Setup"), false, nullptr, "setup.xml"),
ActionListener(),
mTabs(),
- mModsTab(nullptr),
mWindowsToReset(),
mButtons(),
+ mModsTab(nullptr),
mResetWindows(nullptr),
mPanel(new TabbedArea(this)),
mVersion(new Label(this, FULL_VERSION))
diff --git a/src/gui/windows/setupwindow.h b/src/gui/windows/setupwindow.h
index 38b3eb206..e604bf0de 100644
--- a/src/gui/windows/setupwindow.h
+++ b/src/gui/windows/setupwindow.h
@@ -77,9 +77,9 @@ class SetupWindow final : public Window,
void unloadModTab();
std::list<SetupTab*> mTabs;
- SetupTab *mModsTab;
std::list<Window*> mWindowsToReset;
std::vector<Button*> mButtons;
+ SetupTab *mModsTab;
Button *mResetWindows;
TabbedArea *mPanel;
Label *mVersion;
diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp
index 32e249d35..923511baa 100644
--- a/src/gui/windows/shopwindow.cpp
+++ b/src/gui/windows/shopwindow.cpp
@@ -78,6 +78,7 @@ ShopWindow::ShopWindow():
mCloseButton(new Button(this, _("Close"), "close", this)),
mBuyShopItems(new ShopItems),
mSellShopItems(new ShopItems),
+ mTradeItem(nullptr),
mBuyShopItemList(new ShopListBox(this, mBuyShopItems, mBuyShopItems)),
mSellShopItemList(new ShopListBox(this, mSellShopItems, mSellShopItems)),
mBuyScrollArea(new ScrollArea(this, mBuyShopItemList,
@@ -106,14 +107,13 @@ ShopWindow::ShopWindow():
// TRANSLATORS: shop window checkbox
mAnnounceLinks(new CheckBox(this, _("Show links in announce"), false,
this, "link announce")),
+ mAcceptPlayer(""),
+ mTradeNick(""),
mSelectedItem(-1),
mAnnonceTime(0),
mLastRequestTimeList(0),
mLastRequestTimeItem(0),
mRandCounter(0),
- mAcceptPlayer(""),
- mTradeItem(nullptr),
- mTradeNick(""),
mTradeMoney(0)
{
mBuyShopItemList->postInit();
@@ -138,8 +138,8 @@ ShopWindow::ShopWindow():
mBuyShopItemList->setPriceCheck(false);
mSellShopItemList->setPriceCheck(false);
- mBuyScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mSellScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
+ mBuyScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
+ mSellScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
mBuyShopItemList->addSelectionListener(this);
mSellShopItemList->addSelectionListener(this);
diff --git a/src/gui/windows/shopwindow.h b/src/gui/windows/shopwindow.h
index 76971364b..5b5a8309b 100644
--- a/src/gui/windows/shopwindow.h
+++ b/src/gui/windows/shopwindow.h
@@ -147,6 +147,7 @@ class ShopWindow final : public Window,
ShopItems *mBuyShopItems;
ShopItems *mSellShopItems;
+ ShopItem *mTradeItem;
ShopListBox *mBuyShopItemList;
ShopListBox *mSellShopItemList;
@@ -163,15 +164,13 @@ class ShopWindow final : public Window,
Button *mSellAnnounceButton;
Button *mSellAuctionButton;
CheckBox *mAnnounceLinks;
-
+ std::string mAcceptPlayer;
+ std::string mTradeNick;
int mSelectedItem;
int mAnnonceTime;
int mLastRequestTimeList;
int mLastRequestTimeItem;
int mRandCounter;
- std::string mAcceptPlayer;
- ShopItem *mTradeItem;
- std::string mTradeNick;
int mTradeMoney;
int mAnnounceCounter[2];
};
diff --git a/src/gui/windows/shortcutwindow.cpp b/src/gui/windows/shortcutwindow.cpp
index 5b3c03e90..6ec442cd5 100644
--- a/src/gui/windows/shortcutwindow.cpp
+++ b/src/gui/windows/shortcutwindow.cpp
@@ -97,7 +97,7 @@ ShortcutWindow::ShortcutWindow(const std::string &restrict title,
mBoxesWidth += bw + border;
mScrollArea->setPosition(SCROLL_PADDING, SCROLL_PADDING);
- mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
+ mScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
place(0, 0, mScrollArea, 5, 5).setPadding(0);
@@ -163,7 +163,7 @@ void ShortcutWindow::addTab(const std::string &name,
{
ScrollArea *const scroll = new ScrollArea(this, content, false);
scroll->setPosition(SCROLL_PADDING, SCROLL_PADDING);
- scroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
+ scroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
content->setWidget2(this);
Tab *const tab = new ShortcutTab(this, name, content);
mTabs->addTab(tab, scroll);
diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp
index f33534a85..8e6becca1 100644
--- a/src/gui/windows/socialwindow.cpp
+++ b/src/gui/windows/socialwindow.cpp
@@ -198,8 +198,8 @@ public:
mScroll = new ScrollArea(this, mList, showBackground,
"social_background.xml");
- mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_AUTO);
- mScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS);
+ mScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_AUTO);
+ mScroll->setVerticalScrollPolicy(ScrollArea::SHOW_ALWAYS);
}
A_DELETE_COPY(SocialGuildTab)
@@ -334,8 +334,8 @@ public:
mScroll = new ScrollArea(this, mList, showBackground,
"social_background.xml");
- mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_AUTO);
- mScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS);
+ mScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_AUTO);
+ mScroll->setVerticalScrollPolicy(ScrollArea::SHOW_ALWAYS);
}
A_DELETE_COPY(SocialGuildTab2)
@@ -403,8 +403,8 @@ public:
mScroll = new ScrollArea(this, mList, showBackground,
"social_background.xml");
- mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_AUTO);
- mScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS);
+ mScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_AUTO);
+ mScroll->setVerticalScrollPolicy(ScrollArea::SHOW_ALWAYS);
}
A_DELETE_COPY(SocialPartyTab)
@@ -519,8 +519,8 @@ public:
mScroll = new ScrollArea(this, mList, showBackground,
"social_background.xml");
- mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_AUTO);
- mScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS);
+ mScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_AUTO);
+ mScroll->setVerticalScrollPolicy(ScrollArea::SHOW_ALWAYS);
getPlayersAvatars();
setCaption(name);
@@ -685,8 +685,8 @@ public:
mScroll = new ScrollArea(this, mList, showBackground,
"social_background.xml");
- mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_AUTO);
- mScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS);
+ mScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_AUTO);
+ mScroll->setVerticalScrollPolicy(ScrollArea::SHOW_ALWAYS);
// TRANSLATORS: Navigation tab name in social window. Should be small
setCaption(_("Nav"));
@@ -1014,8 +1014,8 @@ public:
mScroll = new ScrollArea(this, mList, showBackground,
"social_background.xml");
- mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_AUTO);
- mScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS);
+ mScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_AUTO);
+ mScroll->setVerticalScrollPolicy(ScrollArea::SHOW_ALWAYS);
// TRANSLATORS: Attack filter tab name in social window. Should be small
setCaption(_("Atk"));
@@ -1061,8 +1061,8 @@ public:
mScroll = new ScrollArea(this, mList, showBackground,
"social_background.xml");
- mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_AUTO);
- mScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS);
+ mScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_AUTO);
+ mScroll->setVerticalScrollPolicy(ScrollArea::SHOW_ALWAYS);
// TRANSLATORS: Pickup filter tab name in social window. Should be small
setCaption(_("Pik"));
@@ -1108,8 +1108,8 @@ public:
mScroll = new ScrollArea(this, mList, showBackground,
"social_background.xml");
- mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_AUTO);
- mScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS);
+ mScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_AUTO);
+ mScroll->setVerticalScrollPolicy(ScrollArea::SHOW_ALWAYS);
getPlayersAvatars();
setCaption(name);
@@ -1255,10 +1255,10 @@ SocialWindow::SocialWindow() :
mGuildAcceptDialog(nullptr),
mGuildCreateDialog(nullptr),
mPartyInviter(),
- mPartyAcceptDialog(nullptr),
- mPartyCreateDialog(nullptr),
mGuilds(),
mParties(),
+ mPartyAcceptDialog(nullptr),
+ mPartyCreateDialog(nullptr),
mAttackFilter(nullptr),
mPickupFilter(nullptr),
// TRANSLATORS: here P is title for visible players tab in social window
diff --git a/src/gui/windows/socialwindow.h b/src/gui/windows/socialwindow.h
index 57fbd5be5..f0bfe1fb9 100644
--- a/src/gui/windows/socialwindow.h
+++ b/src/gui/windows/socialwindow.h
@@ -138,23 +138,21 @@ public:
protected:
friend class SocialTab;
+ typedef std::map<Guild*, SocialTab*> GuildMap;
+ typedef std::map<Party*, SocialTab*> PartyMap;
void updateButtons();
int mGuildInvited;
ConfirmDialog *mGuildAcceptDialog;
TextDialog *mGuildCreateDialog;
-
std::string mPartyInviter;
- ConfirmDialog *mPartyAcceptDialog;
- TextDialog *mPartyCreateDialog;
-
- typedef std::map<Guild*, SocialTab*> GuildMap;
GuildMap mGuilds;
-
- typedef std::map<Party*, SocialTab*> PartyMap;
PartyMap mParties;
+ ConfirmDialog *mPartyAcceptDialog;
+ TextDialog *mPartyCreateDialog;
+
SocialTab *mAttackFilter;
SocialTab *mPickupFilter;
SocialTab *mPlayers;
diff --git a/src/gui/windows/textcommandeditor.h b/src/gui/windows/textcommandeditor.h
index de7f3b1a4..915ef204c 100644
--- a/src/gui/windows/textcommandeditor.h
+++ b/src/gui/windows/textcommandeditor.h
@@ -68,18 +68,16 @@ class TextCommandEditor final : public Window,
void deleteCommand();
bool mIsMagicCommand;
- TextCommand *mCommand;
+ TextCommand *mCommand;
RadioButton *mIsMagic;
RadioButton *mIsOther;
Label *mSymbolLabel;
TextField *mSymbolTextField;
Label *mCommandLabel;
TextField *mCommandTextField;
-
Label *mCommentLabel;
TextField *mCommentTextField;
-
TargetTypeModel *mTargetTypeModel;
Label *mTypeLabel;
DropDown *mTypeDropDown;
diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp
index 506f25c17..f05cf1cac 100644
--- a/src/gui/windows/tradewindow.cpp
+++ b/src/gui/windows/tradewindow.cpp
@@ -80,13 +80,13 @@ TradeWindow::TradeWindow():
// TRANSLATORS: trade window money change button
mMoneyChangeButton(new Button(this, _("Change"), "money", this)),
mMoneyField(new TextField(this)),
- mStatus(PROPOSING),
mAutoAddItem(nullptr),
mAutoAddToNick(""),
mGotMoney(0),
mGotMaxMoney(0),
mAutoMoney(0),
mAutoAddAmount(0),
+ mStatus(PROPOSING),
mOkOther(false),
mOkMe(false)
{
@@ -440,7 +440,7 @@ void TradeWindow::initTrade(const std::string &nick)
const Inventory *const inv = PlayerInfo::getInventory();
if (inv)
{
- Item *const item = inv->findItem(mAutoAddItem->getId(),
+ const Item *const item = inv->findItem(mAutoAddItem->getId(),
mAutoAddItem->getColor());
if (item)
tradeItem(item, mAutoAddAmount);
diff --git a/src/gui/windows/tradewindow.h b/src/gui/windows/tradewindow.h
index 9704c1e80..447e99144 100644
--- a/src/gui/windows/tradewindow.h
+++ b/src/gui/windows/tradewindow.h
@@ -171,13 +171,13 @@ class TradeWindow final : public Window,
Button *mMoneyChangeButton;
TextField *mMoneyField;
- Status mStatus;
Item* mAutoAddItem;
std::string mAutoAddToNick;
int mGotMoney;
int mGotMaxMoney;
int mAutoMoney;
int mAutoAddAmount;
+ Status mStatus;
bool mOkOther;
bool mOkMe;
};
diff --git a/src/gui/windows/unregisterdialog.h b/src/gui/windows/unregisterdialog.h
index 206c05413..207f2fef3 100644
--- a/src/gui/windows/unregisterdialog.h
+++ b/src/gui/windows/unregisterdialog.h
@@ -61,12 +61,9 @@ class UnRegisterDialog final : public Window,
private:
LoginData *mLoginData;
-
TextField *mPasswordField;
-
Button *mUnRegisterButton;
Button *mCancelButton;
-
WrongDataNoticeListener *mWrongDataNoticeListener;
};
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp
index e72308da7..247ef8707 100644
--- a/src/gui/windows/updaterwindow.cpp
+++ b/src/gui/windows/updaterwindow.cpp
@@ -159,27 +159,19 @@ UpdaterWindow::UpdaterWindow(const std::string &restrict updateHost,
Window(_("Updating..."), false, nullptr, "update.xml"),
ActionListener(),
KeyListener(),
- mDownloadStatus(UPDATE_NEWS),
+ mDownloadProgress(0.0F),
mUpdateHost(updateHost),
mUpdatesDir(updatesDir),
mUpdatesDirReal(updatesDir),
mCurrentFile("news.txt"),
mNewLabelCaption(),
- mDownloadProgress(0.0F),
mDownloadMutex(),
mCurrentChecksum(0),
- mStoreInMemory(true),
- mDownloadComplete(true),
- mUserCancel(false),
- mDownloadedBytes(0),
mMemoryBuffer(nullptr),
mDownload(nullptr),
mUpdateFiles(),
mTempUpdateFiles(),
- mUpdateIndex(0),
- mUpdateIndexOffset(0),
- mLoadUpdates(applyUpdates),
- mUpdateType(updateType),
+ mUpdateServerPath(mUpdateHost),
// TRANSLATORS: updater window label
mLabel(new Label(this, _("Connecting..."))),
// TRANSLATORS: updater window button
@@ -192,7 +184,15 @@ UpdaterWindow::UpdaterWindow(const std::string &restrict updateHost,
"browserbox.xml")),
mScrollArea(new ScrollArea(this, mBrowserBox,
true, "update_background.xml")),
- mUpdateServerPath(mUpdateHost)
+ mDownloadStatus(UPDATE_NEWS),
+ mDownloadedBytes(0),
+ mUpdateIndex(0),
+ mUpdateIndexOffset(0),
+ mUpdateType(updateType),
+ mStoreInMemory(true),
+ mDownloadComplete(true),
+ mUserCancel(false),
+ mLoadUpdates(applyUpdates)
{
setWindowName("UpdaterWindow");
setResizable(true);
diff --git a/src/gui/windows/updaterwindow.h b/src/gui/windows/updaterwindow.h
index 79d764752..39e1e84f3 100644
--- a/src/gui/windows/updaterwindow.h
+++ b/src/gui/windows/updaterwindow.h
@@ -198,8 +198,8 @@ private:
UPDATE_RESOURCES2
};
- /** Status of the current download. */
- UpdateDownloadStatus mDownloadStatus;
+ /** The new progress value to be set in the logic method. */
+ float mDownloadProgress;
/** Host where we get the updated files. */
std::string mUpdateHost;
@@ -215,9 +215,6 @@ private:
/** The new label caption to be set in the logic method. */
std::string mNewLabelCaption;
- /** The new progress value to be set in the logic method. */
- float mDownloadProgress;
-
// The mutex used to guard access to mNewLabelCaption
// and mDownloadProgress.
Mutex mDownloadMutex;
@@ -225,18 +222,6 @@ private:
/** The Adler32 checksum of the file currently downloading. */
unsigned long mCurrentChecksum;
- /** A flag to indicate whether to use a memory buffer or a regular file. */
- bool mStoreInMemory;
-
- /** Flag that show if current download is complete. */
- bool mDownloadComplete;
-
- /** Flag that show if the user has canceled the update. */
- bool mUserCancel;
-
- /** Byte count currently downloaded in mMemoryBuffer. */
- int mDownloadedBytes;
-
/** Buffer for files downloaded to memory. */
char *mMemoryBuffer;
@@ -249,24 +234,40 @@ private:
/** List of temp files to download. */
std::vector<UpdateFile> mTempUpdateFiles;
+ std::string mUpdateServerPath;
+
+ Label *mLabel; /**< Progress bar caption. */
+ Button *mCancelButton; /**< Button to stop the update process. */
+ Button *mPlayButton; /**< Button to start playing. */
+ ProgressBar *mProgressBar; /**< Update progress bar. */
+ BrowserBox *mBrowserBox; /**< Box to display news. */
+ ScrollArea *mScrollArea; /**< Used to scroll news box. */
+
+ /** Status of the current download. */
+ UpdateDownloadStatus mDownloadStatus;
+
+ /** Byte count currently downloaded in mMemoryBuffer. */
+ int mDownloadedBytes;
+
/** Index of the file to be downloaded. */
unsigned int mUpdateIndex;
/** Index offset for disaplay downloaded file. */
unsigned int mUpdateIndexOffset;
- /** Tells ~UpdaterWindow() if it should load updates */
- bool mLoadUpdates;
-
int mUpdateType;
- Label *mLabel; /**< Progress bar caption. */
- Button *mCancelButton; /**< Button to stop the update process. */
- Button *mPlayButton; /**< Button to start playing. */
- ProgressBar *mProgressBar; /**< Update progress bar. */
- BrowserBox *mBrowserBox; /**< Box to display news. */
- ScrollArea *mScrollArea; /**< Used to scroll news box. */
- std::string mUpdateServerPath;
+ /** A flag to indicate whether to use a memory buffer or a regular file. */
+ bool mStoreInMemory;
+
+ /** Flag that show if current download is complete. */
+ bool mDownloadComplete;
+
+ /** Flag that show if the user has canceled the update. */
+ bool mUserCancel;
+
+ /** Tells ~UpdaterWindow() if it should load updates */
+ bool mLoadUpdates;
};
#endif // GUI_WINDOWS_UPDATERWINDOW_H
diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp
index dabc8c7c1..a1683ffc8 100644
--- a/src/gui/windows/whoisonline.cpp
+++ b/src/gui/windows/whoisonline.cpp
@@ -79,20 +79,24 @@ class NameFunctuator final
WhoIsOnline::WhoIsOnline() :
// TRANSLATORS: who is online window name
Window(_("Who Is Online - Updating"), false, nullptr, "whoisonline.xml"),
+ mUpdateTimer(0),
mThread(nullptr),
- mDownloadStatus(UPDATE_LIST),
- mDownloadComplete(true),
- mDownloadedBytes(0),
mMemoryBuffer(nullptr),
mCurlError(new char[CURL_ERROR_SIZE]),
mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, true,
"onlinebrowserbox.xml")),
mScrollArea(new ScrollArea(this, mBrowserBox, false)),
- mUpdateTimer(0),
mOnlinePlayers(),
mOnlineNicks(),
// TRANSLATORS: who is online. button.
mUpdateButton(new Button(this, _("Update"), "update", this)),
+ mFriends(),
+ mNeutral(),
+ mDisregard(),
+ mEnemy(),
+ mDownloadedBytes(0),
+ mDownloadStatus(UPDATE_LIST),
+ mDownloadComplete(true),
mAllowUpdate(true),
mShowLevel(false),
mUpdateOnlineList(config.getBoolValue("updateOnlineList")),
@@ -201,22 +205,18 @@ void WhoIsOnline::handleLink(const std::string& link, MouseEvent *event)
}
}
-void WhoIsOnline::updateWindow(std::vector<OnlinePlayer*> &restrict friends,
- std::vector<OnlinePlayer*> &restrict neutral,
- std::vector<OnlinePlayer*> &restrict disregard,
- std::vector<OnlinePlayer*> &restrict enemy,
- size_t numOnline)
+void WhoIsOnline::updateWindow(size_t numOnline)
{
// Set window caption
// TRANSLATORS: who is online window name
setCaption(_("Who Is Online - ") + toString(numOnline));
// List the online people
- std::sort(friends.begin(), friends.end(), nameCompare);
- std::sort(neutral.begin(), neutral.end(), nameCompare);
- std::sort(disregard.begin(), disregard.end(), nameCompare);
+ std::sort(mFriends.begin(), mFriends.end(), nameCompare);
+ std::sort(mNeutral.begin(), mNeutral.end(), nameCompare);
+ std::sort(mDisregard.begin(), mDisregard.end(), nameCompare);
bool addedFromSection(false);
- FOR_EACH (std::vector<OnlinePlayer*>::const_iterator, it, friends)
+ FOR_EACH (std::vector<OnlinePlayer*>::const_iterator, it, mFriends)
{
mBrowserBox->addRow((*it)->getText());
addedFromSection = true;
@@ -226,7 +226,7 @@ void WhoIsOnline::updateWindow(std::vector<OnlinePlayer*> &restrict friends,
mBrowserBox->addRow("---");
addedFromSection = false;
}
- FOR_EACH (std::vector<OnlinePlayer*>::const_iterator, it, enemy)
+ FOR_EACH (std::vector<OnlinePlayer*>::const_iterator, it, mEnemy)
{
mBrowserBox->addRow((*it)->getText());
addedFromSection = true;
@@ -236,15 +236,15 @@ void WhoIsOnline::updateWindow(std::vector<OnlinePlayer*> &restrict friends,
mBrowserBox->addRow("---");
addedFromSection = false;
}
- FOR_EACH (std::vector<OnlinePlayer*>::const_iterator, it, neutral)
+ FOR_EACH (std::vector<OnlinePlayer*>::const_iterator, it, mNeutral)
{
mBrowserBox->addRow((*it)->getText());
addedFromSection = true;
}
- if (addedFromSection == true && !disregard.empty())
+ if (addedFromSection == true && !mDisregard.empty())
mBrowserBox->addRow("---");
- FOR_EACH (std::vector<OnlinePlayer*>::const_iterator, it, disregard)
+ FOR_EACH (std::vector<OnlinePlayer*>::const_iterator, it, mDisregard)
mBrowserBox->addRow((*it)->getText());
if (mScrollArea->getVerticalMaxScroll() <
@@ -255,14 +255,47 @@ void WhoIsOnline::updateWindow(std::vector<OnlinePlayer*> &restrict friends,
}
}
+void WhoIsOnline::handlerPlayerRelation(const std::string &nick,
+ OnlinePlayer *const player)
+{
+ switch (player_relations.getRelation(nick))
+ {
+ case PlayerRelation::NEUTRAL:
+ default:
+ setNeutralColor(player);
+ mNeutral.push_back(player);
+ break;
+
+ case PlayerRelation::FRIEND:
+ player->setText("2");
+ if (mGroupFriends)
+ mFriends.push_back(player);
+ else
+ mNeutral.push_back(player);
+ break;
+
+ case PlayerRelation::DISREGARDED:
+ case PlayerRelation::BLACKLISTED:
+ player->setText("8");
+ mDisregard.push_back(player);
+ break;
+
+ case PlayerRelation::ENEMY2:
+ player->setText("1");
+ mEnemy.push_back(player);
+ break;
+
+ case PlayerRelation::IGNORED:
+ case PlayerRelation::ERASED:
+ // Ignore the ignored.
+ break;
+ }
+}
+
void WhoIsOnline::loadList(std::vector<OnlinePlayer*> &list)
{
mBrowserBox->clearRows();
const size_t numOnline = list.size();
- std::vector<OnlinePlayer*> friends;
- std::vector<OnlinePlayer*> neutral;
- std::vector<OnlinePlayer*> disregard;
- std::vector<OnlinePlayer*> enemy;
FOR_EACH (std::set<OnlinePlayer*>::iterator, itd, mOnlinePlayers)
delete *itd;
@@ -281,41 +314,10 @@ void WhoIsOnline::loadList(std::vector<OnlinePlayer*> &list)
if (!mShowLevel)
player->setLevel(0);
- switch (player_relations.getRelation(nick))
- {
- case PlayerRelation::NEUTRAL:
- default:
- setNeutralColor(player);
- neutral.push_back(player);
- break;
-
- case PlayerRelation::FRIEND:
- player->setText("2");
- if (mGroupFriends)
- friends.push_back(player);
- else
- neutral.push_back(player);
- break;
-
- case PlayerRelation::DISREGARDED:
- case PlayerRelation::BLACKLISTED:
- player->setText("8");
- disregard.push_back(player);
- break;
-
- case PlayerRelation::ENEMY2:
- player->setText("1");
- enemy.push_back(player);
- break;
-
- case PlayerRelation::IGNORED:
- case PlayerRelation::ERASED:
- // Ignore the ignored.
- break;
- }
+ handlerPlayerRelation(nick, player);
}
- updateWindow(friends, neutral, disregard, enemy, numOnline);
+ updateWindow(numOnline);
if (!mOnlineNicks.empty())
{
if (chatWindow)
@@ -324,6 +326,10 @@ void WhoIsOnline::loadList(std::vector<OnlinePlayer*> &list)
socialWindow->updateActiveList();
}
updateSize();
+ mFriends.clear();
+ mNeutral.clear();
+ mDisregard.clear();
+ mEnemy.clear();
}
void WhoIsOnline::loadWebList()
@@ -343,10 +349,6 @@ void WhoIsOnline::loadWebList()
bool listStarted(false);
std::string lineStr;
int numOnline(0);
- std::vector<OnlinePlayer*> friends;
- std::vector<OnlinePlayer*> neutral;
- std::vector<OnlinePlayer*> disregard;
- std::vector<OnlinePlayer*> enemy;
// Tokenize and add each line separately
char *line = strtok(mMemoryBuffer, "\n");
@@ -441,38 +443,7 @@ void WhoIsOnline::loadWebList()
player->setIsGM(true);
numOnline++;
- switch (player_relations.getRelation(nick))
- {
- case PlayerRelation::NEUTRAL:
- default:
- setNeutralColor(player);
- neutral.push_back(player);
- break;
-
- case PlayerRelation::FRIEND:
- player->setText("2");
- if (mGroupFriends)
- friends.push_back(player);
- else
- neutral.push_back(player);
- break;
-
- case PlayerRelation::DISREGARDED:
- case PlayerRelation::BLACKLISTED:
- player->setText("8");
- disregard.push_back(player);
- break;
-
- case PlayerRelation::ENEMY2:
- player->setText("1");
- enemy.push_back(player);
- break;
-
- case PlayerRelation::IGNORED:
- case PlayerRelation::ERASED:
- // Ignore the ignored.
- break;
- }
+ handlerPlayerRelation(nick, player);
}
}
else if (lineStr.find("------------------------------")
@@ -483,11 +454,15 @@ void WhoIsOnline::loadWebList()
line = strtok(nullptr, "\n");
}
- updateWindow(friends, neutral, disregard, enemy, numOnline);
+ updateWindow(numOnline);
// Free the memory buffer now that we don't need it anymore
free(mMemoryBuffer);
mMemoryBuffer = nullptr;
+ mFriends.clear();
+ mNeutral.clear();
+ mDisregard.clear();
+ mEnemy.clear();
}
size_t WhoIsOnline::memoryWrite(void *ptr, size_t size,
diff --git a/src/gui/windows/whoisonline.h b/src/gui/windows/whoisonline.h
index bc04c8066..915150409 100644
--- a/src/gui/windows/whoisonline.h
+++ b/src/gui/windows/whoisonline.h
@@ -162,6 +162,8 @@ private:
void updateSize();
+ void handlerPlayerRelation(const std::string &nick,
+ OnlinePlayer *const player);
/**
* The thread function that download the files.
*/
@@ -178,11 +180,7 @@ private:
const std::string &restrict color)
const A_WARN_UNUSED;
- void updateWindow(std::vector<OnlinePlayer*> &restrict friends,
- std::vector<OnlinePlayer*> &restrict neutral,
- std::vector<OnlinePlayer*> &restrict disregard,
- std::vector<OnlinePlayer*> &restrict enemy,
- size_t numOnline);
+ void updateWindow(size_t numOnline);
enum DownloadStatus
{
@@ -191,18 +189,11 @@ private:
UPDATE_LIST
};
+ time_t mUpdateTimer;
+
/** A thread that use libcurl to download updates. */
SDL_Thread *mThread;
- /** Status of the current download. */
- DownloadStatus mDownloadStatus;
-
- /** Flag that show if current download is complete. */
- bool mDownloadComplete;
-
- /** Byte count currently downloaded in mMemoryBuffer. */
- int mDownloadedBytes;
-
/** Buffer for files downloaded to memory. */
char *mMemoryBuffer;
@@ -211,11 +202,23 @@ private:
BrowserBox *mBrowserBox;
ScrollArea *mScrollArea;
- time_t mUpdateTimer;
std::set<OnlinePlayer*> mOnlinePlayers;
std::set<std::string> mOnlineNicks;
Button *mUpdateButton;
+ std::vector<OnlinePlayer*> mFriends;
+ std::vector<OnlinePlayer*> mNeutral;
+ std::vector<OnlinePlayer*> mDisregard;
+ std::vector<OnlinePlayer*> mEnemy;
+
+ /** Byte count currently downloaded in mMemoryBuffer. */
+ int mDownloadedBytes;
+
+ /** Status of the current download. */
+ DownloadStatus mDownloadStatus;
+
+ /** Flag that show if current download is complete. */
+ bool mDownloadComplete;
bool mAllowUpdate;
bool mShowLevel;
bool mUpdateOnlineList;
diff --git a/src/gui/windows/worldselectdialog.cpp b/src/gui/windows/worldselectdialog.cpp
index 77d167c82..58c1aaee8 100644
--- a/src/gui/windows/worldselectdialog.cpp
+++ b/src/gui/windows/worldselectdialog.cpp
@@ -60,7 +60,7 @@ WorldSelectDialog::WorldSelectDialog(Worlds worlds):
ScrollArea *const worldsScroll = new ScrollArea(this, mWorldList,
getOptionBool("showbackground"), "world_background.xml");
- worldsScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
+ worldsScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
place(0, 0, worldsScroll, 3, 5).setPadding(2);
place(1, 5, mChangeLoginButton);