Commit graph

1426 commits

Author SHA1 Message Date
jan Iversen
d4a2c5cdee plannerShared: replace notes variables to plannerShared
Replace
    display_runtime
    display_duration
    display_transitions
    verbatim_plan
    display_variations

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 09:59:26 -08:00
jan Iversen
c976385aed desktop-widgets: replace variables to plannerShared
Use plannerShared setter to update the variables in qPref.
This will also signal the cylindermodel to calculate a new bestmix.

variables:
   bottompo2
   decopo2
   bestmixend

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 09:58:47 -08:00
jan Iversen
738ee360ba desktop-widgets: replace o2narcotic from plannerModel to plannerShared
Use plannerShared setter to update o2narcotic. This will also signal
the cylindermodel to calculate a new bestmix.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 09:58:21 -08:00
jan Iversen
413501bc61 desktop-widgets: replace variables from plannerModel to plannerShared
variables
bottomsac
decosac
problemsolvingtime
sacfactor
are not set in diveplanner.cpp, but instead
signals a slot in plannerModel.

change signals to slots in plannerShared

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 08:45:40 -08:00
jan Iversen
53958a50c6 desktop-widgets: replace var plannerModel -> plannerShared converted
variables
min_switch_duration
are not set in diveplanner.cpp, but instead
signals a slot in plannerModel.
and are read from plannerShared which includes a conversion

change signals to slots in plannerShared
change read from prefs. to plannerShared

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 08:40:08 -08:00
jan Iversen
316e56f4f7 desktop-widgets: replace vars. qPrefDivePlanner -> plannerShared
change local doo2breaks to plannerShared and update connect.

change signals to slots in plannerShared

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 08:39:49 -08:00
jan Iversen
5063431263 desktop-widgets: replace variables from plannerModel to plannerShared
variables
drop_stone_mode,
last_stop,
switch_at_req_stop
are not set in diveplanner.cpp, but instead
signals a slot in plannerModel.

change signals to slots in plannerShared

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 08:39:30 -08:00
jan Iversen
df6f01a6f6 desktop-widgets: replace vars. qPrefDivePlanner -> plannerShared
change local setBailout to plannerShared and update connect.

change signals to slots in plannerShared

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 08:39:05 -08:00
jan Iversen
87f680f5e7 desktop-widgets: replace variables from plannerModel to plannerShared
planner_deco_mode is not set in diveplanner.cpp, but instead
signals a slot in plannerModel.

reserve_gas is not set in diveplanner.cpp, but instead
signals a slot in plannerModel.

change signals to slots in plannerShared

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 08:38:51 -08:00
willemferguson
6212bb6721 Preferences UI: final cleanup
This commit does some final cleaning up to the code, mostly deleting
white space and comments.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-25 02:57:42 +09:00
willemferguson
75b5be8f40 Preferences UI: add reset tab
Add a separate preferences tab for resetting all preferences to their default values.
One or two very small alterations to other sections of the preferences UI code.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-25 02:57:42 +09:00
willemferguson
b6c3cdb20c Preferences UI: add dive log tab
This adds a tab for dive log - related preferences.
A suitable test programs is still required.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-25 02:57:42 +09:00
willemferguson
b24caa4e2d Preferenced UI: add dive download tab
Add a preferences tab for dive download, allowing resetting the
buttons representing download connections in the Download panel.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-25 02:57:42 +09:00
willemferguson
2ac279d129 Pereferences UI: add media tab
Remove the preference settings dealing with thumbnails (currently under
General preferences and Profile preferences) and put them in a newly-created
Media preference tab.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-25 02:57:42 +09:00
willemferguson
3e853e37a5 Preferences UI: create new equipment tab
Remove the "Show unused cylinders" checkbox (Profile tab) and the
"Set default cylinder" qTextEdit box (General tab) and put them in a
separate and new Equipment tab. This sounds like a simple task but,
as can be seen from the files changed, was actually a complex matter.
Adapt the existing test programs (General and TechDetails) for creating
a test program that tests parts of the Equipment tab.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-25 02:57:42 +09:00
willemferguson
c121afc96c Preferences UI: split network preferences
Split the Network Preferences page into two screens:
1) Network preferences
2) Cloud storage preferences
Enable storing these preferences locally.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-25 02:57:42 +09:00
jan Iversen
7751ec1c78 build-system: move plannerShared to backend-shared
WARNING: multi directory commit, needed to secure it builds.

move the core/plannerShared.* to backend-shared.

update CMakeLists.txt to include backend-shared lib in link process.

update ios project to reflect new directory

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-24 08:44:23 +09:00
jan Iversen
9c52aaf043 build-system: move exportfuncs to backend-shared
WARNING: multi directory commit, needed to secure it builds.

move the core/exportfuncs.* to backend-shared.

update backend-shared/CMakeLists.txt to generate backend-shared lib

