aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
AgeCommit message (Collapse)Author
2019-12-11desktop-widgets: divelogsDE: integrate shared backendGravatar jan Iversen
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-11desktop-widgets: divelogsDE: delay handling until user select uploadGravatar jan Iversen
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-11desktop-widgets: split UI and network in DivelogsDeWebServices (prepare)Gravatar jan Iversen
Clean prepareDivesForUpload() and uploadDives() so that uploadDives() only contain network handling no UI. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11desktop-widgets: use qPrefCloudStorage instead of QSettingsGravatar jan Iversen
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-11desktop-widgets: remove code under RM_OBSOLETE_CODE ifdefGravatar jan Iversen
history, and it is disturbing in "diff". Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11desktop-widgets: use uploadDiveLogsDE::prepareDivesGravatar jan Iversen
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-11desktop-widgets: diveDiveShareExportDialog add signal handlingGravatar jan Iversen
connect signals from uploadDiveShare and remove reply variable Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11desktop-widgets: use shared uploadDiveShare for diveshare.Gravatar jan Iversen
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-11desktop-widgets: use qPrefCloudStorage for diveshare.Gravatar jan Iversen
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-10Dive list: access header via filter-modelGravatar Berthold Stoeger
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-10Dive list: clear dive data via the filter modelGravatar Berthold Stoeger
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-10Dive list: don't handle selection changes on filter-change in viewGravatar Berthold Stoeger
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-05Cleanup: remove WeightModel::changedGravatar Berthold Stoeger
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-05Undo: make weight editing undoableGravatar Berthold Stoeger
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-05Desktop: refactor WSInfoDelegate logicGravatar Berthold Stoeger
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-05Cleanup: return value type from WeightModel::weightSystemAt()Gravatar Berthold Stoeger
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-05Undo: make weight-deletion an undoable actionGravatar Berthold Stoeger
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-05Desktop: don't connect to remove() slot of model from TableModelGravatar Berthold Stoeger
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-05Undo: make adding of weights an undoable actionGravatar Berthold Stoeger
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-05Cleanup: remove displayed_dive from WeightModelGravatar Berthold Stoeger
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-04Cleanup: remove DiveListView::dontEmitDiveChangedSignal memberGravatar Berthold Stoeger
Should have been removed in 4928c4ae04. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04Cleanup: remove DiveListView::expandedRows member variableGravatar Berthold Stoeger
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-04Cleanup: remove DiveListView::mouseClickSelection member variableGravatar Berthold Stoeger
That hasn't been used since 2013 (9cc04c1ca6). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04Cleanup: remove toggle parameter from DiveListView::selectDive()Gravatar Berthold Stoeger
This defaulted to false and no caller used anything different. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04Cleanup: remove DiveListView::remember/restoreSelection()Gravatar Berthold Stoeger
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-04Selection: don't reset selection when resortingGravatar Berthold Stoeger
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-04Cleanup: remove unnecessary remember/restoreSelection() pairGravatar Berthold Stoeger
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-04Cleanup: remove unpaired rememberSelection() callGravatar Berthold Stoeger
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-04Selection: move translation of indexes to filter modelGravatar Berthold Stoeger
The DiveListView caught signals from the DiveTripModel with the corresponding indexes. However, the DiveListView is actually connected to the MultiFilterSortModel and thus has to translate the indexes. Instead, catch the signals in the MultiFilterSortModel, transform them and resend. Let the DiveListView get its signal from the MultiFilterSortModel. Yes, this makes things less efficient because there is an extra signal. On the upside, the makes data-flow much more logical. Selection will have to be fixed anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04Selection: move initialization of selection from view to modelGravatar Berthold Stoeger
The goal here is to unify desktop and mobile by moving selection code from the desktop-only view. Currently, initialization of the selection still has to be called from the view after connecting the appropriate signals. This is due to the weird way in which create completely new models when resetting them. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04Selection: move selection of "first" dive to coreGravatar Berthold Stoeger
The DiveListView has a function to select the first dive. Move this to the core to be able to call it from all parts (not only desktop) of the code. Currently, this has a (small?) UI regression: when filtering dives and no selected dive is visible anymore, the old code would select the first dive in the list. The new code selects the newest dive, which might not be the first if some sort-criterion is active. To revert to the old behavior, it will be necessary to move the sorting function likewise to the core. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04Cleanup: rename newCurrentDive signal to currentDiveChangedGravatar Berthold Stoeger
This is more consistent with the rest of the signals. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04Cleanup: use quotation marks for non-system includesGravatar Berthold Stoeger
That's the idiomatic way of doing things. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04Selection: move selection functions from divelist.c to selection.cGravatar Berthold Stoeger
Since we now have a selection.c translation unit, put the selection- related functions there. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04Cleanup: Fix order of initialization in MainTab::MainTab()Gravatar Berthold Stoeger
For deterministic construction/destruction (i.e. objects are destructed in reverse order of construction) it is crucial that constructor initializer lists follow the order of the class definition. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-03desktop-widgets: move export functions to shared classGravatar jan Iversen
Remove export functions from desktop-widgets and move to core in order to share with mobile version Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-03Undo: make profile-editing undoableGravatar Berthold Stoeger
Recently, undo of dive-replanning was introduced. Therefore, it appears logical to do the same thing for editing of the profile of manually added dives. For now, use the same undo-command, just change the displayed text from "replan dive" to "edit profile". Move the fixup dive call into the undo-command. Eventually, every action on the profile should be made undoable. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-03Desktop: add additional star widgets to Information tabGravatar willemferguson
Connect the UI to the underlying dive structure. Enable proper initialisation and management of star widgets while Information tab is active. Enable undo for the addtional star widgets. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-03Desktop: enable additional environmental star widgetsGravatar willemferguson
Implement the UI features related to the additonal star widgets. Create the additonal star widgets and connect them to the preferences settings. By default only the current and visibility widgets are shown. In this case the current widget is on the left hand side of the tab. If the additional widgets are enabled the horizontal order of the widegts are changed to reflect attributes roughly from the start of the dive on the left to those towards the end of the dive on the right. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-03Desktop: handle environmental states in Information tabGravatar willemferguson
Create a preference setting on the General Settings page. The setting is saved with the other preferences. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-28Desktop: Improve speed of selecting multiple (or all) divesGravatar Berthold Stoeger
When selecting all dives via CTRL-A or manually and the trips were not expanded, the QSelectionModel sends a single selectionChanged signal per trip. We are reloading the map in every call, making this very slow. I couldn't figure out how to make QSelectionModel behave more nicely, therefore I chose the nuclear option: Remove the map reloading from selectionChanged() and hook into all functions that do selection changes. In these functions, first call the original code and then do the selection-changed operations. This will certainly need some tuning. Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-27Bugfix: inconsistent groupbox sizes in Iformation tabGravatar willemferguson
This is a bugfix for an error that slipped through. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2019-11-19Cleanup: remove MainWindow::recreateDiveList() functionGravatar Berthold Stoeger
The function had only one line and had only one caller. We might just as well fold that line into the caller. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-19Desktop: don't reload dive list model after clearing the modelGravatar Berthold Stoeger
By clearing the model, its contents are removed. There is no point in reloading the model. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-19Cleanup: remove ProfileWidget2::refreshDisplay signalGravatar Berthold Stoeger
It was not used anywhere. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-19Filter: don't reload filter after reloading dive listGravatar Berthold Stoeger
The hidden_by_filter items are set on reload of the dive list. No point in reloading the filter again. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-19Filter: move recalculation of filter from FilterModel to TripModelGravatar Berthold Stoeger
The way this was accessed via Qt's model semantics was horrible. This gives arguably more readable code, since we don't have to shoehorn things through QVariants. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-19Filter: split out filter from modelGravatar Berthold Stoeger
Split out the actual filtering from the MultiFilterSortModel. Create a DiveFilter class that does the actual filtering. Currently, mobile and desktop have their own version of this class, though ultimately we may want to merge them. The idea here is that the trip-model and undo-commands have direct access to the filter-function and thus can take care of keeping track of the number of shown dives, etc. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-19Filter: move calculation of shown dives to undo commandGravatar Berthold Stoeger
The filter-model was catching dives-added / dives-deleted signals from the models to keep track of the number of shown dives. To simplify the data flow, do this directly in the undo-command. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-19Filter: move number of shown dives to coreGravatar Berthold Stoeger
We mark hidden/shown dives in the core but store the number of shown dives in the MultiFilterSortModel. Move this datum to the core for improved locality. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>