aboutsummaryrefslogtreecommitdiffstats
path: root/core
AgeCommit message (Collapse)Author
2019-12-11core: add uploadStatus signal to uploadDiveLogsDEGravatar jan Iversen
The uploadStatus signal can be used to inform the user about the process e.g. - preparing zip file - starting actual upload It is a suplement to uploadProgress, that only informs about the network part. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11core: make uploadDiveLogsDE slots workable for desktopGravatar jan Iversen
Secure that the slots/signals in uploadDiveLogsDE, which are without UI, can be used in DivelogsDeWebServices (to add the UI part). Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11core: rename slot in uploadDiveLogsDEGravatar jan Iversen
The difference between slot names and signal names was to insignificant e.g. uploadFinish (signal) uploadFinished (slot). Change slot names to slot_<name> should clear any confusion. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11core: make prepareDives public in uploadDiveLogsDEGravatar jan Iversen
prepareDives needs to be public, in order to be used in subsurfacewebservices. "friend" is another option, but that gives subsurfacewebservices too much freedom. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11core: make shared prepareDives identical to desktop prepare_dives_for_divelogsGravatar jan Iversen
In order to replace DivelogsDeWebServices::prepare_dives_for_divelogs with uploadDiveLogsDE::prepareDives, first step is to make the functions identical. amount_selected is not maintained for mobile, add #ifdef SUBSURFACE_MOBILE Add comment, to make code more readable add white line to make code more readable change to use variable ds (created a couple of lines earlier Avoid "goto" by adding close code Remove label and close code (it was only called in 1 place) Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11core: correct QString arg problemGravatar jan Iversen
use report_error directly, instead of making a QString first, argument syntax are different (%s vs. %1) Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11core: add timeout.stop() if upload successfulGravatar jan Iversen
Stop timeout not only in case of errors, but also in positive case. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11core: add upload divelogs.de classGravatar jan Iversen
The implementation is based on class DivelogsDeWebServices in desktop-widgets but without the UI entanglement Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11core/settings: extend qPrefCloudStorage with divelogsde user infoGravatar jan Iversen
Add divelogsde_userid and divelogsde_password to qPrefCloudStorage to be used in Export.qml Extending qPrefCloudStorage is more logical than adding QSettings (and securing the same behaviour) outside qPref. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11core: change uploadFinish() to include htmlGravatar jan Iversen
diveshareexport wants to show the HTML received in a positive response, so signal cannot be compatible with diveLogsDE Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11core: copy doUpload from desktop-widgets to coreGravatar jan Iversen
Add DiveShareExportDialog::do_upload() to uploadDiveShare::do_upload(), while cleaning it from UI. Add signal connections as used in uploadDiveLogsDE Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11core/settings: extend qPrefCloudStorage with diveshare uid/privateGravatar jan Iversen
Add diveshare/uid and diveshare/private to qPrefCloudStorage to be used in Export.qml as well as diveshareexportdialog Extending qPrefCloudStorage is more logical than adding QSettings (and securing the same behaviour) outside qPref. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11core: add upload dive-share.com classGravatar jan Iversen
This is the framework that mobileExecutable needs, all prepared to move functionality from desktop-widgets (current implementation) into a shared version. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-10Filter: send filterReset via signalGravatar Berthold Stoeger
The old code called directly into the DiveListModel. Instead, send a signal and hook into the signal from the model. This will allow us to remove the DiveListModel::instance() function. This, in turn, is a step towards supporting multiple models at the same time. However, currently the model manually sets the hidden_by_filter flag in the core and therefore only one active model is supported at a time. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-07Selection: provide convenience function for single-dive selectionGravatar Berthold Stoeger
Currently, selecting a single dive or deselecting all dives was quite awkward: One had to pass in a single-dive vector and the dive itself (as current dive). Provide a convenience function that selects a single dive or deselects all dives if null is passed in. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-05core/settings: remove Q_PROPERTY warning in qPref headersGravatar jan Iversen
Q_PROPERTY contains an internal ";", making clang produce a warning when ending the line with a ; Remove ; at the end of Q_PROPERTY lines. Signed-off-by: Jan Iversen <jani@apache.org>
2019-12-05core/settings: make qPref* constructors privateGravatar jan Iversen
Signed-off-by: Jan Iversen <jani@apache.org>
2019-12-05core/settings: make qPrefGeocoding functions staticGravatar jan Iversen
Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-05core: correct cloudstorage.cpp to use static qPrefCloudStorage functions.Gravatar jan Iversen
qPrefCloudStorage set/get functions are static. remove creation of qPrefCloudStorage instance, reference static functions. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-05Cleanup: set description to null in free_[weightsystem|cylinder]Gravatar Berthold Stoeger
Currently, the caller is responsible for not reusing a freed weightsystem / cylinder or resetting the description field to null. This is very unfriendly. Set the description field to null, because that allows us to call free_* repeatedly on the same object. Use the new behavior to make the weightsystem model code a bit cleaner. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-05Undo: make weight editing undoableGravatar Berthold Stoeger
Implement the EditWeight undo command. Since there is common code (storage of the old weight), this creates a common base class for RemoveWeight and EditWeight. The model calls directly into the undo command, which is somewhat unfortunate as it feels like a layering violation. It's the easy thing to do for now. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-05Cleanup: use free_weightsystem function instead of explicit freeGravatar Berthold Stoeger
Instead of freeing internal data of the weightsystem structure, call the free_weightsystem function (which has to be made extern at first). This makes things more future-proof, should the weightsystem struct ever be extended. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-05Cleanup: introduce empty_weightsystem constantGravatar Berthold Stoeger
To make things more future-proof, introduce an empty_weightsystem constant. Replace explicit aggragate initialization of empty weightsystems by this constant. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-05Undo: make weight-deletion an undoable actionGravatar Berthold Stoeger
This one is a bit more complicated than weight adding, because the multiple-dive case is not well defined. If multiple dives are selected, this implementation will search for weights that are identical to the weight deleted in the currently shown dive. The position of the weight in the list is ignored. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-05Undo: make adding of weights an undoable actionGravatar Berthold Stoeger
Introduce an AddWeight undo command. This is modelled after the numerous dive-edit undo commands. The redo and undo actions are connected to the WeightModel via two new signals, weightAdded and weightRemoved. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-05core: add dive_site export for mobile in ExportfuncsGravatar jan Iversen
DiveFilter is not available in Mobile, so another solution is needed. Use "for_each_dive_site" to loop over dive sites instead. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-04Selection: move selection of "first" dive to coreGravatar Berthold Stoeger
The DiveListView has a function to select the first dive. Move this to the core to be able to call it from all parts (not only desktop) of the code. Currently, this has a (small?) UI regression: when filtering dives and no selected dive is visible anymore, the old code would select the first dive in the list. The new code selects the newest dive, which might not be the first if some sort-criterion is active. To revert to the old behavior, it will be necessary to move the sorting function likewise to the core. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04Cleanup: remove superfluous includes from core/divelist.cGravatar Berthold Stoeger
Most of these haven't been used in a long time. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04Selection: move selection functions from divelist.c to selection.cGravatar Berthold Stoeger
Since we now have a selection.c translation unit, put the selection- related functions there. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04Selection: move commands/command_private.* to core/selection.*Gravatar Berthold Stoeger
The file command_private.cpp had functions concerning selections only. To make these functions accessible from outside the undo machinery, turn it into a part of the core-library. Currently, only C++ functions are exported. We might think about also exporting a C interface. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-03core: add shared export functions (copy from desktop-widgets)Gravatar jan Iversen
desktop-widgets/divelogexportdialog.* contains both the desktop dialog as well as the "real" export functions. Create a class to be shared between desktop and mobile Copy the export functions 1-1 from divelogexportdialog.* of course changing class names. saveProfile is highly dependent on the UI, so the implementaion will be done in each UI directory (desktop-widgets, mobile-widgets). Remark this commit just add the copied functions, in order to secure nothing is broken. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-03Desktop: add export to htmlGravatar willemferguson
Add the export of environmental parameters in star widgets to .html format. The dive rating is always shown both in the condensed as well as in the expanded view. The other five environmental variables are only shown in the expanded view. Only those star widgets with a rating are shown: if a star widget has not been rated in the UI, then it is assumed unrated and is not indicated in the expanded view. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-03Desktop: add additional star widgets to Information tabGravatar willemferguson
Provide file I/O for those star widgets that are enabled. The values of the widgets can be stored to and read from either xml or git. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-03Desktop: add additional star widgets to Information tabGravatar willemferguson
Connect the UI to the underlying dive structure. Enable proper initialisation and management of star widgets while Information tab is active. Enable undo for the addtional star widgets. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-03Desktop: handle environmental states in Information tabGravatar willemferguson
Create a preference setting on the General Settings page. The setting is saved with the other preferences. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-28Add current GF to infoboxGravatar Robert C. Helling
As per request from users on scubaforum.com, this adds the current gradient factor to the deco information of the infobox. Up to now, this information was only graphically represented in the pressure bar graph and the heatmap. This gives a numerical value. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-11-26core: add --testqml flag to mobileExecutableGravatar jan Iversen
Add flag to subsurface_mobile (only when compiling for desktop) to allow using qml files from disk instead of resources. This allows testing qml changes with just restarting subsurface_mobile. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-11-22Core: don't prevent some OSTC models from being recognizedGravatar Dirk Hohndel
The code seemed to do something really reasonable by picking one of the supported OSTC versions - except that the one it picked didn't support BT/BLE and therefore our logic of recognizing dive computers on iOS failed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-20Translations: try to be smarter when picking the right localeGravatar Dirk Hohndel
I was reminded to do this when a user in French speaking Switzerland reasonably suggested that fr_FR would be a much better fallback than en_US in their situation. Fixes: #2388 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-19Dive list: update selection after clearing modelGravatar Berthold Stoeger
When clearing the model the selection is cleared. Send the according signal. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-19Filter: move recalculation of filter from FilterModel to TripModelGravatar Berthold Stoeger
The way this was accessed via Qt's model semantics was horrible. This gives arguably more readable code, since we don't have to shoehorn things through QVariants. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-19Filter: move num_shown logic from model to coreGravatar Berthold Stoeger
Since the number of shown dives is stored in the core, let's also keep it updated there. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-19Filter: split out filter from modelGravatar Berthold Stoeger
Split out the actual filtering from the MultiFilterSortModel. Create a DiveFilter class that does the actual filtering. Currently, mobile and desktop have their own version of this class, though ultimately we may want to merge them. The idea here is that the trip-model and undo-commands have direct access to the filter-function and thus can take care of keeping track of the number of shown dives, etc. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-19Filter: move calculation of shown dives to undo commandGravatar Berthold Stoeger
The filter-model was catching dives-added / dives-deleted signals from the models to keep track of the number of shown dives. To simplify the data flow, do this directly in the undo-command. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-19Filter: move number of shown dives to coreGravatar Berthold Stoeger
We mark hidden/shown dives in the core but store the number of shown dives in the MultiFilterSortModel. Move this datum to the core for improved locality. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-16Check if all required bytes were readGravatar Robert C. Helling
Fixes CID 350077 Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-11-16Don't acces null dive computerGravatar Robert C. Helling
Fixes CID 350111 Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-11-16Use the actual error numberGravatar Robert C. Helling
According to the man page, fopen and fclose return the error number in the global variable errno. Fixes CID 350115 Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-11-16Initialize cylider field properlyGravatar Robert C. Helling
This fixes another thing Coverty found. I am not 100% sure I understand the semantics of cylinder_t.manually_added but looking at other instance I guess true is the correct value for a cylinder from a csv file for a Poseidon rebreather. Fixes CID 350734 Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-11-16Don't access uninitialized deco_structureGravatar Robert C. Helling
Coverty found that in the export functions, we initialize the planner deco state with NULL and then possibly later access its content. This makes sure, we don't do that. Let's see if this makes Coverty happy or I missed somehting else. Fixes CID 350736 Fixes CID 350735 Signed-off-by: Robert C. Helling <helling@atdotde.de>