aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-05-22 09:42:35 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-05-22 09:42:35 -0300
commit94ba79c0fedc92113df22da27a4ff2cf01b26f94 (patch)
tree153d9b95ada235ec8c75654dd108c349de3514cf
parent28deb3e65dd04ba0eb178b44b2a3bdd16f40ef0f (diff)
downloadsubsurface-94ba79c0fedc92113df22da27a4ff2cf01b26f94.tar.gz
Only enable the add buttons when there's a dive loaded
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
-rw-r--r--qt-ui/maintab.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 50549f2c0..0a8710e09 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -69,11 +69,12 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
addCylinder->setFlat(true);
addCylinder->setToolTip(tr("Add Cylinder"));
connect(addCylinder, SIGNAL(clicked(bool)), this, SLOT(addCylinder_clicked()));
-
+ addCylinder->setEnabled(false);
addWeight = new QPushButton(plusIcon, QString(), ui->weightGroup);
addWeight->setFlat(true);
addWeight->setToolTip(tr("Add Weight System"));
connect(addWeight, SIGNAL(clicked(bool)), this, SLOT(addWeight_clicked()));
+ addWeight->setEnabled(false);
}
// We need to manually position the 'plus' on cylinder and weight.
@@ -237,6 +238,8 @@ void MainTab::updateDiveInfo(int dive)
ui->shortestAllText->setText(get_time_string(stats_selection.shortest_time.seconds, 0));
cylindersModel->setDive(d);
weightModel->setDive(d);
+ addCylinder->setEnabled(true);
+ addWeight->setEnabled(true);
} else {
/* make the fields read-only */
ui->location->setReadOnly(true);
@@ -263,6 +266,8 @@ void MainTab::updateDiveInfo(int dive)
ui->airPressureText->clear();
cylindersModel->clear();
weightModel->clear();
+ addCylinder->setEnabled(false);
+ addWeight->setEnabled(false);
}
/* statisticsTab*/
/* we can access the stats_selection struct, but how do we ensure the relevant dives are selected