aboutsummaryrefslogtreecommitdiffstats
path: root/core
AgeCommit message (Collapse)Author
2020-02-11Filter: implement starts-with and exact modesGravatar Berthold Stoeger
Currently, we do substring search. Implement starts-with and exact mode (for example when search for "Cave vs. Cavern" tags). For each textual search criterion add a combo-box. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-09Correcting typos of the word celsiusGravatar Jason Bramwell
Corrected typo of the word celsius in three files: core/import-csv.c core/divefileter.h mobile-widgets/qml/Settings.qml These were spelled as celcius but corrected these to celsius. The 'core files were just comments but the mobile-widgets file would be 'active' code. Reported by: tormento <turment@gmail.com> Signed-off-by: Jason Bramwell <jb2cool@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-09Cleanup: remove const bool parameters and return typesGravatar Berthold Stoeger
These just make no sense. Since the value is copied, it has no meaning to the caller whether the function can change the value (and vice versa for return types). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-08Cleanup: remove erroneous commentsGravatar Berthold Stoeger
Remove two erroneous comments stating that a function-local QSettings variable should not be static because it is initialized too early. Scoped static variables are initialized when execution first hits the statement. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-08core/settings: add new preference to limit number of columns on mobileGravatar Dirk Hohndel
The idea is that in portrait mode we can force the display to be single column (which makes sure that the profile in dive display mode is nice and big). This commit only implements the preference variable that we need for that. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-08mobile/summary: implement firstDiveDate and lastDiveDateGravatar Berthold Stoeger
Instead of transporting the global first and last dive date in the dive summary, calculate it in an external function. Since we already have time and date functions in qthelper.cpp implement those functions there. Provide a stub in QMLInterface so that QML can access these standalone functions. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-06Gps coordinates: be more graceful when parsing coordinatesGravatar Berthold Stoeger
Some Wikipedia pages use special (non-ASCII) unicode symbols for representing the " and ' separators. Before parsing, replace these by the ASCII symbols to enable copy & paste from Wikipedia (and other sources?). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-06Coding style: remove braces around single-line if blocksGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-06Coding style: move & from type to variableGravatar Berthold Stoeger
Trivial white-space cleanup according to coding style document. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-06CSV import: fix importing ampersand characterGravatar Miika Turkia
As we do XSLT parsing for the CSV import, ampersand characters need to be encoded with &amp; for the parsing to succeed. Fixes #2037 Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
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-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>
2020-01-26code cleanup: QLatin1Literal is deprecated in Qt 5.14Gravatar Dirk Hohndel
Simply replace it with QLatin1String. There is a tiny performance penalty, but none of that code would care. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-25Parse GPX dive coordinates: Qt XML frameworkGravatar willemferguson
This replaces the C-code XML parsing with a Qt infrastructure. QXmlStreamReader is used to parse the GPX file. It also takes into account comments by @neolit123 Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2020-01-24core: move GPX parsing into coreGravatar Dirk Hohndel
This shouldn't be part of the desktop UI code; there's still the issue that we really shouldn't hand code XML parsing, but I'll leave that for later. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20core/settings: removed unnecessary ifGravatar jan Iversen
prefs.unit_system is set at the top, so no need to set it again. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20core/settings: correct signal errorGravatar jan Iversen
prefs.unit = x needs to be after the setters are called, otherwise the setter will not do anything, and result in an inconsistency between the values stored on disk and in prefs.units. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20core/settings:: remove string functions for unitsGravatar jan Iversen
Remove string version of unit_system, duration_units, length, pressure, temperature, vertical_speed_time, and volume, including tests and make signals strongly typed in C++ Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20core/settings: allow signals to be strongly typed in C++Gravatar jan Iversen
Register enums to allow them to be used in signal handlers instead of int. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-18mobile-widgets: make cloud_verification_status type proof in QML.Gravatar jan Iversen
Add CLOUD_STATUS enum to interface. Add cloud_verifification_status variable to interface, and make it strongly typed in QML. using backend.cloud_verification_status = 1 will fail but backend.cloud_verification_status = backend.CS_UNKNOWN is correct. Added note to the original definitions of the enums that they have been duplicated. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-18mobile-widgets: add pure interface for passing values to QMLGravatar jan Iversen
Add a header file that contains a duplicate of the enums, that are needed in QML in one class. the unit enums are added imidiatly, since they are needed or will be neede shortly in Settings and DivePlannerSettings This class will also contain Q_PROPERTY and signal/slot for variables used in QML. This is done to allow e.g. deco_mode qPrefUnits::planner_deco_mode() void qPrefUnits::set_planner_deco_mode(deco_mode) as strongly typed in C++ and DECO_MODE planner_deco_mode() void set_planner_deco_mode(DECO_MODE) as strongly typed in QML Remark: wrong assignments gives errors in QML The advantage over using strings or the value directly is that QML detects typos and flags them as errors/warnings. It is important to note that the class may only contain a) a function call to the implementation b) a reference to a global variable e.g. prefs. Added note to the original definitions of the enums that they have been duplicated. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-17core/settings: remove PrefClearDC because not used.Gravatar jan Iversen
PrefClearDC was registred with the wrong object, but also is not used. Remove registration. Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-17core/settings: correct copy/paste error.Gravatar jan Iversen
The registration for several Pref* point at wrong C++ object, correct the paste error. Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-10code cleanup: add empty table structuresGravatar Dirk Hohndel
It seemed to make sense to combine all three types in one commit. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10code cleanup: use explicit zero_locationGravatar Dirk Hohndel
Again, several different ways to achieve the same thing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10code cleanup: use gasmix_air for zero initialized gasGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10code cleanup: consistently initialize zero duration_tGravatar Dirk Hohndel
There were three different ways (two of which generated warnings) in a single source file. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10code cleanup: introduce empty_cylinder constantGravatar Dirk Hohndel
This deals with the issue of initializing structs in C++. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10code cleanup: replace created() with birthTime() for Qt >= 5.10Gravatar Dirk Hohndel
We still support Qt5.9 for now, so we need the version check as birthTime() wasn't available in 5.9. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-06core: read and write the user-specified salinityGravatar willemferguson
Both XML and git storage are added. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-06desktop UI: create the UI components for editing the salinity.Gravatar willemferguson
The user may modify the salinity by selecting a water type from the combobox. The new datum does not replace the existing salinity value but is stored in a separate variable within the dive structure. If the dc-based salinity is overwritten, there is an exclamation mark next to the modified salinity value to indicate that the salinity has been overwritten. The dc-derived salinity can always be recovered by selecting the "use dc" option in the combobox. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-06desktop UI: add preference for making salinity editableGravatar willemferguson
Create a checkbox in the Preferences: General screen that enables or disables editing of the salinity data. This preference is saved with all the other preferences. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-05Fix get_divemode logicGravatar Robert C. Helling
Commit dbb504 tried to prevent an uninitialized dc pointer from being dereferenced. But I screwed up the logic always setting the event pointer to NULL. This fixes this error. Reported-by: willemferguson@zoology.up.ac.za Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-01-04core/settings: qPrefUnit, secure original signal gets emittedGravatar jan Iversen
When using the string setters, the original signal should still be emitted. Change to call original setter in string setter. Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-04core/settings: force sending of signal when unit type changesGravatar jan Iversen
When changing between METRICS <-> IMPERIAL, all type signals are emitted. This may cause double sending of some signals, but all signals will be emitted at least once. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-04core/settings: change measurements when changing metric/imperialGravatar jan Iversen
When switching between imperial/metric it is important to change the single measurements as well (e.g. METER <-> FEET). Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-04core/settings: split "normal" version of unit_systemGravatar jan Iversen
All unit functions have a string version and a normal version, except unit_system. Make a non string version of unit_system. Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29tests: fix TestQPrefLogGravatar Dirk Hohndel
There were several issues with these tests, including checking the value argument against bool values even if the underlying preference isn't bool. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-27core/settings: make qPrefUnit accesable from QMLGravatar jan Iversen
Use string literals to communicate with QML. Instead of passing arounds enum/int value, it seems easier to pass string literals to QML and have that code respond to those Signed-off-by: Jan Iversen <jani@apache.org>
2019-12-27core: use set_lang_locale to modify prefs.locale.lang_localeGravatar jan Iversen
Do not set prefs.locale_lang_locale directly, but do it indirectly through qPrefLanguage::set_lang_locale(), to ensure the file plist is consistent with prefs. the difference (prefs. contra plist) cause surprises when restarting mobile (and playing with language). Signed-off-by: Jan Iversen <jani@apache.org>
2019-12-25Preferences UI: final cleanupGravatar willemferguson
This commit does some final cleaning up to the code, mostly deleting white space and comments. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-25Preferences UI: add dive log tabGravatar willemferguson
This adds a tab for dive log - related preferences. A suitable test programs is still required. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-25Preferenced UI: add dive download tabGravatar willemferguson
Add a preferences tab for dive download, allowing resetting the buttons representing download connections in the Download panel. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-25Pereferences UI: add media tabGravatar willemferguson
Remove the preference settings dealing with thumbnails (currently under General preferences and Profile preferences) and put them in a newly-created Media preference tab. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-25Preferences UI: create new equipment tabGravatar willemferguson
Remove the "Show unused cylinders" checkbox (Profile tab) and the "Set default cylinder" qTextEdit box (General tab) and put them in a separate and new Equipment tab. This sounds like a simple task but, as can be seen from the files changed, was actually a complex matter. Adapt the existing test programs (General and TechDetails) for creating a test program that tests parts of the Equipment tab. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-24build-system: move plannerShared to backend-sharedGravatar jan Iversen
WARNING: multi directory commit, needed to secure it builds. move the core/plannerShared.* to backend-shared. update CMakeLists.txt to include backend-shared lib in link process. update ios project to reflect new directory Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-24build-system: move exportfuncs to backend-sharedGravatar jan Iversen
WARNING: multi directory commit, needed to secure it builds. move the core/exportfuncs.* to backend-shared. update backend-shared/CMakeLists.txt to generate backend-shared lib update CMakeLists.txt to include backend-shared lib in link process. update ios project to reflect new directory Signed-off-by: Jan Iversen <jan@casacondor.com>