aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
AgeCommit message (Collapse)Author
2020-10-03planner: limit depth and time of segments to sane valuesGravatar Berthold Stoeger
Using non-sensical depth and times for segments in the planner may lead to an unresponsive UI. Therefore limit depth to 1000 m/3300 ft and time to 100 h. Limiting of depth is done in settingsChanged() since it has to adapt to the user changig their preferred units. Fixes #2762. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-03cleanup: use getDiveSelection() to loop over selected divesGravatar Berthold Stoeger
getDiveSelection() returns a vector of the selected dives. Use that instead of looping over the dive table and checking manually. This removes a few lines of code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-03desktop: allow moving dives to arbitrary tripsGravatar Berthold Stoeger
The UI only allowed adding dives to trips above or below the current dive (and even that is buggy). This is a strange restriction, since trips are designed to be non-contiguous. Allow adding dives to any trip using the new trip selection dialog. The undo-command is already there, so only little code to write. This feature was requested on the mailing list. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-03desktop: add trip selection dialogGravatar Berthold Stoeger
A simple dialog to select a trip. Simply fill a QListWidget without the model/view rigmarole. So much less painful! Of course that means that the dialog has to be regenerated everytime it is used. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-02desktop: fix paging through dive list with page-up key, etcGravatar Berthold Stoeger
In the dive list we have horrible code, which intercepts all events to save the selection before/after the event. This was necessary because we couldn't get Qt's selection data flow under control. This means intercepting all events that can change the selection. The page-up, page-down, home and end keys were forgotten. Add these cases. Fixes #2957. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29cleanup: rename FilterWidget2 to FilterWidgetGravatar Berthold Stoeger
The name "FilterWidget2" is historical and has no meaning anymore, since the current version has little to nothing to do with the "second" version of the widget. Rename the class and source files accordingly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: avoid unnecessary filter recalculations when loading setGravatar Berthold Stoeger
When loading a stored filter set, we would get numerous constraintChanged signals, which caused filter recalculations. Use the ignoreSignal flag to prevent these. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: add modified flagGravatar Berthold Stoeger
When editing the filter, the modified flag is set and shown to the user. After saving / loading / clearing the filter, the flag is reset. This simulates (probably badly) a usual load/save interface. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: show currently selected preset in a text fieldGravatar Berthold Stoeger
This provides some visual feedback on the currently selected preset. Update when changing selection or clearing the filter. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: when clearing the filter unselect the current filter presetGravatar Berthold Stoeger
It makes no sense to have the a filter preset selected after clearing the filter. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: when a filter preset is selected, suggest its name on saveGravatar Berthold Stoeger
The goal here is to let the user edit already existing sets and save them using their old name. This is a stop-gap measure until we get a proper filter-set editing interface. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: implement importing of filter presetsGravatar Berthold Stoeger
When importing a divelog, import filter presets. If there are equal names, import only if the presets differ. In that case, disambiguate the name. This made things a bit more complicated, as comparison of filter presets had to be implemented. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29cleanup: forward declare QHideEvent and QShowEventGravatar Berthold Stoeger
Don't include the respective header files in filterwidget2.h Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29cleanup: move shown-text calculation from filter widget to coreGravatar Berthold Stoeger
The filter widget was caching whether the filter was active and used that flag to calculate the "# dives shown" string. Move this directly to the DiveFilter class to remove interdependencies and to unify with mobile. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: add completer for save-filter-preset dialogGravatar Berthold Stoeger
Thus, the user can easily overwrite already existing settings. Not perfect, but the easy solution for now. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: load filter presets from XML filesGravatar Berthold Stoeger
This is a bit painful: since we don't want to modify the filter presets when the user imports (as opposed to opens) a log, we have to provide a table where the parser stores the presets. Calling the parser is getting quite unwieldy, since many tables are passed. We probably should introduce a structure representing a full log-book at one point, which collects all the things that are saved to the log. Apart from that, this is simply the counterpart to saving to XML. The interpretation of the string data is performed by core functions, not the parser itself to avoid code duplication with the git parser. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: add filter preset tableGravatar Berthold Stoeger
Add a table view that shows all presets and a button to delete old presets. When clicking on an item, load the preset. When the filter is reset, deselect any item. Change the preset-loading code: instead of simply loading the preset, select the preset in the table. Thus, it will be loaded implicitly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: connect load filter preset functionality to uiGravatar Berthold Stoeger
Add a button to the filter preset widget that allows the user to load a previously saved filter preset. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: create a primitive "create filter preset" dialogGravatar Berthold Stoeger
The dialog asks the user for a name and warns if the name already exists, i.e. an old filter preset will be overwritten. Possibly, this should contain an auto-completion facility in the case that the user wants to overwrite old presets. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: connect new filtercode to filterwidget2Gravatar Berthold Stoeger
Replace the static filterwidget with a list of filterconstraints. The first attempt of using a table widget failed, because Qt's table delegates are dysfunctional. It's not that they are bad, they just don't work at all. Therefore, this code "simulates" a table in that on addition / deletion of constraints it keeps track of the rows of all constraints so that each constraint-widget can be associated with a row of the constraint model. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: add a filter constraint widgetGravatar Berthold Stoeger
This add a widget that represents a single filter constraint. Since filter constraints are very general, the widget has to consider a number of cases: - numerical ranges - star-widget ranges - string lists - multiple choice lists Moreover, it supports units, which must be updated when the preferences change. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29cleanup: remove unnecessary includes in divelistview.cppGravatar Berthold Stoeger
Most of these became unnecessary when including media in the undo system. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-21translations: initialize water type strings at run timeGravatar Berthold Stoeger
The water type strings were static and therefore passed through gettextFromC::tr() before main(). One would hope to get a warning in such a case, but this is not the case. Therefore, use the QT_TRANSLATE_NOOP macro to register the strings in Qt's translation system and translate the list when needed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-13desktop: fix TableView for Qt 5.15Gravatar Dirk Hohndel
If we set the size on the QPushButton, the button no longer receives any input (tested on macOS). With this change we get an odd visual artifact when clicking on the 'add' button, but it least it works, so this is good enough for the next release. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-13Disable SAC factor setting for CCR divesGravatar Robert C. Helling
The SAC factor is only used for minimal gas calculations which don't make sense in the CCR context. Additionally, make bailout stop for at least minimum switch time or problem solving time. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-09-12cleanup: remove empty files in desktop-widgets/statisticsGravatar Berthold Stoeger
This functionality never came to be and there are fundamentally different plans floating around. Therefore, remove these empty files. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-10desktop: make completion of equipment types substring searchGravatar Berthold Stoeger
User request: when entering a cylinder type, do a substring search. For example, when entering "100" also find "AL100". Currently, a starts-with search was used. This is simply done by setting the "filterMode" of the ComboBoxDelegate to "Qt::MatchContains". Suggested-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-08cleanup: when planning a dive, set dive computer to first dcGravatar Berthold Stoeger
When planning a dive, dc_number was set to 1, which actually is the second dc! The code seems to handle this gracefully, however it appears weird. Let's set dc_number to 0 instead. Originally, the assignment was introduced in a422957cd6525b9753 and moved later in 4f5621c4c6acc3a. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-06cleanup: use taxonomy_get_value() instead of taxonomy_get_index()Gravatar Berthold Stoeger
Instead of getting the index and using that to access values, use the taxonomy_get_value() helper function. Two places are affected: 1) reverse geo-lookup 2) location filter delegate The behavior of reverse geo-lookup is changed slightly: now an empty string is likewise recognized as missing "TC_ADMIN_L3". Before, only a missing category was interpreted as such. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-05[Bug #2934] Geo Lookup - support for remote dive sitesGravatar Michael Werle
Some remote dive sites have no populated places (towns, cities) nearby. For such sites, we now fall back to looking up unpopulated place names, such as the reef or island name. Also some code refactorisation: the actual network access is now encapsulated in its own function removing some duplicated code handling in the reverseGeoLookup function and making it more readable. Furthermore, reverseGeoLookup() was completely refactored as most of its functionality was due to legacy requirements; the current code-base only calls this function from a single location and only with an empty taxonomy_data object. This makes the function more focussed and much simpler and more readable. Finally, a resource leak in reverseGeocde introduced in 4f3b26f9b6296273e37ec317bc68f32f94f546dc was fixed. Signed-off-by: Michael Werle <micha@michaelwerle.com>
2020-09-03Increase event icon size in print modeGravatar Robert C. Helling
When plotting the profile in higher resolution for export, increase the icon size in the same way. This is commented out for the mobile version as that uses printMode for profile display. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-03Improve resolution of profile exportGravatar Robert C. Helling
The way we export the profile image (as direct export but also used for printing) is that we render the profile from the screen to a Pixmap and save that to a file. Unfortunately this results in very bad resultion and a blurred image. This is an attempt to improve that situation but it's still far from perfect: Rather than a QPixmap and grab, I now use a QImage (where I can set the size) and render, and indeed the picture resolution (when vied at fixed size) get's better this way. The disadvantage is that icons get smaller at the same rate und so there is a natural limit on how big we can get. Maybe somebody with better Qt knowledge can take off from here. In my opinion this is already a step in the right direction. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-03Set printer resolutionGravatar Robert C. Helling
You need a better resolution to plot a picture with high resolution... Connection done with a lambda expression thanks to @dirkhh. Signed-off-by: Robert C. Helling <helling@atdotde.de> (+1 squashed commit) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-03[Bug #2930] Fix crash bug in LocationInformationWidgetGravatar Michael Werle
If a user exits the LocationInformationWidget (Edit Dive Site) while a reverseGeocode lookup is in progress, the object's diveSite variable is set to null. When the reverseGeocode lookup completes, this variable is dereferenced causing an application crash. Signed-off-by: Michael Werle <micha@michaelwerle.com>
2020-09-02Planner: Properly initialize salinityGravatar Robert C. Helling
When the dive has no explicity salinity, our conversion between pressure and depth assumed salt water. Make this explicity by using the corresponding macro. When the planner starts and no salinity is set explicity, set the water type chooser to salt water to reflect our default assumption. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-08-24cleanup: fix compiler warningGravatar Robert C. Helling
... at least for llvm. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-08-22core/BLE: don't insist on pairing of pure BLE devicesGravatar Dirk Hohndel
Most (all?) BLE dive computers actually don't need to be paired, and some apparently can't be paired. So let's not enforce that. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-13Fix includes for building against Qt-5.15Gravatar Gaetan Bisson
Signed-off-by: Gaetan Bisson <bisson@archlinux.org>
2020-05-27cleanup: remove QCalendarWidget forward declaration and includeGravatar Berthold Stoeger
This is an artifact of code that never came to be. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-27cleanup: unglobalize grayImage()Gravatar Berthold Stoeger
This function was globalized in be462ae1a6 to be used for the calender widget, but that never came to be. Therefore, for now unglobalize it until it is needed. That said, there probably is a helper function to turn pictures into gray-scale. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-27cleanup: un-singletonize ShiftTimesDialogGravatar Berthold Stoeger
There is no reason that this dialog is a singleton. Since it is modal, it can be created on demand. Apart from removing superfluous global state, this simplifies code, because preparing the widget can now be done in the constructor instead of overriding the showEvent() function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-27cleanup: un-singletonize RenumberDialogGravatar Berthold Stoeger
There is no reason that this dialog is a singleton. Since it is modal, it can be created on demand. This simplifies code, because the mode (selected-only or all-dives) can be set in the constructor. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-25cleanup: whitespace fixes in TabDiveInformationGravatar Berthold Stoeger
Use C-style function definitions (squirly brackets on new lines) and remove empty lines at end of file. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-25desktop: localize salinity valueGravatar Berthold Stoeger
The salinity value was not displayed with localized thousands separators. E.g. to a user of a German locale the density read as slightly over 1 g/l, when it should be approximately 1000 g/l. For consistency, also localize that value. Also localize the CNS and OTU numbers, even though these should (hopefully!) never come with thousands separators. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-22cleanup: create common QDateTime -> timestamp conversion functionGravatar Berthold Stoeger
In analogy to the timestamp -> QDateTime conversion, create a common function. 1) For symmetry with the opposite conversion. 2) To remove numerous inconsistencies. 3) To remove use of the deprecated QDateTime::toTime_t() function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-22cleanup: move timestampToDateTime() to qthelper.cppGravatar Berthold Stoeger
Move this function from maintab.cpp to qthelper.cpp. Since the functionality was used in numerous places, use the helper function there as well. This removes a number of inconsistencies. For example, sometime setTimeSpec(Qt::UTC) was called, even though the QDateTime object was already created with that time spec. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-22desktop: update date and time fields if user changes formatGravatar Berthold Stoeger
This was more painful than expected, because we get the "preferences" changed signal too early when the user switches to system format. The correct format is set by the preferences-widget, not the preferences subsystem. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-22desktop: refresh date/time format when switching to system defaultsGravatar Berthold Stoeger
When switching to system defaults, refresh the fields in the preferences UI so that the user can tell how the fields will be formatted. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-16desktop: don't call plotDive with doClearPictures = trueGravatar Berthold Stoeger
This was an old "optimization" to avoid double plotting of the pictures, first by the profile itself, then by the picture tab. Since the profile now updates the pictures itself, this must be removed: The picture tab doesn't do it anymore. Fixes #2833 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-16cleanup: use pointer-to-member style connect for ComboBoxDelegateGravatar Berthold Stoeger
This was still using the archaic macro version, because Qt decided to parameter-overload the signals (which turned out to be a horrible idea). However, since we switched to fairly recent Qt this can be solved using the qOverload template. In this case things are a bit more complicated because we overload the corresponding slots. Since we have control over that, let's just disambiguate their names instead of using the cryptic qOverload. While doing this, tighten the access specifiers of the slots. Turn public into private and protected as appropriate. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>