Commit graph

14360 commits

Author SHA1 Message Date
Berthold Stoeger
4bdd811f06 Cleanup: remove DiveListView::fixMessyQtModelBehaviour()
The function DiveListView::fixMessyQtModelBehaviour() was used to
expand the first columns of dive-trips in the dive-list view.
This function was called everytime that the dive-list was modified.
It is kind of ludicrous that external callers would have to
tell the DiveListView, when it has to update its column headers.

Instead, place this functionality in the overriden reset() and
rowsInserted() functions, as these are the only ways that
rows can be added. Change the DiveTripModel to use the proper
beginResetModel()/endResetModel() pair instead of the previous
full deletion and full repopulation using the beginRemoveRows()/
endRemoveRows() and beginInsertRows()/endInsertRows().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-30 12:21:17 -07:00
Berthold Stoeger
5e1e6110ce Cleanup: remove parameter from currentDiveChanged signal
The currentDiveChanged signal was emitted by the DiveListView
to inform the MainWindow of a change of current dive. The
new current dive was passed as a parameter. The slot in MainWindow
then called select_dive() on the dive.

This seems pointless because:
1) In both emits, selected_dive dive was passed as argument. But
   MainWindow can read this global variable itself.
2) Calling select_dive() again is a no-op, because obviously,
   this already *was* the selected dive.

Moreover it seems conceptually wrong to set the current dive in the
slot that is informed of the change of the current dive.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-30 12:20:26 -07:00
jan Iversen
d3f3d82abd tests: add Proxy qml test cases
Add tst_qPrefProxy qml file to test C++ qml connection

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-30 07:43:22 -07:00
jan Iversen
7acd489891 tests: move Proxy test from testpreferences
Remove Proxy test in testpreferences
add the same Proxy tests to testqPrefProxy

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-30 07:43:22 -07:00
jan Iversen
e198230c83 tests: add qPrefProxy testcases
add test cases to secure struct preferences and qPrefProxy work together

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-30 07:43:22 -07:00
jan Iversen
181d2cf364 core: activate qPrefProxy
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-30 07:43:22 -07:00
jan Iversen
f4f798f8dd core: create qPrefProxy from SettingsObjectWrapper
Update set/get functions to follow common name scheme:
- get function have same name as in struct prefs
- set function have set_<name>
- signal function have <name>_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-30 07:43:22 -07:00
jan Iversen
c696c7941d ssrf: simplify Register/check calls in subsurface-helper
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-30 07:43:22 -07:00
jan Iversen
600da8b9ff tests: correct test_multiple in all qPref classes
test_multiple did not test correctly, correct.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-30 07:43:22 -07:00
jan Iversen
311b2672da core: qPrefPrivate.h added HANDLE_PREFERENCE_INT_DEF_EXT
Add missing type macro, needed for qPrefProxy

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-30 07:43:22 -07:00
Berthold Stoeger
58cdc67227 Cleanup: remove DiveListView::testSlot()
This debugging-slot was not linked anywhere. And especially in the
light of the impending refactoring of DiveListView/DiveTreeModel
it seems pointless to keep old debugging code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-30 07:40:36 -07:00
Kristaps Dz
02e76be96a BT support: disable BT download when compiling without BT
When BT_SUPPORT is not enabled, don't default to "true" for using bluetooth for downloading dives.
Otherwise, bluetooth will be forced since the bluetooth button has been removed and is never overridden.

Fixes #1541

Signed-off-by: Kristaps Dzonsons <kristaps@bsd.lv>
2018-07-29 10:55:25 -07:00
Berthold Stoeger
ff2de9099f CHANGELOG.md update
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-28 15:31:25 -07:00
Berthold Stoeger
a76433279e Dive media: put duration on video thumbnails
On the profile, the run-length of the videos is visualized by a bar.
Add the same information to video-thumbnails in the dive-photo-tab.
Though in this case, render it as text on top of the thumbnails.

