summaryrefslogtreecommitdiffstats
path: root/core
AgeCommit message (Collapse)Author
2018-08-02core: qPref, remove inline and ; for inline functionsGravatar jan Iversen
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-02core: create qPrefUnit 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-08-02core: change type of unit_system to enumGravatar jan Iversen
unit_system is an enum, but was declared as short, correct declaration. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-02Cleanup: shrink size of three-letter month name strings to 4Gravatar Berthold Stoeger
There was a comment reading /*++GETTEXT: these are three letter months - we allow up to six code bytes*/ but this is not valid (anymore), since the array contains only untranslated strings, which will be translated on-the-fly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-02Cleanup: move sort_table() from subsurface_startup.c to divelist.cGravatar Berthold Stoeger
The function is not only used at startup and arguably belongs the the file with the rest of the low-level divelist functions. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
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-08-01Cleanup: remove silly " != 0" expressionGravatar Berthold Stoeger
In metadata.cpp, replace a silly "if (!memcmp(...) != 0)" by the intended "if (!memcmp(...))" Obviously, both have the same effect. Fixes a warning. 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-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-30core: create qPrefProxy from SettingsObjectWrapperGravatar jan Iversen
Update set/get functions to follow common name scheme: - get function have same name as in struct prefs - 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-30core: qPrefPrivate.h added HANDLE_PREFERENCE_INT_DEF_EXTGravatar jan Iversen
Add missing type macro, needed for qPrefProxy Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-29BT support: disable BT download when compiling without BTGravatar Kristaps Dz
When BT_SUPPORT is not enabled, don't default to "true" for using bluetooth for downloading dives. Otherwise, bluetooth will be forced since the bluetooth button has been removed and is never overridden. Fixes #1541 Signed-off-by: Kristaps Dzonsons <kristaps@bsd.lv>
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-28Build-system: add OpenBSD supportGravatar Kristaps Dz
Rename linux.c to unix.c and add OpenBSD support as well. Conditionally compile based on OS. Signed-off-by: Kristaps Dzonsons <kristaps@bsd.lv>
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-27core: create qPrefFacebook 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-27core: fix qPrefCloudStorage to derive git_urlGravatar jan Iversen
remove set_git_url and git_url_changed, because it is not possible to set git_url, this is done inderectly through set_base_url Update disk_base_url to generated git_url for both load/sync Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-26Whitespace cleanup core divecomputer handlingGravatar Dirk Hohndel
Not entirely script based because of two odd issues where the script creates bogus indentation. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-07-26Whitespace cleanup core/settingsGravatar Dirk Hohndel
We can argue about any of the changes here, but they are the result of our whitespace.pl script - so if any of this is offensive to you, part of the resolution will be fixing the script... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-07-25core: qPrefCloudStorage save userid to new locationGravatar jan Iversen
userid was saved outside all groups, even though it belongs to cloudStorage Add code to save in new location and read from new/old location Signed-off-by: Jan Iversen <jani@apache.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-25core: update qPrefDisplay to new consensusGravatar jan Iversen
add inline to load/sync remove const from QString getters Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25core: update qPrefCloudStorage to new consensusGravatar jan Iversen
make load/sync inline remove const from QString getters Signed-off-by: Jan Iversen <jani@apache.org>
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-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-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-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-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-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-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-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-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>