aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/simplewidgets.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-03-10 11:35:05 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-03-10 11:35:05 -0700
commitb81647bd8a532c6a9c7ac5df0c9051174f32df4f (patch)
tree390024d5da9e9db5a5be79f051e81c60bccb41c7 /qt-ui/simplewidgets.cpp
parentca64f8a7827722212679e8af355b1000c48338c6 (diff)
downloadsubsurface-b81647bd8a532c6a9c7ac5df0c9051174f32df4f.tar.gz
Change the diveSiteMessage to show close or accept/reject
This gives us consistent behavior and allows closing the dive site management screen without editing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/simplewidgets.cpp')
-rw-r--r--qt-ui/simplewidgets.cpp33
1 files changed, 23 insertions, 10 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp
index cbc570e97..ecb8a8bc9 100644
--- a/qt-ui/simplewidgets.cpp
+++ b/qt-ui/simplewidgets.cpp
@@ -670,17 +670,21 @@ void MultiFilter::closeFilter()
LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBox(parent), modified(false)
{
ui.setupUi(this);
- ui.diveSiteMessage->setText("You are editing the Dive Site");
ui.diveSiteMessage->setCloseButtonVisible(false);
- ui.diveSiteMessage->hide();
+ ui.diveSiteMessage->show();
+
+ // create the three buttons and only show the close button for now
+ closeAction = new QAction(tr("Close"), this);
+ connect(closeAction, SIGNAL(triggered(bool)), this, SLOT(rejectChanges()));
+
+ acceptAction = new QAction(tr("Apply changes"), this);
+ connect(acceptAction, SIGNAL(triggered(bool)), this, SLOT(acceptChanges()));
- QAction *action = new QAction(tr("Apply changes"), this);
- connect(action, SIGNAL(triggered(bool)), this, SLOT(acceptChanges()));
- ui.diveSiteMessage->addAction(action);
+ rejectAction = new QAction(tr("Discard changes"), this);
+ connect(rejectAction, SIGNAL(triggered(bool)), this, SLOT(rejectChanges()));
- action = new QAction(tr("Discard changes"), this);
- connect(action, SIGNAL(triggered(bool)), this, SLOT(rejectChanges()));
- ui.diveSiteMessage->addAction(action);
+ ui.diveSiteMessage->setText(tr("Dive site management"));
+ ui.diveSiteMessage->addAction(closeAction);
}
void LocationInformationWidget::setLocationId(uint32_t uuid)
@@ -786,15 +790,24 @@ void LocationInformationWidget::resetState()
{
modified = false;
resetPallete();
- ui.diveSiteMessage->hide();
+ MainWindow::instance()->dive_list()->setEnabled(true);
MainWindow::instance()->setEnabledToolbar(true);
+ ui.diveSiteMessage->setText(tr("Dive site management"));
+ ui.diveSiteMessage->addAction(closeAction);
+ ui.diveSiteMessage->removeAction(acceptAction);
+ ui.diveSiteMessage->removeAction(rejectAction);
+ ui.diveSiteMessage->setCloseButtonVisible(false);
}
void LocationInformationWidget::enableEdition()
{
MainWindow::instance()->dive_list()->setEnabled(false);
MainWindow::instance()->setEnabledToolbar(false);
- ui.diveSiteMessage->show();
+ ui.diveSiteMessage->setText(tr("You are editing a dive site"));
+ ui.diveSiteMessage->removeAction(closeAction);
+ ui.diveSiteMessage->addAction(acceptAction);
+ ui.diveSiteMessage->addAction(rejectAction);
+ ui.diveSiteMessage->setCloseButtonVisible(false);
}
void LocationInformationWidget::on_diveSiteCoordinates_textChanged(const QString& text)