Fixes #359

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-28 15:31:25 -07:00
Berthold Stoeger
fce42d4858 Dive media: Extract thumbnails from videos with ffmpeg
Extract thumbnails using ffmpeg.
Behavior is controlled by three new preferences fields:
 - extract_video_thumbnails (bool): if true, thumbnails are calculated.
 - extract_video_thumbnail_position (int 0..100): position in video
   where thumbnail is fetched.
 - ffmpeg_executable (string): path of ffmpeg executable.

If ffmpeg refuses to start, extract_video_thumbnails is set to false
to avoid unnecessary churn.

Video thumbnails are marked by an overlay.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-28 15:31:25 -07:00
Kristaps Dz
51066e5478 Build-system: add OpenBSD support
Rename linux.c to unix.c and add OpenBSD support as well. Conditionally compile based on OS.

Signed-off-by: Kristaps Dzonsons <kristaps@bsd.lv>
2018-07-28 14:08:06 -07:00
jan Iversen
8da7ddc64b tests: add Facebook qml test cases
Add tst_qPrefFacebook qml file to test C++ qml connection

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-27 12:36:20 -07:00
jan Iversen
711b96a143 tests: move Facebook test from testpreferences
Remove Facebook test in testpreferences
add the same Facebook tests to testqPrefFacebook

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-27 12:36:20 -07:00
jan Iversen
4102cc755f tests: add qPrefFacebook testcases
add test cases to secure struct preferences and qPrefFacebook work together

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-27 12:36:20 -07:00
jan Iversen
f175890632 core: activate qPrefFacebook
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-27 12:36:20 -07:00
jan Iversen
e0f1817fdc core: create qPrefFacebook from SettingsObjectWrapper
Update set/get functions to follow common name scheme:
- get function have same name as in struct diveComputer
- set function have set_<name>
- signal function have <name>_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-27 12:36:20 -07:00
jan Iversen
75661186d3 tests: correct name in tst_qPrefDisplay.qml
Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-27 12:36:20 -07:00
jan Iversen
6f420773da tests: update qPrefCloudStorage tests for git_url
update tests to reflect that git_url is derived from base_url

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-27 12:23:09 -07:00
jan Iversen
037ee9994d core: fix qPrefCloudStorage to derive git_url
remove set_git_url and git_url_changed, because it is not possible
to set git_url, this is done inderectly through set_base_url

Update disk_base_url to generated git_url for both load/sync

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-27 12:23:09 -07:00
Berthold Stoeger
67a875ef81 Dive list view: setup columns in constructor
The column-widths must only be set once the source-model is that.
The old code realized this with a rather complicated logic.

Instead, simply set the source-model in the constructor and
set the column widths after that. Rename the corresponding
function from "setupUi" to "setColumnWidths".

Moreover, the setupUi function had different code-paths for
the first and other calls. Since it is only called once,
remove the other code paths.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-27 09:08:42 -07:00
Berthold Stoeger
079b99135a Dive list view: move column width logic back from DiveTripModel
Conceptually, the width of the columns should probably reside in
the view not the model. But much more severly, the old code didn't
work: Columns were set in a DiveTripModel, which was deleted
right away.

Therefore, move the logic back to the DiveListView. Introduce
a QVector<int> of the initial column widths, so that they can be
erased from the setting if unchanged.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-27 09:08:42 -07:00
Berthold Stoeger
d3dc698bba Update CodingStyle.md: placement of *, & and && declarators
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-26 07:06:28 -07:00
Dirk Hohndel
c7f0e65b12 Whitespace cleanup core divecomputer handling
Not entirely script based because of two odd issues where the script creates
bogus indentation.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-07-26 16:32:51 +03:00
Dirk Hohndel
0e6c3db24c Whitespace cleanup desktop-widget
Not entirely script based because of the broken 'else if'.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-07-26 16:32:51 +03:00
Dirk Hohndel
00c0f94d8c Whitespace cleanup main/helper files
Again, entirely script based.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-07-26 16:32:51 +03:00
Dirk Hohndel
afe7e847d6 Whitespace cleanup tests
Again, entirely script based.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-07-26 16:32:51 +03:00
Dirk Hohndel
128fc5f4b8 Whitespace cleanup core/settings
We can argue about any of the changes here, but they are the result of our
whitespace.pl script - so if any of this is offensive to you, part of the
resolution will be fixing the script...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-07-26 16:32:51 +03:00
Dirk Hohndel
68b5fe9ccb Small edit of whitespace script
This makes sure we don't end up indenting macro invocations.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-07-26 16:32:51 +03:00
jan Iversen
19871a6ab2 core: qPrefCloudStorage save userid to new location
userid was saved outside all groups, even though it belongs to cloudStorage

