summaryrefslogtreecommitdiffstats
path: root/shemovcleaner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'shemovcleaner.cpp')
-rw-r--r--shemovcleaner.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/shemovcleaner.cpp b/shemovcleaner.cpp
index e7c6d07..2484689 100644
--- a/shemovcleaner.cpp
+++ b/shemovcleaner.cpp
@@ -11,6 +11,7 @@
#include <QMessageBox>
#include <QTreeView>
#include <QSettings>
+#include <QKeyEvent>
#include "shemovcleaner.h"
#include "torrentwidget.h"
@@ -43,6 +44,7 @@ ShemovCleaner::ShemovCleaner(QWidget *parent, Qt::WindowFlags f) : QMainWindow(p
QSettings s;
restoreGeometry(s.value("geometry").toByteArray());
+ mTorrentTab->torrentFileView()->setFocus();
}
void ShemovCleaner::statusBarMessage(const QString &msg){
@@ -81,6 +83,32 @@ void ShemovCleaner::closeEvent(QCloseEvent *e){
QMainWindow::closeEvent(e);
}
+void ShemovCleaner::keyPressEvent(QKeyEvent *e){
+ //Yes, this could be much more terse, but this is readable!
+ if(e->key() == Qt::Key_Left && (e->modifiers() & Qt::AltModifier)){
+ int curTabIdx = mTab->currentIndex();
+ if(curTabIdx - 1 < 0){
+ curTabIdx = mTab->count() - 1;
+ }else{
+ --curTabIdx;
+ }
+ mTab->setCurrentIndex(curTabIdx);
+ e->accept();
+ return;
+ }
+ if(e->key() == Qt::Key_Right && (e->modifiers() & Qt::AltModifier)){
+ int curTabIdx = mTab->currentIndex();
+ if(curTabIdx + 1 >= mTab->count()){
+ curTabIdx = 0;
+ }else{
+ ++curTabIdx;
+ }
+ mTab->setCurrentIndex(curTabIdx);
+ e->accept();
+ return;
+ }
+}
+
void ShemovCleaner::createStatusBar(){
QLabel *l1 = new QLabel(tr("Sel."));
mSelected = new QLabel("000/000");