aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
AgeCommit message (Collapse)Author
2018-09-07Cleanup: constify get_units()Gravatar Berthold Stoeger
get_units() returns a pointer to the units struct in the preferences. Callers should not modify the preferences via this struct, therefore make the return value point to const. This is a small step in constifying the global preferences structure. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-04Desktop: buddies in the dive listGravatar Jan Mulder
As proposed in RFC #1587, now also alllow buddies to be shown in the divelist. Fixes: #1587 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-01Desktop: allow using a file dialog to find Garmin folderGravatar Dirk Hohndel
If we don't auto-detect where the Garmin Descent is mounted, the user can either just type in the correct path, or can use a file diealog to specify it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-01Desktop: fix warnings when building preferences UIGravatar Dirk Hohndel
Fixes #1618 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-01Cleanup: make DiveTripModel a global objectGravatar Berthold Stoeger
DiveTripModel (the model describing the dive-list) was destroyed and recreated on every reset of the list. This seems excessive. Instead - in analogy to most other models - make it a single global object. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-31Filter: remove diveSiteAdded signal of MainTabGravatar Berthold Stoeger
Signals can be useful. In this case, a simple function call does it. Thus, remove the signal. It can be readded later at an more appropriate place. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-29Dive trips: don't crash on repeated trip-removalGravatar Berthold Stoeger
In the UI it is possible to remove a dive from a trip twice, which leads to a crash, because trip is NULL (obviously). Instead of doing a proper fix (don't show the "remove from trip" entry in the first place), ignore dives without a trip, since a rewrite of the undo-code is planned for the medium future anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-29Revert "desktop-widgets: remove QSettings from desktop-widgets"Gravatar Dirk Hohndel
This reverts commit 321a920a9873a3828a24c1b28cf8eb5fe1bff2cb. It appears that the load_xxx functions aren't called, so while the correct values are stored to the settings, they aren't retrieved. Let's revert while this gets fixed. Fixes #1609 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-28Cleanup: we don't support configuring a Uemis SDAGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-27Make device enumeration use the device transport dataGravatar Linus Torvalds
This removes some special-case code for Uemis, replacing it with simply passing in the device transport information. This makes device enumeration work for the Garmin Descent (if it is listed by libdivecomputer as a USB storage device, that is). I don't actually do any of the libdivecomputer parsing yet, and only have a stub for the Garmin Descent, but now the directory selection works with that stub. The actual download obviously does not. [Dirk Hohndel: removed obsolete FIXME from code] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-27Show new firmware notice for OSTC PlusGravatar Jan Mulder
Also show a new firmware notice for a HW OSTC Plus. This appeared to be broken (as can be verified on the current master from today, as HW just released version 2.98 of the firmware). Notice that there is some confusion in both Subsurface and Libdivecomputer with respect to types of OSTCs. Physcically, there exist 2 type of OSTC3's. The first edition with only DC_TRANSPORT_SERIAL (and an USB connector), and a second version that lacks the connector but supports both BT and BLE. Confusingly, the second version is marked OSTC3 on the device, but the user needs to select OSTC Plus (which is basically a 3rd version of the OSTC3, combined with a successor of the OSTC Sport) to download dives using BT/BLE. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-08-26divelistview: always show at least one columnGravatar Lubomir I. Ivanov
Currently it is possible to hide all columns by unchecking them in the context menu that appears by right clicking the header of the divelist. But once all are hidden the header disappears. This can cause a situation where the user cannot show any columns and the only fix for that is to edit the application configuration. To avoid this sutuation prevent the last column from being hidden. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-08-26modeldelegates: use font metrics for dive list row heightGravatar Lubomir I. Ivanov
Include font metrics as part of the height in DiveListDelegate::sizeHint(). When 22px is hardcoded, this handles small fonts, but for larger fonts it seem that the bottom of the dive list row text is cut on Windows. Keep 22px as the minimum size hint, but for larger fonts use QFontMetric::height(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-08-25desktop-widgets: remove QSettings from desktop-widgetsGravatar jan Iversen
The variables referenced are moved into qPref in earlier commits so in general all QSettings calls are replaced by qPref*:: calls Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25desktop-widget: remove QSettingsGravatar jan Iversen
Update desktop-widget to use qPrefDisplay (amended variable) Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25core/tests: merge Animations and add vars. to qPrefDisplayGravatar jan Iversen
Add class variable tooltip_position to qPrefDisplay Add class variable lastDir to qPrefDisplay qPrefDisplay is updated to use new qPrefPrivate functions Adjust test cases incl. qml tests qPrefAnimations only has 1 variable, that really is a display variable Merge the variable into qPrefDisplay, to simplify setup (and avoid loading extra page in qml). correct theme to save in correct place, and make it a static class variable Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-23Parse: pass dive_table argument to parse_file()Gravatar Berthold Stoeger
To enable undo of divelog-importing it is crucial that parse_file() can parse into arbitrary dive tables. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-23Cleanup: pass gasmix by valueGravatar Berthold Stoeger
In a previous commit, the get_gasmix_* functions were changed to return by value. For consistency, also pass gasmix by value. Note that on common 64-bit platforms struct gasmix is the size of a pointer [2 * 32 bit vs. 64 bit] and therefore uses the same space on the stack. On 32-bit platforms, the stack use is probably doubled, but in return a dereference is avoided. Supporting arbitrary gas-mixes (H2, Ar, ...) will be such an invasive change that going back to pointers is probably the least of our worries. This commit is a step in const-ifying input parameters (passing by value is the ultimate way of signaling that the input parameter will not be changed [unless there are references to said parameter]). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-15desktop-widget: remove SettingsObjectWrapper and update qPref callsGravatar jan Iversen
remove use of SettingsObjectWrapper:: remove include of SettingsObjectWrapper.h use qPrefFoo:: for setters and getters replace prefs.foo with qPrefXYZ::foo() where feasible (this expands to the same code, but gives us more control over the variable). Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-15desktop-widgets/facebook: remove SettingsObjectWrapperGravatar jan Iversen
remove use of SettingsObjectWrapper:: remove include of SettingsObjectWrapper.h use qPrefFoo:: for setters and getters replace prefs.foo with qPrefXYZ::foo() where feasible (this expands to the same code, but gives us more control over the variable). Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-15desktop-widgets/preferences: reemove SettingsObjectWrapperGravatar jan Iversen
remove use of SettingsObjectWrapper:: remove include of SettingsObjectWrapper.h use qPrefFoo:: for setters and getters replace prefs.foo with qPrefXYZ::foo() where feasible (this expands to the same code, but gives us more control over the variable). Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-14core: activate qPrefGeneralGravatar jan Iversen
remove General from SettingsObjectWrapper and reference qPrefGeneral update files using SettingsObjectWrapper/General to use qPrefGeneral this activated qPrefGeneral and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-14core: activate qPrefPartialPressureGasGravatar jan Iversen
remove PartialPressureGas from SettingsObjectWrapper and reference qPrefPartialPressureGas update files using SettingsObjectWrapper/PartialPressureGas to use qPrefPartialPressureGas this activated qPrefPartialPressureGas and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-13core: activate qPrefGeocodingGravatar jan Iversen
remove Geocoding from SettingsObjectWrapper and reference qPrefFacebook update files using SettingsObjectWrapper/Geocoding to use qPrefFacebook this activated qPrefGeocoding and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-13core: activate qPrefLanguageGravatar jan Iversen
remove Language from SettingsObjectWrapper and reference qPrefLanguage update files using SettingsObjectWrapper/Language to use qPrefLanguage this activated qPrefLanguage and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-12core: activate qPrefTechnicalDetailsGravatar jan Iversen
remove TechnicalDetails from SettingsObjectWrapper and reference qPrefTechnicalDetails update files using SettingsObjectWrapper/TechnicalDetails to use qPrefTechnicalDetails this activated qPrefTechnicalDetails and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-12desktop_widget: preferences_graph, replace setBuehlmannGravatar jan Iversen
setBuehlmann is really planner_deco_mode = BUEHLMANN, change to ensure consistency. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-09core: activate qPrefUpdateManagerGravatar jan Iversen
remove UpdateManager from SettingsObjectWrapper and reference qPrefUpdateManager update files using SettingsObjectWrapper/UpdateManager to use qPrefUpdateManager this activated qPrefUpdateManager and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-08core: activate qPrefDivePlannerGravatar jan Iversen
remove DivePlanner from SettingsObjectWrapper and reference qPrefDivePlanner update files using SettingsObjectWrapper/DivePlanner to use qPrefDivePlanner this activated qPrefDivePlanner and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-02core: activate qPrefUnitsGravatar jan Iversen
remove Units from SettingsObjectWrapper and reference qPrefUnits update files using SettingsObjectWrapper/Units to use qPrefUnits this activated qPrefUnits and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-01Cleanup: remove all override modifiersGravatar Berthold Stoeger
Commit df156a56c08a56eb380711a507ef739d8150a71f replaced "virtual" by "override" where appropriate. Unfortunately, this had the unintended consequence of producing numerous clang warnings. If clang finds a override-modified function in a class definition, it warns for *all* overriden virtual functions without the override modifier. To solve this, go the easy route and remove all overrides. At least it is consistent. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-31Cleanup: replace virtual by override where appropriateGravatar Berthold Stoeger
The keyword "virtual" signalizes that the function is virtual, i.e. the function of the derived class is called, even if the call is on the parent class. It is not necessary to repeat the "virtual" keyword in derived classes. To highlight derived virtual functions, the keyword "override" should be used instead. It results in a hard compile- error, if no function is overridden, thus avoiding subtle bugs. Replace "virtual" by "override" where appropriate. Moreover, replace Q_DECL_OVERRIDE by override, since we require reasonably recent compilers anyway. Likewise, replace /* reimp */ by "override" for consistency and compiler support. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-30Cleanup: Make WindowsTitleUpdate a global objectGravatar Berthold Stoeger
WindowsTitleUpdate is such a trivial object (a QObject with a single signal and no own state), that it's not really understandable why it would need all that "singleton" boiler-plate. Just make it a default constructed/destructed global object. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-30Cleanup: remove DiveListView::fixMessyQtModelBehaviour()Gravatar Berthold Stoeger
The function DiveListView::fixMessyQtModelBehaviour() was used to expand the first columns of dive-trips in the dive-list view. This function was called everytime that the dive-list was modified. It is kind of ludicrous that external callers would have to tell the DiveListView, when it has to update its column headers. Instead, place this functionality in the overriden reset() and rowsInserted() functions, as these are the only ways that rows can be added. Change the DiveTripModel to use the proper beginResetModel()/endResetModel() pair instead of the previous full deletion and full repopulation using the beginRemoveRows()/ endRemoveRows() and beginInsertRows()/endInsertRows(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-30Cleanup: remove parameter from currentDiveChanged signalGravatar Berthold Stoeger
The currentDiveChanged signal was emitted by the DiveListView to inform the MainWindow of a change of current dive. The new current dive was passed as a parameter. The slot in MainWindow then called select_dive() on the dive. This seems pointless because: 1) In both emits, selected_dive dive was passed as argument. But MainWindow can read this global variable itself. 2) Calling select_dive() again is a no-op, because obviously, this already *was* the selected dive. Moreover it seems conceptually wrong to set the current dive in the slot that is informed of the change of the current dive. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-30core: activate qPrefProxyGravatar jan Iversen
remove Proxy from SettingsObjectWrapper and reference qPrefProxy update files using SettingsObjectWrapper/Proxy to use qPrefProxy this activated qPrefProxy and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-30Cleanup: remove DiveListView::testSlot()Gravatar Berthold Stoeger
This debugging-slot was not linked anywhere. And especially in the light of the impending refactoring of DiveListView/DiveTreeModel it seems pointless to keep old debugging code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-28Dive media: Extract thumbnails from videos with ffmpegGravatar Berthold Stoeger
Extract thumbnails using ffmpeg. Behavior is controlled by three new preferences fields: - extract_video_thumbnails (bool): if true, thumbnails are calculated. - extract_video_thumbnail_position (int 0..100): position in video where thumbnail is fetched. - ffmpeg_executable (string): path of ffmpeg executable. If ffmpeg refuses to start, extract_video_thumbnails is set to false to avoid unnecessary churn. Video thumbnails are marked by an overlay. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-27core: activate qPrefFacebookGravatar jan Iversen
remove Facebook from SettingsObjectWrapper and reference qPrefFacebook update files using SettingsObjectWrapper/Facebook to use qPrefFacebook this activated qPrefFacebook and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-27Dive list view: setup columns in constructorGravatar Berthold Stoeger
The column-widths must only be set once the source-model is that. The old code realized this with a rather complicated logic. Instead, simply set the source-model in the constructor and set the column widths after that. Rename the corresponding function from "setupUi" to "setColumnWidths". Moreover, the setupUi function had different code-paths for the first and other calls. Since it is only called once, remove the other code paths. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-27Dive list view: move column width logic back from DiveTripModelGravatar Berthold Stoeger
Conceptually, the width of the columns should probably reside in the view not the model. But much more severly, the old code didn't work: Columns were set in a DiveTripModel, which was deleted right away. Therefore, move the logic back to the DiveListView. Introduce a QVector<int> of the initial column widths, so that they can be erased from the setting if unchanged. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-26Whitespace cleanup desktop-widgetGravatar Dirk Hohndel
Not entirely script based because of the broken 'else if'. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-07-25core: activate qPrefDiveComputerGravatar jan Iversen
remove DiveComputer from SettingsObjectWrapper and reference qPrefDiveComputer update files using SettingsObjectWrapper/DiveComputer to use qPrefDiveComputer this activated qPrefDiveComputer and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-21core: activate qPrefCloudStorageGravatar jan Iversen
remove CloudStorage from SettingsObjectWrapper and reference qPrefCloudStorage update files using SettingsObjectWrapper/CloudStorage to use qPrefCloudStorage this activated qPrefCloudStorage and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-20Dive media: implement "Open folder of selected media files"Gravatar Berthold Stoeger
Add a context-menu entry to TabDivePhotos which opens the folder(s) of all selected files. Fixes #1514. Suggested-by: Stefan Fuchs <sfuchs@gmx.de> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-19Undo: remember deleted trip in UndoRemoveDivesFromTrip::undo()Gravatar Berthold Stoeger
If the last dive of a trip is removed, the trip is deleted. On redo the dive is added to a non existing trip, leading to a segfault. Therefore, keep a copy of the trip to reinstate it on redo. Note: this cannot work for a sequence of multiple commands. One would have to rewrite the whole undo-history. Nevertheless, let's do this as a stop-gap measure. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-19Undo: clear list of trips to be recreated in UndoDeleteDive::undo()Gravatar Berthold Stoeger
UndoDeleteDive::tripList kept track of the trips to be recreated on undo. But the list wasn't cleared on undo, thus on subsequent redo the same trip was readded to the list, leading to double-free. This could trivially be reproduced by repeated CTRL-Z, CTRL-SHIFT-Z pairs. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-18Dive media: transport dive-id in drag'n'drop eventsGravatar Berthold Stoeger
9efb56e2d43161d952efb444d1f13d87bfdd45b5 introduced rather complex logic for picture drag'n'drop events onto the profile. Among other things, the code had to check whether the picture actually belongs to the displayed dive. This can be simplified by transporting the dive-id in the drag'n'drop event structure. The flow goes like this: DivePictureModel--(1)-->DivePictureWidget--(2)-->ProfileWidget For (1), we can use the Qt::UserRole role. This was used to transport the picture-offset, but this is not needed anymore since ProfileWidget was decoupled from DivePictureModel. For (2), we simply replace the "position" value, which was never used. Why would the receiver care which pixel was pressed in the media-tab? This commit also contains a minor cleanup in DivePictureWidget: QListView::mousePressEvent(event) was called in both branches of an if and can therefore be removed from the if. This is so trivial, that it doesn't warrant its own commit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-18Bluetooth: don't call deviceDiscoveryError() on scan finishedGravatar Berthold Stoeger
In the remoteDeviceScanFinished slot, the old code called into the deviceDiscoveryError() in case the device discovery agent had the error flag set. This is not necessary, since the agent will send an error signal in such a case. For Qt's device discovery agent, the whole check-for-error is unnecessary, as the documentation states: "The signal is not going to be emitted if the device discovery finishes with an error." But for the homebrew WinBluetoothDeviceDiscoveryAgent, which derives from QThread, both an error() *and* a finished() signal will be sent. Therefore keep the test, but don't call into the slot twice. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-17Cleanup: simplify dive_getUniqID()Gravatar Berthold Stoeger
dive_getUniqID() is used to create unique dive ids, which are stable during application lifetime. It was passed a dive, checked that the id was not set (if it was that it is know to the application) and set a new id (in contradiction to its name!) if it hadn't any. There were three callers: alloc_dive(): called the function on a zeroed dive struct. fixup_dive(): called the function only if the dive had a 0 id. MainWindow::setupForAddAndPlan(): called the function on a zeroed dive struct. Thus, in all three callers the id is guaranteed to be zero and the whole keeping-track-of-ids logic is moot. Remove the logic, don't pass a dive struct to dive_getUniqID() and move the function to the C-backend. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>