mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fill Dive Notes widget
Make sure we clear things out if no dive is selected. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
06eab74a72
commit
b3fce3497c
2 changed files with 16 additions and 2 deletions
|
@ -60,6 +60,12 @@ void MainTab::clearStats()
|
||||||
ui->shortestAllText->setText(QString());
|
ui->shortestAllText->setText(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define UPDATE_TEXT(d, field) \
|
||||||
|
if (!d || !d->field) \
|
||||||
|
ui->field->setText(""); \
|
||||||
|
else \
|
||||||
|
ui->field->setText(d->field)
|
||||||
|
|
||||||
void MainTab::updateDiveInfo(int dive)
|
void MainTab::updateDiveInfo(int dive)
|
||||||
{
|
{
|
||||||
// So, this is what happens now:
|
// So, this is what happens now:
|
||||||
|
@ -73,7 +79,15 @@ void MainTab::updateDiveInfo(int dive)
|
||||||
// the access is ui->objectName from here on.
|
// the access is ui->objectName from here on.
|
||||||
|
|
||||||
struct dive *d = get_dive(dive);
|
struct dive *d = get_dive(dive);
|
||||||
ui->notes->setText(d->notes);
|
UPDATE_TEXT(d, notes);
|
||||||
|
UPDATE_TEXT(d, location);
|
||||||
|
UPDATE_TEXT(d, suit);
|
||||||
|
UPDATE_TEXT(d, divemaster);
|
||||||
|
UPDATE_TEXT(d, buddy);
|
||||||
|
if (d)
|
||||||
|
ui->rating->setCurrentStars(d->rating);
|
||||||
|
else
|
||||||
|
ui->rating->setCurrentStars(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainTab::on_addCylinder_clicked()
|
void MainTab::on_addCylinder_clicked()
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
<widget class="QTextEdit" name="notes"/>
|
<widget class="QTextEdit" name="notes"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="StarWidget" name="widget" native="true"/>
|
<widget class="StarWidget" name="rating" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
Loading…
Add table
Reference in a new issue