Commit graph

13444 commits

Author SHA1 Message Date
Berthold Stoeger
0b0eacce30 Check cloudserver availability only for cloud repositories
The check used to be done for any https:// repository.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-19 09:45:08 +02:00
Berthold Stoeger
b188f00587 Factor out counting of authentication attempts into function
Moreover, make the maximum number of authentication attempts a
const variable.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-19 09:45:08 +02:00
Jan Mulder
88658bd9e3 Use different preference file for mobile
This is a change mainly for developers working on both mobile and
desktop application. As the current setup is that all preferences
are stored in one file (Subsurface.conf), for both mobile and desktop,
the unwary developer might get confused that the things tested on
mobile-on-desktop are not working on mobile-on-device. As we share
a lot of code between the desktop and the mobile code, also
our fairly extensive set of preferences play a significant role
in the inner workings of our applications.

So, this commit introduces an own preferences file for mobile
(on desktop) resulting in the preferences between the plain
desktop apllication now invisible to the mobile-on-desktop
application and vise versa. Making the mobile-on-desktop a
much more realistic test plaform for mobile development.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-19 09:39:07 +02:00
Oliver Schwaneberg
af89698d64 Checking for ACK for getDive.
get_matching_dive does not check if the DC wrote an acknowledgement for the requested dive.
As result, the sync stalls if dive number 0 is not available.

Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
2018-01-19 09:27:32 +02:00
Jan Mulder
65caddb294 code cleanup: translators are not global
Un-globalize unused global variables.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-18 17:36:31 +02:00
Berthold Stoeger
3d02edf61e Mobile: start message timer on startup
Since the timer will be started on first message anyway, we might
just start it at application startup.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-18 17:35:35 +02:00
Berthold Stoeger
84b96ac2ae Mobile: don't show timer twice in log-message
This was probably an oversight - the timer was only shown for very
specific messages. This was change to show the timer for all messages.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-18 17:35:35 +02:00
Jan Mulder
e592dfe17c Whitespace only
Now that we properly return when raising an error, do not
if () else if(). Useles.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-18 09:44:08 +01:00
Jan Mulder
d28f48a793 Fix preferences handling with invalid passwords
This fixes 2 problems related to entering passwords with
illegal characters in it:
1) Do not save an invalid password in the preferences, but keep the old
one.
2) On password change, check both old and new password for format
validity instead of pushing an invalid password to the server that
has to ignore it.

Fixes: #1048

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-18 09:44:08 +01:00
Berthold Stoeger
ff9bdfd0df Fix PreferencesNetwork::passwordUpdateSuccessful slot
In preferences_network.cpp, the CloudStorageAuthenticate::passwordChangeSuccessful
signal was connected to the PreferencesNetwork::passwordUpdateSuccessful
slot. This never worked, because passwordUpdateSuccessful() was declared
as a normal member function, not a slot (hooray for Qt's weird runtime-checked
signal system).

While touching this code, change the weird SIGNAL/SLOT macros to
actual member function, to at least get *some* compile-time checks.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-18 08:56:27 +01:00
Berthold Stoeger
a116ff85f8 Remove redundant local variables cloudPwd and cloudUser
These were assigned the member variables QMLManager::m_cloudPassword
and QMLManager::m_cloudPassword. Use the member variables directly.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-18 08:56:00 +01:00
Berthold Stoeger
ee17024ac5 Remove redundant QML getter functions
QMLManager was full of redundant getter functions of the type
bool QMLManager::locationServiceAvailable() const
{
       return m_locationServiceAvailable;
}
These can be removed changing READ keywords to MEMBER keywords
in the QPROPERTY declarations.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-18 08:56:00 +01:00
Berthold Stoeger
2d24dceafa Use format_string() in core/git_access.c
Since this helper-function exists, we might just use it. A subtle
reuse of a buffer (string of second use was known to be shorter than
string of first use) was replaced by a separate allocation.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-17 21:45:48 +02:00
Berthold Stoeger
daede13571 Fix leak(s) in core/git-access.c
The libgit2 functions git_cred_ssh_key_new() and git_cred_userpass_plaintext_new()
copy their arguments. Therefore, free the string arguments or don't
copy them in the first place.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-13 21:55:33 +01:00
Robert C. Helling
de49f2484f Resize progress bar width to fit all text
At least on Mac with larger font sizes part of the label
text of the git access progress bar is cut off (even though
it should automatically resize). This patch adds explicit
resize.

