mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
7d66dcd12d
commit
68691c9d6d
5 changed files with 45 additions and 3 deletions
|
@ -57,12 +57,11 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
|
||||||
|
|
||||||
action = new QAction(tr("Discard changes"), this);
|
action = new QAction(tr("Discard changes"), this);
|
||||||
connect(action, SIGNAL(triggered(bool)), this, SLOT(rejectChanges()));
|
connect(action, SIGNAL(triggered(bool)), this, SLOT(rejectChanges()));
|
||||||
|
addMessageAction(action);
|
||||||
|
|
||||||
QShortcut *closeKey = new QShortcut(QKeySequence(Qt::Key_Escape), this);
|
QShortcut *closeKey = new QShortcut(QKeySequence(Qt::Key_Escape), this);
|
||||||
connect(closeKey, SIGNAL(activated()), this, SLOT(escDetected()));
|
connect(closeKey, SIGNAL(activated()), this, SLOT(escDetected()));
|
||||||
|
|
||||||
addMessageAction(action);
|
|
||||||
|
|
||||||
if (qApp->style()->objectName() == "oxygen")
|
if (qApp->style()->objectName() == "oxygen")
|
||||||
setDocumentMode(true);
|
setDocumentMode(true);
|
||||||
else
|
else
|
||||||
|
|
|
@ -112,6 +112,7 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||||
connect(DivePlannerPointsModel::instance(), SIGNAL(planCanceled()), this, SLOT(planCanceled()));
|
connect(DivePlannerPointsModel::instance(), SIGNAL(planCanceled()), this, SLOT(planCanceled()));
|
||||||
connect(plannerDetails->printPlan(), SIGNAL(pressed()), divePlannerWidget(), SLOT(printDecoPlan()));
|
connect(plannerDetails->printPlan(), SIGNAL(pressed()), divePlannerWidget(), SLOT(printDecoPlan()));
|
||||||
connect(mainTab, SIGNAL(requestDiveSiteEdit()), this, SLOT(enableDiveSiteEdit()));
|
connect(mainTab, SIGNAL(requestDiveSiteEdit()), this, SLOT(enableDiveSiteEdit()));
|
||||||
|
connect(locationInformation, SIGNAL(informationManagementEnded()), this, SLOT(setDefaultState()));
|
||||||
#ifdef NO_PRINTING
|
#ifdef NO_PRINTING
|
||||||
ui.printPlan->hide();
|
ui.printPlan->hide();
|
||||||
ui.menuFile->removeAction(ui.actionPrint);
|
ui.menuFile->removeAction(ui.actionPrint);
|
||||||
|
@ -217,6 +218,10 @@ void MainWindow::enableDiveSiteEdit() {
|
||||||
setApplicationState("EditDiveSite");
|
setApplicationState("EditDiveSite");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::setDefaultState() {
|
||||||
|
setApplicationState("Default");
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::setLoadedWithFiles(bool f)
|
void MainWindow::setLoadedWithFiles(bool f)
|
||||||
{
|
{
|
||||||
filesAsArguments = f;
|
filesAsArguments = f;
|
||||||
|
|
|
@ -160,6 +160,7 @@ slots:
|
||||||
void on_actionFilterTags_triggered();
|
void on_actionFilterTags_triggered();
|
||||||
void on_actionConfigure_Dive_Computer_triggered();
|
void on_actionConfigure_Dive_Computer_triggered();
|
||||||
void enableDiveSiteEdit();
|
void enableDiveSiteEdit();
|
||||||
|
void setDefaultState();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *);
|
void closeEvent(QCloseEvent *);
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
#include <QCalendarWidget>
|
#include <QCalendarWidget>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
@ -646,7 +647,34 @@ void MultiFilter::closeFilter()
|
||||||
MultiFilterSortModel::instance()->clearFilter();
|
MultiFilterSortModel::instance()->clearFilter();
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QShowEvent>
|
||||||
|
|
||||||
LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBox(parent) {
|
LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBox(parent)
|
||||||
|
{
|
||||||
ui.setupUi(this);
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,6 +221,15 @@ class LocationInformationWidget : public QGroupBox {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
LocationInformationWidget(QWidget *parent = 0);
|
LocationInformationWidget(QWidget *parent = 0);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void acceptChanges();
|
||||||
|
void rejectChanges();
|
||||||
|
|
||||||
|
void showEvent(QShowEvent *);
|
||||||
|
signals:
|
||||||
|
void informationManagementEnded();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::LocationInformation ui;
|
Ui::LocationInformation ui;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue