aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
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>
2021-01-20statistics: leak textures on exitGravatar Berthold Stoeger
The scatter plot items shared their textures. These were std::unique_ptrs and cleaned up on exit. Owing to QSG's broken memory model, freeing the textures after QApplication terminated its threads led to crashes. Therefore, leak the textures. Not satisfying, but ultimately harmless and better than a crash. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: fix range in categorical axesGravatar Berthold Stoeger
Fix a bug that was fixed in b5c8d0dbb4 and reintroduced in e7907c494f. Here is the original commit message: The range for a one-bin chart is [-0.5,0.5], thus the range in an n-bin chart is [-0.5,n-0.5], not [-0.5,n+0.5]. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: refactor QSG memory managementGravatar Berthold Stoeger
The code was wrong, because it deleted the ChartItems in the main UI thread, not the render thread. This would delete the QSG nodes in the UI thread and then crash on mobile. Therefore refactor this part of the code by adding the items to be deleted to a list that will be deleted by the render thread. As a drop in replacement of std::unique_ptr, implement a silly ChartItemPtr class, which auto-initializes to null. This turns the deterministic and easily controlled memory management into a steaming pile of insanity. Obviously, this can be made much more elegant, but this has to do for now. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: remove QSceneGraphGravatar Berthold Stoeger
All items are now painted with QSG. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: remove float z-valueGravatar Berthold Stoeger
These values were used for items on the QGraphicsScene and have been replaced by integer values used on the QSG scene. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: replace chart title by QSG nodeGravatar Berthold Stoeger
This one is trivial, since everything is there already: Replace the QGraphicsSimpleTextItem with a ChartTextItem. Only few functions have to be renamed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: remove QGraphicsView from StatSeriesGravatar Berthold Stoeger
All series are converted to QSG. Thus, the pointer to the QGraphicsView can be removed from the common base class. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: replace PieSeries by QSG nodesGravatar Berthold Stoeger
Since there are no disk-segment QSG primitives (one could draw a triangle fan, but that doesn't seem optimal), this draws into a pixmap and blits that as a QSG node. Since this is the only series without axis, it needs a function that returns the size of the plot area. This didn't exist, so add it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: convert scatter series to use QSGGravatar Berthold Stoeger
The original plan to reuse the ChartPixmapItem for the scatteritems was dumped, because it is unclear if the textures are shared if generated for each item. Instead, a new ChartScatterItem was created, where all items share the same textures (one for highlighted, one for non-highlighted). This means that the rendering of the scatter items is now done in the chartitem.cpp file, which feels like a layering violation. Not good, but the easiest for now. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: convert box-and-whiskers plot to QSGGravatar Berthold Stoeger
This is lazy: Derive from the bar chart item and add whiskers in the subclassed render() function. The code is ugly, because the base class function clears the dirty flags and therefore the derived class has to remember them. Oh well. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: implement showing / hiding of items in QSGGravatar Berthold Stoeger
To replace the QGraphicsScene, we need the possibility of showing and hiding items. Turns out, the QSG API is completely insane. Whether an item should be shown is queried by the virtual function isSubtreeBlocked(), which is supposed to be overriden by the derived classes. However, the common nodes for rectangles and pixmaps are supposed to be created by QQuickWindow, for hardware optimization. This gives nodes that cannot be derived from and therefore whether the item is shown or not cannot be controlled. There are therefore two distinct cases to consider: The node is allocated by the code directly or indirectly by QQuickWindow. In the latter case, we use a proxy node with the only purpose of having a "visible" flag and add the obtained node as a child. This madness is performed with template trickery to get unified code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: convert bar series to QSGNodesGravatar Berthold Stoeger
To this end, two new ChartItems were added: A "bar" (a rectangle with a border) and a "text" (multiple lines of text). It turns out that the text on the bars now looks atrocious. The reason appears to be that the antialiasing of the font-rendering does not blend into the alpha channel, but into a supposed background color? This will have to be investigated. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: render regression item using QSGNodeGravatar Berthold Stoeger
Render the confidence area and the regression line into a pixmap and show that using a QSGNode. It is unclear whether it is preferred to do it this way or to triangulate the confidence area into triangles to be drawn by the shader. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: keep track of dirty items in double-linked listGravatar Berthold Stoeger
So far the items to be recalculated in the drawing thread had a "dirty" flag and were kept in one array par z-level. Once the series are implemented in terms of QSGNodes, there may lots of these items. To make this more efficient when only one or two of these items change (e.g. highlighting due to mouseover), keep the dirty items in a linked list. Of course, this makes the draw first version of the chart less efficient. There are more fancy ways of implementing the double-linked list, but the few ns gained in the render thread are hardly worth it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: turn axes into QSGNodeGravatar Berthold Stoeger
Render the labels and the title into a pixmap and render the ticks and the base line using individual QSGNodes. Attempting to render the ticks likewise into the pixmap gave horrible results, because (quite obviously) rendering with QPainter and the QSG shader gives non-matching ticks and grid lines. The memory management had to be changed a bit: The ChartItems were collected in the root QSGNode. However, the axes are added before the first plotting, so this node might not exist. Therefore, store the axes in the StatsView object. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: turn ChartGrid into QSGNodesGravatar Berthold Stoeger
Turn the background grid into QSGNodes. Each grid line is represented by a QSG line item. An alternative would be drawing the grid into a QImage and blasting that onto the screen. It is unclear which one is preferred. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: draw background using a QSGRectangle nodeGravatar Berthold Stoeger
Currently, the background was drawn as solid color onto the chart-scene. This is of course incompatible with doing the grid as QSGNodes. Therefore, make the scene image transparent and use a QSGRectangle as background color. We could also simply omit the background and show the widget's background. However, that would mean setting the background color in two seperate code paths (desktop and mobile). I found no way of directly setting the background of the QQuickItem. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: convert HistogramMarkers to QSGNodesGravatar Berthold Stoeger
This is in analogy to the quartile markers. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: convert QuartileMarkers to QSGNodesGravatar Berthold Stoeger
Slowly converting the QGraphicsScene items to QSGNodes to avoid full replot of the scene. This adds a new abstraction for line-nodes. Since the render() function here is fundamentally different from the pixmap-nodes we had so far, this has to be made virtual. Also, move the quartile markers to their own source file, since the StatsView source file is quite huge already. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: remember position of legend when resizingGravatar Berthold Stoeger
The position of the legend was reset when resizing. This was OK as long as the legend wasn't movable. To avoid resetting the position, store the center position of the legend relatively to the size of the canvas. On resize restore the center to the same relative size. To avoid code duplication, move the sanitizing of the coordinates from the StatsView to the Legend. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-20statistics: add notion of Z-value to chart itemsGravatar Berthold Stoeger
The chart items were drawn in order of creation. To control this, add a notion of Z-value. In contrast to QGraphicsScene, make this a small integer value. To controll order of drawing, a plain QSGNode is created for every possible Z-Value and items are added to these nodes. Thus, items are rendered by Z-value and if the Z-value is equal by order of creation. Likewise split the list of chart-items into Z-values, so that items can be quickly unregistered: The items that will be removed individually will usuall be part of Z-levels with only few items (e.g. legend, infobox). Z-levels with many items (notably the series) will always be fully rebuilt. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>