summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-07-26 22:47:45 +0300
committerAndrei Karas <akaras@inbox.ru>2016-07-26 22:47:45 +0300
commit83981f76348655507d225aca220893e668b09bdc (patch)
treea86b9a28bb584bed5a6f397bc0b47aba908d0f82 /src/gui
parent8f3d5cce14912a4c955a02f50a13130ca15b585e (diff)
downloadplus-83981f76348655507d225aca220893e668b09bdc.tar.gz
plus-83981f76348655507d225aca220893e668b09bdc.tar.bz2
plus-83981f76348655507d225aca220893e668b09bdc.tar.xz
plus-83981f76348655507d225aca220893e668b09bdc.zip
Add support for loading stats pages from stats.xml
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/statspage.cpp5
-rw-r--r--src/gui/widgets/statspage.h3
-rw-r--r--src/gui/windows/statuswindow.cpp11
3 files changed, 13 insertions, 6 deletions
diff --git a/src/gui/widgets/statspage.cpp b/src/gui/widgets/statspage.cpp
index b41cc6224..1f30f2862 100644
--- a/src/gui/widgets/statspage.cpp
+++ b/src/gui/widgets/statspage.cpp
@@ -37,7 +37,8 @@
#include "debug.h"
-StatsPage::StatsPage(const Widget2 *const widget) :
+StatsPage::StatsPage(const Widget2 *const widget,
+ const std::string &page) :
Container(widget),
WidgetListener(),
StatListener(),
@@ -51,7 +52,7 @@ StatsPage::StatsPage(const Widget2 *const widget) :
mAttrScroll->setVerticalScrollPolicy(ScrollArea::SHOW_AUTO);
add(mAttrScroll);
- const std::vector<BasicStat> &basicStats = StatDb::getExtendedStats();
+ const std::vector<BasicStat> &basicStats = StatDb::getStats(page);
FOR_EACH (std::vector<BasicStat>::const_iterator, it, basicStats)
{
const BasicStat &stat = *it;
diff --git a/src/gui/widgets/statspage.h b/src/gui/widgets/statspage.h
index 2bfb144d2..b9ab37df5 100644
--- a/src/gui/widgets/statspage.h
+++ b/src/gui/widgets/statspage.h
@@ -35,7 +35,8 @@ class StatsPage final : public Container,
public StatListener
{
public:
- StatsPage(const Widget2 *const widget);
+ StatsPage(const Widget2 *const widget,
+ const std::string &page);
A_DELETE_COPY(StatsPage)
diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp
index 461d5e01d..57ca97206 100644
--- a/src/gui/windows/statuswindow.cpp
+++ b/src/gui/windows/statuswindow.cpp
@@ -48,6 +48,8 @@
#include "net/inventoryhandler.h"
#include "net/playerhandler.h"
+#include "resources/db/statdb.h"
+
#include "resources/item/item.h"
#include "utils/gettext.h"
@@ -213,15 +215,18 @@ void StatusWindow::addTabs()
{
// TRANSLATORS: status window tab name
addTabBasic(_("Basic"));
- // TRANSLATORS: status window tab name
- addTab(_("Extended"));
+ const std::vector<std::string> &pages = StatDb::getPages();
+ FOR_EACH(std::vector<std::string>::const_iterator, it, pages)
+ {
+ addTab(*it);
+ }
mTabs->adjustSize();
}
void StatusWindow::addTab(const std::string &name)
{
mTabs->addTab(name,
- new StatsPage(this));
+ new StatsPage(this, name));
}
void StatusWindow::addTabBasic(const std::string &name)