update CMakeLists.txt to include backend-shared lib in link process.

update ios project to reflect new directory

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-24 08:44:23 +09:00
jan Iversen
080def7729 diveplanner: desktop, remove no longer used slots
Remove PlannerSettingsWidget slots, that are directed to plannerShared

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-24 06:30:57 +09:00
jan Iversen
fb5a67e16a diveplanner: desktop, connect signals direct to plannerShared
Connect the signals for ascent/descent directly to plannerShared

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-24 06:30:57 +09:00
jan Iversen
dc713000ff desktop-widgets: use share meter/feet funcs. in diveplanner
change the settings variables using UNIT_FACTOR to use
plannerShared instead.

There are no changed functionality, it is simply removing calculations
from the UI.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-24 06:30:57 +09:00
jan Iversen
a17cb6b681 build-system: clean desktop-widgets CMakeLists.txt
The CMakeLists.txt referenced mapwidget which is in another root
directory (and also a seperate library)

Remove mapwidget reference from CMakeLists.txt

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-24 06:18:36 +09:00
jan Iversen
6ccea3c39d desktop-widgets: divelogsDE: integrate shared backend
Use doUpload() from uploadDiveLogsDE

Connect signals from uploadDiveLogsDE to do UI part.

Clean slots to only contain UI.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11 12:36:43 -05:00
jan Iversen
9fd95c18bd desktop-widgets: divelogsDE: delay handling until user select upload
Do not prepare zip file, just because user selected the divelogs.de
radiobutton

Move prepareDives to startUpload (slot handling user clicking on
upload button).

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11 12:36:43 -05:00
jan Iversen
8becc29ca8 desktop-widgets: split UI and network in DivelogsDeWebServices (prepare)
Clean prepareDivesForUpload() and uploadDives() so that
uploadDives() only contain network handling no UI.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11 12:36:43 -05:00
jan Iversen
2f680c1f76 desktop-widgets: use qPrefCloudStorage instead of QSettings
Use qPrefCloudStorage for divelogde_user/password to secure same
handling as other settings, as well as same handling as used in
shared uploadDiveLogsDE class

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11 12:36:43 -05:00
jan Iversen
fba3e5115a desktop-widgets: remove code under RM_OBSOLETE_CODE ifdef
history, and it is disturbing in "diff".

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11 12:36:43 -05:00
jan Iversen
4ee7cb7d1d desktop-widgets: use uploadDiveLogsDE::prepareDives
Remove local implementation (prepare_dives_for_divelog) and call
uploadDiveLogsDE::prepareDives, which are shared between
mobile and desktop

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11 12:36:43 -05:00
jan Iversen
91e0ee9d9b desktop-widgets: diveDiveShareExportDialog add signal handling
connect signals from uploadDiveShare and remove reply variable

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11 11:08:51 -05:00
jan Iversen
e5f3e927a7 desktop-widgets: use shared uploadDiveShare for diveshare.
Remove shared code from DiveShareExportDialog::doUpload()
and add call to uploadDiveShare::doUpload()

Remark signal handling is not implemented.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11 11:08:51 -05:00
jan Iversen
bba9385d76 desktop-widgets: use qPrefCloudStorage for diveshare.
Diveshare upload in mobile is using qPrefCloudStorage, so change
diveshareexportdialog as well, to keep consistency.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11 11:08:51 -05:00
Berthold Stoeger
0f417a3bc1 Dive list: access header via filter-model
The dive list accesses the filter model, therefore it makes sense
to also get the header data from there, even if they are only
forwarded from the source model.

This makes control flow more logical and will allow us to remove
the global DiveTripModel instance.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-10 18:45:30 -08:00
Berthold Stoeger
e7dafe36aa Dive list: clear dive data via the filter model
The UI talks to the filter model. Therefore route clearing of
data through that model instead of accessing the source model
directly.

This will allow us to remove the DiveTripModel::instance()
function and makes control flow less "jumpy".

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-10 18:45:30 -08:00
Berthold Stoeger
71307bce42 Dive list: don't handle selection changes on filter-change in view
The selection changes upon completing the filter are handled by
the core. Don't do this explicitly in the DiveListView.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-10 18:45:30 -08:00
Berthold Stoeger
a4c95fd8e8 Cleanup: remove WeightModel::changed
Since changes to the weight model are not modal anymore, nobody
queries the changed-flag. Remove it.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-05 10:14:25 -08:00
Berthold Stoeger
72c6b83866 Undo: make weight editing undoable
Implement the EditWeight undo command. Since there is common code
(storage of the old weight), this creates a common base class for
RemoveWeight and EditWeight. The model calls directly into the undo
command, which is somewhat unfortunate as it feels like a layering
violation. It's the easy thing to do for now.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-05 10:14:25 -08:00
Berthold Stoeger
029c9ccf02 Desktop: refactor WSInfoDelegate logic
The WSInfoDelegate (weight-system-info delegate) is used to display
a combo box of known weightsystem-types and auto-fills the weight if
the weightsystem-type is changed.

