mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									e7907c494f
								
							
						
					
					
						commit
						d77f254328
					
				
					 5 changed files with 53 additions and 0 deletions
				
			
		|  | @ -129,6 +129,7 @@ SOURCES += subsurface-mobile-main.cpp \ | |||
| 	backend-shared/roundrectitem.cpp \ | ||||
| 	mobile-widgets/qmlinterface.cpp \ | ||||
| 	mobile-widgets/qmlmanager.cpp \ | ||||
| 	mobile-widgets/statsmanager.cpp \ | ||||
| 	mobile-widgets/themeinterface.cpp \ | ||||
| 	qt-models/divesummarymodel.cpp \ | ||||
| 	qt-models/diveplotdatamodel.cpp \ | ||||
|  | @ -264,6 +265,7 @@ HEADERS += \ | |||
| 	backend-shared/roundrectitem.h \ | ||||
| 	mobile-widgets/qmlinterface.h \ | ||||
| 	mobile-widgets/qmlmanager.h \ | ||||
| 	mobile-widgets/statsmanager.h \ | ||||
| 	mobile-widgets/themeinterface.h \ | ||||
| 	map-widget/qmlmapwidgethelper.h \ | ||||
| 	qt-models/divesummarymodel.h \ | ||||
|  |  | |||
|  | @ -3,6 +3,7 @@ | |||
| set(SUBSURFACE_MOBILE_SRCS | ||||
| 	qmlinterface.cpp | ||||
| 	qmlmanager.cpp | ||||
| 	statsmanager.cpp | ||||
| 	themeinterface.cpp | ||||
| ) | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										28
									
								
								mobile-widgets/statsmanager.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								mobile-widgets/statsmanager.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -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); | ||||
| } | ||||
							
								
								
									
										20
									
								
								mobile-widgets/statsmanager.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								mobile-widgets/statsmanager.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -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 | ||||
|  | @ -16,6 +16,7 @@ | |||
| #include "mobile-widgets/themeinterface.h" | ||||
| #include "mobile-widgets/qmlmanager.h" | ||||
| #include "mobile-widgets/qmlinterface.h" | ||||
| #include "mobile-widgets/statsmanager.h" | ||||
| #include "qt-models/divesummarymodel.h" | ||||
| #include "qt-models/gpslistmodel.h" | ||||
| #include "qt-models/messagehandlermodel.h" | ||||
|  | @ -207,6 +208,7 @@ static void register_qml_types(QQmlEngine *engine) | |||
| 
 | ||||
| #ifdef SUBSURFACE_MOBILE | ||||
| 	register_qml_type<QMLManager>("QMLManager"); | ||||
| 	register_qml_type<StatsManager>("StatsManager"); | ||||
| 	register_qml_type<QMLProfile>("QMLProfile"); | ||||
| 	register_qml_type<DiveImportedModel>("DCImportModel"); | ||||
| 	register_qml_type<DiveSummaryModel>("DiveSummaryModel"); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue