aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
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>
2021-01-28core/BT: fix duplicate entries in BT detectionGravatar Dirk Hohndel
Somehow three identical lines snuck into commit 0a4e37ee8b ("core/BT: simplify detection of bluetooth names"). Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-26downloader: don't leak device nameGravatar Berthold Stoeger
For Uemis there was string-manipulation that leaked the temporary string. Use QString instead in order not to have to bother about such things. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-26downloader: don't leak DiveImportedModelGravatar Berthold Stoeger
Not that it matters, but there seems to be no reason to allocate DiveImportedModel on the heap and no reason to leak it after the download has finished. Removes a artifactuous comment and fixes a typo. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-26downloader: copy logfile nameGravatar Berthold Stoeger
At some places, this string is free()d, so it must not be assigned a constant string. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-26downloader: remove unnecessary includesGravatar Berthold Stoeger
Including <QObject> should only be necessary in very few cases, because all widget classes have QObject as a base class, which means that <QObject> already has to be included. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-23core/BT: simplify detection of bluetooth namesGravatar Dirk Hohndel
Instead of that super long if-else if chain, have something more structured using a table for the common case of prefix based names. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-23core/BT: improve BT name detection for Pelagic dive computersGravatar Dirk Hohndel
It would be so much nicer if we could just let libdivecomputer do this, but the filter function there doesn't quite do things the way we need them to be. Which is why we have our own function here. This is a small attempt to rationalize the code that we have to make it easier to maintain. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-23Sync libdivecomputer with upstreamGravatar Dirk Hohndel
Merge with Jef's upstream libdivecomputer updates: - support new Ratio iX3M 2021 model IDs - support Mares Horizon, and fix the Mares Genius layout - add support for Shearwood Sage - various warning fixes, other minor details Mark Aqualung i750TC as BLE capable Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-23mobile/UI: show result of manual syncGravatar Dirk Hohndel
Since we no longer show the noisy git updates to the user, it has become harder for them to know whether a sync to the cloud was successful. Since a manual sync will never show the new 'what did you change and here's how you undo it' notification, it seems easy enough to simply show a status update. This adds a passive notification with no action button after the user either uses the main menu or pulling down on the dive list in order to trigger a manual sync. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-23mobile/debugging: copy GPS fixes to clipboardGravatar Dirk Hohndel
The goal is to enable a user experiencing crashes when applying GPS data to their dive log to make all necessary data available to the developers. Hopefully the clipboard is large enough to hold all the data. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-23Add Diviac conversion to smtk converter CGI scriptGravatar Robert C. Helling
Plus a little bit of error reporting. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-01-21Update translations from TransifexGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-21statistics: do resizing in UI thread, not render threadGravatar Berthold Stoeger
The updatePaintNode() function, which is run on the render thread detected a geometry change and initiated recalculation of the chart layout. This means that plotAreaChanged() was called in two different thread contexts, which is questionable. Instead, hook into the geometryChanged() function and recalculate the chart items there. This fixes a rendering bug, because the old code would first delete unneeded items and then rerender the chart. Thus, old grid and tick items were still visible. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20Update translation source stringsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-20cleanup: make a few DivePlannerModel functions privateGravatar Berthold Stoeger
It simplifies reasoning about control flow a lot if it is known that functions can't be invoked from a different part of the code base. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20cleanup: constify TankItem::setData()Gravatar Berthold Stoeger
The TankItem only displays the data. Pass pointers as const. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20cleanup: constify create_plot_info_new()Gravatar Berthold Stoeger
This only read accesses the dive and constructs a plot-info structure. Make the dive parameter const. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20cleanup: constify populate_pressure_information()Gravatar Berthold Stoeger
This has only read access on the dive. Make the parameter const. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20cleanup: constify init_decompression()Gravatar Berthold Stoeger
This function initializes decompression data from a dive. The dive is not modified, therefore make it const. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20cleanup: remove dive parameter from DivePlotDataModel::setDive()Gravatar Berthold Stoeger
This was not used, probably an artifact from days long gone. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20profile: don't "fake" dc in profile widgetGravatar Berthold Stoeger
There was code to create a fake dc in the profile widget in the case that there are no samples. To my understanding, this is obsolete, as such fake data is now generated automatically when adding dives. If for some reason there really are no samples, quit early and go into the empty state. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20planner: remove DivePlannerPointsModel::startTimeChanged signalGravatar Berthold Stoeger
The way the starting time of a new plan was set was bonkers: 1) PlannerWidgets::planDive() invokes DivePlannerPointsModel:: createSimpleDive(). 2) createSimpleDive() calls DivePlannerPointsModel:: setupStartTime() 3) setupStartTime() emits a signal startTimeChanged() 4) startTimeChanged is caught by PlannerWidget and sets the UI field 5) change of the UI field emits a timeChanged() signal which is connected to DivePlannerPointsModel::setStartTime() 6) setStartTime() sets the time of the plan and displayed_dive and emits dataChanged() 7) dataChanged() replots the dive() 8) Back in DivePlannerPointsModel::createSimpleDive() the diveplan start time is overwritten with displayed_dive (the value are equal owing to 6) Wow! But it gets worse: 9) The initial dive plan is set up in createSimpleDive(). Since the profile is drawn in 7) after clearing the displayed_dive and before constructing the initial plan, the profile is shown on a dive without samples. It therefore generates a dummy profile. To make this somewhat less insane, remove the startTimeChanged() signal in 3), explicitly set the start time of plan and dive to the one calculated by setupStartTime() and explicitly set the UI filed in the plannerWidget. This still indirectly draws the profile via signals in a convoluted way, but at it straightens out things somewhat. Most importantly, the profile doesn't have to generate a fake DC. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20profile: make three member functions constGravatar Berthold Stoeger
These accessors do not change the ProfileWidget2 state, so make them const. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20Merge branch 'tvalue'Gravatar Dirk Hohndel
2021-01-20statistics/legend: fix dragging legend on touch screenGravatar Dirk Hohndel
While this didn't appear to be needed when dragging the legend with a mouse, on a touch screen for some reason the drag ended after 30 pixels either way horizontally (but no apparent limit vertically). By setting this flag to true, drags on a tablet appear to work as expected. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-20statistics: render bar and pie labels onto fill colorGravatar Berthold Stoeger
The labels in bar an pie charts are realized as individual QSG pixmap nodes with an alpha channel. Sadly, rendering bright labels onto a transparent background gives very ugly artifacts. As a stop gap measure, until the problem is understood, render on a background with the color of the pie slice or bar. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: move colors to statscolors.hGravatar Berthold Stoeger
Most colors were already collected there, but a few were dispersed throughout the source files. For future themeability, move the remaining colors to this common place. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: make confidence area and regression line opt-inGravatar Berthold Stoeger
This is not perfect - the polygon of the confidence area is calculated even if it is not shown. Oh well. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: don't replot chart when changing featuresGravatar Berthold Stoeger
Up to now, when the user changed the visibility of chart features (legend, quartiles, labels, etc.) the whole chart was replot. Instead, only change the visibility status of these items. After all, this modularity is one of the things the conversion to QSG was all about. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>