aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
AgeCommit message (Collapse)Author
2018-04-01Dive pictures: Move metadata functions into own translation unitGravatar Berthold Stoeger
Move all metadata function into new core/metadata.cpp file. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-19Profile heatmap/heartrate: Only enable max one of these at same timeGravatar Stefan Fuchs
Only allow to enable maximum one of both items tissue heatmap or heartrate in profile. This is done by always switching off the other one at the moment you turn on one of the two items (heatmap or heartrate). Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-03-19Cleanup: Initialize variable MainTab::lastSelectedDiveGravatar Berthold Stoeger
This variable was read before being set. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-14Cleanup: consistently use toUtf8() instead of toLocal8Bit()Gravatar Berthold Stoeger
These do the same, since the text-codex is set to UTF-8 on startup. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-14Cleanup: introduce copy_qstring() functionGravatar Berthold Stoeger
strdup(qPrintable(s)) and copy_string(qPrintable(s)) were such common occurrences that they seem worthy of a short helper-function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-14Cleanup: consistently use qPrintable()Gravatar Berthold Stoeger
Replace constructs of the kind s.toUtf8().data(), s.toUtf8().constData(), s.toLocal8Bit().data(), s.toLocal8Bit.constData() or qUtf8Printable(s) by qPrintable(s). This is concise, consistent and - in principle - more performant than the .data() versions. Sadly, owing to a suboptimal implementation, qPrintable(s) currently is a pessimization compared to s.toUtf8().data(). A fix is scheduled for new Qt versions: https://codereview.qt-project.org/#/c/221331/ Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-05Cleanup: Fold add_hash() call into learnHash() functionGravatar Berthold Stoeger
learnHash() was always called in conjunction with add_hash(). The pattern was that a local filename and a hash were connected in the hash-to-filename and the filename-to-hash maps. Then, the original picture-filename or url were registered in the filename-to-hash map. This commit changes learnHash() to take three parameters (original-filename, local-filename and hash) and do all of the above. The new code is simpler because no dummy picture struct has to be generated in DiveListView::loadImageFromURL(). The tests were extended to check for all hash<->filename associations. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-05Configure DC dialog: Always correctly set update firmware buttonGravatar Stefan Fuchs
Always set the update firmware button correctly based on DC model. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-03-05Configure DC dialog: Add a few missing translationsGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-03-05Configure DC dialog: Change order of DCs and correct namesGravatar Stefan Fuchs
In the configure dive computer dialog change the order of the DCs (all HW first, then Suunto) and correct the names of some HW DCs (make them the same as in the "download from DC selection list"). Plus added the OSTC Plus to the list of supported DC. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-03-04Indentation fix in desktop-widgets/downloadfromdivecomputer.cppGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-03-04Correctly spell OSTC cRGravatar Stefan Fuchs
Correctly spell OSTC cR (wrong: "Cr") in two files. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-03-02Choose water presets from a qcombobox in planner, custom value possibleGravatar Oliver Schwaneberg
Add a combo box for water types with defaults for fresh water, sea water and the EN 13319. All values taken from units.h, where EN 13319 was added beforehand. Custom values can be entered through a spinbox. Also changed "Salinity" in TapDiveInformation.ui to "Water type". Translation required! Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
2018-02-26Move icd preference settingGravatar Willem Ferguson
Move the icd preference setting to the preference group that deals with gas pressures. I also reorganised the existing items so that the items within the pressure widget are logically arranged according to the grid layout. The order of items was very haphazard. No change of code at all in this reorganisation. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-02-26Cleanup: remove two unused macros in tabwidgets/maintab.cppGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-02-26Cleanup: Use QString as parameter for [get|save]BtDeviceInfo()Gravatar Berthold Stoeger
Each callsite of saveBtDeviceInfo() has a QString, which is converted to a C-string, passed and immediately converted back. Remove these conversions by taking a reference to QString directly. getBtDeviceInfo() is not as clear. Here, the callsite has a C-string handed down from libdivecomputer. Nevertheless, pass a reference of QString here as well. Firstly, for reasons of symmetry. Secondly, to avoid multiple conversions in the getBtDeviceInfo() functions. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-02-24Use temperature_t for temperatures in struct stats_tGravatar Stefan Fuchs
Use struct temperature_t for temperatures in struct stats_t and use get_temperature_string() when printing these temperatures for statistics and HTML export. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-02-22In configure DC dialogs don't use a space between values and unitsGravatar Stefan Fuchs
In the configure dive computer dialogs remove all the spaces between values and units. This makes it consistent with the standard used all over the Subsurface UI. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-02-17Consistently use the famous l for liters in info tabGravatar Stefan Fuchs
For salinity in info tab change the l character to the famous Subsurface "ℓ". Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-02-17Coding-style: remove superfluous parenthesesGravatar Berthold Stoeger
Mostly replace "return (expression);" by "return expression;" and one case of "function((parameter))" by "function(parameter)". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-02-11Cleanup: fix emits in WinBluetoothDeviceDiscoveryAgentGravatar Berthold Stoeger
As far as I know, Qt's emit is defined to nothing. Thus, the construct "emit(lastError);" is compiled to "(lastError);", which is a no-op. Obviously "emit error(lastError)" was meant. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-02-11Cleanup: use constructor directly instead of move-assignmentGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-02-10Add a preference to turn on ICD warningsGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-02-04downloadfromdivecomputer.cpp: remove unused variable err_stringGravatar Berthold Stoeger
This was a relict from Gtk days. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-02-04Cleanup: Remove redefinition of DC_TRANSPORT_BLUETOOTHGravatar Berthold Stoeger
This transport option was defined at a time where libdc didn't know anything about bluetooth. Nowadays, this enum is defined by libdc to a different value. Since it is never returned from libdc, not a problem at the moment. But this looks like a recipe for desaster, therefore let's just use the libdc version. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-02-04Do not remove seconds from duration input fieldGravatar Oliver Schwaneberg
This change deals with issue #554. If you enter a dive duration manually, the cell renderer cuts the seconds away when the changes are saved. I added the helper "render_seconds_to_string" as a counterpart to "parseDurationToSeconds". The helper keeps the seconds, if not null. The rendering of the cell is done at two places in the code, so I think it is cleaner to add a dedicated method for it. Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
2018-02-02Free various struct membuffer in different functionsGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-01-31Make report_error() reentrantGravatar Berthold Stoeger
Remove the global error buffer and pass the error string directly to the frontend. The frontend is then responsible for accumulating errors. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-31Remove unnecessary check for MainWindow instanceGravatar Berthold Stoeger
The error-callback is installed in the MainWindow constructor. Therefore, in the error-callback the existence of the MainWindow instance is guaranteed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-31Use queued connection to thread-safe MainWindow error handlingGravatar Berthold Stoeger
Up to now, errors produced by threads were not directly shown in the MainWindow. Code running in the GUI thread had to manually show the errors. This can be simplified by using Qt's queued connection as message passing facility. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-31Make future_watcher a subobject of NotificationWidgetGravatar Berthold Stoeger
This was a raw pointer. No point in doing error-prone manual memory management. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-27Use correct alias for satellite icon for revers geo lookupGravatar Stefan Fuchs
Bring back the satellite icon for the reverse geo lookup by using the correct alias name. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-01-18Whitespace onlyGravatar Jan Mulder
Now that we properly return when raising an error, do not if () else if(). Useles. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-18Fix preferences handling with invalid passwordsGravatar Jan Mulder
This fixes 2 problems related to entering passwords with illegal characters in it: 1) Do not save an invalid password in the preferences, but keep the old one. 2) On password change, check both old and new password for format validity instead of pushing an invalid password to the server that has to ignore it. Fixes: #1048 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-18Fix PreferencesNetwork::passwordUpdateSuccessful slotGravatar Berthold Stoeger
In preferences_network.cpp, the CloudStorageAuthenticate::passwordChangeSuccessful signal was connected to the PreferencesNetwork::passwordUpdateSuccessful slot. This never worked, because passwordUpdateSuccessful() was declared as a normal member function, not a slot (hooray for Qt's weird runtime-checked signal system). While touching this code, change the weird SIGNAL/SLOT macros to actual member function, to at least get *some* compile-time checks. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-13Resize progress bar width to fit all textGravatar Robert C. Helling
At least on Mac with larger font sizes part of the label text of the git access progress bar is cut off (even though it should automatically resize). This patch adds explicit resize. Fixes #1041 Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-01-11Use helper function empty_string() instead of manual checksGravatar Berthold Stoeger
For code consistency, substitute boolean expressions: s && *s -> !empty_string(s) s && s[0] -> !empty_string(s) !s || !*s -> empty_string(s) !s || !s[0] -> empty_string(s) Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-11Introduce helper function empty_string()Gravatar Berthold Stoeger
There are ca. 50 constructs of the kind same_string(s, "") to test for empty or null strings. Replace them by the new helper function empty_string(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10Unused code: GroupedLineEdit::removeAllColors()Gravatar Jan Mulder
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-08Remove redundant setting of prefs.git_local_onlyGravatar Berthold Stoeger
In MainWindow::on_actionCloudOnline_triggered(), prefs.git_local_only was set twice in the case of going online. Remove the second, unnecessary, assignment. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-08Move resetting of current file out of clear_dive_file_data()Gravatar Berthold Stoeger
This is the only case where C-code sets the current file. Remove this call for a better separation of C-backend and C++-frontend parts. There were four callers of clear_dive_file_data(). Two of them would call set_filename() anyway. For the remaining two add an explicit call to set_filename(). This commit fixes a bug introduced in commit b3901aa8f90499ee2a34efdddc2463105afc53f1: The cloud-online menu entry was still enabled after "closing" the cloud storage. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-08Refactor CSV importGravatar Miika Turkia
Move CSV import related functions into import-csv.c. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-06Remove cloud_background_sync preferences optionGravatar Berthold Stoeger
The preferences flag cloud_background_sync used to be used heavily in the mobile code, but is not used there anymore. Now, it is accessed only in one place, but does not do what it actually says: If it is off, the remote storage is not synced on save (but will be synced on next load). Syncing on save can also be prevented by unchecking the "Cloud online" menu checkbox. Since the latter seems more logical and general (support for non-cloud remote git repositories), remove the cloud_background_sync option. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-06Enable cloud-online menu entry only if connected to cloudGravatar Berthold Stoeger
Enable the menu item cloud-online only if the current file is the cloud storage. Since this has to be checked every time the current file is set, factor this out into the new MainWindow::setCurrentFile() function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-06Turn take-cloud-online menu action into checkboxGravatar Berthold Stoeger
Replace the "Take cloud storage online" menu entry by a "Cloud online" checkbox. After this change, the user can also force going offline. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-06Sync cloud storage on take-cloud-onlineGravatar Berthold Stoeger
When taking the cloud online, actually sync with the online cloud storage. If there are no unsaved changes, do the same as "Open cloud storage". If there are unsaved changes, ask the user if they want to commit them (do the same as "Save to cloud storage") or if they want to sync manually. If syncing failed, inform the user. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-06Do not save WebserviceID in preferences until asked forGravatar Jan Mulder
Do not save the WebserviceID in the preferences until we ask for this. That is simply wrong. This is definitely not a full fix for all the weirdness that is going in related to the WebserviceID but saving the ID even if we do not ask for it, adds to possible confusion. To always automatically pull in the ID from the server based on cloud credentials, just leave the ID field empty in the network preferences. Fixes: #1013 (well ... a tiny part of this mess) Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-06cleanup: use new urlsGravatar Jan Mulder
Just rename some old hohndel.org urls Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-06cleanup: localize global variableGravatar Jan Mulder
Not needed to be global. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-06GPS: use applyGpsLocation::applyLocations from coreGravatar Jan Mulder
Fixes a big duplication of code. The code to apply GPS locations from the location service was already in core, and used from mobile, but there was an almost literal copy in the desktop code. See also commits 6f42ab46da1b59 and ee9531f76ec31a, where only one side of the duplicated code was fixed. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>