This patch adds the shortcuts to two other windows.

--
Regards,
Gehad Elrobey

>From 53f2338fc9a63383d28f51409772d3b22b5081be Mon Sep 17 00:00:00 2001
From: Gehad elrobey <gehadelro...@gmail.com>
Date: Fri, 25 Apr 2014 19:39:40 +0200
Subject: [PATCH] Closing shortcuts for connection manager/shift times windows

Adding the ability to close the connection manager window and the shift
times window, also Quit subsurface with these windows in front.

See #489

Signed-off-by: Gehad elrobey <gehadelro...@gmail.com>
---
 qt-ui/simplewidgets.cpp         | 5 +++++
 qt-ui/subsurfacewebservices.cpp | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp
index d100eb7..4752768 100644
--- a/qt-ui/simplewidgets.cpp
+++ b/qt-ui/simplewidgets.cpp
@@ -14,6 +14,7 @@
 #include <QTime>
 #include <QFileDialog>
 #include <QDateTime>
+#include <QShortcut>
 #include "exif.h"
 #include "../dive.h"
 #include "../file.h"
@@ -181,6 +182,10 @@ ShiftTimesDialog::ShiftTimesDialog(QWidget *parent) : QDialog(parent)
 	connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));
 	connect(ui.timeEdit, SIGNAL(timeChanged(const QTime)), this, SLOT(changeTime()));
 	connect(ui.backwards, SIGNAL(toggled(bool)), this, SLOT(changeTime()));
+	QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this);
+	connect(close, SIGNAL(activated()), this, SLOT(close()));
+	QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this);
+	connect(quit, SIGNAL(activated()), parent, SLOT(close()));
 }
 
 void ShiftImageTimesDialog::buttonClicked(QAbstractButton *button)
diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp
index 87cd600..350c8e8 100644
--- a/qt-ui/subsurfacewebservices.cpp
+++ b/qt-ui/subsurfacewebservices.cpp
@@ -14,6 +14,7 @@
 #include <QSettings>
 #include <QXmlStreamReader>
 #include <qdesktopservices.h>
+#include <QShortcut>
 
 #include "dive.h"
 #include "divelist.h"
@@ -220,6 +221,10 @@ WebServices::WebServices(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f
 	ui.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
 	timeout.setSingleShot(true);
 	defaultApplyText = ui.buttonBox->button(QDialogButtonBox::Apply)->text();
+	QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this);
+	connect(close, SIGNAL(activated()), this, SLOT(close()));
+	QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this);
+	connect(quit, SIGNAL(activated()), parent, SLOT(close()));
 }
 
 void WebServices::hidePassword()
-- 
1.9.1

_______________________________________________
subsurface mailing list
subsurface@hohndel.org
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to