Fixes #1041

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-01-13 19:13:14 +01:00
Jan Mulder
b4d37e8eeb profile: fix garbled profiles after visiting the planner
See mentioned GitHub issue for the full issue, and images.

The reason for this weird behavior is the existence of 2 flags in
the profile code: shouldCalculateMaxTime and shouldCalculateMaxDepth.
When exactly following the use case and test data as attached to
the GitHub issue (a very short dive, shorter than most of the
dives in the logbook), the shouldCalculateMaxTime flag never got
back to its true status, causing the the time scale not to adapt
to other dives when just clicking (or selecting) them from the dive
list.

The problem is fixed here by also setting the shouldCalculateMaxTime
flag on manipulating wayppoints in the dive plan.

Fixes: #1039

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-12 10:26:05 -08:00
Willem Ferguson
082def8162 Fix indentations for plannernotes.c
The last 2 commits have now been squashed.
S Fuchs's comment on line 315 has been fixed

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-01-11 21:47:04 +01:00
Berthold Stoeger
c44224ed29 Move always true ++lineptr out of while-condition
In core/file.c move ++lineptr out of the while condition
  !empty_string(lineptr) && (lineptr = strchr(lineptr, '\n') && ++lineptr
since it always evaluates to true.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-11 06:07:13 +01:00
Berthold Stoeger
6a07ccbad2 Use helper function empty_string() instead of manual checks
For code consistency, substitute boolean expressions:
 s && *s     -> !empty_string(s)
 s && s[0]   -> !empty_string(s)
 !s || !*s   ->  empty_string(s)
 !s || !s[0] ->  empty_string(s)

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-11 06:07:13 +01:00
Berthold Stoeger
e85ecdd925 Introduce helper function empty_string()
There are ca. 50 constructs of the kind
  same_string(s, "")
to test for empty or null strings. Replace them by the new helper
function empty_string().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-11 06:07:13 +01:00
Berthold Stoeger
86ef9fce75 Change return code of string comparison functions to bool
These functions were returning 0 or 1 anyway.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-11 06:07:13 +01:00
Jan Mulder
34bc4fc0af Pictures tied to profile are not supported on mobile
Move divepicturemodel.cpp to the desktop only category and deal
with the (limited) fallout. We, currently, do not support dive
pictures tied to the profile on mobile, so there is no use
including this code.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 21:28:02 +01:00
Jan Mulder
9c01315d31 Un-tie plannner model from profile on mobile
Do not pull in the DivePlannerPointsModel::instance as this is not
used in the called function. We (currently) do not support deco
computations on mobile, so trying to pull in any deco state from
the planner is futile anyway.

With this uncoupling, 6 more model files are not needed in mobile
any more.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 21:28:02 +01:00
Berthold Stoeger
14e6c132c8 Typo: Threshould -> Threshold
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10 21:25:02 +01:00
Berthold Stoeger
85ac3106e6 Typo: indice -> index
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10 21:25:02 +01:00
Berthold Stoeger
d9ac716162 Replace CREATE_PP_GAS macro by member function in profilewidget2.cpp
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10 21:25:02 +01:00
Berthold Stoeger
05974d17c9 Remove two arguments from ProfileWidget2::setupItem()
1) hAxis was always set to timeAxis
2) model was always set to dataModel

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10 21:25:02 +01:00
Berthold Stoeger
769c64fe5e Replace ADD_ACTION macro by member function in profilewidget2.cpp
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10 21:25:02 +01:00
Berthold Stoeger
3d8b0e6d3f Replace HIDE_ALL macro by template function in profilewidget2.cpp
This is easier to read and debug.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10 21:25:02 +01:00
Berthold Stoeger
6cf06fb61d Remove unnecessary deletes in destructor of ProfileWidget2
All the deleted items were added to the scene, which takes
"ownership" (a remarkably fuzzy concept in Qt) of these
objects. In principle, deleting these items is a bug - even
though it is handled gracefully.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10 21:25:02 +01:00
Jan Mulder
6193aef9ac mobile: fix crash on delete dive from divelist
This is a somewhat hacky commit. For a very long time, the delete
from the divelist on mobile crashed. That is, not always for anyone,
but for me almost consistently. This commit tries to solve it.

