aboutsummaryrefslogtreecommitdiffstats
path: root/core
AgeCommit message (Collapse)Author
2019-07-18Cleanup: remove non-existing pressures in debug_print_pressures()Gravatar Berthold Stoeger
DILUENT_PRESSURE and INTERPOLATED_DILUENT_PRESSURE do not exist anymore. No point in trying to output them. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Cleanup: remove unused macro SAC_WINDOWGravatar Berthold Stoeger
Last user was removed in ae1e9b11a537eb0ba9b649cb876dae4cc4628045 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Cleanup: remove includes from qthelper.hGravatar Berthold Stoeger
To reduce interdependencies, remove the dive.h and divelist.h includes in qthelper.h Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Cleanup: move deco function declarations to deco.hGravatar Berthold Stoeger
Another tiny step in making dive.h smaller: move function declarations to deco.h if these functions are defined in deco.c and don't directly concern dives. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Cleanup: fix include weirdness concerning string_to_*() functionsGravatar Berthold Stoeger
The string_to_*() functions were declared in dive.h and qthelper.h. Moreover in one file they were declared with C in the other with C++ linkage. This only works because qthelper.h includes dive.h first. Fix this anomaly by declaring the functions only in qthelper.h, but moving them from the C++ to the C part. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Cleanup: move cylinderuse_from_text() to equipment.cGravatar Berthold Stoeger
Since this function doesn't act on a dive and is only related to cylinders, move it to equipment.c and equipment.h. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-15Bluetooth: recognize Ratio iX3m GPS dive computersGravatar Dirk Hohndel
We cannot tell them apart by Bluetooth name, so pick one of the names. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-07-14Fix up XML saving of remaining bottom time dataGravatar Linus Torvalds
While testing the cylinder type saving fix, I noticed that the RBT saving was broken. Instead of saving RBT whenever it changed, we'd save it when it was non-zero. Which doesn't match the git save format, and also doesn't match what we do when loading an xml file (where we default to the previous RBT value, and a sample RBT will modify it). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-07-14Fix cylinder gas type saving when we have bogus gas use dataGravatar Linus Torvalds
Steve Williams reported a crash when saving a previously loaded dive as xml, and gave a gdb backtrace. It turns out that if we can't parse the cylinder use type (OC, diluent, oxygen, unused) we initialize the cylinder use to an invalid type, and then when we save it, we mess up. Fix it up by doing proper limit checking before accessing the "cylinderuse_text[]" array when saving. Reported-by: Steve <stevewilliams@internode.on.net> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-07-11Thumbnailer: improve error messageGravatar Berthold Stoeger
In the error messages shown when failing to start ffmpeg, instruct the user to set the correct executable in the preferences. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-10Git: handle excess of cylinders or weightsystems gracefullyGravatar Berthold Stoeger
Currently, the git parser happily trashes memory if a git repository contains too many weightsystems or cylinders. This should only happen in testing, but nevertheless try to handle it gracefully and ignore excess cylinders / weightsystems. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-06Cleanup: call calculate_max_limits_new() in create_plot_info_new()Gravatar Berthold Stoeger
All callers of create_plot_info_new() called calculate_max_limits_new() a line before. Thus, simply call the latter in the former. This allows us to automatically free the plot data in create_plot_info_new(). The old code overwrote the corresponding field with NULL. As a side-effect, this removes a bogus static variable. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-06Cleanup: fix memory management of the plot dataGravatar Berthold Stoeger
There was a global variable last_pi_entry_new, which stored the recently allocated plot data. This was freed when new plot data was generated. A very scary proposition: You can never have two plot datas at the same time! But exactly that happens when you export for example subtitles. The only reason why this didn't lead to very crazy behavior is that at least on my Linux machine, the calloc() call would just return the previously freed memory. Fix this mess by removing the global variable and freeing the data in the callers. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-06Cleanup: remove unused get_screen_dpi() functionGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-06Cleanup: remove unused declarations from display.hGravatar Berthold Stoeger
A number of declarations were not used anywhere. Remove them. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-28Planner: Wait minimum switch time when bailing out to OCGravatar Robert C. Helling
Bailing out does not happen instantly. Rather wait for the minimum stop switch duration before ascending. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-06-28Cleanup: remove includes from extern "C" blockGravatar Berthold Stoeger
In "core/save-html.h", the "core/dive.h" header was included in the extern "C" block. This is invalid, because "core/dive.h" included from C++ code contains Qt macros that expand to C++ templates. These in turn must not have extern "C" linkage, since a plain C-linker cannot handle such things. The only reason this worked is that in all cases "core/save-html.h" was included after "core/dive.h". The include of the latter in the former had therefore not effect. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-28Import: use TRIP_THRESHOLD when checking for trip-overlapGravatar Berthold Stoeger
When checking for trip-overlap on import, only really overlapping trips have been considered, i.e. when dives had overlapping times. Instead use the TRIP_THRESHOLD so that on download dives are added to the same trip if in a two-days time frame. Reported-by: Miika Turkia <miika.turkia@gmail.com> Reported-by: Dirk Hohndel <dirk@hohndel.org> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-23Cleanup: unify selection signalsGravatar Berthold Stoeger
For historic reasons, there where three distinct signals concerning dive-selection from the undo-machinery: 1) divesSelected: sent newly selected dives 2) currentDiveChanged: sent if the current dive changed 3) selectionChanged: sent at the end of a command if either the selection or the current dive changed Since now the undo-commands do a full reset of the selection, merge these three signals into a single signal. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-23Undo: unify selection behavior in dive-list commandsGravatar Berthold Stoeger
Some commands tried to retain the current selection on undo/redo, others set the selection to the modified dives. The latter was introduced because it was easier in some cases, but it is probably more user-friendly because the user gets feedback on the change. Therefore, unify to always select the affected dives on undo()/redo(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-23Undo: don't send signals batched by tripGravatar Berthold Stoeger
Since the default view is batched by trips, signals were sent trip-wise. This seemed like a good idea at first, but when more and more parts used these signals, it became a burden. Therefore push the batching to the part of the code where it is needed: the trip view. The divesAdded and divesDeleted are not yet converted, because these are combined with trip addition/deletion. This should also be detangled, but not now. Since the dive-lists were sorted in the processByTrip function, the dive-list model now does its own sorting. This will have to be audited. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Undo: sort dives by dive_less_than() in signalsGravatar Berthold Stoeger
In signals dives were sorted by date. This criterion is not be unique. Therefore sort by the dive_less_than() function of the core to avoid any inconsistencies between the Qt-models and the core data. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: remove unused macros WEIGHT_IDX_PRIMARY and _SECONDARYGravatar Berthold Stoeger
Last users were removed in 34db6dc2bea6173c070c9820a2e57a511b9ca0b1. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: use total_weight() in DiveObjectHelper::sumWeight()Gravatar Berthold Stoeger
Don't reimplement the summation of weights. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: remove unused parameter used from find_best_gasmix_match()Gravatar Berthold Stoeger
The last direct user of the used parameter was removed in 16276faa45279817e363367550a6a37c179251f7, the last actual user in e2bbd0ceecff7193bb272430fbebfc4b02dd67c3. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: constify two equipment helper functionsGravatar Berthold Stoeger
add_cylinder_description() and add_weightsystem_description() don't modify their input parameter. constify them. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: use add_to_dive_table() in record_dive_to_table()Gravatar Berthold Stoeger
This was reimplementing functionality that was already there. Simply call the already existing function. Thus, we don't have to export the grow_dive_table function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: generate clear_*_table() functions by macroGravatar Berthold Stoeger
In analogy to the other table functions, generate these by a macro as well. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: localize enum and table in divelist.cGravatar Berthold Stoeger
The cns_table was only used in divelist.c. Make it of static linkage accordingly. The cns_table_headers enum is likewise only used in divelist.c. Therefore move it from the header to the .c file. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: make local variables and functions in deco.c staticGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: move function declaration into header fileGravatar Berthold Stoeger
The function declarations of regressiona(), regressionb() and reset_regression() were given in an independent translation unit. Move them into the proper header file. To ensure consistent function signatures is the whole point of header files, after all. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: remove unused global variables plangflow and plangfhighGravatar Berthold Stoeger
The last user was removed in 1093d6235b5657746f2cb4524ed08cf13c80c3bb. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: make lookup table in planner.c of static linkageGravatar Berthold Stoeger
The lookup tables decostoplevels_metric and decostoplevels_imperial in planner.c were not used outside the translation unit. Make them static. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: remove unused function find_dive_includingGravatar Berthold Stoeger
Last caller was removed in 7eb422d98837b3cfb289a66fa0f3a8f78f222001. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: Make gaspressures.h a regular include fileGravatar Berthold Stoeger
gaspressure.h had definitions of non-exported structs, but did not declare the only function exported by gaspressure.c. Therefore, move the struct definitions into gaspressure.c and the declarations of the populate_pressure_information() function from profile.c to gaspressures.h. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: move gas-functions to own translation unitGravatar Berthold Stoeger
But only functions that operate only on gases. Functions concerning cylinders or dives remain in dive.c or are moved to equipment.c Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: remove unused macro FOR_EACH_PICTURE_NON_PTRGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: remove bogus inline modifierGravatar Berthold Stoeger
gas_density() was declared extern in the header and defined inline in the translation unit. I didn't even realize that this oxymoron is valid. Remove inline and an Java-style function definition. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: move unit-related functions to own translation unitGravatar Berthold Stoeger
Create a units.c translation unit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: move trip-related functions into own translation unitGravatar Berthold Stoeger
These functions were spread out over dive.c and divelist.c. Move them into their own file to make all this a bit less monolithic. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: move TRIP_THRESHOLD into divelist.cGravatar Berthold Stoeger
This macro was not used elsewhere. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: create equipment.h headerGravatar Berthold Stoeger
There is an equipment.c file, but no corresponding header. Move the corresponding functions into a newly created header. This does not improve compile time since, at least for now, equipment.h is included in dive.h. But it makes things more consistent. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: fix comment to STRUCTURED_LIST_FREEGravatar Berthold Stoeger
The comment said "Clear everything but the first element" but actually the macro freed the whole list including the first element. For dive computers it was explicitly called on the second element. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: move tag functions into own translation unitGravatar Berthold Stoeger
Make dive.h a bit slimmer. It's only a drop in the bucket - but at least when modifying tag functions not the *whole* application is rebuilt anymore. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: fix includes in membuffer.hGravatar Berthold Stoeger
Headers should not have to be included in a certain order. Therefore include stdarg.h and stdio.h in membuffer.h, since the latter uses FILE and va_list. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: use taglist_copy() instead of STRUCTURED_LIST_COPYGravatar Berthold Stoeger
There is a function for copying tag-lists, use that instead of the raw STRUCTURED_LIST_COPY macro-invocation. This will help in moving tag functions into their own translation unit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Coding style: remove Java-style function definitions in dive.cGravatar Berthold Stoeger
These stuck out like a sore thumb - let's go C-style instead. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: remove unused function dump_taglist()Gravatar Berthold Stoeger
This was probably used for debugging but has no callers anymore. Let's remove it. If needed, it can be trivially readded. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-15Android: add Cressi Cartesio and Goa as potentially supportedGravatar Dirk Hohndel
Assuming they are connected to an FTDI cable. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-06-15Undo: hide multi-dive-edit warning message on subsequent editGravatar Berthold Stoeger
When a different field is edited, hide any old multi-dive-edit warning message. The reason is that we might want to add an "undo" button to the message. But this will undo the wrong command if we don't hide the message. Sadly, this means that we can't use animated show / hide, because an animatedHide() followed immediately by an animatedShow() does not necessarily show the message. In other words, and animatedShow() does not interupt a started animatedHide()!? Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>