summaryrefslogtreecommitdiffstats
path: root/core
AgeCommit message (Collapse)Author
2021-01-11undo: remove invalidate_dive_cache() call from make_first_dc()Gravatar Berthold Stoeger
The make_first_dc() function clones a dive with a certain dive computer moved to the front. This is used by the MoveDiveComputerToFront undo command. make_first_dc() calls invalidate_dive(). However, the undo command does that by itself on every undo/redo. Thus, remove the call in make_first_dc(). Aside from consistency, the goal is to move invalidate_dive() to command/* so that we can be more aggressive about the whole topic: Store only "const dive *" pointers and thus force any writing access to explicitly invalidate the dive cache. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10mobile: enable deco information calculation on mobileGravatar Dirk Hohndel
This simply allows us to calculate the information, it doesn't do anything to actually display it, yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-10profile: pass dive to DiveHandlerGravatar Berthold Stoeger
The DiveHandler shows a context menu where a cylinder can be chosen. This indirectly accesses the global displayed_dive variable. Remove this in a step to make the profile reentrant. The code was quite ominous: instead of simply generating the list of cylinders, a global model was reset and then accessed with Qt's cumbersome model/view API. All this trampling over global state can be removed by simply making the function that generates the list globally accessible. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10profile: pass dive to RulerItemGravatar Berthold Stoeger
Instead of accessing the global displayed_dive variable in RulerItem, pass the dive. This is a step in making the profile reentrant. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10profile: pass dive to ToolTipItem::refresh()Gravatar Berthold Stoeger
Don't access the global displayed_dive variable in a step to make the profile reentrant. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10profile: pass dive to plot function of profile-itemsGravatar Berthold Stoeger
Instead of accessing the global displayed_dive variable, pass the dive to the various profile items. This is a step in making the profile code reentrant. This removes the last user of the displayed_dc macro, which can now be removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10profile: pass dive to EventItemGravatar Berthold Stoeger
Don't access the global displayed_dive variable in an effort to make the profile reentrant. Note that this still accesses the global dc_number variable, which will likely have to be removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10profile: move adding of ceiling-violation-eventGravatar Berthold Stoeger
The profile item that shows the ceilings adds a warning event if the ceiling is violated. This is very unfortunate. Improve this situation by adding the event up to the function that calculates the ceiling. This is still not how it should be - the display layer should not modify the dive that it displays. To make this clear, add a comment that details that this is a contract between planner and display layer: The planner uses a dive that can be trampled upon by the profile. Still, this should be solved differently. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10profile: use a parameter to determine planner stateGravatar Berthold Stoeger
The in_planner() function is incompatible with a reentrant profile, since it accesses a global variable. In create_plot_info_new() it is essentially redundant, because there is a planner_ds (ds = deco_state) parameter that is used only when in the planner. Therefore use that as the in_planner indicator: when non-null, the profile is showing a planned dive. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10cleanup: make calculate_deco_information() of static linkageGravatar Berthold Stoeger
This function was not used outside of profile.c Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10btdiscovery - Add second matcher for Ratio iX3MGravatar Damian Zaremba
New (late 2020) iX3M hardware (refered to as 'iX3m with Sequared Buttons' in the Ratio support section) appears to identify as iX5M, both in the Bluetooth name and reported revision e.g. $ ./ratio-toolbox-x86_64.AppImage info | head -n2 Model: Ratio® iX5M GPS TECH+ Firmware version: 4.1.26/016 (English) Add a second Bluetooth name matcher for this variation, returning the same (generic) model as is currently used. Signed-off-by: Damian Zaremba <damian@damianzaremba.co.uk>
2021-01-06preferences: remove pointless memberGravatar Dirk Hohndel
This could never have worked the way it was used. Some whitespace fixes snuck into this commit. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-03desktop: add statistics widget dummy and application stateGravatar Berthold Stoeger
Add a new "statistics" application state. In the statistics state show the statistics widget and the filter in the top quadrants. The idea is to allow filtering and doing statistics at the same time. Sadly, we can't use the filter-widget in different quadrants, because Qt's ownership model is completely broken / inflexible. It does not support a widget having different parents and thus a widget can only belong to one QStackedWidget. Hiding the map in the statistics view is quite hacky: Since the view of the quadrants is not determined by the "ApplicationState", we have to restore the original quadrant visibility when exiting the stats mode. Therefore, set the original visibility-state when changing application state. The MainWindow-quadrant code really needs to be rewritten! Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-02mobile: turn GpsLocation into a regular singleton constructGravatar Dirk Hohndel
Simply move the initialization of the logging function into its own method and call that in the QMLManager constructor. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-02cleanup: move pref related structs and functions to pref.cGravatar Berthold Stoeger
These were declared in pref.h and defined in subsurfacestartup.c. pref.c didn't even exist. Create it and move preferences-related structs and functions there. setup_system_prefs() is left in subsurfacestartup.c, since it works with environment variables. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-02cleanup: move definition of get_units() to core/unit.cGravatar Berthold Stoeger
The function is declared in core/unit.h, therefore it seems logical to define it in the corresponding source file. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-02cleanup: remove support for PASCAL in get_pressure_units()Gravatar Berthold Stoeger
The user preferences can never end up with PASCAL pressure units. The only place that uses these units is the XML parser. Therefore, remove the PASCAL case in get_pressure_units(). This will remove an unused translation string. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-02cleanup: don't save PASCAL pressure units to gitGravatar Berthold Stoeger
The way I understand, the PASCAL pressure unit is used to parse obscure dive logs. However, there is no support in the UI for using Pa as pressure unit. Therefore remove reading / writing this unit to git divelogs. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-01cleanup: ensure DiveFilter is consistent when createdGravatar Dirk Hohndel
Otherwise we might access an uninitialized member. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-01core: add get_*_unit functions with explicit unit systemGravatar Berthold Stoeger
The get_*_unit() functions return the unit-name as set in the preferences. Add versions with a "metric" parameter. This will be used by the statistics code, which may in the future allow for binning with alternative units. All the unit-formatting functions should probably be moved away from qthelper to their own source file. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-01core: move formatting of day-of-week to string-format.cppGravatar Berthold Stoeger
This was only used by the filter, but will also be used by the statistics module. To avoid duplicate translation strings, move to a common place. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-01core: add "transparent" parameter to renderSVGIconGravatar Berthold Stoeger
The start-selection widget will need icons with a transparent background so that the icons don't stick out like a sore thumb. So far the icons rendered by this function were only used by the images on the profile and were perfectly rectangular. Therefore there was no need for this. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-01core: make gasmix_is_invalid globally accessibleGravatar Berthold Stoeger
The statistics module will use that to bin dives by gasmix. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-01core: add notion of gas-type to core/gas.cGravatar Berthold Stoeger
Create a gastype enum, which describes the type of a gas. For now: air, nitrox, normoxic, trimix and oxygen. This probably should be made configurable. The gas types will be used to bin gasses in the statistics module. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-01core: move renderSVGIcon() to qthelper.cppGravatar Berthold Stoeger
The renderIcon() function was used by the thumbnailer to render SVG-based icons. Move it to the global qthelper.cpp so that it can also be used by the statistics module. Add "SVG" to the name to emphasize what it is used for. For consistency also move the renderSVGIconWidth() function, which renders to a fixed width, to qthelper.cpp Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-29cleanup: const-ify utc_mktime()Gravatar Berthold Stoeger
To make it clear that the struct tm is only used as an input parameter. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-29cleanup: move monthname to time.cGravatar Berthold Stoeger
Weirdly, this function was declared in dive.h and defined in subsurface-startup.c. Let's move declaration and definition to more appropriate places, viz. subsurface-time.h and time.c. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-29cleanup: remove getDivesInTrip() in qthelper.cppGravatar Berthold Stoeger
This function was not used anywhere. Moreover, remove a few unused includes from qthelper.h. Surprisingly, a number of users of qthelper.h depend on these, so readd them at the appropriate places. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-29filter: provide function that returns all shown divesGravatar Berthold Stoeger
This will be used by the statistics widget. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-29filter: internalize shown_dives in DiveFilter classGravatar Berthold Stoeger
one piece of global state removed! Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-29filter: move shown_dive from divelist.c to divefilter.cppGravatar Berthold Stoeger
Arguably, the number of filtered dives is a matter of the divefilter. Let's move it there. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-29filter: keep track on shown_dive on dive removal in DiveFilterGravatar Berthold Stoeger
When removing dives, the UndoCommands would keep track of the shown dives. When adding, they were calling into the filter instead. Let's remove this asymmetry. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-29filter: reset shown_dives in filterGravatar Berthold Stoeger
The shown_dives variable was reset by the dive_list code. Arguably, the filter should keep track of the number of shown dives, so move the resetting there. This means adding a new "reset()" member function to the filter and call that instead of "updateAll()" when the core data is reset. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17core: remove DiveObjectHelperGravatar Berthold Stoeger
Since switching to the mobile-models and removing grantlee, DiveObjectHelper was demoted to a thin wrapper around string formatting functions. The last user was removed in a previous commit. It was never a good idea, given QML's strange memory-management. Let's remove it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17mobile: remove DiveObjectHelper codeGravatar Berthold Stoeger
When editing a dive, a DiveObjectHelper of the unmodified dive was created to compare the edited with the old values. Since the DiveObjectHelper is used here only as a pointless wrapper around the formatting functions, call these functions directly. However, note that the code is in principle wrong since the change to the mobile-models, which do not use the DiveObjectHelper. The real fix would be to reload the data from the model to prevent going out-of-sync with respect to the formatting routines! Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17printing: remove CylinderObjectHelperGravatar Berthold Stoeger
With the removal of grantlee, this became pointless glue code. Call the formatting functions directly. Since the printing code was the only user of CylinderObjectHelper, remove the whole thing. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17printing: remove DiveObjectHelper from printing codeGravatar Berthold Stoeger
At this point (post grantlee), DiveObjectHelper is just pointless glue code. Let's remove it from the printing code and call the formatting functions directly. If necessary, move these functions to core/string-format.cpp. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17printing: remove DiveObjectHelperGrantleeGravatar Berthold Stoeger
This was a weird helper object, needed for grantlee. Instead of storing this object, loop over cylinders and dives directly. The actual accessor function is unchanged and now generates a DiveObjectHelper or DiveCylinderHelper for every variable access. Obviously, this is very inefficient. However, this will be replaced in future commits by direct calls to formatting functions. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17core: create string-format.cpp source fileGravatar Berthold Stoeger
The mobile version of the list used string formatting functions defined in DiveObjectHelper and declared in mobilelistmodels.h. Very confusing. Move them to a separate source file where - in the long run - all the string-formatting functions, which are scattered all over the place, can be collected. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17core: correct AL* tankinfo sizes.Gravatar Berthold Stoeger
Recently (d16a9f118a) the tankinfo table was made dynamic, which means that the default tankinfos are added programatically. Thereby, the wrong function was used for AL* type of cylinders: metric instead of imperial. Fix those. Reported-by: Michael Andreen <harv@ruin.nu> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-13prefs: add option to display only actually used tanksGravatar Berthold Stoeger
A user complained about the default cylinders list. Provide a preferences option to turn this off. When changing the preferences, the tank-info model will be completely rebuilt. Currently, this is a bit crude as this will be done for any preferences change. Suggested-by: Adolph Weidanz <weidanz.adolph@gmail.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-13core: remove the "no-name" tank infoGravatar Berthold Stoeger
There was a tank info with an empty name. According to a comment, this is needed for the "no cylinder" case. However, we now support empty cylinder tables, so this is not needed anymore. Therefore, remove it. Make sure that the user can still enter the empty name, just in case. But don't save the size and pressure in that case. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-13core: free tank info table on exitGravatar Berthold Stoeger
This is obviously a pure code-hygiene thing. But with the new dynamic tank info table, this becomes trivial, so let's do it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-13core: keep tank infos in a dynamic tableGravatar Berthold Stoeger
The list of known tank types were kept in a fixed size table. Instead, use a dynamic table with our horrendous table macros. This is more flexible and sensible. While doing this, clean up the TankInfoModel, which was leaking memory. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-12preferences: create global settingsChanged signalGravatar Berthold Stoeger
So far, the PreferencesDialog emitted a settingsChanged signal. This meant that models that listened to that signal had to conditionally compile out the code for mobile or the connection had to be made in MainWindow. Instead, introduce a global signal that does this and move the connects to the listeners to remove inter-dependencies. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-12Add surge etc to printing template variablesGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-12-03downloader: filter possible devices and add mounts, remember last choicesGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-12-03build-system/downloader: cli-downloader isn't part of the coreGravatar Dirk Hohndel
It's part of the main excutable / helper and needs to be linked before all of our support libraries. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-03downloader: turn off bluetooth mode for nowGravatar Robert C. Helling
Eventually, this should also be set from the command line. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-12-03downloader: small improvementsGravatar Robert C. Helling
Provide supported dive computer list on the command line and actually call the cli download. Still not functional. Signed-off-by: Robert C. Helling <helling@atdotde.de>