From 94ba79c0fedc92113df22da27a4ff2cf01b26f94 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Wed, 22 May 2013 09:42:35 -0300 Subject: Only enable the add buttons when there's a dive loaded Signed-off-by: Tomaz Canabrava --- qt-ui/maintab.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3-70-g09d2