Commit graph

26 commits

Author SHA1 Message Date
Berthold Stoeger
4fb01dd766 Fix ownership issues in preferences code
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-25 07:41:09 -08:00
Lubomir I. Ivanov
0c74f7a2c8 win32: optimize the console and logging logic
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-11-03 07:49:11 -07:00
Tomaz Canabrava
a55efcf7d8 Move the fill_computer_list() out of widgets
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-05-27 08:07:35 -07:00
Dirk Hohndel
59ed9ea3fc Add SPDX header to top level files
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-29 13:32:55 -07:00
Marco Martin
751626eec5 QML UI: Fully port dive edit to Kirigami2
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-04-01 09:35:51 +02:00
Joakim Bygdell
11dcae436e MOBILE: Read profile settings from git
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-02-05 11:59:47 -08:00
Dirk Hohndel
ca6a241a97 Add argument to subsurface_console_init call
Subsurface-mobile doesn't work on Windows, so we can just
hardcode this to false.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03 17:43:25 -08:00
Dirk Hohndel
c52688c528 Fix compile for Subsurface-mobile
The Settings update series didn't make the corresponding changes
for Subsurface-mobile.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-27 12:45:20 -07:00
Dirk Hohndel
6cf100f1cc Avoid crash with empty command line argument
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-06-17 04:10:39 -07:00
Thiago Macieira
8f35b7324e Move the qtTranslator and ssrfTranslator pointers to qt-init.cpp
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-05-02 07:07:21 -07:00
Dirk Hohndel
7afcadef53 Remove pointless code
This isn't how you remove the default filename

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-30 11:07:58 -07:00
Dirk Hohndel
93d21ceac7 correctly load default filename
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-27 15:05:37 -07:00
Dirk Hohndel
ec136defa8 QML UI: set the default local repo to load
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-27 15:05:37 -07:00
Dirk Hohndel
a1f0263c64 Remove useless command line handling code from mobile app
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-22 11:59:16 -07:00
Dirk Hohndel
7be962bfc2 Move subsurface-core to core and qt-mobile to mobile-widgets
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-04-04 22:33:58 -07:00
Dirk Hohndel
94a549e767 QML UI: brute force password saving
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-29 21:43:37 -05:00
Dirk Hohndel
cae180036e QML UI: really force passwords to be saved
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-29 21:23:28 -05:00
Dirk Hohndel
8185d24e61 QML UI: force local saving of password
commit d99c931219 ("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-03-27 19:28:31 -05:00
Jan Mulder
dd53411550 Mobile: always show divecomputer reported ceiling in red
We do not not want to do decompress model calculations in the mobile app
(see 130f4cd7ac), 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-02-06 06:14:15 -08:00
Dirk Hohndel
a9b53efce6 QML UI: switch UI to imperial units for users in the US
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>
2016-01-05 23:43:05 -08:00
Dirk Hohndel
c0ac953242 QML UI: call plot dive when we set the dive
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-12-01 15:32:16 -08:00
Lubomir I. Ivanov
f390fa0bb8 subsurface-mobile-main.cpp: fix unused variable 'application'
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-18 19:26:46 -08:00
Dirk Hohndel
97fa132202 Move proxy initialization into shared code
This way we can use the same code on desktop and mobile app.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-14 09:39:02 -08:00
Dirk Hohndel
dab207a8c8 Subsurface-mobile: load preferences after org is set up
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-07 11:25:12 -08:00
Dirk Hohndel
61e36124e4 Subsurface-mobile: make sure we load the preferences
Otherwise all kinds of things don't work right.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-07 09:51:01 -08:00
Dirk Hohndel
b76d3fa25f Better file names for Subsurface-mobile related sources
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>
2015-11-06 13:44:13 -08:00
Renamed from subsurface-android-main.cpp (Browse further)