aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2020-02-04Cleanup: remove capture-all lambda clausesGravatar Berthold Stoeger
These were forgotten the last time. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-03mobile-widgets: switch to new subsurfaceThemeGravatar jan Iversen
Remove subsurfaceTheme from main.qml Replace ThemeNew -> subsurfaceTheme change registration ThemeNew -> subsurfaceTheme Signed-off-by: jan Iversen <jan@casacondor.com>
2020-02-03mobile-widgets/qml: secure subsurfaceTheme.initial*Gravatar jan Iversen
move initialWidth/initialHeight out of subsurfaceTheme to placeHolder, this secures no change in behaviour. Signed-off-by: jan Iversen <jan@casacondor.com>
2020-02-03mobile-widgets/qml/settings.qml: show all colorsGravatar jan Iversen
Show all colors in a theme, allowing user to change theme. This is preparation for allowing users to click on the individual colors and change them. Signed-off-by: jan Iversen <jan@casacondor.com>
2020-02-03mobile-widgets/themeinterface: make most part staticGravatar jan Iversen
Make variables and functions static where possible, this is done to prevent different versions of theme with different values. Signed-off-by: jan Iversen <jan@casacondor.com>
2020-02-03mobile-widgets/qml: use new templates in converted pagesGravatar jan Iversen
Use the TemplatePage and TemplateButton in the converted pages. In order to avoid a bigger search/replace all other pages are left untouched (for now). Signed-off-by: jan Iversen <jan@casacondor.com>
2020-02-03mobile-widgets/qml: add TemplateButtonGravatar jan Iversen
Do "git mv SsrfButton TemplateButton", and search/replace all uses. The general idea of the templates are to secure common layout, but also to isolate the Kirigami parts (slowly) in the templates. Signed-off-by: Jan Iversen <jani@apache.org>
2020-02-03mobile-widgets/qml: add TemplatePageGravatar jan Iversen
Signed-off-by: Jan Iversen <jani@apache.org>
2020-02-04Dive site: ignore dive sites without location in proximity searchGravatar Berthold Stoeger
When editing a dive site, the user can search for close dive sites to merge duplicates. Dive sites without location are treated as being located at 0N0E. This makes no sense, because: When selecting a dive site without location, we shouldn't list dive sites close to 0N0E. Likewise when having a dive site close to 0N0E, we shouldn't list dive sites that have no location. Therefore, ignore these cases. This also means that now dive sites without location are not considered as close to other dive sites without location. That might be a debatable point. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-04Dive sites: select each dive site only onceGravatar Berthold Stoeger
After selecting dives, the selected dive sites are collected. This was done using the selectionModel()->selection().indexes(), which is wrong, because it gives one index per row *and* column. Accordingly, every dive site was added numerous times to the array of dive sites to be selected. Change this to selectionModel()->selectedRows(), which gives one entry per row. Moreover, if multiple dives with the same site were selected, this site was also added to the array multiple times. Therefore, check the array before adding sites. Note that all this should not change the user experience in any way, it is only a code-hygiene thing. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-04Coding style: PascalCase for classesGravatar Berthold Stoeger
Codify our unspoken practice in the coding style document. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-04Cleanup: rename plannerShared to PlannerSharedGravatar Berthold Stoeger
Usually, we use PascalCase (i.e. camelCase with a capital letter at the start) for class names. For consistency, let's do it here as well. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-04Dive site: inform map of selection in DiveFilter::setFilterDiveSiteGravatar Berthold Stoeger
When starting / changing the dive-site filter, inform the map of the changed dive site selection by calling MapWidget::instance()->selectionChanged(); This fixes a bug, where on clicking dive sites in the dive site tab the dive sites from the *previous* click were highlighted. Perhaps the selectionChanged() call should be put into the setSelected() call. But the data flow between the different parts of the dive-site and map code are so convoluted that I don't want to risk anything! Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-04Cleanup: lower-case filenames in core/subsurface-qt/Gravatar Berthold Stoeger
We tend to use lower-case filenames. Let's do it for these files as well. Simple search & replace. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-03GitHub Actions: use the official Ubuntu 18.04 containerGravatar Dirk Hohndel
Something is seriously wrong with the default Ubuntu 18.04 environment on GitHub Actions. C++ builds fail with very confusing messages about C++11 support. Switching to building in a Ubuntu 18.04 based container - that seems redundant, but it fixes the problem. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-03android: use non-broken version of qt-android-cmakeGravatar Dirk Hohndel
A recent merge upstream causes build faiilures because the PROJECT_VERSION variiable isn't defined. I can't figure out how to make sure that it is defined correctly, so hack around that by using the version prior to that merge. See https://github.com/LaurentGomila/qt-android-cmake/issues/33 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-31Remove plannerShared::instance()Gravatar Berthold Stoeger
This class contains only static functions (i.e. it does not contain any state). There does not seem to be a reason to have an instance of that class. Therefore, remove the instance() function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-31Cleanup: remove QMLInterface::instance()Gravatar Berthold Stoeger
QMLInterface::instance() is only used in one single place. This makes the whole notion of having a global instance of the object moot, isn't it? Simply make the object static to the function that uses it, which guarantees that the object will be created when the function is called. I.e. the same behavior is retained with less complexity. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-31Cleanup: connect QMLInterface signals in constructorGravatar Berthold Stoeger
It appears weird to connect the QMLInterface signal/slot combination in a static helper function. This generates a bunch of lambdas that call the instance() function. Instead, simply do the connections in the constructor as we do it in numerous other places. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-30divesummary: fix potential division by zeroGravatar jan Iversen
[Dirk Hohndel: extracted from a larger commit from Jan] Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-30mobile-widgets/qml/divesummary.qml: detect change in unitsGravatar jan Iversen
When either length or volume unit is changed, the text needs to be changed. Let signal lengthChanged and volumeChanged cause a recalcation and therefore new text. Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-30mobile: increment version numberGravatar Dirk Hohndel
In order to be able to roll out new betas, we need to first increment the version number. Given the magnitude of the changes, incrementing the minor version (not that we have ever been really consistent with how we do the numbering in the first place). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-30Cleanup: remove redundant(?) commentGravatar Berthold Stoeger
We don't have such a comment anywhere in the code base. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-30Profile: fill gas change context menu from current diveGravatar Berthold Stoeger
The gas change context menu was filled from the CylindersModel. This means that even before saving new cylinders, the user could add a gas change event to these cylinders. Instead, fill from the current dive. Fixes #2552. Reported-by: Doug Junkins <junkins@foghead.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-30Profile: transport gas id and timestamp via lambdaGravatar Berthold Stoeger
When adding a gas change event via a context menu, the gas-id and timestamp were passed in two distinct ways. 1) The gas id was extracted from the text of the action. This meant doing rather complicated parsing. 2) The timestamp was passed via the "user data" of the action, which means transporting via "QVariant". There is a much simpler way to pass arbitrary data, that is strongly typed: lambdas. Instead of shoehorning the data onto the action in an archaic way, we can simply connect to a stateful lambda. That's what they're for after all. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-30CylindersModel: don't crash if accessing non-existing cylinderGravatar Berthold Stoeger
It shouldn't happen, but currently we overwrite the displayed_dive without updating the CylindersModel. Thus, CylindersModel may now crash when the new displayed_dive has less cylinders than the old one. For now, catch this condition. Treat the root cause later. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-30mobile-widgets: emit signals for each colorGravatar jan Iversen
Emit signals for each standard color when theme changes. The iconStyle property was changed from being a constant, because it can change, and thus a signal was added. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-30mobile-widgets: correct empty linesGravatar jan Iversen
Remove extra empty lines in themeinterface.cpp just a cleanup, no functionality change. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-30mobile-widgets/qml: move fontMetrics to ThemeTestGravatar jan Iversen
fontMetrics is no longer used in production code, but still in the theme test page. Isolate fontMetrics in ThemeTest page. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-30mobile-widgets: do not use fontmetric for heightGravatar jan Iversen
In order to remove fontMetrics from QML, replace references (height) in DownloadFromDiveComputer and Settings Add include kirigami as needed Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-30mobile-widgets: move font property to themeInterfaceGravatar jan Iversen
Move setting of font properties used throughout to themeInterface. Add new settings "currentScale". The properties are kept in main (subsurfaceTheme) in order not to do a big search/replace. Update settings to use currectScale and signal changes in themeinterface. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-30mobile-widgets: move basePointSize to themeinterfaceGravatar jan Iversen
Check defaultfont and calculate basepointsize in themeinterface instead of in QML. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-30mobile/dive summary: rewrite statistics codeGravatar Dirk Hohndel
There were quite a few issues with the code - clearly a complete failure of code review. - all values were '??' if a period contained no dives - imperial units were not calculated at all - significant truncation and data loss in the way totals were added as meters and minutes instead of the higher precision data that is available - several issues in striing conversion methodology, e.g. missing zero padding for minutes - missing maxSac - incorrectly calculated avgSac - incorrectly claculated number of EANx dives - hard to read code with most variables named 'temp' Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-29mobile-widgets/qml: Fix Kirigami error.Gravatar jan Iversen
Solve kirigami error: INFO: qrc:/org/kde/kirigami/ScrollablePage.qml:187: TypeError: Cannot assign to read-only property "parent". Kirigami.scrollPage does not allow a ListModel be defined, even though it is allowed in QtQuick. Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-28divesummary: correct SAC calculationGravatar jan Iversen
Do not count dives where SAC == 0. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-28mobile-widgets/qml: add icon to dive summary entryGravatar jan Iversen
Add sigma icon to menu entry "dive summary". Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-28mobile icons: add sigma svgGravatar jan Iversen
Add svg sigma to be used for dive summary. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-28mobile-widgets: add dive_mode variable to QMLGravatar jan Iversen
Add dive_move variable to qmlinterface, to make it aviable to QML. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-28GitHub Actions: remove outdated libdivecomputer header filesGravatar Dirk Hohndel
We never noticed this before, but during the build of the Trusty Qt5.12 container itself we create libdivecomputer include files and we ship them with the container. And as the recent build failures after an incompatible API change in libdivecomputer show, those include files are apparently used in this build, not the ones that are newly created during the build. Obviously the build container needs to be fixed, but as a quick workaround, this should do. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-28mobile-widget/qml/Settings.qml: correct theme switchesGravatar jan Iversen
Replace subsurfaceTheme with ThemeNew, since there are still 2 objects subsurfaceTheme in main.qml and ThemeNew in themeinterface.* Replace theme color references with ThemeNew, as they are no longer available in main.qml (subsurfaceTheme). Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-28themeinterface: move registration to themeinterfaceGravatar jan Iversen
Move setup call and registration from subsurface-helper to themeInterface, in order to keep the registration where the code are. Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-27documentation: add line to CHANGELOG.mdGravatar jan Iversen
Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-27mobile-widgets/qml: integrate DiveSummary in menu.Gravatar jan Iversen
Add DiveSummary to globalDrawer Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-27mobile-widgets/qml: add DiveSummary.qmlGravatar jan Iversen
Add DivePlannerSummary, a page to show in dive centers. Allow user to select period for the 2 colums in DiveSummary. Default is "Total" and "3 month", but allowing the user to change these, make it a very simple tool to view how the user progresses. Variables are taken from Backend. [Dirk Hohndel: adjusted text strings as these aren't really months] Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-27divesummary: add DiveSummary class to shared and backendGravatar jan Iversen
Create DiveSummary class in backend-shared and make the DiveSummary calculation results available to QML. This adds a loop over all dives (could have been done with a model, but the models available to mobile are very limited, so use the basic way). [Dirk Hohndel: renamed the results variable and combined a couple of commits] Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-27mobile-widgets/qml: add background color propertyGravatar jan Iversen
Add property "colorBackground" to allow instances of templateLabel to have background color overwritten. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-27mobile-widgets/qml: correct spelling errorGravatar jan Iversen
Correct spelling error in TemplateTitle. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-27core/qtserialbluetooth.cpp: use QEventLoop for pollingGravatar Lubomir I. Ivanov
The Qt docs here: https://doc.qt.io/qt-5/qbluetoothsocket.html#details and here: https://doc.qt.io/qt-5/qabstractsocket.html#waitForReadyRead say that waitForReadyRead() does not work for QBluetoothSocket and that it's flaky on Windows for the underlying QAbstractSocket. Use a QEventLoop and a QTimer to poll the readyRead() signal. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2020-01-27rfcomm: make Windows use QtBluetooth tooGravatar Linus Torvalds
Windows had it's own direct socket implementation for rfcomm (ie legacy BT), while all the other platforms used QtBluetooth. This makes Windows do the same thing. Hopefully modern Qt libraries now work well enough on the Windows platform for this to work, but I can't test it. We can make a test build that Windows people can try, though. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-01-27Update to new libdivecomputer versionGravatar Linus Torvalds
Jef has changed the libdivecomputer iostream layer and extended it in two different ways: - iostram's now have a 'poll()' method, which does what the name implies: waits for data to be available with a timeout. - iostreams now have a 'ioctl()' method, which can be used to implement miscellaneous operations. Right now the two ones that you can do are "set latency" (this replaces the old 'set_latency()' method) and "get BLE name" (this replaces our 'get_name()' method that was never part of the upstream libdivecomputer interfaces) Neither of these is all that complicated, and the transition is fairly obvious. HOWEVER. I have absolutely no idea how to do 'poll()' on Windows sockets, and I have no intention of figuring it out. We use a direct socket interface to implement the (non-BLE) RFCOMM bluetooth serial protocol, and I'm not sure why Windows is so special here. I suspect - but cannot test - that we should just switch the Windows RFCOMM implementation over to the use the same QtBluetooth code that we use on other platforms. I assume that the Windows Bluetooth support was originally not sufficiently good for that, but these days we depend on Qt doing BLE for us even on Windows, so presumably FRCOMM works too. That would be a nice cleanup, and would make 'poll()' work on RFCOMM under Windows too. However, since I can't test it, I've not done that, but instead just made the Windows RFCOMM 'poll()' method always return success. That may or may not get the thing limping along. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>