summaryrefslogtreecommitdiffstats
path: root/subsurface-mobile-main.cpp
AgeCommit message (Collapse)Author
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-04mobile: Expose ftdi if compiled inGravatar Anton Lundin
Expose ftdi connection posibilities if its compiled in, not only on Android. Its useful to be able to test it on a Linux machine to. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2019-06-19Cleanup: move tag functions into own translation unitGravatar Berthold Stoeger
Make dive.h a bit slimmer. It's only a drop in the bucket - but at least when modifying tag functions not the *whole* application is rebuilt anymore. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-11core/settings ... : remove qPref* includes in qPref.hGravatar jan Iversen
reduce number of includes by removing qPref* includes in qPref.h 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-15ssrf: remove SettingsObjectWrapper and update qPref callsGravatar jan Iversen
remove use of SettingsObjectWrapper:: remove include of SettingsObjectWrapper.h use qPrefFoo:: for setters and getters replace prefs.foo with qPrefXYZ::foo() where feasible (this expands to the same code, but gives us more control over the variable). Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-15ssrf: call sync() when exiting appl.Gravatar jan Iversen
In order to ensure preferences are saved, sync() is called when leaving the program. 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-18Cleanups to core/color.[c|hpp]Gravatar Berthold Stoeger
A number of small cleanups to the color-table: 1) Make the profile_color map of static linkage - it is not used outside of this file. 2) Remove the third color, which originally was planned for printing. It was not accessed anywhere. 3) Replace QVector<QColor> by std::array<QColor, 2>. Using a reference-counted, copy-on-write, dynamic container for static data seems like overkill. std::array<QColor, 2> has exactly the same run-time impact as QColor[2], but allows for assignment. 4) Use brace-initialization and remove the unneeded COLOR macro. 5) Remove the fill_profile_color function. Simply use static initialization. 6) Move #includes from .h to .cpp file. 7) Remove text_render_options(_t), which were not used anywhere. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-12ssrf: move functions from mobile-helper to mobile-mainGravatar jan Iversen
Move few mobile only functions from mobile-helper to mobile-main remove subsurface-mobile-helper file structure is now subsurface-*-main.cpp + subsurface-helper.cpp Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-04Cleanup: fold core/helpers.h into core/qthelper.hGravatar Berthold Stoeger
helpers.h included qthelper.h and all functions declared in helpers.h were defined in qthelper.h. Therefore fold the former into the latter, since the split seems completely arbitrary. While doing so, change the return-type of get_dc_nichname from "const QString" to "QString". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-30mobile: add timer to measure startup.Gravatar jan Iversen
Subsurface-mobile has a long startup time; in order to isolate the problem(s) a timer is added to see where time is "lost". The collected startup times are added to the clipboard together with the other logs, allowing test users to report back. All this is only enabled when compiling with -DENABLE_STARTUP_TIMING Closes #1340 [Dirk Hohndel: collapsed multiple commits and minor white space cleanups, added missing QMutex variable] Signed-off-by: Jan Iversen <jani@apache.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-05-24mobile: application variable unused in mainGravatar jan Iversen
Simplify starting application. instead of declaring var. application, and the setting unused, simple do the "new QApplication" without a variable. Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-14Core: remove dive.h from files that don't need itGravatar Dirk Hohndel
Of course, quite a few of them indirectly get it through other header files. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-03-14Cleanup: consistently use qPrintable()Gravatar Berthold Stoeger
Replace constructs of the kind s.toUtf8().data(), s.toUtf8().constData(), s.toLocal8Bit().data(), s.toLocal8Bit.constData() or qUtf8Printable(s) by qPrintable(s). This is concise, consistent and - in principle - more performant than the .data() versions. Sadly, owing to a suboptimal implementation, qPrintable(s) currently is a pessimization compared to s.toUtf8().data(). A fix is scheduled for new Qt versions: https://codereview.qt-project.org/#/c/221331/ Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-11Remove second parameter (bool force) in set_filename()Gravatar Berthold Stoeger
The last force=false case was removed in commit 96d1cc570e31396039e4970d2bf75d5f00f1e550. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-03Use QLocale to identify unit systemGravatar Murillo Bernardes
Identifying unit system ends up being more complex than just checking language for -US. Some users might use US English, but prefer the metric system. Signed-off-by: Murillo Bernardes <mfbernardes@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-25Fix ownership issues in preferences codeGravatar Berthold Stoeger
Each preferences object owns its string members. In three cases, pointers were copied instead of strings, leading to (in the best case) dangling pointers if the user edited values: 1) In the GET_TXT macro in core/prefs-macros.h 2) In the PreferencesDialog::defaultsRequested() method 3) In main() of the mobile version This patch fixes these issues, by using copy_string() or copy_prefs() as appropriate. The only reason that the old code didn't crash regularly is that the default_prefs object was only used at startup and defaultsRequested() is (at the moment?) dead code. This patch also aligns the backslashes in core/pref.h and fixes a typo. The declaration of copy_prefs() is moved to the core/prefs.h header. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-03win32: optimize the console and logging logicGravatar Lubomir I. Ivanov
Currently one has to explicitly use --win32console and/or --win32log to enable a dedicated console (a console window that opens next to the Subsurface window) or to enable file logging on Win32. This patch makes the following changes: - removes the --win32* command line arguments - removes the dedicated console window support - if the app starts from a shortcut and not from a console, always redirect stderr and stdout to _err & _out log files - if the app starts from a console redirect stderr and stdout to that console Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-05-27Move the fill_computer_list() out of widgetsGravatar Tomaz Canabrava
fill_computer_list() creates a Qt friendly structure that contains all of the necessary information about dive computers and it's devices, and it's needed both in Qml and Widgets to allow the user to download their dives. This patch makes it possible to use the code in QML without duplication. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-29Add SPDX header to top level filesGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-01QML UI: Fully port dive edit to Kirigami2Gravatar Marco Martin
Completely adapt to the api changes of OverlaySheet in Kirigami2 in order to achieve the same look and behavior for the dive edits that had with kirigami1 Port most components to QtQuickContrls2, except comboboxes in the dive edit sheet that will need a new control type Signed-off-by: Marco Martin <notmart@gmail.com>
2017-02-05MOBILE: Read profile settings from gitGravatar Joakim Bygdell
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-02-03Add argument to subsurface_console_init callGravatar Dirk Hohndel
Subsurface-mobile doesn't work on Windows, so we can just hardcode this to false. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-27Fix compile for Subsurface-mobileGravatar Dirk Hohndel
The Settings update series didn't make the corresponding changes for Subsurface-mobile. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-06-17Avoid crash with empty command line argumentGravatar Dirk Hohndel
It appears on iOS we can get a command line argument of "" which would crash Subsurface-mobile on startup. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-05-02Move the qtTranslator and ssrfTranslator pointers to qt-init.cppGravatar Thiago Macieira
No point in having it defined in each main program's .cpp. Especially since the unit tests don't define them. Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-30Remove pointless codeGravatar Dirk Hohndel
This isn't how you remove the default filename Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-27correctly load default filenameGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-27QML UI: set the default local repo to loadGravatar Dirk Hohndel
This will allow the user to open a repo that was stored in no cloud mode. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-22Remove useless command line handling code from mobile appGravatar Dirk Hohndel
The files collected were never opened, this all is just the result of a copy and paste job that clearly was never fully thought through. Also remove support for ancient libgit2 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04Move subsurface-core to core and qt-mobile to mobile-widgetsGravatar Dirk Hohndel
Having subsurface-core as a directory name really messes with autocomplete and is obviously redundant. Simmilarly, qt-mobile caused an autocomplete conflict and also was inconsistent with the desktop-widget name for the directory containing the "other" UI. And while cleaning up the resulting change in the path name for include files, I decided to clean up those even more to make them consistent overall. This could have been handled in more commits, but since this requires a make clean before the build, it seemed more sensible to do it all in one. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-29QML UI: brute force password savingGravatar Dirk Hohndel
This is embarrassing. I should have done this in the first place instead of trying to hack around it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-29QML UI: really force passwords to be savedGravatar Dirk Hohndel
The logic looked so easy, but the preference needs to be hard coded twice because there are two scenarios: - new install, make sure we load the password from settings (so it needs to be hard coded BEFORE we load preferences) - update where previously for some reason the user stored that they didn't want to store the password, so we need to also hard code it after the settings were loaded Looks odd, but that should do the trick. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-27QML UI: force local saving of passwordGravatar Dirk Hohndel
commit d99c9312195c ("QML UI: remove the checkbox for remembering the password") made the incorrect assumption that this would always be true by default when it actually was false by default. Oops. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-06Mobile: always show divecomputer reported ceiling in redGravatar Jan Mulder
We do not not want to do decompress model calculations in the mobile app (see 130f4cd7ac5b), but we do want to see the divecomputer reported ceiling (in red). The latter is fixed here. Ticket #1006 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-05QML UI: switch UI to imperial units for users in the USGravatar Dirk Hohndel
This is overly simplistic and it would be better to be able to override this in the settings, but frankly fewer settings are better and in most cases this is what the user wants. Fixes #987 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-01QML UI: call plot dive when we set the diveGravatar Dirk Hohndel
The asynchronous nature of the profile bites us here. plotDive() signals that it changes model data and expects the rest of the data structures to respond to that. Very neat and it seems to work perfectly well on the desktop, but on Android calling render() right after plotDive() resulted in paint() functions being called before all the elements had been calculated as a result of the signals being emitted in the model change. That's why so often the profile was missing parts. Now admittedly this makes me nervous. Do we now know that all calculations have finished by the time render() gets called? Not really. It just seems that in my testing we tend to get lucky and things work out. But that does not feel like a sane architecture to me. Messing around with the animation speed is silly as we render the profile into a pixmap, so let's turn this off globally. Also, the scaling of the pixmap is still completely bogus. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-18subsurface-mobile-main.cpp: fix unused variable 'application'Gravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-14Move proxy initialization into shared codeGravatar Dirk Hohndel
This way we can use the same code on desktop and mobile app. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-07Subsurface-mobile: load preferences after org is set upGravatar Dirk Hohndel
The persistent storage of the preferences includes the Organization name set in the application. So we need to make sure we load the preferences AFTER setting up the Organization in the init_ui() call. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-07Subsurface-mobile: make sure we load the preferencesGravatar Dirk Hohndel
Otherwise all kinds of things don't work right. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-06Better file names for Subsurface-mobile related sourcesGravatar Dirk Hohndel
They aren't Android specific - they are for the QML UI mobile app which should run on iOS as well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>