aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
AgeCommit message (Collapse)Author
2020-04-07undo: switch SetpointDialog from divecomputer to dive + dc-numberGravatar Berthold Stoeger
Since pointers to divecomputers may not be stable, the undo commands take a dive + a divecomputer number. Update the SetpointDialog accordingly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: use pointer-to-member version of connect in SetpointDialogGravatar Berthold Stoeger
While touching this dialog, might as well change away from the MOC version of the connect() statements. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: un-singletonify SetpointDialogGravatar Berthold Stoeger
We have too many global objects. There is no reason why this dialog should be a persistent global object. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: remove DIVE EditMode in MainTabGravatar Berthold Stoeger
That mode is not used anymore, since only the editing of profiles of manually added dives enters editing mode. For that case we have the MANUALLY_ADDED_DIVE edit mode. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: remove parameter to MainTab::enableEditionGravatar Berthold Stoeger
All remaining callers were passing MANUALLY_ADDED_DIVE as a new mode, so we may just as well remove the parameter and thus simplify the logic. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07desktop: remove EDIT modeGravatar Berthold Stoeger
The only way to enter edit mode is to edit the profile. However, that means that the profile is already visible, so there is no need to change the mode. Simply remove the EDIT mode. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07desktop: move undo-disabling from enterEditState to disableShortcutsGravatar Berthold Stoeger
When entering the edit state, we don't want the user to be able to undo/redo lest things become inconsistent. Since the only way to enter edit state is to edit the profile, we can simply use the disableShortcuts() function that is used by the profile when it goes into edit state. This has one desirable side-effect: Undo is now also disabled in the planner. Undo during planning likewise can lead to inconsistent state. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo/cylinders: Implement editing of the typeGravatar Berthold Stoeger
This one is tricky, as when browsing through the types-combobox, the user is presented with presets without actually changing the dive. We do not want an undo-command for every change-event in the combo-box. Therefore, implement a scheme analoguous to the weight-editing: A temporary row can be set / committed or reset. Sadly, the code is more complex because we have to consider the planner, which is not included in the undo system. Firstly, the planner uses a different model, therefore all interactions are channeled through setData() with special roles. Secondly, in the planner we shouldn't place an undo command, but simply overwrite the dive. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: remove default-code for editCurrentDiveGravatar Berthold Stoeger
The profile can only be edited for manually added or planned dives. No point in keeping code for other kinds of dives. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07desktop: don't disable tabs in edit stateGravatar Berthold Stoeger
The edit state is now only used to edit the profile. There is no reason to disable random tabs. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: don't center map on rejecting editGravatar Berthold Stoeger
The editing of the dive site is controlled via an undo command. No point in centering the map when cancelling a profile-edit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: remove lastMode variable in MainTab::rejectChanges()Gravatar Berthold Stoeger
This stored the old editMode. However, it was not read after editMode was changed, so there is no point to it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07edit: remove multi-dive version of edit informationGravatar Berthold Stoeger
The "dive is currently" edited is only shown when the profile is edited. This affects only the current dive and therefore a message saying that multiple dives are edited makes no sense. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: remove strange recursive code in MainTab::enableEditionGravatar Berthold Stoeger
When enableEdition() was called with mode == NONE and the dive was a manually added dive, it would call into MainWindow:: editCurrentDive(), which would in turn call enableEdition(), however with another mode. Since the only caller of enableEdition() is now editCurrentDive() anyway, we can remove that weird code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: remove cylinders_equal check in MainTab::rejectChanges()Gravatar Berthold Stoeger
This check make no more sense since cylinder editing is now treated by undo commands. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: add cylinders via undoGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: remove TabDiveWidget::acceptChanges and rejectChangesGravatar Berthold Stoeger
Since cylinders are now edited using the undo system, these functions are not needed anymore. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: call removeCylinder undo command in equipment tabGravatar Berthold Stoeger
Instead of connecting to the remove() function of the model, call the removeCylinder undo command. Take care to translate the index into the source index, should cylinders be hidden! Apart from the map-to-source call, this copies the weightsystem code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07CylinderModel: make dive dynamicGravatar Berthold Stoeger
The CylinderModel always accessed the global "displayed_dive" and in some special cases also "current_dive". To implement cylinder undo, the model should work on an arbitrary dive. Therefore, in analogy to the weight model, make the dive dynamic. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-06delegate: don't add WSInfo entry in delegateGravatar Berthold Stoeger
The weightsystem info for new weightsystem types is added by the undo command. Remove this redundant code. Use the lookup only to determine the weight and the canonical name (i.e. use the capitalization according to the saved entry, in analogy to tanks). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-06delegates: don't use starts-with search to fetch cylinder/weight dataGravatar Berthold Stoeger
In the wightsystem-type and cylinder-type delegates, when entering data, when entering known weight- or cylinder-types, some ui fields (notably weight, size and working-pressure) are automatically filled out. The search was using the default flags provided by Qt: starts-with and case-insensitive. This had a few strange effects, when entering a string that is the beginning of a known string (e.g. "AL6" when "AL63" already exists): 1) The wrong data was used if the new string didn't exist. 2) For cylinders it was impossible to create new cylinder types whose name is the starting string of a different type. 3) For weights, the new type was not added to the list of known types. This, however, is no problem, because it will be added by the undo command anyway. A future commit will address that redundancy. Therefore use only the case-insensitive flag (which has to be performed by passing the MatchFixedString flag - very weird). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04cleanup: update all copyright dates to 2020Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-01cleanup: explicitly cast to int to silence a compiler warningGravatar Berthold Stoeger
In DivelogsDeWebServices::updateProgress() QProgressBar::setRange() and QProgressBar::setValue() were passed floats even though they expect ints. To silence a compiler warning, cast by hand. Use the lrint() function, since we generally do it this way. However, it is not clear whether this is necessary here. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-22Typo fix: Programm to programGravatar Johan Hansson
Signed-off-by: Johan Hansson <reply.johan@gmail.com>
2020-03-22cleanup: remove unnecessary <QDebug> includeGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-22cleanup: split uiLanguage() in two functionsGravatar Berthold Stoeger
The uiLanguage() function was used for two purposes: to initialize the language related preferences and to read the current language. To make things more easy to follow, split this function in two: one for initializing, one for getting the current language. Moreover, don't return the current locale in an out-parameter as there is already a function to do that [getLocale()]. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-20Dive filter: reset filter on change of display_invalid_dives flagGravatar Berthold Stoeger
The user had to restart the application or manually change the filter if they changed the flag. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-20Dive list: add option to mark dives validGravatar Berthold Stoeger
If the dive the user clicked on is invalid show an option to make the dive valid. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-20Undo: implement invalidate-dive commandGravatar Berthold Stoeger
Connect command to context menu. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-19Typo: UCT to UTCGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-03-18models: update divesite-model when clearing/updating dive modelGravatar Berthold Stoeger
When the dive list is cleared or updated, the entries in the divesite-model become stale and therefore the divesite-model (with the actual name LocationInformationModel) also must be updated. This was done manually in some parts of the code and forgotten in others. Therefore, do it directly in the clear() and reset() function of the dive list-model. This might be a bit of a layering violation: why should one model call into another if they are not in parent/child relationship? However, this seems easier than introducing a global "reset dives" function that coordinates the models. Moreover, it does not appear 100% safe: if the clearing of the divesite model causes accesses to the divelist-model, they happen in the midst of a model reset and we had horrible bugs with that kind of things. However, I don't think that should happen. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-12Make statistics window resizable on MacGravatar Robert C. Helling
For some reason, the window needs an active maximize button to be resizable on Mac. Fixes #2671 Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-03-11Grammar: replaces 'indexes' by 'indices'Gravatar Robert C. Helling
Grammar-nazi ran git grep -l 'indexes' | xargs sed -i '' -e 's/indexes/indices/g' to prevent future wincing when reading the source code. Unfortunatly, Qt itself is infected as in QModelIndexList QItemSelection::indexes() const Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-03-10mobile: unify download code on mobile and desktopGravatar Berthold Stoeger
Use the undo-command for importing dives also on mobile. This should make the whole disconnect-model shenigans unnecessary. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-10undo: clear undo-stack when clearing dive dataGravatar Berthold Stoeger
When the dive data is cleared, all pointers in the undo-stack become stale. Desktop explicitly called Command::clear() in that case, but mobile doesn't. Thus, move the clear() call into DiveTripModelBase::clear() Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-07debug: try to capture changes that don't invalidate git cacheGravatar Dirk Hohndel
At least in those cases where we are sending a divesChanged signal we can easily check if the cache was properly invalidated. Of course this won't help in cases where we don't notify the dive list about changes, either. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-06Cleanup: Move stringToList to core/qthelper.cppGravatar Berthold Stoeger
The same code was used in desktop and undo commands. Let's unify. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-06Cleanup: use getDiveSelection() for shifting timeGravatar Berthold Stoeger
There are two cases where dive-times are shifted: in an explicit dialog and when editing the date/time of a dive. In each of these cases, the selected dives were collected manually. Instead use the getDiveSelection() function. Since this returns a std::vector, change the argument of Command::ShiftTime() to such a std::vector. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-05desktop UI: fix typo in GPS import UIGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-01selection: update selection on key-pressesGravatar Berthold Stoeger
Commit 2cea115ddb7528d9e6dd1bf918ebf5c670b82479 "fixed" the selection by hooking into mouseRelease events. An unintended consequence was that scrolling with the cursor keys didn't update the current dive. Therefore, also hook into the corresponding key-press events. This is just horrible, but I'm not aware of any possibility to fix it properly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01filter: fix tab-order of filter widgetGravatar Berthold Stoeger
This was basically random. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01filter: on show focus on fulltext-fieldGravatar Berthold Stoeger
After pressing CTRL-F let the user immediately enter a search string. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01filter: connect fulltext filter to frontendGravatar Berthold Stoeger
There are now three filter modes: 1) Dive site 2) Fulltext 3) Normal When doing a fulltext search, get the dives that match the fulltext filter and then apply the other filters on that list. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01filter: add fulltext field to filter widgetGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01filter: move StringMode out of FilterDataGravatar Berthold Stoeger
The FilterData struct has the enum StringMode, which describes how strings are searched (substring, startswith, exact). To make it more generally accessible, remove it from the class. Since it is an "enum class", the values don't pollute the global namespace anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28cleanup: remove setTabIcon() calls in MainTabGravatar Berthold Stoeger
These were used to remove warning-icons to mark tabs with user changes. However these icons haven't been set since commit a86aca037843167b26726926dbf2aebe0513afba. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28crash fix: Don't cast to CylindersModel or CylindersModelFilteredGravatar Berthold Stoeger
The tank-info-delegate cast its model to CylindersModelFiltered, since this is what the equipment-tab uses since implementing the filtering of unused cylinders. However, the planner users the same delegate and still uses the unfiltered CylindersModel. This means that the (dynamic) cast returns a null pointer and crashes. One possibility would be to derive CylindersModelFiltered and CylindersModel from the same class that defines virtual functions and cast to that class. This is a different attempt: don't cast (i.e. stay with a QAbstractItemModel and play it via Qt's model-view system. Firstly, replace the passInData function by a role to setData(). Secondly, read the working-pressure and size via new columns using data(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-27cleanup: don't update tabs twice in MainTab::rejectChangesGravatar Berthold Stoeger
The updateDiveInfo() call updates all tabs. No need to do it right afterwards. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-27cleanup: remove weightsystems_equal functionGravatar Berthold Stoeger
This was used to test whether the "really discard changes?" message should be shown. However, we now edit weightsystems directly with undo commands. Therefore, the check is unnecessary and the whole function can be removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-27cleanup: remove MainTab::modifiedGravatar Berthold Stoeger
This field was not set to true since introducing undo of dive fields. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>