diff options
Diffstat (limited to 'shemovcleaner.cpp')
-rw-r--r-- | shemovcleaner.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/shemovcleaner.cpp b/shemovcleaner.cpp index fa21934..1a46c96 100644 --- a/shemovcleaner.cpp +++ b/shemovcleaner.cpp @@ -16,6 +16,7 @@ #include <QStorageInfo> #include <QPainter> #include <QSplashScreen> +#include <QEvent> #include "shemovcleaner.h" #include "torrentwidget.h" @@ -68,6 +69,8 @@ ShemovCleaner::ShemovCleaner(QWidget *parent, Qt::WindowFlags f) : QMainWindow(p connect(this, &ShemovCleaner::configurationChanged, mFileTab, &FileWidget::readSettings); connect(mFileTab->fileCopier(), &FileCopier::copying, this, &ShemovCleaner::updateCopying); connect(mFileTab->fileCopier(), &FileCopier::finished, [=] { updateCopying(false, QString());} ); + mCopying->installEventFilter(this); + updateCopying(false, QString()); QMenu *helpMenu = new QMenu(tr("&Help")); QAction *aboutThisA = new QAction(tr("About ShemovCleaner..."), this); @@ -185,6 +188,21 @@ void ShemovCleaner::closeEvent(QCloseEvent *e){ } } +bool ShemovCleaner::eventFilter(QObject *watched, QEvent *event){ + if(watched == mCopying){ + if(event->type() == QEvent::MouseButtonPress){ + if(mFileTab->fileCopier()->isRunning()){ + int retval = QMessageBox::question(this, tr("Cancel copy?"), tr("Cancel copying?")); + if(retval == QMessageBox::Yes){ + mFileTab->fileCopier()->cancel(); + return true; + } + } + } + } + return QMainWindow::eventFilter(watched, event); +} + void ShemovCleaner::createStatusBar(){ QLabel *l1 = new QLabel(tr("Sel.")); mSelected = new QLabel("000/000"); |