mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 01:43:23 +00:00
QML UI: Add helper function to get cylinder info
Helper function that retrieves the cylinder description to be displayed in the DiveDetails. Only the first cylinder for a dive is retrieved. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
1c3a1433e4
commit
19588ce139
3 changed files with 13 additions and 1 deletions
|
@ -12,6 +12,7 @@ import org.kde.plasma.mobilecomponents 0.2 as MobileComponents
|
|||
Item {
|
||||
id: detailsView
|
||||
property int labelWidth: MobileComponents.Units.gridUnit * 10
|
||||
property string cylinder: manager.getCylinder(dive.id)
|
||||
width: parent.width
|
||||
height: mainLayout.implicitHeight + MobileComponents.Units.iconSizes.large
|
||||
Rectangle {
|
||||
|
@ -169,7 +170,7 @@ Item {
|
|||
}
|
||||
MobileComponents.Label {
|
||||
id: txtWeight
|
||||
//text: dive.weights
|
||||
text: weight
|
||||
Layout.fillWidth: true
|
||||
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
|
||||
Layout.alignment: Qt.AlignRight
|
||||
|
|
|
@ -708,3 +708,13 @@ QString QMLManager::getDate(QString diveId)
|
|||
datestring = get_dive_date_string(d->when);
|
||||
return datestring;
|
||||
}
|
||||
|
||||
QString QMLManager::getCylinder(QString diveId)
|
||||
{
|
||||
int dive_id = diveId.toInt();
|
||||
struct dive *d = get_dive_by_uniq_id(dive_id);
|
||||
QString cylinder;
|
||||
if (d)
|
||||
cylinder = d->cylinder[0].type.description;
|
||||
return cylinder;
|
||||
}
|
||||
|
|
|
@ -84,6 +84,7 @@ public slots:
|
|||
QString getNumber(QString diveId);
|
||||
QString getDate(QString diveId);
|
||||
QString getCurrentPosition();
|
||||
QString getCylinder(QString diveId);
|
||||
void deleteGpsFix(quint64 when);
|
||||
void refreshDiveList();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue