aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2019-10-02Desktop: Use DiveImportedModel::deleteDeselected()Gravatar Berthold Stoeger
In DownloadFromDCWidget::on_ok_clicked() deselected dives were directly deleted from the dive table, leaving DiveImportedModel in an inconsistent state. Use the function in DiveImportedModel instead. This also removes code duplication. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02Import: keep model state consistent when deleting unselected divesGravatar Berthold Stoeger
In DiveImportedModel::deleteDeselected(), unselected dives were deleted from the dive-table. But this left the model in an inconsistent state and the frontend was not informed of the missing dives. Fix this by invoking the appropriate beginRemoveRows()/ endRemoveRows() pairs. Move the functionality into its own function so that it can be reused by the desktop version. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02Import: Make DownloadThread a subobject of DiveImportedModelGravatar Berthold Stoeger
Currently, desktop and mobile are accessing the DownloadThread and the DiveImportedModel concurrently. This makes a big data flow mess. To achieve a more hierarchical data flow, start by making the DownloadThread a subobject of DiveImportedModel. Start the download by calling a function in DiveImportedModel. Route the finished signal through DiveImportedModel. Thus, the model can reload itself with the new data. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02Core: implement move functions for dive and dive_site tableGravatar Berthold Stoeger
To allow efficient moving of downloaded dives from the download thread to the model, implement a general move function that moves table data. Instantiate that function for the dive and dive_site tables. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-27Mobile: replace model-reset by row-addition in DiveListModel::reload()Gravatar Berthold Stoeger
Owing to apparent QML breakage, a model-reset leads to the DiveDetail page being reloaded for every dive in the list(!). Therefore, add rows instead. This leads to extremely subtle code, as it is now imperative that the model has been properly cleared beforehand. Nevertheless, for now we have to do this to fix a severe performance regression. Fixes #2295 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-27Mobile: clear dive data via modelGravatar Berthold Stoeger
Clearing the dive data directly in the core leaves us with an inconsistent model. Therefore, clear via the model. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-27Mobile: Don't access dive-id via DiveObjectHelperGravatar Berthold Stoeger
There is already a role to do that. Query the model directly to avoid creating a full DiveHelperObject. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-27Revert the singleton PRGravatar Dirk Hohndel
It turns out that this isn't working the way it was intended to. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-25Cleanup: remove GpsLocation::instance() functionGravatar Berthold Stoeger
The last user was removed in 8576edd8d611f06fcbd452d88bbc3d46c39d1b9f. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-25Cleanup: Pass gpsTrackers directly to GpsListModel::update()Gravatar Berthold Stoeger
Instead of using the GpsLocation singleton in GpsListModel::update() to extract the gpsTrackers, pass the gpsTrackers as function argument. The caller has direct access to the GpsLocation object anyway and this make things less entangled. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-25Cleanup: unify idiosyncratic singletonsGravatar Berthold Stoeger
The way we handle singletons in QML, QML insists on allocating the objects. This leads to a very idiosyncratic way of handling singletons: The global instance pointer is set in the constructor. Unify all these by implementing a "SillySingleton" template. All of the weird singleton-classes can derive from this template and don't have to bother with reimplementing the instance() function with all the safety-checks, etc. This serves firstly as documentation but also improves debugging as we will now see wanted and unwanted creation and destruction of these weird singletons. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-25Cleanup: remove GpsLocation::hasInstance()Gravatar Berthold Stoeger
This function was not used anywhere. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-23AppImage: Fix path of machine-id in dbus libraryGravatar Paul Buxton
When building dbus within the appimage, cmake picks up the installation path of various files dbus uses through the GNUInstallDirs package, however this doesn't work under the appimage build. So we replace the variable with the normal location of this file. Signed-off-by: Paul Buxton <paubuxton.mail@googlemail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-23AppImage: Fix missing libssl1.1Gravatar Paul Buxton
Add ssl to the AppImage build. Add helper script to fetch required dependancies. Update docker build container used. Signed-off-by: Paul Buxton <paubuxton.mail@googlemail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21Mobile: make sure QML gets notified when value changesGravatar Dirk Hohndel
This addresses the following warning when running the mobile app: INFO: QQmlExpression: Expression qrc:/qml/DownloadFromDiveComputer.qml:339:5 depends on non-NOTIFYable properties: INFO: QMLManager::DC_forceDownload Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21Mobile: more space around menu button on Download pageGravatar Dirk Hohndel
This looked fine when playing with it on the desktop, but required more space on device for some reason. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21Mobile: pass section directly to tripTitle() and tripShortDate()Gravatar Berthold Stoeger
Instead of converting the section-heading string to a trip-pointer in QML and pass that to the tripTitle() and tripShortDate() functions, pass the string and convert in C++ code. Hopefully, this makes the code more robust. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-21Mobile: pass trip-ids through QML, not formatted pointersGravatar Berthold Stoeger
The section heading in the QtQuick ListView has to be a string. Therefore, we passed a pointer formatted using hexadecimal notation. Later, that was converted back without being checked. A very scary proposition, so let's pass unique integer trip-id instead. This means that on converting back we have to scan the trip table, but that is a very minor cost comsidering to the gained robustness. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-21Core: add unique id to tripGravatar Berthold Stoeger
To make it easier to pass around trips through QML, give each trip a unique id. The id is generated in alloc_trip() and uses the same function to generate unique dive ids. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-21If only one dive selected, only one temperature in stats tabGravatar Fabio Rueda
In stats tab, when only one dive is selected, on one stat, only average is shown, except temperature which 3 same temps for max, min and avg are shown. [Dirk Hohndel: fixed whitespace] Signed-off-by: Fabio Rueda <avances123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21Cleanup: remove bogus assignment in startFilterDiveSites()Gravatar Berthold Stoeger
In MultiFilterSortModel::startFilterDiveSites(), the setting of the dive sites to be filtered is done later in the code. Therefore, remove the assignment in the first line of the function. Under some circumstances, this would prevent a needed map reload! Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-21Export: special case dive site mode when exporting dive sitesGravatar Berthold Stoeger
In dive site mode, export selected dive sites, not dive sites of selected dives. Fixes #2275. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-21Cleanup: return each dive site only once in selectedDiveSites()Gravatar Berthold Stoeger
In TabDiveSite::selectedDiveSites(), the QItemSelectionModel:: selectedIndexes() function was used. Thus for every selected dive site 8 entries were added to the return-vector! Instead, use the QItemSelectionModel::selectedRows() function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-21Export: move dive site selection logic to C++Gravatar Berthold Stoeger
When exporting dive sites, the dive sites to be selected were collected in the C-core. But that doesn't have access to the selected dive sites if in dive site mode. Therefore, collect the dive sites in C++ and pass down to the core. Use a std::vector to avoid memory management woes. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-21Cleanup: make location argument to put_location() constGravatar Berthold Stoeger
Since this is an output function, the pointed-to value is not modified. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-21Cleanup: replace is_dive_site_used() by is_dive_site_selected()Gravatar Berthold Stoeger
is_dive_site_used() had a "selected" parameter. If true it would return whether the given dive site had a selected dive. Turns out all callers had this parameter set to true. Therefore, replace by a simplified function without the "selected" parameter and give the function an appropriate name. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-21Cleanup: make two functions in core/save-xml.c of static linkageGravatar Berthold Stoeger
These functions were not used outside of the core/save-xml.c. Make them local. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-21Mobile: don't show filter button when entering credentialsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21Android: force different font on OnePlus devicesGravatar Dirk Hohndel
Those show a very strange font by default. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21Android: bundle default font for use in OnePlus devicesGravatar Dirk Hohndel
This is working around a Qt Bug https://bugreports.qt.io/browse/QTBUG-69494 which prevents correct rendering of the OnePlus fonts. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21Android: print Android HW informationGravatar Dirk Hohndel
This uses Android methods through JNI. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21Mobile: update version to 2.2.1Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21Mobile: print out Qt information on the system we are running onGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21Android: update the target SDK Version to 28Gravatar Dirk Hohndel
This is required by the play store starting November. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21Mobile: dump the information QML has about the screenGravatar Dirk Hohndel
Maybe this will allow us to customize things for certain devices? Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21Mobile: correct font size of 'Previously used DC' labelGravatar Dirk Hohndel
This appears to be the one label where we didn't set the correct font size based on the global scaling. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21Mobile: allow setting a width via environment variableGravatar Dirk Hohndel
This should make it much easier to debug and hopefully fix some of the odd scenarios where we get font sizes (or even the screen layout) wrong. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21Mobile: recalculate gridUnit and font size if width changesGravatar Dirk Hohndel
This could happen when you rotate a mobile device, or when running Subsurface-mobile on the desktop. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21Mobile: move gridUnit and font adjustment to functionGravatar Dirk Hohndel
This way we can call it in other situations when needed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21Android: add FTDI based DiveSystem / Ratio / Seac dive computersGravatar Dirk Hohndel
This way they can be used on a mobile device that supports our way of doing USB on Android. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-15if only one dive, max depth show in average fieldGravatar Fabio Rueda
Signed-off-by: Fabio Rueda <avances123@gmail.com>
2019-09-14Mobile: don't generate numerous DiveObjectHelpers in startEditMode()Gravatar Berthold Stoeger
Since that object is very heavy, generate one object and read out all the necessary values. The old code accessed the model again and again. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Grantlee: split out grantlee-only property from DiveObjectHelperGravatar Berthold Stoeger
The cylindersObject list was only used by grantlee but not by the mobile code. Since it is quite heavy, split it out and thus don't generate it for every dive on mobile. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: transform DiveObjectHelper into value-typeGravatar Berthold Stoeger
Instead of handing a reference-to-dive to QML, prerender all the needed properties and store them as values in DiveObjectHelper. Exception: - date(): generated from timestamp - time(): generated from timestamp - cylinderList(): does not depend on dive anyway and should be made static. This hopefully avoids the random mobile crashes that we are seeing. Clearly, this code needs to be optimized, but it is a start. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Cleanup: make cylinder_t argument to CylinderObjectHelper constGravatar Berthold Stoeger
CylinderObjectHelper copies state from the passed in cylinder_t but does not modify it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Cleanup: remove unused function DiveObjectHelper::cylinder(int)Gravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Cleanup: remove unused function DiveObjectHelper::weight(int)Gravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: remove DiveObjectHelper to bool castsGravatar Berthold Stoeger
These were temporary functions as long as DiveObjectHelpers were used to access dives. All users now access the core directly and therefore don't have to test DiveObjectHelpers for validity. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: remove DiveObjectHelper::getDive()Gravatar Berthold Stoeger
Don't provide access to the raw dive in DiveObjectHelper. All users now access the core directly. This is a step in making DiveObjectHelper value-based. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: Map directly from source in DiveListSortModel::getIdxForId()Gravatar Berthold Stoeger
Instead of looping over all dives and search the dive with the given id, let the source model determine the index and map that. Thus, we do only one mapping and don't generate a ton of DiveObjectHelpers. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>