process_dives() is used to post-process the dive table after loading
or importing. The first parameter states whether this was after
load or import.
Especially in the light of undo, load and import are fundamentally
different things. Notably, that latter should be undo-able, whereas
the former is not. Therefore, as a first step to make import undo-able,
split the function in two versions and remove the first parameter.
It turns out the the load-version is very light. It only sets the
DC nicknames and sorts the dive-table. There seems to be no reason
to merge dives.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
We only store the address part of the connection name, so don't try to find an
exact match, try to find the sub-string.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The unit types are set from system locale when the app starts.
We need to explicitly set the units to match the unit system that is saved in
the git repo. Or we end up with situations where the preferences and git say
"metric" but the units are "imperial".
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Use qPrefLocationService::set_time_threshold and remove from
qmlprefs.cpp and qmlmanager.cpp
Remark: mobile UI shows time in minutes, while it is stored (and calculated)
in seconds. Therefore a /60 when reading and *60 when setting.
Signed-off-by: Jan Iversen <jani@apache.org>
Remove distanceThreshold from qmlprefs and use qPref instead
update qml
no user experience change
Signed-off-by: Jan Iversen <jani@apache.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Despite the fast that this code is sitting in core, its used mainly
from mobile. In 987e221f8e, the buttons to interact with the GPS
webservice were deleted from the UI. Now, delete all the code that
was used under these buttons.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
When installing for the first time cloudCredentials needs to be added,
this commit a problem with updating them correctly
this problem was caused by
da6e8a4cd5
Signed-off-by: Jan Iversen <jani@apache.org>
To enable undo of divelog-importing it is crucial that parse_file()
can parse into arbitrary dive tables.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
A trivial cleanup: replace void by properly typed pointers in
cylinder_none() and weightsystem_none(). Moreover, remove the
unused function no_weightsystems().
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
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>
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>
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>
With the new setup we need to know which state we are coming from
when we are saving cylinder related info. When we are adding
a new dive we explicitly should save cylinder data to the first cylinder.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Same as for cylinder info, we need to make sure that the gasmixes gets saved to the correct cylinder.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Save the edited cylinder in the correct slot.
Since the cylinder number and the used cylinder number need not be
the same we first need to test if the cylinder are used.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Parse the device string and try to figure out what was plugged in.
In some cases we know exactly which vendor and product was plugged in,
in other cases we only know which vendor it was, in some cases we don't
even know that (if all we see is a generic FTDI cable).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
And try to guess which one from the device string we get from the Intent.
The function is named to indicate its future use (because once the user
plugs in such a device, we should show the download page).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If the user plugs in a device on Android we get a device string that
should allow us to figure out which dive computer was plugged in. Make
that string available to the QML UI.
Right now all we do is log it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
add enum to qPref and remove elsewhere
update source core to reference qPref.
the enum cannot be in pref.h because it is to be used in qml and Q_ENUM
need the enum to be defined as part of the class
Signed-off-by: Jan Iversen <jani@apache.org>
Use Q_ENUM instad of Q_ENUMS (which is depreciated) since it does the
meta registration for all Qt platforms.
Q_ENUM require the enum to be defined in the class and cannot refer to
a global class, therefore copied enum to class.
This commit is made to get the release to work, with minimal changes,
this class will be moved to qPref and the double definition solved
Signed-off-by: Jan Iversen <jani@apache.org>
Remove cloud_storage_status from qmlprefs.h.
usage to qPref::
enum cloud_storage_status is not used from C, but only from C++, and
having the same structure defined multiple times is a maintenance
challenge.
Signed-off-by: Jan Iversen <jani@apache.org>
The clipboard fails if we attempt to copy more than 1MB of data. But the
data buffer used is shared between all transactions 'in flight' and we
cannot tell what else is currently using that buffer. Limiting ourselves
to 500k of text for the logfiles seems reasonable and hopefully makes it
more likely that the transaction will succeed (sadly, Qt doesn't tell us
if it failed).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
On some devices (e.g., a Sony Xperia phone) the GenericDataLocation is
not app writeable. Instead of just giving app, try a few other default
locations as well (and since all of these are actually string lists,
try all of the options that Qt gives us).
Reasonably, we should only set the libdivecomputer logfile name if we
found a writeable location.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This way the user doesn't inadvertantly end up with information from a previous
run of Subsurface-mobile when they copy the logs to the clipboard.
Not sure we should do the same when building for desktop, so right now it's
only when building for a device.
Reported-by: Thomas Fänge <thomas.fange@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We want to allow people to keep dives they collected without a cloud
account. The code was mostly there, we just got confused about the
existing status because we ran through this twice (no cloud -> unknown
-> verified). This way we explicitly remember this kind of transition.
Fixes#1404
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
add settings variables/functions to qmlprefs
remove settings variables/functions from qmlmanager
change manager. to prefs. in qml files for setting variables/functions
Signed-off-by: Jan Iversen <jani@apache.org>
Remove Q_OBJECT and qml properties from DCDeviceData class
Remove DCDeviceData register from mobile-helper.cpp
Change DCDeviceData constructor to be without parameters
Signed-off-by: Jan Iversen <jani@apache.org>
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>
The reply member variable was used to access the reply in the
handleSslErrors, handleError and retrieveUserid slots. This is a
very scary proposition in the light of multi-threading. Instead,
the reply can be accessed by using the QObject::sender() function.
Thus, we can remove the member variable.
The request member was just downright weird. This was only used
locally to describe a network request. Since QNetworkAccessManager::get()
copies the request, it can be destructed right away. Nevertheless,
the data was kept as a subobject. Remove member and make it function-local.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Read libdivecomputer.log file and append to clipboard
Remark, subsurface_open is not available in iOS so using
QFile instead.
Signed-off-by: Jan Iversen <jani@apache.org>