aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
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>
2019-09-14Mobile: provide direct access to dives in DiveListModelGravatar Berthold Stoeger
Accesses were via DiveObjectHelpers. Provide a direct access to struct dive *. Use this for the filter - there is no point in mass generating DiveHelperObjects in the filter code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: create DiveObjectHelper only when neededGravatar Berthold Stoeger
In DiveListModel::data() a DiveObjectHelper was created for any data-access. Create it only when a DiveObjectHelper is actually returned. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: remove dive argument from DiveListModel::insertDive()Gravatar Berthold Stoeger
Since DiveListModel does not keep its own list of dives anymore, insertDive() doesn't use the DiveObjectHelper argument. Remove it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: use value semantics for DiveObjectHelper in qmlmanager.cppGravatar Berthold Stoeger
Instead of creating a pointer-to-DiveObjectHelper in commitChanges, use a normal object. Thus, we don't have to think about ownership issues with respect to this object. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: replace clear()/addAllDives() pairs by reload()Gravatar Berthold Stoeger
The clear()/addAllDives() pair was bogus as the former didn't clear the model (this is not possible anymore - the model represents the core dive list) and the latter readded all dives again. Replace this by a reload() function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Cleanup: remove DiveListSortModel::addAllDives()Gravatar Berthold Stoeger
This function was never used. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: Generate DiveObjectHelpers on the flyGravatar Berthold Stoeger
Instead of keeping track of a list of DiveObjectHelpers, generate them on-the-fly in DiveListModel. Thus, there is less danger of model and core getting out of sync. On the flip-side, now the DiveListModel and the DiveListSortModel might get out of sync. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14DiveObjectHelper: Turn DiveObjectHelper into Q_GADGET based objectGravatar Berthold Stoeger
DiveObjectHelper is a tiny wrapper around dive * to allow access to dive data from QML and grantlee. It doesn't have to be a full-fledged QObject with support for signals, etc. Therefore, turn it into a Q_GADGET based object. This allows us passing the object around as object, not as pointer to DiveObjectHelper. This makes memory-management distinctly easier. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: return depthDuration directly from DiveListModelGravatar Berthold Stoeger
We don't want to generate a DiveObjectHelper numerous times for every item in the dive list. Therefore, return this data directly from the model. In this case, don't remove from DiveObjectHelper, as these data might be used by grantlee templates. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: return location directly from DiveListModelGravatar Berthold Stoeger
We don't want to generate a DiveObjectHelper numerous times for every item in the dive list. Therefore, return this datum directly from the model. In this case, don't remove from DiveObjectHelper, as this datum might be used by grantlee templates. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: return dive-number directly from DiveListModelGravatar Berthold Stoeger
We don't want to generate a DiveObjectHelper numerous times for every item in the dive list. Therefore, return this datum directly from the model. In this case, don't remove from DiveObjectHelper, as this datum might be used by grantlee templates. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: return dive-id directly from DiveListModelGravatar Berthold Stoeger
We don't want to generate a DiveObjectHelper numerous times for every item in the dive list. Therefore, return this datum directly from the model. In this case, don't remove from DiveObjectHelper, as this datum might be used by grantlee templates. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: return dateTime directly from DiveListModelGravatar Berthold Stoeger
We don't want to generate a DiveObjectHelper numerous times for every item in the dive list. Therefore, return this data directly from the model. In this case, don't remove from DiveObjectHelper, as these data might be used by grantlee templates. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: move tripNrDive from DiveObjectHelper to DiveListModelGravatar Berthold Stoeger
We don't want to generate a DiveObjectHelper numerous times for every item in the dive list. Therefore, return this datum directly from the model. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: move tripId from DiveObjectHelper to DiveListModelGravatar Berthold Stoeger
The canonical way of displaying lists in Qt is via models. Thus, return the tripId directly from the DiveListModel instead of going indirectly via a DiveObjectHelper. In the future, this will allow us to make the DiveObjectHelper value-based, as it is not generated numerous times for every list item. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: remove full-text properties from DiveObjectHelperGravatar Berthold Stoeger
These properties are not needed anymore, because the full text search was decoupled from the DiveObjectHelper. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>