diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-09-07 01:02:41 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-09-07 01:02:41 +0300 |
commit | abfc18794cbd9119c110f32e39ea48a00e5b9214 (patch) | |
tree | 5a1cbe3cb321eecda56e2f4b4498019a96eb4b0a | |
parent | fea2f27179d17bbba96873ea0eeae99df20a457c (diff) | |
download | plus-abfc18794cbd9119c110f32e39ea48a00e5b9214.tar.gz plus-abfc18794cbd9119c110f32e39ea48a00e5b9214.tar.bz2 plus-abfc18794cbd9119c110f32e39ea48a00e5b9214.tar.xz plus-abfc18794cbd9119c110f32e39ea48a00e5b9214.zip |
Add stats tab into debug window. Move LPS counter into stats tab.
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabs/mapdebugtab.cpp | 25 | ||||
-rw-r--r-- | src/gui/widgets/tabs/mapdebugtab.h | 1 | ||||
-rw-r--r-- | src/gui/widgets/tabs/statdebugtab.cpp | 54 | ||||
-rw-r--r-- | src/gui/widgets/tabs/statdebugtab.h | 43 | ||||
-rw-r--r-- | src/gui/windows/debugwindow.cpp | 11 | ||||
-rw-r--r-- | src/gui/windows/debugwindow.h | 2 |
8 files changed, 123 insertions, 17 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d89e44cec..6bd5cb8a8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -310,6 +310,8 @@ SET(SRCS gui/widgets/tabs/socialplayerstab.h gui/widgets/tabs/socialtab.h gui/widgets/tabs/socialtabbase.h + gui/widgets/tabs/statdebugtab.cpp + gui/widgets/tabs/statdebugtab.h gui/widgets/tabs/tab.cpp gui/widgets/tabs/tab.h gui/widgets/tabbedarea.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 55a1d4038..b55b7a237 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1254,6 +1254,8 @@ SRC = ${BASE_SRC} \ gui/widgets/tabs/socialplayerstab.h \ gui/widgets/tabs/socialtab.h \ gui/widgets/tabs/socialtabbase.h \ + gui/widgets/tabs/statdebugtab.cpp \ + gui/widgets/tabs/statdebugtab.h \ gui/models/skillmodel.cpp \ gui/models/skillmodel.h \ gui/models/sortlistmodelbuy.h \ diff --git a/src/gui/widgets/tabs/mapdebugtab.cpp b/src/gui/widgets/tabs/mapdebugtab.cpp index 14dd4184e..6b133e4bb 100644 --- a/src/gui/widgets/tabs/mapdebugtab.cpp +++ b/src/gui/widgets/tabs/mapdebugtab.cpp @@ -86,8 +86,6 @@ MapDebugTab::MapDebugTab(const Widget2 *const widget) : #endif // DEBUG_BIND_TEXTURE // TRANSLATORS: debug window label, frames per second mFPSLabel(new Label(this, strprintf(_("%d FPS"), 0))), - // TRANSLATORS: debug window label, logic per second - mLPSLabel(new Label(this, strprintf(_("%d LPS"), 0))), mFPSText() { LayoutHelper h(this); @@ -135,20 +133,19 @@ MapDebugTab::MapDebugTab(const Widget2 *const widget) : #endif // USE_OPENGL place(0, 0, mFPSLabel, 2, 1); - place(0, 1, mLPSLabel, 2, 1); - place(0, 2, mMusicFileLabel, 2, 1); - place(0, 3, mMapLabel, 2, 1); - place(0, 4, mMapNameLabel, 2, 1); - place(0, 5, mMinimapLabel, 2, 1); - place(0, 6, mXYLabel, 2, 1); - place(0, 7, mTileMouseLabel, 2, 1); - place(0, 8, mParticleCountLabel, 2, 1); - place(0, 9, mMapActorCountLabel, 2, 1); + place(0, 1, mMusicFileLabel, 2, 1); + place(0, 2, mMapLabel, 2, 1); + place(0, 3, mMapNameLabel, 2, 1); + place(0, 4, mMinimapLabel, 2, 1); + place(0, 5, mXYLabel, 2, 1); + place(0, 6, mTileMouseLabel, 2, 1); + place(0, 7, mParticleCountLabel, 2, 1); + place(0, 8, mMapActorCountLabel, 2, 1); #ifdef USE_OPENGL - place(0, 10, mMapAtlasCountLabel, 2, 1); + place(0, 9, mMapAtlasCountLabel, 2, 1); #if defined (DEBUG_OPENGL_LEAKS) || defined(DEBUG_DRAW_CALLS) \ || defined(DEBUG_BIND_TEXTURE) - int n = 11; + int n = 10; #endif // defined (DEBUG_OPENGL_LEAKS) || defined(DEBUG_DRAW_CALLS) // || defined(DEBUG_BIND_TEXTURE) #ifdef DEBUG_OPENGL_LEAKS @@ -283,7 +280,5 @@ void MapDebugTab::logic() #endif // USE_OPENGL mFPSLabel->setCaption(strprintf(mFPSText.c_str(), fps)); - // TRANSLATORS: debug window label, logic per second - mLPSLabel->setCaption(strprintf(_("%d LPS"), lps)); BLOCK_END("MapDebugTab::logic") } diff --git a/src/gui/widgets/tabs/mapdebugtab.h b/src/gui/widgets/tabs/mapdebugtab.h index 16130b353..340be19af 100644 --- a/src/gui/widgets/tabs/mapdebugtab.h +++ b/src/gui/widgets/tabs/mapdebugtab.h @@ -60,7 +60,6 @@ class MapDebugTab final : public DebugTab #endif // DEBUG_BIND_TEXTURE Label *mFPSLabel A_NONNULLPOINTER; - Label *mLPSLabel A_NONNULLPOINTER; std::string mFPSText; }; diff --git a/src/gui/widgets/tabs/statdebugtab.cpp b/src/gui/widgets/tabs/statdebugtab.cpp new file mode 100644 index 000000000..29fca62de --- /dev/null +++ b/src/gui/widgets/tabs/statdebugtab.cpp @@ -0,0 +1,54 @@ +/* + * The ManaPlus Client + * Copyright (C) 2011-2018 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/tabs/statdebugtab.h" + +#include "gui/widgets/containerplacer.h" +#include "gui/widgets/label.h" +#include "gui/widgets/layouthelper.h" + +#include "utils/gettext.h" +#include "utils/stringutils.h" +#include "utils/timer.h" + +#include "debug.h" + +StatDebugTab::StatDebugTab(const Widget2 *const widget) : + DebugTab(widget), + // TRANSLATORS: debug window label, logic per second + mLPSLabel(new Label(this, strprintf(_("LPS: %d"), 0))) +{ + LayoutHelper h(this); + ContainerPlacer place = h.getPlacer(0, 0); + + place(0, 0, mLPSLabel, 2, 1); + + place.getCell().matchColWidth(0, 0); + place = h.getPlacer(0, 1); + setDimension(Rect(0, 0, 600, 300)); +} + +void StatDebugTab::logic() +{ + BLOCK_START("StatDebugTab::logic") + // TRANSLATORS: debug window label, logic per second + mLPSLabel->setCaption(strprintf(_("LPS: %d"), lps)); + BLOCK_END("StatDebugTab::logic") +} diff --git a/src/gui/widgets/tabs/statdebugtab.h b/src/gui/widgets/tabs/statdebugtab.h new file mode 100644 index 000000000..d52ff63af --- /dev/null +++ b/src/gui/widgets/tabs/statdebugtab.h @@ -0,0 +1,43 @@ +/* + * The ManaPlus Client + * Copyright (C) 2011-2018 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_TABS_STATDEBUGTAB_H +#define GUI_WIDGETS_TABS_STATDEBUGTAB_H + +#include "gui/widgets/tabs/debugtab.h" + +class Label; + +class StatDebugTab final : public DebugTab +{ + friend class DebugWindow; + + public: + explicit StatDebugTab(const Widget2 *const widget); + + A_DELETE_COPY(StatDebugTab) + + void logic() override final; + + private: + Label *mLPSLabel A_NONNULLPOINTER; +}; + +#endif // GUI_WIDGETS_TABS_STATDEBUGTAB_H diff --git a/src/gui/windows/debugwindow.cpp b/src/gui/windows/debugwindow.cpp index 958a5428a..35d114ede 100644 --- a/src/gui/windows/debugwindow.cpp +++ b/src/gui/windows/debugwindow.cpp @@ -31,6 +31,7 @@ #include "gui/widgets/tabs/mapdebugtab.h" #include "gui/widgets/tabs/netdebugtab.h" +#include "gui/widgets/tabs/statdebugtab.h" #include "gui/widgets/tabs/targetdebugtab.h" #include "utils/delete2.h" @@ -46,7 +47,8 @@ DebugWindow::DebugWindow(const std::string &name) : mTabs(CREATEWIDGETR(TabbedArea, this)), mMapWidget(new MapDebugTab(this)), mTargetWidget(new TargetDebugTab(this)), - mNetWidget(new NetDebugTab(this)) + mNetWidget(new NetDebugTab(this)), + mStatWidget(new StatDebugTab(this)) { setWindowName(name); if (setupWindow != nullptr) @@ -68,6 +70,8 @@ DebugWindow::DebugWindow(const std::string &name) : mTabs->addTab(std::string(_("Target")), mTargetWidget); // TRANSLATORS: debug window tab mTabs->addTab(std::string(_("Net")), mNetWidget); + // TRANSLATORS: debug window tab + mTabs->addTab(std::string(_("Stat")), mStatWidget); mTabs->setDimension(Rect(0, 0, 600, 300)); @@ -76,6 +80,7 @@ DebugWindow::DebugWindow(const std::string &name) : mMapWidget->resize(w, h); mTargetWidget->resize(w, h); mNetWidget->resize(w, h); + mStatWidget->resize(w, h); loadWindowState(); enableVisibleSound(true); } @@ -85,6 +90,7 @@ DebugWindow::~DebugWindow() delete2(mMapWidget); delete2(mTargetWidget); delete2(mNetWidget); + delete2(mStatWidget); } void DebugWindow::postInit() @@ -114,6 +120,9 @@ void DebugWindow::slowLogic() case 2: mNetWidget->logic(); break; + case 3: + mStatWidget->logic(); + break; } if (localPlayer != nullptr) diff --git a/src/gui/windows/debugwindow.h b/src/gui/windows/debugwindow.h index 00862ffb6..1f4de118a 100644 --- a/src/gui/windows/debugwindow.h +++ b/src/gui/windows/debugwindow.h @@ -27,6 +27,7 @@ class MapDebugTab; class NetDebugTab; +class StatDebugTab; class TabbedArea; class TargetDebugTab; @@ -71,6 +72,7 @@ class DebugWindow final : public Window MapDebugTab *mMapWidget A_NONNULLPOINTER; TargetDebugTab *mTargetWidget A_NONNULLPOINTER; NetDebugTab *mNetWidget A_NONNULLPOINTER; + StatDebugTab *mStatWidget A_NONNULLPOINTER; }; extern DebugWindow *debugWindow; |