I found that trying to save the delete immediately after removing
data from the underlying model seemed to cause the crash. Hacking
around, I found that a simple beginResetModel/endResetModel between
the delete of the underlying model data and actual save is
sufficient to solve the crash.

The big question is, why does this all work? I suspect some of race
condition between deleting model data, and giving the QML engine
the opportunity to do its thing.

This is also related to issue #311, but that is not implemented
here.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 20:34:16 +01:00
Jan Mulder
0096284a8e cleanup: fix possbile buffer overrun
No reason to mess around with a 5 byte buffer when we have a
proper buffer available to receive a possibly 8 byte output
based on the format string. And silences compiler warning.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 16:45:42 +01:00
Jan Mulder
3e2caa468e cleanup: initilize local variable
Silence compiler warning by correctly initializing local variable.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 16:45:42 +01:00
Jan Mulder
0bb1a82127 GpsLocation::clearGpsData() is only used in SUBSURFACE_MOBILE
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 16:45:42 +01:00
Jan Mulder
53221ffd8e Unused code: GpsListModel::addGpsFix()
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 16:45:42 +01:00
Jan Mulder
1892e2af21 Unused code: remove ProfileWidget2::isAddOrPlanner()
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 16:45:42 +01:00
Jan Mulder
5faf3f9410 Unused code: has_hr_data()
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 16:45:42 +01:00
Jan Mulder
1d7fc93017 Unused code: remove CCRMax() and used macro
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 16:45:42 +01:00
Jan Mulder
a88c950738 Unused code: DiveCartesianAxis::percentAt()
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 16:45:42 +01:00
Jan Mulder
d0ff3917b1 Unused code: GroupedLineEdit::removeAllColors()
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 16:45:42 +01:00
Jan Mulder
b7a6b7c6be Unused code: report_message()
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 16:45:42 +01:00
Jan Mulder
1c03075f24 Unused code: remove taglist_contains_all()
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 16:45:42 +01:00
Jan Mulder
dc54b4aaeb Unused code: remove weightsystems_equal()
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 16:45:42 +01:00
Jan Mulder
b2c7a4cf1d Unused code: weekday()
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 16:45:42 +01:00
Jan Mulder
3cd3653972 Unused code: remove taglist_equal()
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 16:45:42 +01:00
Jan Mulder
768f0db991 Unused code: remove shift_times()
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 16:45:42 +01:00
Jan Mulder
c69ea1de1b Unused code: remove trip_has_selected_dives()
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 16:45:42 +01:00
Jan Mulder
69b922dc72 Unused code: remove PluginManager::socialNetworkIntegrationPlugins()
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 16:45:42 +01:00
Jan Mulder
d88e916c1d Unused code: remove DiveCartesianAxis::tickInterval() and tickSize()
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 16:45:42 +01:00
Jan Mulder
c8e9b93404 build system: split qt-models into parts
For a long time, I did not realize that a lot of qt-models are only
used in the mobile app, or only used in the desktop application.

This commit splits the qt-models in 3 parts. Used in both mobile and
desktop, used in desktop only, used in mobile only.

There is no other code change in here, other than cmake changes.

To me, this gives at least developers more insight where code is
actually used, and there is a small benefit in footpoint.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 16:44:15 +01:00