aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2021-01-10profile: remove TankItem's connection to the resize signalGravatar Berthold Stoeger
Since the initial commit introducing TankItem, there was a connection that replotted the item if the horizontal axis sent the sizeChanged() signal. I never managed to create this signal for the horizontal axis, only for the vertical axes. Therefore remove this thing. If it turns out that we need it after all, readd it in a more deterministic way (i.e. call where it is needed). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10profile: remove model parameter from TankItem::setData()Gravatar Berthold Stoeger
This one is extremely obscure: TankItem::setData(), which is called on every replot, was passed the DivePlotDataModel, even though it doesn't access that model at all. Instead, it connect()s to the model to stay informed of changes to the data. First of all, this should obviously be done once in the constructor, not on every replot. But also, the setData() function is called on every replot one lines before sending the model-changed signal. Thus, the tankitem was always repainted twice. Just remove the whole connect() thing and go for a more deterministic model. Should the tankbar not be repainted anywhere, add the appropriate calls there. Accordingly rename the "modelDataChanged" slot to "replot". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10profile: remove AbstractProfilePolygonItem::settingsChanged()Gravatar Berthold Stoeger
settingsChanged() is a virtual function, which is called when the preferences dialog signals changes. In most derived classes, the function does nothing. In two classes, DiveProfileItem and DiveCalculatedTissue, it replots the item respectively changes its visibility. However, these two flags are *not* controlled by the preferences dialog. Indeed, the functions are also connected to finer-grained qPref signals. Therefore, settingsChanged() can be removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10profile: collect dive-profile items in a vectorGravatar Berthold Stoeger
Collect all the created profile items in a dynamic vector. This allows us to loop over them when adding them to the scene, instead of addressing each item individually. Hopefully, this will also allow for a more deterministic repaint logic, without relying on signals. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10cleanup: remove obsolete #undef in profilewidget2.cppGravatar Berthold Stoeger
The macro was removed quite some time ago. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10profile: remove ProfileWidget2::setupItem()Gravatar Berthold Stoeger
The only thing left that this function did, was setting the Z-value of the item. This can be done directly on construction. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10profile: construct PP gas items with createPPGas() functionGravatar Berthold Stoeger
This function was called after creating the items. It can be called directly to create the items. Less chance of mixups. For this to work, the initialization of isGrayscale has to be moved to the front, because createPPGas sets the color according to this flag. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10profile: move allocation of DiveProfileItems into a templateGravatar Berthold Stoeger
Instead of typing out the same arguments again and again, do the allocation of DiveProfileItems in a templated function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10profile: initialize axis of DiveProfileItems on constructionGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10cleanup: make DiveCartesianAxis functions constGravatar Berthold Stoeger
A few DiveCartesianAxis functions that were pure accessors were not const. Make them so. Moreover, mark a few overridden virtual functions as such. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10profile: remove ProfileWidget2::dateTimeChanged()Gravatar Berthold Stoeger
This function sent a signal and the only listener was removed in the previous commit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10profile: set model of profile items on constructionGravatar Berthold Stoeger
The profile items had a "setModel()" function to set the DivePlotDataModel post creation. The model is never changed. It does however mean that the model might be null in a short period between construction and setting the model. To simplify reasoning about this code, set the model in the constructor. To drive the point home that the can never change and cannot be null, turn it into a reference. Yes, this is gratuitous bike-shedding, but it helps me analysis the code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10profile: remove redundant code in DiveCalculatedCeilingGravatar Berthold Stoeger
The DiveCalculatedCeiling profile-item has a recalc() function, which calls "dataModel->calculateDecompression()". This is a questionable reversal of control-flow: The profile-item should paint the model-data not change it. The code was supposed to be called under two conditions: 1) The value of the calcceiling3m preferences flag changed. This code was buggy for two reasons: Firstly, the cached value was always initialized to false, which means that sometimes the first call was missed. Secondly, the settingsChanged() functions was only called when closing the preferences window, not when changing the flag in the profile widgets. 2) The datetime of the dive changed. The whole control-flow is pretty absurd (due to "bit rot"): - The replan-dive command sends a date-time changed signal. - The main tab changes the date-time and informs the profile. - The profile sends a signal to the item. - The item instructs the model to recalculate the decompression. - The model causes the profile to be redrawn. In any case, the whole thing is moot, because the decompression is recalculated for *every* profile plot in create_plot_info_new(). Let's remove the code from the DiveCalculatedCeiling profile-item and the calculateDecompression() function, which is now not used anymore. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10statistics: split people binnerGravatar Berthold Stoeger
The people binner (called "buddies") is too coarse. Split into buddies, dive guide and people (the old "buddies", which is a combination of buddies and dive guide). Reported-by: Peter Zaal <peter.zaal@gmail.com> Reported-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10mobile/statistics: small UI improvementsGravatar Dirk Hohndel
This gets us better log messages and better spacing - but it's far from good and all of this should be squashed into one working version in the end. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-10statistics/mobile: add variable2 operations combo-boxGravatar Berthold Stoeger
Copy paste of the other combo boxes. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10statistics/mobile: set currentIndex of QML combo boxesGravatar Berthold Stoeger
Use Q_PROPERTYs of the StatsManager to correctly set the current index of comboboxes after a state changed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10mobile/statistics: add simple iconGravatar Dirk Hohndel
This doesn't look great, but it's already part of the breeze-icons, so it's very easy to add - and it's better than no icon. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-10mobile/UI: rewrite screen size logicGravatar Dirk Hohndel
This has been a thorn in my side for a long time. The old code was terrible and insanely fragile. The new code is really dumb and quite fragile. So definitely an improvement? Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-10build-system: compile stats code on mobile OSsGravatar Dirk Hohndel
Android and iOS use qmake, so add the code to the .pro file. This also removes all remnants of QCharts includes and uses and all the references to QCharts in our various build systems. That was a brief but extremely useful detour. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-10mobile/statistics: add a statistics page on mobileGravatar Dirk Hohndel
This adds a reasonably flexibile mobile page that tries to do the right thing for both portrait and landscape mode. In order to get the most out of a mobile screen, it's implemented in a way that always gives it the full screen (it does so by emptying out the page stack and being the only page shown - brutal, but effective). This commit also contains a bunch of other random cleanups that didn't really justify being in separate commits. Parts of this was written by Berthold, hence the double SOB. Signed-off-by: Dirk Hohndel <dirk@hohndel.org> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10statistics: add a skeleton StatsManager classGravatar Berthold Stoeger
In analogy to "QMLManager", add a "StatsManager" class, which manages the statistics module on mobile. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10statistics: convert chart to QQuickItemGravatar Berthold Stoeger
It turns out that the wrong base class was used for the chart. QQuickWidget can only be used on desktop, not in a mobile UI. Therefore, turn this into a QQuickItem and move the container QQuickWidget into desktop-only code. Currently, this code is insane: The chart is rendered onto a QGraphicsScene (as it was before), which is then rendered into a QImage, which is transformed into a QSGTexture, which is then projected onto the device. This is performed on every mouse move event, since these events in general change the position of the info-box. The plan is to slowly convert elements such as the info-box into QQuickItems. Browsing the QtQuick documentation, this will not be much fun. Also note that the rendering currently tears, flickers and has antialiasing artifacts, most likely owing to integer (QImage) to floating point (QGraphicsScene, QQuickItem) conversion problems. The data flow is QGraphicsScene (float) -> QImage (int) -> QQuickItem (float). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10statistics: fix 20 m binnerGravatar Berthold Stoeger
Copy&paste error: the 20 m binner binned to 10 m. Reported-by: Peter Zaal <peter.zaal@gmail.com> Reported-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10statistics: add count to box and whisker plotsGravatar Berthold Stoeger
When calculating the quartiles, we need the count of dives anyway, which makes it trivial to export this value to the frontend. Fixes an erroneous "mean", which should be "median". Suggested-by: Peter Zaal <peter.zaal@gmail.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10Make sure to sanitize the gasmix after editing itGravatar Linus Torvalds
Otherwise we end up showing the gasmix in a different form after editing for the usual air percentages, because we haven't normalized the gasmix values and store them back in the dive in the non-normalized format. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-01-10btdiscovery - Add second matcher for Ratio iX3MGravatar Damian Zaremba
New (late 2020) iX3M hardware (refered to as 'iX3m with Sequared Buttons' in the Ratio support section) appears to identify as iX5M, both in the Bluetooth name and reported revision e.g. $ ./ratio-toolbox-x86_64.AppImage info | head -n2 Model: Ratio® iX5M GPS TECH+ Firmware version: 4.1.26/016 (English) Add a second Bluetooth name matcher for this variation, returning the same (generic) model as is currently used. Signed-off-by: Damian Zaremba <damian@damianzaremba.co.uk>
2021-01-10statistics: add tags variableGravatar Berthold Stoeger
Trivially a copy of the "buddies" code. Suggested-by: Peter Zaal <peter.zaal@gmail.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10statistics: sort dive sitesGravatar Berthold Stoeger
The dive sites where sorted by location in RAM, which is just silly. Add a DiveSiteWrapper that sorts by name, though that should probably be improved. Suggested-by: Peter Zaal <peter.zaal@gmail.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10statistics: add min and max operations for numerical typesGravatar Berthold Stoeger
This makes sense and is easy to implement. Suggested-by: Peter Zaal <peter.zaal@gmail.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-09build.sh: recreate previous behavior with no argsGravatar Dirk Hohndel
When calling build.sh with no args asking for a specific build type, that should be equivalent with calling it with the -desktop arg. Reported-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-09statistics: fix range in categorical axesGravatar Berthold Stoeger
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-09statistics: add a dive-# variableGravatar Berthold Stoeger
This was requested on the mailing list and it makes sense to have it. Of course, not all charts make sense: e.g. a plot dive-# vs. count is a bit redundant... Sadly, this can't use the generic IntRangeBinner, because dive-#s start at 1, not 0. Suggested-by: Christof Arnosti <charno@charno.ch> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-09statistics: add a mean depth variableGravatar Berthold Stoeger
This was requested on the mailing list. Reduce code size somewhat by deriving the binner and the variable classes from common base classes with a mean-vs-max flag. Suggested-by: Christof Arnosti <charno@charno.ch> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-07[snap] enable ccache in Linux Snap workflowGravatar Michał Sawicz
Also adding `push` to triggering events to populate the cache. Signed-off-by: Michał Sawicz <michal@sawicz.net>
2021-01-07[snap] add missing Qt5Charts dependencyGravatar Michał Sawicz
Signed-off-by: Michał Sawicz <michal@sawicz.net>
2021-01-07[snap] add Linux Snap workflowGravatar Michał Sawicz
This will build and verify the snap on pull requests to `master`. Signed-off-by: Michał Sawicz <michal@sawicz.net>
2021-01-07[snap] add daily USN checkGravatar Michał Sawicz
This workflow will download the current snaps published in the `candidate` channel for all architectures and check them for packages with published Ubuntu Security Notices. If it finds one, it will trigger a build of the snap recipe: https://code.launchpad.net/~subsurface/+snap/subsurface-stable This will rebuild the snap with patched packages and publish it to the `candidate` channel. Signed-off-by: Michał Sawicz <michal@sawicz.net>
2021-01-07statistics: add ticks at beginning and end of the axisGravatar Berthold Stoeger
The grid is based on the axis ticks. If labels in histogram axes were skipped (because there are too many bins), it could happen that the grid was incomplete, because the first and/or last tick were missing. Add these explicitly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-06statistics: improve placement of info-boxGravatar Berthold Stoeger
The info box was placed either above or below the mouse-pointer. If the pointer is at the center and the infobox higher than half the chart, it would cross the border. Detect this case and place the info box at the center. Same logic for right/left, though that should typically not happen. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-06statistics: fix chart features: regression line and median/meanGravatar Berthold Stoeger
The coordinates of these were calculated when creating the feature. This is wrong, because the min/max values of the axes can change on resize to get "nice" number. Therefore, recalculate after resizing. This means that the general "LineMarker" class has to be split into two classes, one for regression lines and one for median/mean markers. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-06statistics: paint custom gridGravatar Berthold Stoeger
With removal of QtCharts' axes, the grid was lost. Readd it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-06statistics: draw title of axesGravatar Berthold Stoeger
Easy enough to implement, but one weirdness: To get the height of the rotated text, one has to access the width() member of the boundingRect. I'm not sure if that makes sense, but so be it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-06statistics: replace QtCharts' axesGravatar Berthold Stoeger
Replace by custom implementation, with the ultimate goal to remove the QtCharts module. This doesn't yet display axis titles or a grid. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-06statistics: set correct z-value for barsGravatar Berthold Stoeger
The bars were set to the z-value of the labels. Not an issue, since the labels are generated after the bars and therefore plot later. Still, do the right thing. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-06statistics: render titleGravatar Berthold Stoeger
Since we want to get rid of QtCharts, we have to render our own title. Simply keep around a QGraphicsSimpleTextItem and put in the center of the chart. Define the borders to the scene as constants. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-06statistics: save axis with seriesGravatar Berthold Stoeger
In the future we want to use our own axis implementation to convert from/to screen coordinates. For this purpose, we need to save the axes with the series. Especially if we want to support multiple series on different axes. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-06statistics: save chart in axis classGravatar Berthold Stoeger
The chart was passed as argument to the function recalculating the axis labels. Instead, pass the chart in the constructor of the axes and save it. This gains us flexibility for the future: There will be more functions that need to access the chart (e.g. resizing of the axes). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-06preferences: remove pointless memberGravatar Dirk Hohndel
This could never have worked the way it was used. Some whitespace fixes snuck into this commit. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-06desktop/update-check: fix logic when to ask about update checkGravatar Dirk Hohndel
Checking a field that we intentionally don't store to disk is obviously wrong. It's been this way for a long time and it has annoyed me many times, but somehow I never spent the time to track down why this was happening. It makes much more sense to use the presence of either the don't check flag or a next check date as an indication that we have already asked this question. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>