diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2015-02-11 13:58:23 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-02-11 16:34:02 -0800 |
commit | 68691c9d6d05ba28c8e0e8c837dcd32bb2eec42c (patch) | |
tree | 309705eb75fa69d3730b372ecbee4b4bb7bfae38 /qt-ui/simplewidgets.cpp | |
parent | 7d66dcd12d42db7c9e3f18be21615204588a66e3 (diff) | |
download | subsurface-68691c9d6d05ba28c8e0e8c837dcd32bb2eec42c.tar.gz |
Accept / Cancel location edit
Make it possible to cancel or accept the location edit and
get back to the mainwindow default state.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/simplewidgets.cpp')
-rw-r--r-- | qt-ui/simplewidgets.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index 98d9bcf9f..63ec4b4fa 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -6,6 +6,7 @@ #include <QShortcut> #include <QCalendarWidget> #include <QKeyEvent> +#include <QAction> #include "file.h" #include "mainwindow.h" @@ -646,7 +647,34 @@ void MultiFilter::closeFilter() MultiFilterSortModel::instance()->clearFilter(); hide(); } +#include <QDebug> +#include <QShowEvent> -LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBox(parent) { +LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBox(parent) +{ ui.setupUi(this); + ui.diveSiteMessage->setText("You are editing the Dive Site"); + ui.diveSiteMessage->setCloseButtonVisible(false); + + QAction *action = new QAction(tr("Apply changes"), this); + connect(action, SIGNAL(triggered(bool)), this, SLOT(acceptChanges())); + ui.diveSiteMessage->addAction(action); + + action = new QAction(tr("Discard changes"), this); + connect(action, SIGNAL(triggered(bool)), this, SLOT(rejectChanges())); + ui.diveSiteMessage->addAction(action); +} + +void LocationInformationWidget::acceptChanges() +{ + emit informationManagementEnded(); +} + +void LocationInformationWidget::rejectChanges() +{ + emit informationManagementEnded(); +} + +void LocationInformationWidget::showEvent(QShowEvent *ev) { + ui.diveSiteMessage->setCloseButtonVisible(false); } |