diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2021-01-07 15:12:25 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-01-10 15:16:52 -0800 |
commit | d77f25432850ea2e2ea9e7fb84c49d52c3a308eb (patch) | |
tree | 49c284199f232585dc5c74b4767c845605d747da /mobile-widgets | |
parent | e7907c494f7f78831c2e2d523f7eb43e25ee77c0 (diff) | |
download | subsurface-d77f25432850ea2e2ea9e7fb84c49d52c3a308eb.tar.gz |
statistics: add a skeleton StatsManager class
In analogy to "QMLManager", add a "StatsManager" class,
which manages the statistics module on mobile.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'mobile-widgets')
-rw-r--r-- | mobile-widgets/CMakeLists.txt | 1 | ||||
-rw-r--r-- | mobile-widgets/statsmanager.cpp | 28 | ||||
-rw-r--r-- | mobile-widgets/statsmanager.h | 20 |
3 files changed, 49 insertions, 0 deletions
diff --git a/mobile-widgets/CMakeLists.txt b/mobile-widgets/CMakeLists.txt index 4e4135a5a..b02929bcb 100644 --- a/mobile-widgets/CMakeLists.txt +++ b/mobile-widgets/CMakeLists.txt @@ -3,6 +3,7 @@ set(SUBSURFACE_MOBILE_SRCS qmlinterface.cpp qmlmanager.cpp + statsmanager.cpp themeinterface.cpp ) diff --git a/mobile-widgets/statsmanager.cpp b/mobile-widgets/statsmanager.cpp new file mode 100644 index 000000000..2864a5f16 --- /dev/null +++ b/mobile-widgets/statsmanager.cpp @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0 +#include "statsmanager.h" + +StatsManager::StatsManager() : view(nullptr) +{ + // Test: show some random data. Let's see what happens. + state.var1Changed(2); + state.var2Changed(3); + state.binner2Changed(2); +} + +StatsManager::~StatsManager() +{ +} + +void StatsManager::init(StatsView *v) +{ + if (!v) + fprintf(stderr, "StatsManager::init(): no StatsView - statistics will not work.\n"); + view = v; +} + +void StatsManager::doit() +{ + if (!view) + return; + view->plot(state); +} diff --git a/mobile-widgets/statsmanager.h b/mobile-widgets/statsmanager.h new file mode 100644 index 000000000..3cae244c0 --- /dev/null +++ b/mobile-widgets/statsmanager.h @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0 +#ifndef STATSMANAGER_H +#define STATSMANAGER_H + +#include "stats/statsview.h" +#include "stats/statsstate.h" + +class StatsManager : public QObject { + Q_OBJECT +public: + StatsManager(); + ~StatsManager(); + Q_INVOKABLE void init(StatsView *v); + Q_INVOKABLE void doit(); +private: + StatsView *view; + StatsState state; +}; + +#endif |