aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2018-07-25core: make load/sync inline in qPrefGravatar jan Iversen
Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25core: make load/sync inline in qPrefAnimationsGravatar jan Iversen
Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25core: create qPrefDiveComputer from SettingsObjectWrapperGravatar jan Iversen
Update set/get functions to follow common name scheme: - get function have same name as in struct diveComputer - set function have set_<name> - signal function have <name>_changed one class one .h/.cpp is the C++ idiom. Having load/sync of each variable in 1 functions (in contrast to the distributed way SettingsObjectWrapper handles it) secures the same storage name is used. Having the set/get/load/sync functions grouped together makes it easier to get an overview. REMARK: this commit only defines the class, it is not active in production Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25core: add qPrefAnimations to SettingsObjectWrapper/qPref loadGravatar jan Iversen
correct missng qPrefAnimations in global load functions Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25core: expand qPref macros to handle sub structureGravatar jan Iversen
Expand SET_, DISK_ and HANDLE_ macros with field for substructure Structure prefs contains e.g. prefs.dive_computer.vendor an extra field are added to the macros to allow this. Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25core: remove LOADSYNC* macrosGravatar jan Iversen
expend LOADSYNC* into DISK_* macros remove LOADSYNC* from qPrefPrivate.h update qPrefDisplay to not use LOADSYNC* Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25core: make qPrefAnimations/CloudStorage getters static and inlineGravatar jan Iversen
Add static and inline to getter in all qPref header files Remove call to GET_PREFERENCE_* in qPrefDisplay.cpp Remove GET_PREFERENCE_* from qPrefPrivate.h static inline is slightly faster than a function call, but it saves a lot of coding lines (no lines in qPref*.cpp). Getters are a direct reference to struct preferences, so they will normally only be used from QML. Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25core: make qPrefDisplay getters static and inlineGravatar jan Iversen
Add static and inline to getter in all qPref header files Remove call to GET_PREFERENCE_* in qPrefDisplay.cpp static inline is slightly faster than a function call, but it saves a lot of coding lines (no lines in qPref*.cpp). Getters are a direct reference to struct preferences, so they will normally only be used from QML. Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25core: isolate qPrefPrivate to qPref* classesGravatar jan Iversen
Make functions in qPrefPrivate private and add qPref* as friends Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25core: qPref replace COPY_TXT with copy_txt in qPrefPrivateGravatar jan Iversen
Add copy_txt function to qPrefPrivate class Remove macro COPY_TXT from qPrefPrivate.h Replace use of COPY_TXT with copy_txt in qPref classes copy_txt is only once, COPY_TXT was expanded approx. 160 times, so this commit saves space (and removes a macro). Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-23Update CHANGELOG.mdGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-23Dive video: paint duration-bar above thumbnail in profile plotGravatar Berthold Stoeger
Paint a rectangle on top of thumbnails indicating the run-time of the video. Use the z=100.0-101.0 range for painting the thumbnails, whereby the z-value increases uniformly from first to last thumbnail (sorted by timestamp). The duration-bars are placed at z-values midway between those of the thumbnails. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-23Dive media: prepare for video-thumbnailsGravatar Berthold Stoeger
Video thumbnails are more complex than simple picture thumbnails. We store a duration and might want to store multiple images. Therefore, refactor the thumbnailing in imagedownloader.cpp. Move the thumbnail-writing down in the call chain to where the thumbnails are created, since we have more information there (i.e. whether we could parse the file but not extract an image, etc.). Split the write-to-cache function into three versions: - pictures - videos - unknown Define the video-thumbnail on-disk format as - uint32 MEDIATYPE_VIDEO - uint32 duration of video in seconds - uint32 number of pictures for each picture: - uint32 offset in msec from begining of video - QImage frame Currently, we write 0 pictures. This will be filled in subsequent commits. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-23Cleanup: remove DiveItem::icon_names member arrayGravatar Berthold Stoeger
Each DiveItem (which is a wrapper around diveId with some virtual functions), had a member icon_names, which is an array of four QStrings. These were not used anywhere and must be an obscure oversight and was probably planned as a static cons array?. In any case, remove it. There *was* a function-local analogous icon_names array in DiveItem::data() though. This array would initialize four QStrings from C-string literals on every invocation. Make this array static, local to the translation unit and use the QStringLiteral macro to construct the QString object at compile-time. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-21tests: add CloudStorage qml test casesGravatar jan Iversen
Add tst_qPrefCloudStorage qml file to test C++ qml connection Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-21tests: move CloudStorage test from testpreferencesGravatar jan Iversen
Remove CloudStorage test in testpreferences add the same CloudStorage tests to testqPrefCloudStorage Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-21tests: add qPrefCloudStorage testcasesGravatar jan Iversen
add test cases to secure struct preferences and qPrefCloudStorage work together 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-21core: create qPrefCloudStorage from SettingsObjectWrapperGravatar jan Iversen
Update set/get functions to follow common name scheme: - get function have same name as in struct preferences - set function have set_<name> (from struct preferences>) - signal function have <name>_changed (from struct preferences>) one class one .h/.cpp is the C++ idiom. Having load/sync of each variable in 1 functions (in contrast to the distributed way SettingsObjectWrapper handles it) secures the same storage name is used. Having the set/get/load/sync functions grouped together makes it easier to get an overview. REMARK: this commit only defines the class, it is not active in production Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-21Uninline functions in dive.hGravatar Berthold Stoeger
There were numerous inlined functions in dive.h. For many of them inlining is dubious. Let's uninline most of them, with the exception of trivial accessors and interpolate(). On current master, this gave a size reduction of 5 pages: -rwxrwxr-x 1 bs bs 5863656 Jul 18 20:57 subsurface-inline -rwxrwxr-x 1 bs bs 5843176 Jul 18 20:48 subsurface-noinline ----------------------------------------------------------- 20480 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-21Fetch sqlite from https:// siteGravatar Berthold Stoeger
The http:// version is down an makes Travis fail. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-20Update CHANGELOG.mdGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
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-18tests: update qPrefAnimations test casesGravatar jan Iversen
remove include of QtTest in header, becaue it is not needed, add include of QObject in header, so moc can generate code. add QTest in cpp file, which replaces QtTest Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-18tests: update qPrefDisplay test casesGravatar jan Iversen
remove include of QtTest in header, becaue it is not needed, add include of QObject in header, so moc can generate code. add QTest in cpp file, which replaces QtTest Change content of strings to test divelist_font to a not normal font name, to ensure less confusion by readers. Remark the old surrounding code accept illegal font names, but correcting this is not covered in this commit. Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-18core: remove QSettings in qPref* and use a shared variableGravatar jan Iversen
Add qPrefPrivate class which contains one QSettings variable, delete QSettings from qPref* class definitions this secures there are only instance of QSettings (QSettings needs to be in a QObject class to work) Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-18core: remove include QSettings from QPrefGravatar jan Iversen
remove QSettings header file from qPref.h (which is included in many files) to isolate the use of QSettings in the total system. Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-18tests: update CMakeLists.txt to incude qPref* in both placesGravatar jan Iversen
Files are listed in 2 places in CMakeLists.txt, update file to secure qPrefAnimations and qPrefDisplay are listed correctly Signed-off-by: Jan Iversen <jani@apache.org>
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-18Cleanup: rename trip->index to trip->savedGravatar Berthold Stoeger
The index-field was misused by the IO routines to mark which dives had been saved. Somewhat questionable, but let's at least name the field accordingly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-18Cleanup: removed unused functions in divelist.hGravatar Berthold Stoeger
find_trip_by_idx() and find_matching_trip() weren't used anywhere. The trip index actually is only misused as a "trip saved"-flag. trip_has_selected_dives() only existed as a comment. 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-18Cleanups to core/color.[c|hpp]Gravatar Berthold Stoeger
A number of small cleanups to the color-table: 1) Make the profile_color map of static linkage - it is not used outside of this file. 2) Remove the third color, which originally was planned for printing. It was not accessed anywhere. 3) Replace QVector<QColor> by std::array<QColor, 2>. Using a reference-counted, copy-on-write, dynamic container for static data seems like overkill. std::array<QColor, 2> has exactly the same run-time impact as QColor[2], but allows for assignment. 4) Use brace-initialization and remove the unneeded COLOR macro. 5) Remove the fill_profile_color function. Simply use static initialization. 6) Move #includes from .h to .cpp file. 7) Remove text_render_options(_t), which were not used anywhere. 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>
2018-07-16Dive media: fix stacking of thumbnails in profile plotGravatar Berthold Stoeger
9efb56e2d43161d952efb444d1f13d87bfdd45b5 added code to rearrange pictures on drag'n'drop. To keep the correct repainting order (i.e. later thumbnails are painted on top of previous thumbnails), the z-value was set accordingly. In principle a sound idea, but it did not work out, because on hoverEnter and hoverExit events, the z-values were modified, thus restoring the wrong drawing order. Instead, use the QGraphicsItem::packBefore() function. Experimentation showed that this only works if stacking is done from the back of the list. Silence an erroneous compiler warning by initializing a variable to 0.0. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-16Fix typo in INSTALL: add missing backspace at end of lineGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-15Update CHANGELOG.mdGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-07-15For media file open dialog add different file filtersGravatar Stefan Fuchs
On top of the file filter for all media files add a file filter for images only, one for videos only and one for all files. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-07-15UI change of "images"/"photo" to "media" or "media files"Gravatar Stefan Fuchs
This changes the above mentioned terms everywhere in the UI to reflect the fact that Subsurface now also supports video files on top of image files. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-07-15core: solve copy/paste error in qPref_privateGravatar jan Iversen
DISK_LOADSYNC_INT used double correct to int DISK_LOADSYNC_INT used double correct to int Signed-off-by: Jan Iversen <jani@apache.org>Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-15core: qPrefDisplay correct font setting.Gravatar jan Iversen
SettingsObjectWrapper contained some delicate font handling mixing font and font_size, breaking that into 2 parts broke font handling on some platforms Copy font + font_size handling 1-1 from SettingsObjectWrapper Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-14Merge branch 'metadata' of https://github.com/bstoeger/subsurfaceGravatar Dirk Hohndel
2018-07-14Merge branch 'qPrefAnimations' of https://github.com/janiversen/subsurfaceGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-07-14Merge branch 'qPrefDisplay' of https://github.com/janiversen/subsurfaceGravatar Dirk Hohndel
2018-07-14Merge branch 'qml_test' of https://github.com/janiversen/subsurfaceGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-07-14Update CHANGELOG.mdGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-14Metadata: Parse ASFs (=WMVs)Gravatar Berthold Stoeger
The simplest video-formats to parse so far. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-14Metadata: Parse AVIsGravatar Berthold Stoeger
Whereas extraction of the dive-duration is trivial, AVIs don't seem to have a standardized way of saving the creation time. This commit implements support for two versions randomly found on the internet. Additional version will follow if need arises. AVI seems not to be a particular popular format for either vacation or professional videographers. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>