aboutsummaryrefslogtreecommitdiffstats
path: root/subsurface-helper.cpp
AgeCommit message (Collapse)Author
2019-10-13Mobile: stop dumping the list of supported dive computersGravatar Dirk Hohndel
This doesn't seem to add much value anymore and massively clutters the output. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-04Cleanup: Implicitly free QApplicationGravatar Berthold Stoeger
Instead of deleting the Application explicitly in exit_ui(), use a unique_ptr to have the instance automatically freed. This is the pattern given in the Qt-docs: https://doc.qt.io/qt-5/qapplication.html Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-04Cleanup: Turn DiveListSortModel into classical singletonGravatar Berthold Stoeger
To make this class available from QMLManager, the run_ui() function would create the object and then set a pointer in QMLManager. It works, but is inconsistent with the rest of the code. Therefore, make it a classical singleton class, which is generated on demand. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-04Cleanup: turn GpsListModel into standard singletonGravatar Berthold Stoeger
GpsListModel was one of those "special" singletons that could be created explicitly with new. This would make sense if a parameter were passed to the constructor. We only passed null, so one might as well turn that into a classical singleton with default constructor. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-04Cleanup: turn DiveListModel into standard singletonGravatar Berthold Stoeger
DiveListModel was one of those "special" singletons that could be created explicitly with new. This would make sense if a parameter were passed to the constructor. We only passed null, so one might as well turn that into a classical singleton with default constructor. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-04Cleanup: initialize DiveListSortModel in constructorGravatar Berthold Stoeger
The model was initialized in the global run_ui() function. Move that into the constructor of the class. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02Mobile: add more debugging output for screen width issueGravatar Dirk Hohndel
Somehow we need to be able to figure out which width information is correct. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-02Android: move OnePlus font hack earlierGravatar Dirk Hohndel
We want the new default font in place before the QML engine is initialized. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-02Cleanup: Remove DownloadThread QML-typeGravatar Berthold Stoeger
The download thread is not accessed directly by QML anymore. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-21Android: force different font on OnePlus devicesGravatar Dirk Hohndel
Those show a very strange font by default. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21Mobile: allow setting a width via environment variableGravatar Dirk Hohndel
This should make it much easier to debug and hopefully fix some of the odd scenarios where we get font sizes (or even the screen layout) wrong. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-06Map: don't derive MapLocation from QObjectGravatar Berthold Stoeger
Map location is 1) A plain value type 2) Never passed to QML Make it a simple C++ class. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-06Cleanup: remove unused get_screen_dpi() functionGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12get rid of some foreach and Q_FOREACH constructsGravatar Rolf Eike Beer
See https://www.kdab.com/goodbye-q_foreach/ This is reduced to the places where the container is const or can be made const without the need to always introduce an extra variable. Sadly qAsConst (Qt 5.7) and std::as_const (C++17) are not available in all supported setups. Also do some minor cleanups along the way. Signed-off-by: Rolf Eike Beer <eike@sf-mail.de>
2019-04-04Cleanup: make qPref::registerQML() staticGravatar Berthold Stoeger
This member function does not access any other member of the object. Make it static. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-02-01facebook: remove the featute from the code baseGravatar Lubomir I. Ivanov
Remove from: - unit tests - desktop widgets - preferences - core intergration - cmakefiles - build scripts - icons - docs Also remove the plugins and social network integration. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-10-23QML UI: make the QML window object part of the QMLManager classGravatar Dirk Hohndel
This way we can access it from that code (which we'll need to invoke methods in QML code from C++). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23Cleanup: remove attempt to set long gone propertyGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-12Ssrf: correct mapWidget registration for desktop versionGravatar jan Iversen
Registration was after the mainwindow was created. Move registration back to before creation. Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-11core,tests: change qml register functionGravatar jan Iversen
In order to address the C++ object directy in qml, a different registration is needed. qmlRegisterType, registers the C++ class, allowing qml code to inherit from it and make qml objects. This is needed for graphical elemnets like profile and map setContentProperty, registers the C++ object, thus allowing signals to be catched. Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-11core: add auto registration to qPref*Gravatar jan Iversen
Instead of having all register calls in subsurface-helper.cpp let qPref.cpp handle all qPref registration, since they also need to be different update subsurface-helper and testqml accordingly. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25core/tests: merge Animations and add vars. to qPrefDisplayGravatar jan Iversen
Add class variable tooltip_position to qPrefDisplay Add class variable lastDir to qPrefDisplay qPrefDisplay is updated to use new qPrefPrivate functions Adjust test cases incl. qml tests qPrefAnimations only has 1 variable, that really is a display variable Merge the variable into qPrefDisplay, to simplify setup (and avoid loading extra page in qml). correct theme to save in correct place, and make it a static class variable Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-14core: activate qPrefGeneralGravatar jan Iversen
remove General from SettingsObjectWrapper and reference qPrefGeneral update files using SettingsObjectWrapper/General to use qPrefGeneral this activated qPrefGeneral and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-14core: activate qPrefPartialPressureGasGravatar jan Iversen
remove PartialPressureGas from SettingsObjectWrapper and reference qPrefPartialPressureGas update files using SettingsObjectWrapper/PartialPressureGas to use qPrefPartialPressureGas this activated qPrefPartialPressureGas and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-13core: activate qPrefGeocodingGravatar jan Iversen
remove Geocoding from SettingsObjectWrapper and reference qPrefFacebook update files using SettingsObjectWrapper/Geocoding to use qPrefFacebook this activated qPrefGeocoding and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-13core: activate qPrefLanguageGravatar jan Iversen
remove Language from SettingsObjectWrapper and reference qPrefLanguage update files using SettingsObjectWrapper/Language to use qPrefLanguage this activated qPrefLanguage and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-12core: activate qPrefLocationServiceGravatar jan Iversen
remove LocationService from SettingsObjectWrapper and reference qPrefLocationService update files using SettingsObjectWrapper/LocationService to use qPrefLocationService this activated qPrefLocationService and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-12core: activate qPrefTechnicalDetailsGravatar jan Iversen
remove TechnicalDetails from SettingsObjectWrapper and reference qPrefTechnicalDetails update files using SettingsObjectWrapper/TechnicalDetails to use qPrefTechnicalDetails this activated qPrefTechnicalDetails and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-09core: activate qPrefUpdateManagerGravatar jan Iversen
remove UpdateManager from SettingsObjectWrapper and reference qPrefUpdateManager update files using SettingsObjectWrapper/UpdateManager to use qPrefUpdateManager this activated qPrefUpdateManager and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-08core: activate qPrefDivePlannerGravatar jan Iversen
remove DivePlanner from SettingsObjectWrapper and reference qPrefDivePlanner update files using SettingsObjectWrapper/DivePlanner to use qPrefDivePlanner this activated qPrefDivePlanner and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-02core: activate qPrefUnitsGravatar jan Iversen
remove Units from SettingsObjectWrapper and reference qPrefUnits update files using SettingsObjectWrapper/Units to use qPrefUnits this activated qPrefUnits and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-30core: activate qPrefProxyGravatar jan Iversen
remove Proxy from SettingsObjectWrapper and reference qPrefProxy update files using SettingsObjectWrapper/Proxy to use qPrefProxy this activated qPrefProxy and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-30ssrf: simplify Register/check calls in subsurface-helperGravatar jan Iversen
Add REGISTER_TYPE macro, that expands to register_type and the "if" There are no functional changes, but the code is a lot easier to read. Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-27core: activate qPrefFacebookGravatar jan Iversen
remove Facebook from SettingsObjectWrapper and reference qPrefFacebook update files using SettingsObjectWrapper/Facebook to use qPrefFacebook this activated qPrefFacebook and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-26Whitespace cleanup main/helper filesGravatar Dirk Hohndel
Again, entirely script based. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-07-25core: activate qPrefDiveComputerGravatar jan Iversen
remove DiveComputer from SettingsObjectWrapper and reference qPrefDiveComputer update files using SettingsObjectWrapper/DiveComputer to use qPrefDiveComputer this activated qPrefDiveComputer and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-23Dive video: paint duration-bar above thumbnail in profile plotGravatar Berthold Stoeger
Paint a rectangle on top of thumbnails indicating the run-time of the video. Use the z=100.0-101.0 range for painting the thumbnails, whereby the z-value increases uniformly from first to last thumbnail (sorted by timestamp). The duration-bars are placed at z-values midway between those of the thumbnails. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-21core: create qPrefCloudStorage from SettingsObjectWrapperGravatar jan Iversen
Update set/get functions to follow common name scheme: - get function have same name as in struct preferences - set function have set_<name> (from struct preferences>) - signal function have <name>_changed (from struct preferences>) one class one .h/.cpp is the C++ idiom. Having load/sync of each variable in 1 functions (in contrast to the distributed way SettingsObjectWrapper handles it) secures the same storage name is used. Having the set/get/load/sync functions grouped together makes it easier to get an overview. REMARK: this commit only defines the class, it is not active in production Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-14Merge branch 'qPrefAnimations' of https://github.com/janiversen/subsurfaceGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-07-14Merge branch 'qml_test' of https://github.com/janiversen/subsurfaceGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-07-13map-widget: fix chronology of QML class registrationGravatar Lubomir I. Ivanov
The QML types needs to be registered before the MainWindow instance is created on the desktop version, otherwise the MapWidget instance will be created and it will fail with a missing QML namespace. In subsurface-helper.cpp, move register_qml_types() from run_ui() to init_ui(), as later in init_ui(), MainWindow is instantiated for the first time in the desktop version. Ref #1500 Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-07-12core: copy Animations from SettingsObjectWrapper to qPref as its own classGravatar jan Iversen
Update set/get functions to follow common name scheme: - get function have same name as in struct preferences - set function have set_<name in struct preferences> - signal function have <name in struct preferences>_changed one class one .h/.cpp is the C++ idiom. Having load/sync of each variable in 1 functions (in contrast to the distributed way SettingsObjectWrapper handles it) secures the same storage name is used. Having the set/get/load/sync functions grouped together makes it easier to get an overview. REMARK: this commit only defines the class, it is not active in production Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-12ssrf: prepare subsurface_helper.cpp to be used by testqmlGravatar jan Iversen
add test for SUBSURFACE_TEST_DATA to exclude functions not used when testing Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-12ssrf: combine subsurface-*-helper into subsurface-helperGravatar jan Iversen
combine shared functions like init_ui and run_ui in one file Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-12desktop-widget: move qmlRegister from mapwidget to shared helperGravatar jan Iversen
Remove qmlRegister in desktop-widgets/mapwidget in order to have a shared registration in subsurface-helper.cpp Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-12ssrf: add shared helper fileGravatar jan Iversen
add subsurface-helper.cpp to share functions between mobile and desktop move mobile qml registrations to a shared function (avoiding differences in registrations) Target is to replace current subsurface-desktop-main + subsurface-desktop-helper and subsurface-mobile-main + subsurface-mobile-helper with subsurface-*-main + subsurface-helper Signed-off-by: Jan Iversen <jani@apache.org>