mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
mobile: autocomplete location names
Add the capability to select the location name from a list, constructed from the known dive sites in the logbook. Fixes: #546 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
parent
ba773c811f
commit
64704d6e5a
4 changed files with 26 additions and 5 deletions
|
@ -426,6 +426,23 @@ QStringList DiveObjectHelper::suitList() const
|
|||
return suits;
|
||||
}
|
||||
|
||||
QStringList DiveObjectHelper::locationList() const
|
||||
{
|
||||
QStringList locations;
|
||||
struct dive *d;
|
||||
struct dive_site *ds;
|
||||
int i = 0;
|
||||
for_each_dive (i, d) {
|
||||
ds = get_dive_site_by_uuid(d->dive_site_uuid);
|
||||
QString temp = ds->name;
|
||||
if (!temp.isEmpty())
|
||||
locations << temp;
|
||||
}
|
||||
locations.removeDuplicates();
|
||||
locations.sort();
|
||||
return locations;
|
||||
}
|
||||
|
||||
QStringList DiveObjectHelper::buddyList() const
|
||||
{
|
||||
QStringList buddies;
|
||||
|
|
|
@ -50,6 +50,7 @@ class DiveObjectHelper : public QObject {
|
|||
Q_PROPERTY(QStringList suitList READ suitList CONSTANT)
|
||||
Q_PROPERTY(QStringList buddyList READ buddyList CONSTANT)
|
||||
Q_PROPERTY(QStringList divemasterList READ divemasterList CONSTANT)
|
||||
Q_PROPERTY(QStringList locationList READ locationList CONSTANT)
|
||||
public:
|
||||
DiveObjectHelper(struct dive *dive = NULL);
|
||||
~DiveObjectHelper();
|
||||
|
@ -93,6 +94,7 @@ public:
|
|||
QString endPressure() const;
|
||||
QString firstGas() const;
|
||||
QStringList suitList() const;
|
||||
QStringList locationList() const;
|
||||
QStringList buddyList() const;
|
||||
QStringList divemasterList() const;
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ Kirigami.Page {
|
|||
property alias depth: detailsEdit.depthText
|
||||
property alias duration: detailsEdit.durationText
|
||||
property alias location: detailsEdit.locationText
|
||||
property alias locationModel: detailsEdit.locationModel
|
||||
property alias gps: detailsEdit.gpsText
|
||||
property alias notes: detailsEdit.notesText
|
||||
property alias suitIndex: detailsEdit.suitIndex
|
||||
|
|
|
@ -35,6 +35,7 @@ Item {
|
|||
property alias divemasterModel: divemasterBox.model
|
||||
property alias buddyModel: buddyBox.model
|
||||
property alias cylinderModel: cylinderBox.model
|
||||
property alias locationModel: txtLocation.model
|
||||
property int rating
|
||||
property int visibility
|
||||
|
||||
|
@ -105,12 +106,12 @@ Item {
|
|||
text: qsTr("Location:")
|
||||
font.pointSize: subsurfaceTheme.smallPointSize
|
||||
}
|
||||
Controls.TextField {
|
||||
id: txtLocation;
|
||||
HintsTextEdit {
|
||||
id: txtLocation
|
||||
model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ?
|
||||
diveDetailsListView.currentItem.modelData.dive.locationList : null
|
||||
inputMethodHints: Qt.ImhNoPredictiveText
|
||||
Layout.fillWidth: true
|
||||
onEditingFinished: {
|
||||
focus = false
|
||||
}
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
|
|
Loading…
Add table
Reference in a new issue