Add code to save in new location and read from new/old location

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
daf8921d6f tests: add DiveComputer qml test cases
Add tst_qPrefDiveComputer qml file to test C++ qml connection

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
87b00aea2b tests: move DiveComputer test from testpreferences
Remove DiveComputer test in testpreferences
add the same DiveComputer tests to testqPrefDiveComputer

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
bb5c1da1b7 tests: add qPrefDiveComputer testcases
add test cases to secure struct preferences and qPrefDiveComputer work together

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
3d6848b22c core: activate qPrefDiveComputer
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-25 08:35:04 -07:00
jan Iversen
98820cf970 core: update qPrefDisplay to new consensus
add inline to load/sync
remove const from QString getters

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
8cfe048150 core: update qPrefCloudStorage to new consensus
make load/sync inline
remove const from QString getters

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
5f3471bf86 core: make load/sync inline in qPref
Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
254ba61fd9 core: make load/sync inline in qPrefAnimations
Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
0002cd2d20 core: create qPrefDiveComputer from SettingsObjectWrapper
Update set/get functions to follow common name scheme:
- get function have same name as in struct diveComputer
- set function have set_<name>
- signal function have <name>_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-25 08:35:04 -07:00
jan Iversen
69c7ed676a core: add qPrefAnimations to SettingsObjectWrapper/qPref load
correct missng qPrefAnimations in global load functions

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
ead05c8e17 core: expand qPref macros to handle sub structure
Expand SET_, DISK_ and HANDLE_ macros with field for substructure

Structure prefs contains e.g. prefs.dive_computer.vendor an extra field
are added to the macros to allow this.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
92ade62260 core: remove LOADSYNC* macros
expend LOADSYNC* into DISK_* macros
remove LOADSYNC* from qPrefPrivate.h
update qPrefDisplay to not use LOADSYNC*

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
3eae683b57 core: make qPrefAnimations/CloudStorage getters static and inline
Add static and inline to getter in all qPref header files
Remove call to GET_PREFERENCE_* in qPrefDisplay.cpp
Remove GET_PREFERENCE_* from qPrefPrivate.h

static inline is slightly faster than a function call, but it saves
a lot of coding lines (no lines in qPref*.cpp). Getters are a direct
reference to struct preferences, so they will normally only be used
from QML.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
87d8963c78 core: make qPrefDisplay getters static and inline
Add static and inline to getter in all qPref header files
Remove call to GET_PREFERENCE_* in qPrefDisplay.cpp

static inline is slightly faster than a function call, but it saves
a lot of coding lines (no lines in qPref*.cpp). Getters are a direct
reference to struct preferences, so they will normally only be used
from QML.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
7f4123d0d1 core: isolate qPrefPrivate to qPref* classes
Make functions in qPrefPrivate private and add
qPref* as friends

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
f1648d297b core: qPref replace COPY_TXT with copy_txt in qPrefPrivate
Add copy_txt function to qPrefPrivate class
Remove macro COPY_TXT from qPrefPrivate.h
Replace use of COPY_TXT with copy_txt in qPref classes

copy_txt is only once, COPY_TXT was expanded approx. 160 times, so
this commit saves space (and removes a macro).

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00