aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
AgeCommit message (Collapse)Author
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>
2020-05-16cleanup: make overridden functions in model delegates privateGravatar Berthold Stoeger
There is no point in calling these functions directly, so we can just make them private. Morover, add override specifiers were they were missing and remove a pointless default parameter to the testActivation() function. It was not used anywhere. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-16cleanup: whitespace fixes in modeldelegates.[cpp|h]Gravatar Berthold Stoeger
We put the pointer and reference modifier to the variable, not the type. Some people don't like this, but 1) This is consistent with the rest of the code base. 2) This is how C and C++ parse, love it or hate it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-15core/bt: match DC descriptor in lower caseGravatar Dirk Hohndel
This fixes a rather subtle bug. In btdiscovery.cpp we are detecting dive computers based on their BT name and are setting up product+vendor as the key for that lookup. QMap always uses case sensitive comparisons and a tiny inconsistency snuck into our code. libdivecomputer names for the Aqualung dive computers i200C / i300C / i550C end in an upper case C (as matches the official branding), but in btdiscovery.cpp we have those names with lower case c. And therefore didn't recognize these dive computers. Obviously this is easy to fix by fixing those three strings, but I decided that it was silly to set ourselves up for similar oversights in the future. So instead I switched the matching of the descriptor to simply be allways all lower case. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-09add Berthold to the list of explicitly mentioned developersGravatar Dirk Hohndel
Number 3 overall committer with currently 9% of total commits and 27% of all commits in the last three years. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-08desktop: hide/unhide tags if dive site was editedGravatar Berthold Stoeger
The tags of the dive site were shown/hidden when changing the current dive. Thus the following could happen: 1) User changes to dive with no tags. Tags are hidden. 2) User add image, which creates GPS tag 3) Tag is updated but not shown. Fix this by showing/hiding tags when they are calculated not when switching the dive. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-07cleanup: free tab-widgets when exiting the applicationGravatar Berthold Stoeger
This is completely irrelevant, however out of principle, let's free the tab-widgets at the end of the application. To do so, use Qt's object hierarchy. I'm not a fan of this kind of memory management, but it is how it is. Moreover, remove the explicit constructor of MainTab, since it doesn't differ from the default constructor anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-07cleanup: remove clearing of displayed_dive in MainTab constructorGravatar Berthold Stoeger
Clearing displayed_dive here makes no sense for two reasons: 1) This is only called on startup, when displayed_dive is not yet initialized. 2) The tab-widgets don't use displayed_dive anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-07desktop: use current_dive to save subtitlesGravatar Berthold Stoeger
The old code used displayed_dive. However, virtually all the displayed data is now derived from current_dive. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-07desktop: use current_dive instead of displayed_dive on equipment tabGravatar Berthold Stoeger
Since the displayed data is extracted from current_dive it makes no sense to query displayed_dive for the dive mode. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-07desktop: update tab info only if current_dive is setGravatar Berthold Stoeger
If current_dive was not set, the code would clear the tabs right after updating the data. We might just as well set the data only if current_dive is set. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-07statistics tab: use current_dive to decide whether user is freedivingGravatar Berthold Stoeger
This used the displayed_dive object. However, we now use current_dive to designate the currently displayed dive. Thus, use this instead. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-07DiveComponentSelection: use current_dive instead of displayed_diveGravatar Berthold Stoeger
This should have been converted a long time ago. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>