diff options
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 |