summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2018-02-02 07:51:09 +0100
committerArno <arno@disconnect.de>2018-02-02 07:51:09 +0100
commitaeb21594c540ecab7bbd2c7a37d9e2fcec13b286 (patch)
treed4f691d9fe8a8c9db0f3c25ebf85a9e09fcea90a
parent873aea1fc7a23bf6e764012b3422c4d9b0c39026 (diff)
downloadShemovCleaner-aeb21594c540ecab7bbd2c7a37d9e2fcec13b286.tar.gz
ShemovCleaner-aeb21594c540ecab7bbd2c7a37d9e2fcec13b286.tar.bz2
ShemovCleaner-aeb21594c540ecab7bbd2c7a37d9e2fcec13b286.zip
Add CTRL+S shortcut for SearchDialog
If in FileWidget, show and raise SearchDialog on CTRL+s, hide it on CTRL +x. Show busy cursor while searching.
-rw-r--r--searchdialog.cpp17
-rw-r--r--searchdialog.h3
2 files changed, 20 insertions, 0 deletions
diff --git a/searchdialog.cpp b/searchdialog.cpp
index ff469ee..79beb0f 100644
--- a/searchdialog.cpp
+++ b/searchdialog.cpp
@@ -11,6 +11,8 @@
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSettings>
+#include <QKeyEvent>
+#include <QApplication>
#include "searchdialog.h"
#include "helper.h"
@@ -81,6 +83,7 @@ SearchDialog::~SearchDialog(){
void SearchDialog::doSearch(){
int type = mTypeSel->currentData().toInt();
+ qApp->setOverrideCursor(Qt::BusyCursor);
if(type == Title){
doSearchTitle();
}else if(type == Filename){
@@ -88,16 +91,19 @@ void SearchDialog::doSearch(){
}else if(type == Actors){
doSearchActor();
}
+ qApp->restoreOverrideCursor();
}
void SearchDialog::doResult(const QModelIndex &cur, const QModelIndex &prev){
Q_UNUSED(prev)
int type = mTypeSel->currentData().toInt();
+ qApp->setOverrideCursor(Qt::BusyCursor);
if(type == Title || type == Filename){
doResultName(cur, type);
}else if(type == Actors){
doResultActor(cur);
}
+ qApp->restoreOverrideCursor();
}
void SearchDialog::doSearchTitle(){
@@ -293,6 +299,17 @@ void SearchDialog::readSettings(){
}
}
+void SearchDialog::keyPressEvent(QKeyEvent *e){
+ if(e->key() == Qt::Key_X && (e->modifiers() & Qt::ControlModifier)){
+ hide();
+ goto exit;
+ }
+ return QDialog::keyPressEvent(e);
+
+ exit:
+ e->accept();
+}
+
void SearchDialog::doChild(QStandardItem *item, int childMode){
QStringList res;
QIcon aIcon;
diff --git a/searchdialog.h b/searchdialog.h
index efe081e..0ef4aad 100644
--- a/searchdialog.h
+++ b/searchdialog.h
@@ -29,6 +29,9 @@ class SearchDialog : public QDialog {
void writeSettings();
void readSettings();
+ protected:
+ virtual void keyPressEvent(QKeyEvent *e);
+
private:
void doChild(QStandardItem *item, int childMode);
void doActorGenres(QStandardItem *item);