summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2021-01-02statistics: implement axesGravatar Berthold Stoeger
Implement five kinds of axes: - ValueAxis: a standard axis for plotting numerical linear data. - CountAxis: a ValueAxis for plotting counts of dives. - CategoryAxis: an axis for plotting discrete variables without any notion of distance. - HistogramAxis: an axis for plotting bins with a numeric value. - DateAxis: a HistogramAxis that formats dates. The axes derive from a common virtual base class that defines a small interface, notably, returning the minimum and maximum displayed value and redrawing the axis. The mapping and painting is performed by QtCharts' axes. On the one hand, using QtCharts turned out to be too inflexible. On the other hand it allowed us to quickly prototype the charts. Ultimately, we should do our own drawing of the axis. As a testament to the inflexibility, QtCharts' axes do not allow for repeated labels is needed for quarter-based date charts (year, Q2, Q3, Q4, year, Q2, Q3, ...). Therefore the code disambiguates labels by adding unicode zero-width spaces. Wonderful. When omitting labels due to space reasons, the histogram axis attempts to show "preferred" labels. In the quarter example above, it tries to show full years. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-02statistics: add a header file defining z-valuesGravatar Berthold Stoeger
z-values determine the order in which objects on the chart are painted. To reduce chaos, collect all z-values in a header file. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-02cleanup: move pref related structs and functions to pref.cGravatar Berthold Stoeger
These were declared in pref.h and defined in subsurfacestartup.c. pref.c didn't even exist. Create it and move preferences-related structs and functions there. setup_system_prefs() is left in subsurfacestartup.c, since it works with environment variables. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-02cleanup: move definition of get_units() to core/unit.cGravatar Berthold Stoeger
The function is declared in core/unit.h, therefore it seems logical to define it in the corresponding source file. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-02cleanup: remove support for PASCAL in get_pressure_units()Gravatar Berthold Stoeger
The user preferences can never end up with PASCAL pressure units. The only place that uses these units is the XML parser. Therefore, remove the PASCAL case in get_pressure_units(). This will remove an unused translation string. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-02cleanup: don't save PASCAL pressure units to gitGravatar Berthold Stoeger
The way I understand, the PASCAL pressure unit is used to parse obscure dive logs. However, there is no support in the UI for using Pa as pressure unit. Therefore remove reading / writing this unit to git divelogs. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-01cleanup: remove "GpsLocation *locationProvider" from MainWindowGravatar Berthold Stoeger
This is mobile only and not used on desktop. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-01mobile: update version to 3.1.3Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01cleanup: ensure DiveFilter is consistent when createdGravatar Dirk Hohndel
Otherwise we might access an uninitialized member. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01fix potential crash in GPS codeGravatar Dirk Hohndel
If we don't have a GpsLocation instance, we shouldn't dereference it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01statistics: implement a legend boxGravatar Berthold Stoeger
For some chart (e.g. pie charts or stacked bar charts), we want to display a legend. QtCharts' legend interface happens to be private and therefore is of no use. This introduces a legend box which is implemented using QGraphicItems, which can be placed on top of QCharts. It's very unfancy, but works for now. If there are too many items, not all are shown. Currently, the legend is configured to fill at most half of the width and half of the height of the chart. This might need some optimization. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-01statistics: add color-related functionsGravatar Dirk Hohndel
Add a source file and a header file, which implement the color scheme used by the statistics module. Besides a few color constants, the centerpiece is a function that returns the color representing a bin and an appropriate label color. It picks a roughly equi-distant set of colors out of an already balanced set of 50 candidate colors. And it also picks white as text color when adding a label to a segment with a dark color. The color list was created using a tool by Gregor Aisch that is available on GitHub as https://github.com/gka/palettes to create multi-hued, multi-stop color scales that are safe for color blind people. This commit contains code from three authors. Dirk (main author): adaptive color scheme. Willem: Colors of single-bin charts and lines. Berthold: Infrastructure. Signed-off-by: Dirk Hohndel <dirk@hohndel.org> Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-01statistics: add statistic variablesGravatar Berthold Stoeger
The StatisticVariable class hierarchy encapsulates the concept of a dive-variable, which can be plotted in charts either as dependend or independend variable. There are three types of these variables: 1) discrete: For example dive buddies or suit type. 2) continuous: Has a notion of linear metric - can be used as histogram or scatter plot axis. 3) numeric: Like continuous, but allows for operations such as calculating the mean or the sum over numerous dives. All variables support binning. The bins are defined per variable. Continuous variables can be converted into an arbitrary double value, which is used to be plotted on a continuous axis. Moreover, numeric variables support a number of operations, which depend on the variable. Since binning is based on different types, the code is rather template-heavy. Of course, this could be solved with unions/variants and runtime-polymorphism, but using templates was just much quicker. Notably, this uses the CRTP (curiously recurring template pattern) where a subclass passes itself as argument to the baseclass. This is a weird kind of "reverse inheritance". The StatsTranslations class is a dummy class which will be used to collect all translations of the statistics module. This includes changes by Dirk to fix compilation of the downloader. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01core: add get_*_unit functions with explicit unit systemGravatar Berthold Stoeger
The get_*_unit() functions return the unit-name as set in the preferences. Add versions with a "metric" parameter. This will be used by the statistics code, which may in the future allow for binning with alternative units. All the unit-formatting functions should probably be moved away from qthelper to their own source file. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-01core: move formatting of day-of-week to string-format.cppGravatar Berthold Stoeger
This was only used by the filter, but will also be used by the statistics module. To avoid duplicate translation strings, move to a common place. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-01core: add "transparent" parameter to renderSVGIconGravatar Berthold Stoeger
The start-selection widget will need icons with a transparent background so that the icons don't stick out like a sore thumb. So far the icons rendered by this function were only used by the images on the profile and were perfectly rectangular. Therefore there was no need for this. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-01core: make gasmix_is_invalid globally accessibleGravatar Berthold Stoeger
The statistics module will use that to bin dives by gasmix. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-01core: add notion of gas-type to core/gas.cGravatar Berthold Stoeger
Create a gastype enum, which describes the type of a gas. For now: air, nitrox, normoxic, trimix and oxygen. This probably should be made configurable. The gas types will be used to bin gasses in the statistics module. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-01core: move renderSVGIcon() to qthelper.cppGravatar Berthold Stoeger
The renderIcon() function was used by the thumbnailer to render SVG-based icons. Move it to the global qthelper.cpp so that it can also be used by the statistics module. Add "SVG" to the name to emphasize what it is used for. For consistency also move the renderSVGIconWidth() function, which renders to a fixed width, to qthelper.cpp Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-01mobile/UI: consolidate to a single check boxGravatar Dirk Hohndel
It was very odd that we had two slightly different styled check boxes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01mobile/UI: fix the logic to keep input visibleGravatar Dirk Hohndel
Using the y coordinate of the component directly doesn't work if we use the component inside other components. Instead we need to grab the position relative to the flickable. The comment about needing the function for this to work seemed dubious. So for now I've removed that function and am setting the position directly. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01mobile/UI: trigger position check on focusGravatar Dirk Hohndel
Doing this check every time we get a 'pressed' signal for the input field seems excessive. We really only need to check when the input field gets focus - that's when the OS virtual keyboard might open and hide the field the user wants to edit. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01mobile/UI: don't show warning if text field is not in flickableGravatar Dirk Hohndel
It's entirely reasonable to use the component in a context where we don't have a flickable. Simply don't try to reposition things in that case. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01mobile/UI: ensure active input field stays visibleGravatar Dirk Hohndel
This reuses the logic we implemented in the SsrfTextField. Eventually we will need to clean up the inconsistent names for these elements. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01mobile/UI: avoid pointless warningsGravatar Dirk Hohndel
These can create quite a bit of noise in the log. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01mobile/UI: ensure that edited text is currentGravatar Dirk Hohndel
By removing focus from all input fields we can ensure that we have the correct data reflected when saving an edited dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01mobile UI: avoid circular dependencyGravatar Dirk Hohndel
The relevant text field names are different depending on whether our combo box is editable or not. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01mobile/UI: use our small label templateGravatar Dirk Hohndel
This saves 66 lines of code. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01mobile/UI: provide more structured debug output for dive editGravatar Dirk Hohndel
Instead of always showing info about the location, allow all data to be captured in a more structured format - but only when the app is in verbose mode. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01mobile/UI: don't try to set the combobox indexGravatar Dirk Hohndel
There's no point in doing that - we set the correct text and leave that in the editText and displayText for the combo box. If the user uses the drop down they can replace that. This works correctly for single people, and for multiple people the drop down doesn't work at all, anyway. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01mobile/UI: don't show virtual keyboard when starting dive editGravatar Dirk Hohndel
When we start editing a dive the OS will open the virtual keyboard if any of the input fields have focus (which they might get when we set their content). The explicit closing of the keyboard might be overkill, but also doesn't appear to hurt. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01mobile/UI: add template for editable combo boxGravatar Dirk Hohndel
This makes the code easier to read and manage. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01build-system: fix macOS QtCharts QML resourcesGravatar Dirk Hohndel
On macOS the cmake build system doesn't copy the QML resources into the app bundle and so we do that manually. I forgot to add that for QtCharts. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-30build-system: fix Coverity scriptGravatar Dirk Hohndel
Trying to keep the different build environments consistent I messed up and dropped wget and curl from the Coverity build. Moving them to the beginning of the list so they stand out more. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-30cleanup: fix typoGravatar Dirk Hohndel
Sorry about that. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-30Cleanup: add another incorrect author name to the listGravatar Dirk Hohndel
This way the summaries are "more correct". Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-30build-system: update OBS spec fileGravatar Dirk Hohndel
Contrary to the Launchpad builds, OBS isn't actually using the spec file that is included in the Subsurface source but instead maintains its own. So this is just updating to the version that has been tracked over there, mostly for reference. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-30build-system: fix Launchpad packagingGravatar Dirk Hohndel
There are just so many places where I need to remember to update the package lists. Turns out I had forgotten to add libmtp to the Linux builds when we add the Garmin Descent mk2 support... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-30cleanup: remove obsolete macOS packaging filesGravatar Dirk Hohndel
Several of these stem back from when Subsurface was a Gtk2 app. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-30cleanup: remove obsolete iOS packaging filesGravatar Dirk Hohndel
These have all been replaced with the current build process. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-30cleanup: remove obsolete Android scriptsGravatar Dirk Hohndel
These have all been replaced with the current qmake based build process. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-29GitHub Actions: clearly disable the docker build tasksGravatar Dirk Hohndel
These haven't been used for a while and still create strange errors. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-29update Windows READMEGravatar Dirk Hohndel
Pointing at the current build container. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-29update INSTALL documentationGravatar Dirk Hohndel
Catching up with all of the changes to Qt installation and our build processes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-29build script: move related code closer togetherGravatar Dirk Hohndel
This just makes it more obvious what we are doing. This appears only necessary on macOS. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-29build script: remove the long outdated Qt detectionGravatar Dirk Hohndel
We now require qmake to be found much earlier in the script so we can simply use that to get the right prefix path. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-29build script: fix typos and inconsistenciesGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-29build-system: update Coverity build for QtChartsGravatar Dirk Hohndel
This was missing in the earlier GitHub Action updates. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-29build-system/trusty: use new Qt installerGravatar Subsurface CI
Update to Qt 5.12.10, latest OpenSSL, add QtChart, add other missing packages. Also switch to gcc-7 as our statistics code requires better C++17 support than what gcc-6 can offer. This then creates trusty-qt512:1.1 Signed-off-by: Subsurface CI <dirk@hohndel.org>
2020-12-29build-system: add QQuickWidgets to mobile buildGravatar Dirk Hohndel
Even though the mobile build doesn't have a UI for the statistics, yet, it already builds the base files. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>