summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-07-26 18:10:09 +0300
committerAndrei Karas <akaras@inbox.ru>2016-07-26 21:30:20 +0300
commit8f3d5cce14912a4c955a02f50a13130ca15b585e (patch)
tree7a3d944c9a8841383b97e1824c2c1335924fd9f0
parentdbe86e8285d4029bb641500849f696118d3d5949 (diff)
downloadplus-8f3d5cce14912a4c955a02f50a13130ca15b585e.tar.gz
plus-8f3d5cce14912a4c955a02f50a13130ca15b585e.tar.bz2
plus-8f3d5cce14912a4c955a02f50a13130ca15b585e.tar.xz
plus-8f3d5cce14912a4c955a02f50a13130ca15b585e.zip
Add tabs for stats in status window.
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/Makefile.am4
-rw-r--r--src/gui/widgets/attrs/attrdisplay.h3
-rw-r--r--src/gui/widgets/statspage.cpp77
-rw-r--r--src/gui/widgets/statspage.h54
-rw-r--r--src/gui/widgets/statspagebasic.cpp156
-rw-r--r--src/gui/widgets/statspagebasic.h67
-rw-r--r--src/gui/windows/statuswindow.cpp158
-rw-r--r--src/gui/windows/statuswindow.h29
-rw-r--r--src/net/eathena/generalhandler.cpp6
-rw-r--r--src/net/tmwa/generalhandler.cpp6
11 files changed, 400 insertions, 164 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1f4ff6cd9..a89095e0f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -204,6 +204,10 @@ SET(SRCS
gui/widgets/itemshortcutcontainer.h
gui/widgets/spellshortcutcontainer.cpp
gui/widgets/spellshortcutcontainer.h
+ gui/widgets/statspage.cpp
+ gui/widgets/statspage.h
+ gui/widgets/statspagebasic.cpp
+ gui/widgets/statspagebasic.h
gui/widgets/label.cpp
gui/widgets/label.h
gui/widgets/tabs/chat/langtab.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index 1bef647eb..df47ed2ea 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -986,6 +986,10 @@ manaplus_SOURCES += main.cpp \
gui/widgets/itemshortcutcontainer.h \
gui/widgets/spellshortcutcontainer.cpp \
gui/widgets/spellshortcutcontainer.h \
+ gui/widgets/statspage.cpp \
+ gui/widgets/statspage.h \
+ gui/widgets/statspagebasic.cpp \
+ gui/widgets/statspagebasic.h \
gui/widgets/selldialog.cpp \
gui/widgets/selldialog.h \
gui/widgets/tabs/setup_audio.cpp \
diff --git a/src/gui/widgets/attrs/attrdisplay.h b/src/gui/widgets/attrs/attrdisplay.h
index 693bbc349..7659ff0cd 100644
--- a/src/gui/widgets/attrs/attrdisplay.h
+++ b/src/gui/widgets/attrs/attrdisplay.h
@@ -31,6 +31,7 @@
#include "localconsts.h"
+class AttrDisplay;
class LayoutHelper;
class AttrDisplay notfinal : public Container
@@ -78,4 +79,6 @@ class AttrDisplay notfinal : public Container
Label *mValue;
};
+typedef std::map<AttributesT, AttrDisplay*> Attrs;
+
#endif // GUI_WIDGETS_ATTRS_ATTRDISPLAY_H
diff --git a/src/gui/widgets/statspage.cpp b/src/gui/widgets/statspage.cpp
new file mode 100644
index 000000000..b41cc6224
--- /dev/null
+++ b/src/gui/widgets/statspage.cpp
@@ -0,0 +1,77 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2016 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "gui/widgets/statspage.h"
+
+#include "being/playerinfo.h"
+
+#include "gui/widgets/button.h"
+#include "gui/widgets/scrollarea.h"
+#include "gui/widgets/vertcontainer.h"
+
+#include "gui/widgets/attrs/derdisplay.h"
+
+#include "gui/windows/chatwindow.h"
+
+#include "utils/gettext.h"
+#include "utils/stringutils.h"
+
+#include "resources/db/statdb.h"
+
+#include "debug.h"
+
+StatsPage::StatsPage(const Widget2 *const widget) :
+ Container(widget),
+ WidgetListener(),
+ StatListener(),
+ mAttrs(),
+ mAttrCont(new VertContainer(this, 32)),
+ mAttrScroll(new ScrollArea(this, mAttrCont, false))
+{
+ addWidgetListener(this);
+
+ mAttrScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
+ mAttrScroll->setVerticalScrollPolicy(ScrollArea::SHOW_AUTO);
+
+ add(mAttrScroll);
+ const std::vector<BasicStat> &basicStats = StatDb::getExtendedStats();
+ FOR_EACH (std::vector<BasicStat>::const_iterator, it, basicStats)
+ {
+ const BasicStat &stat = *it;
+ AttrDisplay *disp = new DerDisplay(this, stat.attr, stat.name, stat.tag);
+ disp->update();
+ mAttrCont->add2(disp, true);
+ mAttrs[stat.attr] = disp;
+ }
+}
+
+void StatsPage::widgetResized(const Event &event A_UNUSED)
+{
+ mAttrScroll->setSize(getWidth(), getHeight());
+}
+
+void StatsPage::statChanged(const AttributesT id,
+ const int oldVal1 A_UNUSED,
+ const int oldVal2 A_UNUSED)
+{
+ const Attrs::const_iterator it = mAttrs.find(id);
+ if (it != mAttrs.end() && it->second)
+ it->second->update();
+}
diff --git a/src/gui/widgets/statspage.h b/src/gui/widgets/statspage.h
new file mode 100644
index 000000000..2bfb144d2
--- /dev/null
+++ b/src/gui/widgets/statspage.h
@@ -0,0 +1,54 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2016 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GUI_WIDGETS_STATSPAGE_H
+#define GUI_WIDGETS_STATSPAGE_H
+
+#include "gui/widgets/attrs/attrdisplay.h"
+
+#include "listeners/statlistener.h"
+
+#include "localconsts.h"
+
+class ScrollArea;
+class VertContainer;
+
+class StatsPage final : public Container,
+ public WidgetListener,
+ public StatListener
+{
+ public:
+ StatsPage(const Widget2 *const widget);
+
+ A_DELETE_COPY(StatsPage)
+
+ void widgetResized(const Event &event) override final;
+
+ void statChanged(const AttributesT id,
+ const int oldVal1,
+ const int oldVal2) override final;
+
+ private:
+ Attrs mAttrs;
+ VertContainer *mAttrCont A_NONNULLPOINTER;
+ ScrollArea *mAttrScroll A_NONNULLPOINTER;
+};
+
+#endif // GUI_WIDGETS_STATSPAGE_H
diff --git a/src/gui/widgets/statspagebasic.cpp b/src/gui/widgets/statspagebasic.cpp
new file mode 100644
index 000000000..04252abf5
--- /dev/null
+++ b/src/gui/widgets/statspagebasic.cpp
@@ -0,0 +1,156 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2016 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "gui/widgets/statspagebasic.h"
+
+#include "being/playerinfo.h"
+
+#include "gui/widgets/button.h"
+#include "gui/widgets/label.h"
+#include "gui/widgets/scrollarea.h"
+#include "gui/widgets/vertcontainer.h"
+
+#include "gui/widgets/attrs/changedisplay.h"
+
+#include "gui/windows/chatwindow.h"
+
+#include "utils/gettext.h"
+#include "utils/stringutils.h"
+
+#include "resources/db/statdb.h"
+
+#include "debug.h"
+
+StatsPageBasic::StatsPageBasic(const Widget2 *const widget) :
+ Container(widget),
+ WidgetListener(),
+ StatListener(),
+ mAttrs(),
+ mAttrCont(new VertContainer(this, 32)),
+ mAttrScroll(new ScrollArea(this, mAttrCont, false)),
+ mCharacterPointsLabel(new Label(this, "C"))
+{
+ addWidgetListener(this);
+
+ mAttrScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
+ mAttrScroll->setVerticalScrollPolicy(ScrollArea::SHOW_AUTO);
+
+ add(mAttrScroll);
+ const std::vector<BasicStat> &basicStats = StatDb::getBasicStats();
+ FOR_EACH (std::vector<BasicStat>::const_iterator, it, basicStats)
+ {
+ const BasicStat &stat = *it;
+ AttrDisplay *disp = new ChangeDisplay(this, stat.attr, stat.name, stat.tag);
+ disp->update();
+ mAttrCont->add2(disp, true);
+ mAttrs[stat.attr] = disp;
+ }
+
+ // TRANSLATORS: status window label
+ mCharacterPointsLabel->setCaption(strprintf(_("Character points: %d"),
+ PlayerInfo::getAttribute(Attributes::PLAYER_CHAR_POINTS)));
+ mCharacterPointsLabel->adjustSize();
+ mAttrCont->add1(mCharacterPointsLabel);
+}
+
+void StatsPageBasic::widgetResized(const Event &event A_UNUSED)
+{
+ mAttrScroll->setSize(getWidth(), getHeight());
+}
+
+void StatsPageBasic::statChanged(const AttributesT id,
+ const int oldVal1 A_UNUSED,
+ const int oldVal2 A_UNUSED)
+{
+ const Attrs::const_iterator it = mAttrs.find(id);
+ if (it != mAttrs.end() && it->second)
+ it->second->update();
+}
+
+void StatsPageBasic::attributeChanged(const AttributesT id,
+ const int oldVal A_UNUSED,
+ const int newVal)
+{
+ PRAGMA45(GCC diagnostic push)
+ PRAGMA45(GCC diagnostic ignored "-Wswitch-enum")
+ switch (id)
+ {
+ case Attributes::PLAYER_CHAR_POINTS:
+ mCharacterPointsLabel->setCaption(strprintf(
+ // TRANSLATORS: status window label
+ _("Character points: %d"), newVal));
+
+ mCharacterPointsLabel->adjustSize();
+ // Update all attributes
+ for (Attrs::const_iterator it = mAttrs.begin();
+ it != mAttrs.end(); ++it)
+ {
+ if (it->second)
+ it->second->update();
+ }
+ break;
+
+ case Attributes::PLAYER_CORR_POINTS:
+ // Update all attributes
+ for (Attrs::const_iterator it = mAttrs.begin();
+ it != mAttrs.end(); ++it)
+ {
+ if (it->second)
+ it->second->update();
+ }
+ break;
+
+ default:
+ break;
+ }
+ PRAGMA45(GCC diagnostic pop)
+}
+
+void StatsPageBasic::setPointsNeeded(const AttributesT id,
+ const int needed)
+{
+ const Attrs::const_iterator it = mAttrs.find(id);
+
+ if (it != mAttrs.end())
+ {
+ AttrDisplay *const disp = it->second;
+ if (disp && disp->getType() == AttrDisplay::CHANGEABLE)
+ static_cast<ChangeDisplay*>(disp)->setPointsNeeded(needed);
+ }
+}
+
+std::string StatsPageBasic::getStatsStr() const
+{
+ Attrs::const_iterator it = mAttrs.begin();
+ const Attrs::const_iterator it_end = mAttrs.end();
+ std::string str;
+ while (it != it_end)
+ {
+ const ChangeDisplay *const attr = dynamic_cast<ChangeDisplay*>(
+ (*it).second);
+ if (attr)
+ {
+ str.append(strprintf("%s:%s ", attr->getShortName().c_str(),
+ attr->getValue().c_str()));
+ }
+ ++ it;
+ }
+ return str;
+}
diff --git a/src/gui/widgets/statspagebasic.h b/src/gui/widgets/statspagebasic.h
new file mode 100644
index 000000000..2f1b24e6f
--- /dev/null
+++ b/src/gui/widgets/statspagebasic.h
@@ -0,0 +1,67 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2016 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GUI_WIDGETS_STATSPAGEBASIC_H
+#define GUI_WIDGETS_STATSPAGEBASIC_H
+
+#include "gui/widgets/attrs/attrdisplay.h"
+
+#include "listeners/attributelistener.h"
+#include "listeners/statlistener.h"
+
+#include "localconsts.h"
+
+class Label;
+class ScrollArea;
+class VertContainer;
+
+class StatsPageBasic final : public Container,
+ public WidgetListener,
+ public AttributeListener,
+ public StatListener
+{
+ public:
+ StatsPageBasic(const Widget2 *const widget);
+
+ A_DELETE_COPY(StatsPageBasic)
+
+ void widgetResized(const Event &event) override final;
+
+ void attributeChanged(const AttributesT id,
+ const int oldVal,
+ const int newVal) override final;
+
+ void statChanged(const AttributesT id,
+ const int oldVal1,
+ const int oldVal2) override final;
+
+ void setPointsNeeded(const AttributesT id,
+ const int needed);
+
+ std::string getStatsStr() const;
+
+ private:
+ Attrs mAttrs;
+ VertContainer *mAttrCont A_NONNULLPOINTER;
+ ScrollArea *mAttrScroll A_NONNULLPOINTER;
+ Label *mCharacterPointsLabel A_NONNULLPOINTER;
+};
+
+#endif // GUI_WIDGETS_STATSPAGEBASIC_H
diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp
index c762084fd..461d5e01d 100644
--- a/src/gui/windows/statuswindow.cpp
+++ b/src/gui/windows/statuswindow.cpp
@@ -36,21 +36,18 @@
#include "gui/windows/setupwindow.h"
#include "gui/widgets/button.h"
+#include "gui/widgets/createwidget.h"
#include "gui/widgets/layouthelper.h"
#include "gui/widgets/layouttype.h"
#include "gui/widgets/progressbar.h"
-#include "gui/widgets/scrollarea.h"
-#include "gui/widgets/vertcontainer.h"
+#include "gui/widgets/statspage.h"
+#include "gui/widgets/statspagebasic.h"
+#include "gui/widgets/tabbedarea.h"
#include "gui/widgets/windowcontainer.h"
-#include "gui/widgets/attrs/changedisplay.h"
-#include "gui/widgets/attrs/derdisplay.h"
-
#include "net/inventoryhandler.h"
#include "net/playerhandler.h"
-#include "resources/db/statdb.h"
-
#include "resources/item/item.h"
#include "utils/gettext.h"
@@ -65,6 +62,7 @@ StatusWindow::StatusWindow() :
ActionListener(),
AttributeListener(),
StatListener(),
+ mTabs(CREATEWIDGETR(TabbedArea, this)),
// TRANSLATORS: status window label
mLvlLabel(new Label(this, strprintf(_("Level: %d"), 0))),
// TRANSLATORS: status window label
@@ -80,14 +78,9 @@ StatusWindow::StatusWindow() :
mJobLvlLabel(nullptr),
mJobLabel(nullptr),
mJobBar(nullptr),
- mAttrCont(new VertContainer(this, 32)),
- mAttrScroll(new ScrollArea(this, mAttrCont, false)),
- mDAttrCont(new VertContainer(this, 32)),
- mDAttrScroll(new ScrollArea(this, mDAttrCont, false)),
- mCharacterPointsLabel(new Label(this, "C")),
+ mBasicStatsPage(new StatsPageBasic(this)),
// TRANSLATORS: status window button
- mCopyButton(new Button(this, _("Copy to chat"), "copy", this)),
- mAttrs()
+ mCopyButton(new Button(this, _("Copy to chat"), "copy", this))
{
setWindowName("Status");
if (setupWindow)
@@ -193,21 +186,10 @@ StatusWindow::StatusWindow() :
place(3, 0, mMoneyLabel, 3);
}
- // ----------------------
- // Stats Part
- // ----------------------
-
- mAttrScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
- mAttrScroll->setVerticalScrollPolicy(ScrollArea::SHOW_AUTO);
- place(0, 3, mAttrScroll, 5, 3);
-
- mDAttrScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
- mDAttrScroll->setVerticalScrollPolicy(ScrollArea::SHOW_AUTO);
- place(6, 3, mDAttrScroll, 5, 3);
+ place(0, 3, mTabs, 9, 3);
getLayout().setRowHeight(3, LayoutType::SET);
- place(0, 6, mCharacterPointsLabel, 5);
place(0, 5, mCopyButton);
loadWindowState();
@@ -222,35 +204,30 @@ StatusWindow::StatusWindow() :
mMoneyLabel->setCaption(strprintf(_("Money: %s"), Units::formatCurrency(
PlayerInfo::getAttribute(Attributes::MONEY)).c_str()));
mMoneyLabel->adjustSize();
- // TRANSLATORS: status window label
- mCharacterPointsLabel->setCaption(strprintf(_("Character points: %d"),
- PlayerInfo::getAttribute(Attributes::PLAYER_CHAR_POINTS)));
- mCharacterPointsLabel->adjustSize();
updateLevelLabel();
+ addTabs();
}
-void StatusWindow::addAttributes()
+void StatusWindow::addTabs()
{
- clearAttributes();
+ // TRANSLATORS: status window tab name
+ addTabBasic(_("Basic"));
+ // TRANSLATORS: status window tab name
+ addTab(_("Extended"));
+ mTabs->adjustSize();
+}
- const std::vector<BasicStat> &basicStats = StatDb::getBasicStats();
- FOR_EACH (std::vector<BasicStat>::const_iterator, it, basicStats)
- {
- const BasicStat &stat = *it;
- addAttribute(stat.attr,
- stat.name,
- stat.tag,
- Modifiable_true);
- }
+void StatusWindow::addTab(const std::string &name)
+{
+ mTabs->addTab(name,
+ new StatsPage(this));
+}
- const std::vector<BasicStat> &extendedStats = StatDb::getExtendedStats();
- FOR_EACH (std::vector<BasicStat>::const_iterator, it, extendedStats)
- {
- const BasicStat &stat = *it;
- addAttribute(stat.attr,
- stat.name);
- }
+void StatusWindow::addTabBasic(const std::string &name)
+{
+ mTabs->addTab(name,
+ mBasicStatsPage);
}
void StatusWindow::updateLevelLabel()
@@ -325,9 +302,6 @@ void StatusWindow::statChanged(const AttributesT id,
else
{
updateMPBar(mMpBar, true);
- const Attrs::const_iterator it = mAttrs.find(id);
- if (it != mAttrs.end() && it->second)
- it->second->update();
}
}
@@ -361,32 +335,6 @@ void StatusWindow::attributeChanged(const AttributesT id,
mMoneyLabel->adjustSize();
break;
- case Attributes::PLAYER_CHAR_POINTS:
- mCharacterPointsLabel->setCaption(strprintf(
- // TRANSLATORS: status window label
- _("Character points: %d"), newVal));
-
- mCharacterPointsLabel->adjustSize();
- // Update all attributes
- for (Attrs::const_iterator it = mAttrs.begin();
- it != mAttrs.end(); ++it)
- {
- if (it->second)
- it->second->update();
- }
- break;
-
- // ??
- case Attributes::PLAYER_CORR_POINTS:
- // Update all attributes
- for (Attrs::const_iterator it = mAttrs.begin();
- it != mAttrs.end(); ++it)
- {
- if (it->second)
- it->second->update();
- }
- break;
-
case Attributes::PLAYER_LEVEL:
// TRANSLATORS: status window label
mLvlLabel->setCaption(strprintf(_("Level: %d"), newVal));
@@ -402,45 +350,7 @@ void StatusWindow::attributeChanged(const AttributesT id,
void StatusWindow::setPointsNeeded(const AttributesT id,
const int needed)
{
- const Attrs::const_iterator it = mAttrs.find(id);
-
- if (it != mAttrs.end())
- {
- AttrDisplay *const disp = it->second;
- if (disp && disp->getType() == AttrDisplay::CHANGEABLE)
- static_cast<ChangeDisplay*>(disp)->setPointsNeeded(needed);
- }
-}
-
-void StatusWindow::addAttribute(const AttributesT id,
- const std::string &restrict name,
- const std::string &restrict shortName,
- const Modifiable modifiable)
-{
- AttrDisplay *disp;
-
- if (modifiable == Modifiable_true)
- {
- disp = new ChangeDisplay(this, id, name, shortName);
- disp->update();
- mAttrCont->add1(disp);
- }
- else
- {
- disp = new DerDisplay(this, id, name, shortName);
- disp->update();
- mDAttrCont->add1(disp);
- }
- mAttrs[id] = disp;
-}
-
-void StatusWindow::clearAttributes()
-{
- mAttrCont->clear();
- mDAttrCont->clear();
- FOR_EACH (Attrs::iterator, it, mAttrs)
- delete (*it).second;
- mAttrs.clear();
+ mBasicStatsPage->setPointsNeeded(id, needed);
}
void StatusWindow::updateHPBar(ProgressBar *const bar, const bool showMax)
@@ -694,20 +604,6 @@ void StatusWindow::action(const ActionEvent &event)
if (event.getId() == "copy")
{
- Attrs::const_iterator it = mAttrs.begin();
- const Attrs::const_iterator it_end = mAttrs.end();
- std::string str;
- while (it != it_end)
- {
- const ChangeDisplay *const attr = dynamic_cast<ChangeDisplay*>(
- (*it).second);
- if (attr)
- {
- str.append(strprintf("%s:%s ", attr->getShortName().c_str(),
- attr->getValue().c_str()));
- }
- ++ it;
- }
- chatWindow->addInputText(str);
+ chatWindow->addInputText(mBasicStatsPage->getStatsStr());
}
}
diff --git a/src/gui/windows/statuswindow.h b/src/gui/windows/statuswindow.h
index 539c23a39..2bb457acf 100644
--- a/src/gui/windows/statuswindow.h
+++ b/src/gui/windows/statuswindow.h
@@ -25,8 +25,6 @@
#include "gui/widgets/window.h"
-#include "enums/simpletypes/modifiable.h"
-
#include "listeners/actionlistener.h"
#include "listeners/attributelistener.h"
#include "listeners/statlistener.h"
@@ -36,6 +34,8 @@ class Button;
class Label;
class ProgressBar;
class ScrollArea;
+class StatsPageBasic;
+class TabbedArea;
class VertContainer;
/**
@@ -59,11 +59,6 @@ class StatusWindow final : public Window,
void setPointsNeeded(const AttributesT id,
const int needed);
- void addAttribute(const AttributesT id,
- const std::string &restrict name,
- const std::string &restrict shortName = "",
- const Modifiable modifiable = Modifiable_false);
-
static void updateHPBar(ProgressBar *const bar,
const bool showMax = false);
void updateMPBar(ProgressBar *bar, const bool showMax = false) const;
@@ -87,8 +82,6 @@ class StatusWindow final : public Window,
void action(const ActionEvent &event) override;
- void clearAttributes();
-
void attributeChanged(const AttributesT id,
const int oldVal,
const int newVal) override final;
@@ -99,15 +92,15 @@ class StatusWindow final : public Window,
void updateLevelLabel();
- void addAttributes();
-
private:
+ void addTabs();
+ void addTab(const std::string &name);
+ void addTabBasic(const std::string &name);
+
static std::string translateLetter(const char *const letters);
static std::string translateLetter2(const std::string &letters);
- /**
- * Status Part
- */
+ TabbedArea *mTabs A_NONNULLPOINTER;
Label *mLvlLabel A_NONNULLPOINTER;
Label *mMoneyLabel A_NONNULLPOINTER;
Label *mHpLabel A_NONNULLPOINTER;
@@ -121,16 +114,10 @@ class StatusWindow final : public Window,
Label *mJobLabel;
ProgressBar *mJobBar;
- VertContainer *mAttrCont A_NONNULLPOINTER;
- ScrollArea *mAttrScroll A_NONNULLPOINTER;
- VertContainer *mDAttrCont A_NONNULLPOINTER;
- ScrollArea *mDAttrScroll A_NONNULLPOINTER;
+ StatsPageBasic *mBasicStatsPage;
Label *mCharacterPointsLabel A_NONNULLPOINTER;
Button *mCopyButton;
-
- typedef std::map<AttributesT, AttrDisplay*> Attrs;
- Attrs mAttrs;
};
extern StatusWindow *statusWindow;
diff --git a/src/net/eathena/generalhandler.cpp b/src/net/eathena/generalhandler.cpp
index 1a0353dfa..36cac3d1d 100644
--- a/src/net/eathena/generalhandler.cpp
+++ b/src/net/eathena/generalhandler.cpp
@@ -27,7 +27,6 @@
#include "gui/windows/skilldialog.h"
#include "gui/windows/socialwindow.h"
-#include "gui/windows/statuswindow.h"
#include "gui/widgets/tabs/chat/guildtab.h"
#include "gui/widgets/tabs/chat/partytab.h"
@@ -193,11 +192,6 @@ void GeneralHandler::gameStarted() const
{
if (skillDialog)
skillDialog->loadSkills();
-
- if (!statusWindow)
- return;
-
- statusWindow->addAttributes();
}
void GeneralHandler::gameEnded() const
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index a48f05cec..831e2bd7e 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -27,7 +27,6 @@
#include "gui/windows/skilldialog.h"
#include "gui/windows/socialwindow.h"
-#include "gui/windows/statuswindow.h"
#include "gui/widgets/tabs/chat/guildtab.h"
#include "gui/widgets/tabs/chat/partytab.h"
@@ -204,11 +203,6 @@ void GeneralHandler::gameStarted() const
{
if (skillDialog)
skillDialog->loadSkills();
-
- if (!statusWindow)
- return;
-
- statusWindow->addAttributes();
}
void GeneralHandler::gameEnded() const