aboutsummaryrefslogtreecommitdiffstats
path: root/core
AgeCommit message (Collapse)Author
2019-12-24core: correct include in exportfuncsGravatar jan Iversen
change include "dive.h" to "core/dive.h", in order to prepare the file to moved away from core. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-24core: add convert between meter/feet to plannerSharedGravatar jan Iversen
qPrefDiveplanner contains settings for ascent and descent in a neutral format. diveplanner desktop uses a macro UNIT_FACTOR to convert between UI values and qPref values. In order not to dublicate these calculation (in C++ and QML) a set of shared functions are made. The functions are identical to the calculations in diveplanner desktop. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-24core: add plannerShared classGravatar jan Iversen
Add a plannerShared class, whose purpose is to contain shared functions between mobile and desktop This class is the inner workings of the diveplanner not the UI Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-13core: remove LOG_STP from mobileGravatar jan Iversen
LOG_STP is on longer providing the data needed, since a lot of the startup is indirectly in QML, furthermore using the xcode project and running profiler gives much more detailed information Signed-off-by: Jan Iversen <jani@apache.org>
2019-12-12core: divehare avoid race problem.Gravatar jan Iversen
Do reply->readAll() before reply-deleteLater() With UI deleteLater() seems to happen after the function exist, but with QML it causes problems. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-12core: divehare change slot namesGravatar jan Iversen
change slot names from slot_* to *Slot Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-12core/settings: qPrefCloudStorage, correct diveshare_uid namingGravatar jan Iversen
The variable in Q_PROPERTY was wrongly named diveshare_userid change diveshare_userid to diveshare_uid Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-12core: uploadDiveLogsDE::prepareDives no longer need to be publicGravatar jan Iversen
Integration into desktop-widgets is complete. Move prepareDives() from public to private Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11core: corrected timeout and error text problem in uploadDiveLogsDEGravatar jan Iversen
incorrectly stopped timer before the upload was started. Signed-off-by: Jan Iversen <jan@casacondor.com>
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>