This would overwrite the weight data of the displayed dive when the
user hovers over the different entries. Moreover, it saves the original
weight in case the user cancels the editing action.

This is not viable when implementing undo of weightsystem changes,
because hovering over entries should not produce individual undo
commands. Instead, implement a special "temporary" row in the
weightsystem model. On canceling of the edit actions, simply reload
the weightsystem from the unmodified dive.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-05 10:14:25 -08:00
Berthold Stoeger
2cfb35b6d7 Cleanup: return value type from WeightModel::weightSystemAt()
There is only one caller of WeightModel::weightSystemAt() and that
certainly does not need a pointer into the weightsystem-table of
the current dive. Return a value type instead of a pointer.

This allows us to mark WeightModel::weightSystemAt() as const and
use it from WeightModel::data(). Slightly cleaner code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-05 10:14:25 -08:00
Berthold Stoeger
b3f530bfb9 Undo: make weight-deletion an undoable action
This one is a bit more complicated than weight adding, because the
multiple-dive case is not well defined. If multiple dives are selected,
this implementation will search for weights that are identical to the
weight deleted in the currently shown dive. The position of the weight
in the list is ignored.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-05 10:14:25 -08:00
Berthold Stoeger
b3253304a5 Desktop: don't connect to remove() slot of model from TableModel
When connecting a model to the TableModel class, it would connect
clicking on an item to the remove() slot of the model.

This breaks the program flow implied by the undo code:
Ui --> Undo-Command --> Model --> UI

Moreover, the naming of the remove() slot is illogical, because
clicks can also have different effects, as for example in the
cylinder-table.

Therefore, move the connect() call from TableModel to the
callers. In the case of TabDiveSite, move the remove() function
from the model to the TabWidget, where it makes more sense.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-05 10:14:25 -08:00
Berthold Stoeger
147a36647c Undo: make adding of weights an undoable action
Introduce an AddWeight undo command. This is modelled after the
numerous dive-edit undo commands. The redo and undo actions are
connected to the WeightModel via two new signals, weightAdded
and weightRemoved.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-05 10:14:25 -08:00
Berthold Stoeger
76a5a38f5e Cleanup: remove displayed_dive from WeightModel
The WeightModel always acted on the displayed dive. To support undo
of weightsystem changes, operate on an arbitrary dive. This is
in line with other models, where the updateDive() function resets
the model to represent a certain dive.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-05 10:14:25 -08:00
Berthold Stoeger
fb0bb33d82 Cleanup: remove DiveListView::dontEmitDiveChangedSignal member
Should have been removed in 4928c4ae04.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04 13:00:23 +01:00
Berthold Stoeger
28e97e7555 Cleanup: remove DiveListView::expandedRows member variable
The QList served as backing store for backupExpandedRows()
and restoreExpandedRows(). However, these always came in
pairs in the same scope. There is no reason to store the
expanded rows over a longer time.

Therefore, return the expanded rows from backupExpandedRows()
and take them as argument in restoreExpandedRows(). Morover
replace the QList<int> by the much lighter std::vector<int>.
We certainly don't need copy-on-write, reference-counting and
immutability of iterators in this case.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04 13:00:23 +01:00
Berthold Stoeger
be26b0bd9a Cleanup: remove DiveListView::mouseClickSelection member variable
That hasn't been used since 2013 (9cc04c1ca6).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04 13:00:23 +01:00
Berthold Stoeger
75dac8906e Cleanup: remove toggle parameter from DiveListView::selectDive()
This defaulted to false and no caller used anything different.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04 13:00:23 +01:00
Berthold Stoeger
364a8270d1 Cleanup: remove DiveListView::remember/restoreSelection()
Calls of these functions were removed in the previous commits.
Now, remove the functions themselves.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04 13:00:23 +01:00
Berthold Stoeger
a83bc5ecdb Selection: don't reset selection when resorting
The old code saved, cleared and restored the selection. This
is not necessary anymore, because on model reset the selection,
which is stored in the core, is reset. Remove the unnecessary
selection handling.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04 13:00:23 +01:00
Berthold Stoeger
55ffd5d1b5 Cleanup: remove unnecessary remember/restoreSelection() pair
When accepting changes, the main tab refreshes the display in
a remember/restoreSelection() pair. Since the display refresh
doesn't lose selection, these calls can be removed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04 13:00:23 +01:00
Berthold Stoeger
bddca1ecc9 Cleanup: remove unpaired rememberSelection() call
The old renumbering-dives code had to remember and restore the
selection. This became unnecessary with the undo-code. The
restore-call was removed, the remember-call left in. Remove it
as well.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04 13:00:23 +01:00