mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Group dives by trips
Group dives according to the allocated dive trips. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
f0c7779753
commit
ee9452ae8a
3 changed files with 51 additions and 20 deletions
|
@ -72,21 +72,18 @@ ApplicationWindow {
|
||||||
//And other details at the bottom.
|
//And other details at the bottom.
|
||||||
Row {
|
Row {
|
||||||
id: topLayout
|
id: topLayout
|
||||||
x: 10; y: 10; height: 50; width: parent.width
|
x: 10; y: 10; height: 60; width: parent.width
|
||||||
spacing: 10
|
spacing: 10
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
width: background.width; height: 50
|
width: background.width; height: 60
|
||||||
spacing: 5
|
spacing: 5
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: diveNumber + ' (' + date + ')'
|
text: diveNumber + ' (' + date + ')'
|
||||||
font.bold: true; font.pointSize: 16
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: location
|
|
||||||
}
|
}
|
||||||
|
Text { text: location; width: details.width }
|
||||||
|
Text { text: '<b>Depth:</b> ' + depth + ' <b>Duration:</b>' + duration; width: details.width }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,19 +106,8 @@ ApplicationWindow {
|
||||||
anchors { top: detailsTitle.bottom; bottom: parent.bottom }
|
anchors { top: detailsTitle.bottom; bottom: parent.bottom }
|
||||||
contentHeight: detailsView.height
|
contentHeight: detailsView.height
|
||||||
clip: true
|
clip: true
|
||||||
|
Row {
|
||||||
Column {
|
Text { text: 'Notes: ' + notes; wrapMode: Text.WordWrap; width: details.width }
|
||||||
Row {
|
|
||||||
Text { text: 'Duration: ' + duration; width: details.width }
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
Text { text: 'Depth: ' + depth; width: details.width }
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
Text { text: 'Notes: ' + notes; wrapMode: Text.WordWrap; width: details.width }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,12 +165,31 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: tripHeading
|
||||||
|
Rectangle {
|
||||||
|
width: page.width
|
||||||
|
height: childrenRect.height
|
||||||
|
color: "lightsteelblue"
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: section
|
||||||
|
font.bold: true
|
||||||
|
font.pointSize: 16
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: diveListView
|
id: diveListView
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
model: diveModel
|
model: diveModel
|
||||||
delegate: diveDelegate
|
delegate: diveDelegate
|
||||||
focus: true
|
focus: true
|
||||||
|
|
||||||
|
section.property: "trip"
|
||||||
|
section.criteria: ViewSection.FullString
|
||||||
|
section.delegate: tripHeading
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,14 @@ Dive::Dive(dive *d)
|
||||||
{
|
{
|
||||||
m_thisDive = d;
|
m_thisDive = d;
|
||||||
setDiveNumber(QString::number(d->number));
|
setDiveNumber(QString::number(d->number));
|
||||||
|
|
||||||
|
dive_trip *trip = d->divetrip;
|
||||||
|
|
||||||
|
if(trip) {
|
||||||
|
//trip is valid
|
||||||
|
setTrip(trip->location);
|
||||||
|
}
|
||||||
|
|
||||||
setDate(get_dive_date_string(d->when));
|
setDate(get_dive_date_string(d->when));
|
||||||
setDepth(get_depth_string(d->maxdepth));
|
setDepth(get_depth_string(d->maxdepth));
|
||||||
setDuration(get_dive_duration_string(d->duration.seconds, "h:","min"));
|
setDuration(get_dive_duration_string(d->duration.seconds, "h:","min"));
|
||||||
|
@ -153,6 +161,16 @@ void Dive::setNotes(const QString ¬es)
|
||||||
{
|
{
|
||||||
m_notes = notes;
|
m_notes = notes;
|
||||||
}
|
}
|
||||||
|
QString Dive::trip() const
|
||||||
|
{
|
||||||
|
return m_trip;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Dive::setTrip(const QString &trip)
|
||||||
|
{
|
||||||
|
m_trip = trip;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -184,6 +202,8 @@ QVariant DiveListModel::data(const QModelIndex &index, int role) const
|
||||||
|
|
||||||
if (role == DiveNumberRole)
|
if (role == DiveNumberRole)
|
||||||
return dive.diveNumber();
|
return dive.diveNumber();
|
||||||
|
else if (role == DiveTripRole)
|
||||||
|
return dive.trip();
|
||||||
else if (role == DiveDateRole)
|
else if (role == DiveDateRole)
|
||||||
return dive.date();
|
return dive.date();
|
||||||
else if (role == DiveRatingRole)
|
else if (role == DiveRatingRole)
|
||||||
|
@ -217,6 +237,7 @@ QHash<int, QByteArray> DiveListModel::roleNames() const
|
||||||
{
|
{
|
||||||
QHash<int, QByteArray> roles;
|
QHash<int, QByteArray> roles;
|
||||||
roles[DiveNumberRole] = "diveNumber";
|
roles[DiveNumberRole] = "diveNumber";
|
||||||
|
roles[DiveTripRole] = "trip";
|
||||||
roles[DiveDateRole] = "date";
|
roles[DiveDateRole] = "date";
|
||||||
roles[DiveRatingRole] = "rating";
|
roles[DiveRatingRole] = "rating";
|
||||||
roles[DiveDepthRole] = "depth";
|
roles[DiveDepthRole] = "depth";
|
||||||
|
|
|
@ -50,8 +50,12 @@ public:
|
||||||
QString notes() const;
|
QString notes() const;
|
||||||
void setNotes(const QString ¬es);
|
void setNotes(const QString ¬es);
|
||||||
|
|
||||||
|
QString trip() const;
|
||||||
|
void setTrip(const QString &trip);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_diveNumber;
|
QString m_diveNumber;
|
||||||
|
QString m_trip;
|
||||||
QString m_date;
|
QString m_date;
|
||||||
QString m_rating;
|
QString m_rating;
|
||||||
QString m_depth;
|
QString m_depth;
|
||||||
|
@ -76,6 +80,7 @@ public:
|
||||||
|
|
||||||
enum DiveListRoles {
|
enum DiveListRoles {
|
||||||
DiveNumberRole = Qt::UserRole + 1,
|
DiveNumberRole = Qt::UserRole + 1,
|
||||||
|
DiveTripRole,
|
||||||
DiveDateRole,
|
DiveDateRole,
|
||||||
DiveRatingRole,
|
DiveRatingRole,
|
||||||
DiveDepthRole,
|
DiveDepthRole,
|
||||||
|
|
Loading…
Add table
Reference in a new issue