aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
AgeCommit message (Collapse)Author
2018-06-17Fix an error around translation of dive modes in the UIGravatar Stefan Fuchs
This fixes an mistake introduced in 3d1072f8862e4c329dc2678df52a24137b8d4704 Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-06-17desktop: better handling of progress dialog widthGravatar Dirk Hohndel
We shouldn't need to manually set it, but it appears we do. To avoid constant resizing, let's only grow it - and let's set the size before we update the text. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-16Cleanup: Don't clear WA_QuitOnClose attribute on dialogsGravatar Berthold Stoeger
According to Qt's documentation, the application exits if all windows with the WA_QuitOnClose attribute are closed. This attribute was cleared for three dialogs. This seems not necessary because: 1) The application can't be closed as long as the modal dialog is shown. 2) The flag only concerns primary windows, which these are not. See: http://doc.qt.io/qt-5/qguiapplication.html#quitOnLastWindowClosed-prop Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-06-09Cleanup: make lastUsedDir() functions static and non-slot, respectivelyGravatar Berthold Stoeger
The lastUsedDir() functions of MainWindow and Smrtk2ssrfcWindow don't use any member-objects and are only used in their respective translation units. Therefore, remove them from the class and made of static linkage. The lastUsedImageDir() function was declared as a slog, which makes no sense. Make it a normal static function (though one might argue why it is assiociated with the DiveListView class in the first place). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-06-04Cleanup: fold core/helpers.h into core/qthelper.hGravatar Berthold Stoeger
helpers.h included qthelper.h and all functions declared in helpers.h were defined in qthelper.h. Therefore fold the former into the latter, since the split seems completely arbitrary. While doing so, change the return-type of get_dc_nichname from "const QString" to "QString". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-31Desktop: Derive UserManual from QDialogGravatar Berthold Stoeger
In commit d21d42b69117aae04b68ecc9cc2139e034bde146 helpView was made a child-object of MainWindow, which is Qt's idiomatic way of having helpView deleted with MainWindow. As an unintended consequence, the helpView didn't show. The reason is that UserManual derives directly from QObject. In contrast, UserSurvey derives from QDialog and is correctly shown. Therefore also derive UserManual from QDialog. Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-28Distinguish between user and internal divemode namesGravatar Robert C. Helling
The former should be translated but not those that go to xml/git. ... and fix capitalization of pSCR. Suggested-by: Stefan Fuchs <sfuchs@gmx.de> Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-05-27Dive pictures: automatically recalculate thumbnailsGravatar Berthold Stoeger
If a thumbnail and the original picture can be accessed and the modification date of the thumbnail is before the modification date of the picture, recalculate the thumbnail. This causes more disk access and might give strange effects for picture files with messed up file timestamps (i.e. lying in the future) or messed up computer clocks (i.e. running in the past). Therefore, add a preference option to disable the new behavior. Default is set to enabled. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-27Dive pictures: give user option to recalculate thumbnailsGravatar Berthold Stoeger
Even though hashes of image contents are calculated, the hashes are not compared to actual file contents in routine-operation. Therefore give the user the option to recalculate thumbnails, should they have edited the picture. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-26Cleanup: remove three instances of deleteLater() in mainwindow.cppGravatar Berthold Stoeger
deleteLater() can be dangerous. Remove where not necessary. Analysis: 1) `helpView` was a pointer which was initialized on demand. close() and deleteLater() were called on closure of the main window. Firstly, there's no point in calling deleteLater(), because no references to helpView are used later on. Secondly, the deletion (and closing) can be done automatically in the destructor, by passing `this` as parent object. 2) `survey`: pretty much the same situation. But here, `this` was already passed as parent object. 3) `progressDialog` is a global (not thread safe!) pointer. The object is deleted after use. There is no point in using deleteLater(), because the callers are not active after hideProgressBar(), which is the place were the deleteLater() call was found. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-25Cleanup: Don't defer deletion of oldModel in DiveListView::reload()Gravatar Berthold Stoeger
There seems to be no point in using deleteLater() of the previous model. Set the new model and delete the old one. This fixes a crash with Qt 5.11. Tested-by: Gaetan Bisson <bisson@archlinux.org> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-24desktop-widgets: replace (void) with no parameter nameGravatar jan Iversen
Unused parameters in C++ are "silenced" by removing the name. Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-23Fix includes for building against Qt-5.11.0Gravatar Gaetan Bisson
Signed-off-by: Gaetan Bisson <bisson@archlinux.org>
2018-05-21desktop-widgets/statistics: Change Q_UNUSED to no parameter nameGravatar jan Iversen
C++ permits use of parameters without name, which signals unused Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-21desktop-widgets/.../facebook: Change Q_UNUSED to no parameter nameGravatar jan Iversen
C++ permits use of parameters without name, which signals unused Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-21desktop-widgets: Change Q_UNUSED to no parameter nameGravatar jan Iversen
C++ permits use of parameters without name, which signals unused Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-21Dive pictures: change removePicture() interfaceGravatar Berthold Stoeger
The function removePicture() had a flag "last", which would indicate that the called had finished removing pictures. Only then would the model be recalculated. This is a strange interface and, matter of fact, the caller was buggy: if the last picture to be removed didn't have a proper url, removePicture() was never called with "last" being set. Change the interface to take a list of pictures to be deleted. This will allow us to make picture deletion smarter in follow-up commits. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-17Dive pictures: Don't plot pictures twice when changing current diveGravatar Berthold Stoeger
In MainWindow::current_dive_changed() first plotDive() is called, which replots all the pictures by calling plotPictures(). This is pointess, because it plots the pictures of the previous dive. Then, updateDiveInfo() is called, which resets the dive pictures and automatically replots them. Thus, switching between dives both with hundreds of pictures is way slower than necessary. Switching the plotDive() and updateDiveInfo() calls doesn't work. The reason is not 100% clear, but it doesn't make sense to plot pictures of the new dive as long as the profile still shows the old dive anyway. As a quick-fix, add a flag to plotDive(), which tells the function to clear the pictures list instead of redrawing it. Ultimately, plotDive() should probably be split in two functions. One for the callers who update the pictures themselves and one for the others. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-14Planner: Add combo box for dive mode selectionGravatar Robert C. Helling
I am not really sure what I am doing here but I copied code from the gas selection. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-05-14Rename enum dive_comp_type to divemode_tGravatar Robert C. Helling
...as the usuage is not anymore about a computer but a momentary dive mode. Rename the end indicator as well. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-05-14Cloud-storage: consistently don't save empty file on desktop versionGravatar Berthold Stoeger
Make the behavior consistent: Don't save an empty file to the cloud, neither on selection of "Save to cloud" nor on "Save". The latter was not the case. It was a bit hard to trigger: Open cloud, delete all dives, save. Fixes #1228 Reported-by: Jan Iversen <jani@apache.org> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-14Core: remove dive.h from files that don't need itGravatar Dirk Hohndel
Of course, quite a few of them indirectly get it through other header files. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-05-14Core: introduce new subsurface-string headerGravatar Dirk Hohndel
First small step to shrinking dive.h. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-05-13Dive pictures: Update pictures when thumbnails are readyGravatar Berthold Stoeger
Connect the thumbnailer signal to the dive picture model slot. This needs some code-reshuffling in the dive picture model. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-13Desktop: On dive edit from the dive list or map, switch to new stateGravatar Berthold Stoeger
If "Edit dive" is selected from the dive list or the map view, switch to a new mode, which shows the dive infos and the profile. After the edit, switch back to the previous state. Fixes #1213 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-13Desktop: Make "Edit dive" menu entry work for downloaded divesGravatar Berthold Stoeger
Confusingly, "Edit dive" did only work for planned / manually entered dives. Change this, but only start profile-editing for planned / manually entered dives. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-11Fixed erroneous comparison of cylinders and weight systems.Gravatar Oliver Schwaneberg
Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
2018-05-11Corrected file name "weigthsysteminfomodel" to "weightsysteminfomodel"Gravatar Oliver Schwaneberg
Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
2018-05-10Removed a duplicate include in maintab.cppGravatar Oliver Schwaneberg
Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
2018-05-04Desktop: fix time format in main tabGravatar Dirk Hohndel
Fixes #1234 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-05-01CSV import: include visibility and rating in importGravatar Miika Turkia
Add support for visibility and rating to CSV import dialog. Fixes #1212 Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-05-01CSV import: parse (unit) style headersGravatar Miika Turkia
Commit fc010456 introduced the units to column headers. Thus the matching of these labels must take the unit into account when doing automatic matching of the header line with our field naming. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-04-28Plot OC-pO2 graph for SCR divesGravatar Willem Ferguson
This commit allows plotting the OC-equivalent pO2 graph for PSCR dives. This happens in both the cases where there is no external O2-monitoring AND when there is external pO2 monitoring. The calculations are only done for PSCR dives and is achieved as follows: 1) Within plot-info create a pressure-t called OC_pO2 in profile.h and populate this variable with the open-circuit pO2 values in profile.c. 2) Create a new partialPressureGasItem ocpo2GasItem in profilewidget2.h and, in profilewidget2.cpp, initialise it to read the plot-info OC_pO2 values and enable its display by using the setVisible method. The diveplotdatamodel was also touched in order to achieve this. 3) Create a pref button that controls the display of OC-pO2 for SCR dives 4) Change the colour of the OC-pO2 grpah to orange 5) Change the connection of the crr_OC_pO2 signal to be appropriate 6) rename the OC_pO2 attribute to scr_OC-pO2 Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-04-27Configure ostc3: Remove obsoleted settingGravatar Anton Lundin
In firmware version 2.97 the setting 0x38, SETPOINT FALLBACK, has bin obsoleted and we get a error when trying to write to it. This removes this setting. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2018-04-24Convert our custom IO model to new libdivecomputer IO modelGravatar Linus Torvalds
This converts our old custom IO model to the new model that libdivecomputer introduced. This is partly based on Jef's rough patch to make things build, with further work by me. The FTDI code is temporarily disabled here, because it will need to be integrated with the new way of opening devices. The ble_serial code goes away entirely, since now libdivecomputer knows about BLE transport natively, and doesn't need to have any serial wrapper around it. Signed-off-by: Jef Driesen <jef@libdivecomputer.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-04-19CSV import: fix setpoint (typo)Gravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-04-09Change taglist_get_tagstring to support 'unlimited' tag list sizeGravatar Jeremie Guichard
Previous taglist_get_tagstring signature/implementation did not allow handling of cases where inputted buffer could not contain all tags. New implementation allocates buffer based on pre-computed size allowing to insert all tags in the returned string. Added get_taglist_string in qthelper to handle conversion to QString Added TestTagList with tests for taglist_get_tagstring Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2018-04-04Add "Tags" column in Desktop app's dive list viewGravatar Jeremie Guichard
Add DiveItem::displayTags helper method to return Tags as a QString New Tags column is by default inserted before "Photos" column by default disabled Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2018-04-03Revert "GPS: use applyGpsLocation::applyLocations from core"Gravatar Dirk Hohndel
This reverts commit 70e0e80de5470216df939f994ffda0222560def0. This caused the GPS workflow to break for Linus. Let's revert for 4.7.8 and figure out how to do this cleanup correctly, later. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-03Revert "cleanup: localize global variable"Gravatar Dirk Hohndel
This reverts commit fc7729eb78e7dae803546b3cc0011260e779a2e8. This caused the GPS workflow to break for Linus. Let's revert for 4.7.8 and figure out how to do this cleanup correctly, later. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>