summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-05-06 13:23:14 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-06 09:58:13 -0700
commit06eab74a72c67f5b1dac3cd92bdaa91a15ae8eac (patch)
treee1b7495663ee9045277d798d97ec114239f7220e
parentbaee8975747e8a4944b377b53a554560f292a881 (diff)
downloadsubsurface-06eab74a72c67f5b1dac3cd92bdaa91a15ae8eac.tar.gz
Added the code to populate the tabs when a dive is selected.
So, this is what happens now: Every tab should be populated from updateDiveInfo method, it will be called whenever a new dive is selected I'm already populating the 'notes' box to show how it can be done. If you are unsure what's the name of anything, open the file maintab.ui on the designer, click on the item and check its objectName, the access is ui->objectName from here on. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/maintab.cpp16
-rw-r--r--qt-ui/maintab.h2
-rw-r--r--qt-ui/mainwindow.cpp1
3 files changed, 19 insertions, 0 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 8d196a872..84f29e6e8 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -60,6 +60,22 @@ void MainTab::clearStats()
ui->shortestAllText->setText(QString());
}
+void MainTab::updateDiveInfo(int dive)
+{
+ // So, this is what happens now:
+ // Every tab should be populated from this method,
+ // it will be called whenever a new dive is selected
+ // I'm already populating the 'notes' box
+ // to show how it can be done.
+ // If you are unsure what's the name of anything,
+ // open the file maintab.ui on the designer
+ // click on the item and check its objectName,
+ // the access is ui->objectName from here on.
+
+ struct dive *d = get_dive(dive);
+ ui->notes->setText(d->notes);
+}
+
void MainTab::on_addCylinder_clicked()
{
if (cylindersModel->rowCount() >= MAX_CYLINDERS)
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index cf83e0dfe..e09781362 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -35,6 +35,8 @@ public Q_SLOTS:
void on_editWeight_clicked();
void on_delWeight_clicked();
+ void updateDiveInfo(int dive);
+
private:
Ui::MainTab *ui;
WeightModel *weightModel;
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index f29c82588..e8fe80460 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -94,6 +94,7 @@ void MainWindow::dive_selection_changed(const QItemSelection& newSelection, cons
select_dive(get_divenr(d));
}
ui->ProfileWidget->plot(get_dive(selected_dive));
+ ui->InfoWidget->updateDiveInfo(selected_dive);
}
void MainWindow::on_actionSave_triggered()