aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2021-02-17desktop: fold ApplicationState into MainWindowGravatar Berthold Stoeger
The application state is a desktop-only thing. The mobile UI also has its application state, but that is something completely different. The last remaining user of the application state was to flag whether the planner is active. Since this has all been unglobalized, the ApplicationState structure can be moved from core to the desktop UI. And there it can be made local to the MainWindow class. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-17cleanup: remove setAppState from TestPlanGravatar Berthold Stoeger
This is not needed anymore, since the planner passes down the in_planner flag to the appropriate functions. The planner state is not queried via a global anymore. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-17planner: pass in_planner down to TemplateLayoutGravatar Berthold Stoeger
The TemplateLayout prints different dives depending on whether the planner is active. Instead of accessing a global variable, pass the status down from the MainWindow. That's all quite convoluted, since there are multiple layers involved. On the positive side, the in_planner() function has now no users an can be removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-17cleanup: remove unused includes in mainwindow.cppGravatar Berthold Stoeger
The printing code moved elsewhere, so these includes are not needed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-17planner: pass in_planner argument to replot()Gravatar Berthold Stoeger
To remove reliance on global state, pass an "in_planner" argument to AbstractProfilePolygonItem::replot(). Thus, calls to in_planner() can be removed. This is a bit sad, since the in_planner argument is now passed to numerous replot() reimplementations of classes derived from AbstractProfilePolygonItem. However, it is only needed for one, viz. DiveGasPressureItem. Well, perhaps in the future more features will depend on the planner mode... Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-17cleanup: remove function declarationGravatar Berthold Stoeger
AbstractProfilePolygonItem::shouldCalculateStuff()'s definition has been removed some time ago. Therefore, remove its declaration. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-17planner: pass in_planner argument to decoMode()Gravatar Berthold Stoeger
To remove reliance on global state, pass an "in_planner" argument to decoMode(). Thus, calls to in_planner() can be removed. This is a more-or-less automated change. Ultimately it would probably be better to pass the current deco-mode to the affected functions instead of calling decoMode() with an in_planner parameter. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-17planner: pass in_planner argument to clear_deco()Gravatar Berthold Stoeger
To remove reliance on global state, pass an "in_planner" argument to clear_deco(). Thus, calls to in_planner() can be removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-17planner: pass in_planner argument to vpmb_next_gradient()Gravatar Berthold Stoeger
To remove reliance on global state, pass an "in_planner" argument to vpmb_next_gradient(). Thus, calls to in_planner() can be removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-17planner: pass in_planner argument to add_segment()Gravatar Berthold Stoeger
To remove reliance on global state, pass an "in_planner" argument to add_segment(). Thus, calls to in_planner() can be removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-17planner: remove print_mode parameter from calculate_deco_information()Gravatar Berthold Stoeger
Only 'false' was ever passed as value. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-17Mobile user manual update: statisticsGravatar willemferguson
As the title says. This is a first pass because I cannot see what it looks like on the mobile device if it has not been pulled into master. I need to see what size the images have on the mobile screen and how the organisation of text above and below the images is rendered. There will definitely be a second PR to refine the content for the mobile screen and to ensure proper integration of the statistics section with the overall user manual.. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2021-02-17As last resort, use the site name as locationGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2021-02-17Use country for divelogs.de exportGravatar Miika Turkia
This will use only the country name for the location field in divelogs.de export. The old version concatenated all the fields together. This is inline with Rainer's new import functionality. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2021-02-13statistics: implement primitive "restrict to selection" featureGravatar Berthold Stoeger
Allow the user to restrict the analyzed dives based on the current selection. One button restricts to the current selection and one button resets the restriction. Thus, the user can for example select bars in the bar chart or a range in the scatter plot and perform statistics on these sets. The restriction works on top of the filter. The UI can certainly be improved, but it is a start. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13statistics: implement shift-selection of rangesGravatar Berthold Stoeger
For all the series but the scatter series (which supports lasso selection), implement a range-selection using shift. The code is fairly similar for all series and one might think about factoring it out. But why bother? Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13statistics: support ctrl-selection for all seriesGravatar Berthold Stoeger
Multiple selection using ctrl was only supported for scatter series. Factor out the corresponding code and use it in all series. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13statistics: make selection keyboard modifiers more generalGravatar Berthold Stoeger
Up to now, we passed a "shiftPressed" flag to the individual selection functions. To be more general replace by a struct with "shift" and "ctrl" flags. While doing this: 1) Move the struct into a new statsselection file for better encapsulation. 2) Change shift to control in the scatter series, since individual selection of items is usually done with control, not shift. Shift usually means "select range". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13statistics: highlight selected pie slicesGravatar Berthold Stoeger
In analogy to the other charts, highlight selected pie slices. Overlay them with a checkerboard pattern, like in the bar charts. Since all charts now support highlighting, the divesSelected() virtual function now doesn't need a default implementation anymore. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13statistics: highlight selected boxes in box plotGravatar Berthold Stoeger
In analogy to bar plots, highlight selected boxes in box plots. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13statistics: remove horizontal flag from bar chart itemsGravatar Berthold Stoeger
This flag existed for historical reasons: The base of bar items had no line and therefore the lines had to be draw differently for horizontal (base to the left) and vertical (base on the bottom) item. This did not work properly and therefore has been removed. Thus, the flag became pointless. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13statistics: highlight selected barGravatar Berthold Stoeger
When all items of a bar in a bar chart are selected, highlight them by overlaying with a checkerboard pattern. A gray checkerboard seems to work reasonably well, regardless of base color. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-02-13statistics: implement rectangle selection in scatter plotGravatar Berthold Stoeger
Allow the user to select regions of the scatter plot using a rectangular selection. When shift is pressed, do an incremental selection. Unfortunately, the list-selection code is so slow that this becomes unusable for a large number of selected dives. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13statistics: select multiple dives in scatter-plot by shift-clickingGravatar Berthold Stoeger
Somewhat improve selection mechanics in the scatter-plot by allowing additional selections with shift-clicking. When the dives under the mouse are already selected, then deselect them. This appears to be a rather common UI idiom in desktop applications. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13statistics: show selected dives in scatter plotGravatar Berthold Stoeger
As a visual feedback, show the selected dives in the scatter plot. React to application-wide selection changes. Currently, the dive list is deactivated while in statistics mode, but that may change. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13statistics: select dives from Scatter PlotGravatar Robert C. Helling
When clicking on items in a plot, select the corresponding dives. This can be useful for data validation. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13statistics: replot stats if dives added / removedGravatar Berthold Stoeger
It is crucial to replot the statistics when dives are added / removed, to avoid stale pointers. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13statistics: save dive list with quartilesGravatar Berthold Stoeger
To make box-and-whiskers charts selectable (select corresponding dives when clicking on box), save the dive list with the quartile data. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13statistics: use dive instead of count binsGravatar Berthold Stoeger
If we want to make bar charts selectable (when clicking on a bar select the dives the bar represents), then we must store the dives behind bars. Therefore, use dive-based bins instead of count based bins in bar charts and pie charts. This gave some churn because every structure where a count is stored has to be changed to store a vector of dives. Try to use move semantics where possible to avoid duplication of dive lists. On a positive note, the count_dives() function of the binners can now be removed, since it is unused. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13printing: "fix" progress indicatorGravatar Berthold Stoeger
In TemplateLayout, there was a progress indication, which reported the progress - not of the actual rendering - but of adding the dives to the "to render" list. Which is of course done in less than a ms, making the whole thing completely pointless. Instead, emit progress when actually looping over the dives or statistics. Nobody ever noticed the problem because even rendering is done in fractions of a second and indeed is accounted to only one fifth of the total progress. The real purpose of this "fix" is to get rid of the getTotalWork() function, which was just insane. Instead of asking the TemplateLayout how many dives it rendered, this number was extracted from global state. Simply store the number of dives in the TemplateLayout object instead. Moreover, fix two coding style issues: - "Page" variable identifier starting with a capital - The Printer::render() being defined (as opposed to declared) with a default parameter. This is not how C++'s default parameters work, sorry. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-12cleanup: remove dead code from ToolTipItem::addToolTip()Gravatar Berthold Stoeger
There was never an icon passed to this function. Therefore, remove the parameter and the code that depends on it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-12cleanup: make ToolTipItem::addToolTip() privateGravatar Berthold Stoeger
This was not called from anywhere else. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-12cleanup: whitespace fixes in profile-widget/divetooltipitem.cppGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-10desktop: disable animation when selecting multiple divesGravatar Berthold Stoeger
Selecting many dives when the animation was active was increadibly slow, so disable it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-10desktop: cache photo and geo iconsGravatar Berthold Stoeger
The icons shown in the dive list were rendered for every single access. Render them only once. This supposes that the defaultIconMetrics structure does not change once the icons are rendered! Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-09user manual: make the style more personalGravatar Dirk Hohndel
Style is always tricky. This is really complex material. This attempts to slightly personalize the language and make it less academic sounding, while not removing any of the attention to detail and actual content of this manual section. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-02-09user manual: fix typo in manual textGravatar Dirk Hohndel
This isn't about 'depth variables', but about continuous vs categorical variables. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-02-09user manual: introduce the two variables as 'base' and 'data'Gravatar Dirk Hohndel
Instead of adding these names later, use them right from the start. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-02-09user manual: get ready for 5.0Gravatar Dirk Hohndel
While version numbers are really rather random, we decided that with the new statistics feature we will change the version number to 5.0. Reflect that in the manual. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-02-08Subsurface Desktop user manual: Statistics panelGravatar willemferguson
Update the user manual to take into account the statistics tool. This is a first attempt. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2021-02-08statistics: fix placement of horizontal labels in bar chartsGravatar Berthold Stoeger
The subtraction of half the label width, needed for centered labels, must have been lost somewhere. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-06statistics: don't place labels at half-integer valuesGravatar Berthold Stoeger
Placing labels at half-integer values gives horrible rendering artifacts. Therefore, always round to integer values. The easiest way to do this is right before setting the position. Introduce a helper function to round QPointF in such scenarios. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-06desktop: improve splitter defaultsGravatar Berthold Stoeger
On first startup, use the splitter values suggested by Dirk: Top/Bottom: 60/40 Info/Profile: 50/50 List/Map: 60/40 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-06profile: detect dive-mode change in profileGravatar Berthold Stoeger
The profile must be replotted when the dive mode changes. Weirdly, this was routed via the dive-information tab (making it inherently non-mobile compatible). Detect such a change directly in the profile. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-06desktop: be smarter about filling splittersGravatar Berthold Stoeger
On state change, the splitters were completely emptied and refilled. Instead try to reuse already existing splitter slots. This reduces annoying flickering. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-06desktop: don't access profile directly to redraw itGravatar Berthold Stoeger
The MainWindow has a function to replot the profile. Use that instead of accessing the profile directly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-06desktop: do own memory management of quadrant widgetsGravatar Berthold Stoeger
The memory management of the quadrant widgets is a total mess: When setting the widget, the QSplitters take ownership, which means that they will delete the widget in their destructor. This is inherently incompatible with singletons, which must not be deleted. To avoid all these troubles, remove the widgets from the QSplitters in the desctructor of the MainWindow. This of course means that we now have to take care about deletion of the widgets. For local widgets use std::unique_ptr, for singletons use a static variable that is deleted on application exit. Sadly, for the map widget we can't use a normal singleton, because the QML MapWidget's memory management is buggy. Add a comment in the source code explaining this. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-06desktop: don't allow view change in plannerGravatar Berthold Stoeger
When in planner mode, don't allow the user to change the application state. This brought us nothing but troubles and inconsistencies. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-06desktop: remove the view-stateGravatar Berthold Stoeger
There was the "application state", which decided what to show in the "quadrants" and the "view state" which decided which quadrant to show. These interacted in a hard-to-grasp way. The "view state" is used to show the map or dive list in full screen. I simply couldn't get these two orthogonal states to interact properly. Moreover the thing was buggy: If a quadrant was hidden, the user could still show it, by dragging from the side of the window, at least under KDE. To solve these woes, merge the two states into a single application state. If the widget of a quadrant is set to null, don't show it. So the four "view states" are now "application states" where three of the four quadrants are not shown. This also changes the memory management of the widgets: widgets that are not shown are now removed from the QSplitter objects. This makes it possible that the same widget is shown in *different* quadrants. While writing this, I stumbled upon a Qt bug, which is known since 2014: https://forum.qt.io/topic/43176/qsplitter-sizes-return-0 When restoring the quadrant sizes there was a test whether the quadrant size is 0. If that was the case, a default size was set. This seems not to work if the widgets were recently added. Since this test now always fails, make the quadrants non-collapsible and thus guarantee that 0 is never saved as a size. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-06statistics: delete chart items when root node is deletedGravatar Berthold Stoeger
When reparenting the statistics widget, QtQuick deletes the rootNode and all the child nodes. It is unclear whether this is a bug or intended behavior. In any case, it means that the pointers to QSG nodes in the chart items become stale. To avoid this, delete all chart items in the root node's destructor, before QtQuick can do anything. It is unclear from which context this is called (render or UI) and whether this is even valid. In some tests, it seemed to work. The difficulty is that all the stale pointers to chart items have to be deleted as well. All in all, the QSG memory management is a big nuisance and very brittle. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>