From 27d630f58da1707fce31d2d5e01aa1a37af8cf19 Mon Sep 17 00:00:00 2001 From: Vesa Pikki Date: Thu, 2 Jul 2009 20:23:44 +0300 Subject: [PATCH] Disabling progressbar if stop button is pressed. This actually had no visible effect on KDE. --- gui/fileviewdialog.cpp | 4 ++-- gui/fileviewdialog.h | 4 ++-- gui/mainwindow.cpp | 14 +++++++++++--- gui/mainwindow.h | 6 ++++++ gui/resultsview.cpp | 5 +++++ gui/resultsview.h | 2 ++ gui/threadhandler.h | 6 +++++- 7 files changed, 33 insertions(+), 8 deletions(-) diff --git a/gui/fileviewdialog.cpp b/gui/fileviewdialog.cpp index 4f76df068..0d1fc2e7d 100644 --- a/gui/fileviewdialog.cpp +++ b/gui/fileviewdialog.cpp @@ -27,8 +27,8 @@ #include "fileviewdialog.h" FileViewDialog::FileViewDialog(const QString &file, - const QString &title, - QWidget *parent) + const QString &title, + QWidget *parent) : QDialog(parent) { mUI.setupUi(this); diff --git a/gui/fileviewdialog.h b/gui/fileviewdialog.h index c6c0a19d4..e1c7786f4 100644 --- a/gui/fileviewdialog.h +++ b/gui/fileviewdialog.h @@ -35,8 +35,8 @@ class FileViewDialog : public QDialog Q_OBJECT public: FileViewDialog(const QString &file, - const QString &title, - QWidget *parent = 0); + const QString &title, + QWidget *parent = 0); protected: diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 516d728c9..c1bc9540b 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -65,7 +65,7 @@ MainWindow::MainWindow() : connect(mUI.mActionRecheck, SIGNAL(triggered()), this, SLOT(ReCheck())); - connect(mUI.mActionStop, SIGNAL(triggered()), mThread, SLOT(Stop())); + connect(mUI.mActionStop, SIGNAL(triggered()), this, SLOT(StopChecking())); connect(mUI.mActionSave, SIGNAL(triggered()), this, SLOT(Save())); connect(mUI.mActionAbout, SIGNAL(triggered()), this, SLOT(About())); @@ -362,6 +362,8 @@ void MainWindow::CheckDone() mUI.mActionSave->setEnabled(true); } + + // Notify user - if the window is not active - that check is ready QApplication::alert(this, 3000); } @@ -485,14 +487,14 @@ void MainWindow::About() void MainWindow::ShowLicense() { - FileViewDialog *dlg = new FileViewDialog(":COPYING",tr("License"), this); + FileViewDialog *dlg = new FileViewDialog(":COPYING", tr("License"), this); dlg->resize(570, 400); dlg->exec(); } void MainWindow::ShowAuthors() { - FileViewDialog *dlg = new FileViewDialog(":AUTHORS",tr("Authors"), this); + FileViewDialog *dlg = new FileViewDialog(":AUTHORS", tr("Authors"), this); dlg->resize(350, 400); dlg->exec(); } @@ -602,3 +604,9 @@ void MainWindow::AboutToShowViewMenu() { mUI.mActionToolbar->setChecked(mUI.mToolBar->isVisible()); } + +void MainWindow::StopChecking() +{ + mThread->Stop(); + mUI.mResults->DisableProgressbar(); +} diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 163bb1611..b2aa4b2ee 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -168,6 +168,12 @@ protected slots: */ void AboutToShowViewMenu(); + /** + * @brief Slot when stop checking button is pressed + * + */ + void StopChecking(); + protected: /** diff --git a/gui/resultsview.cpp b/gui/resultsview.cpp index 02f9fb8e2..1233e53cd 100644 --- a/gui/resultsview.cpp +++ b/gui/resultsview.cpp @@ -98,6 +98,7 @@ void ResultsView::Progress(int value, int max) else { mUI.mProgress->setVisible(true); + mUI.mProgress->setEnabled(true); } } @@ -202,3 +203,7 @@ void ResultsView::Translate() mUI.mTree->Translate(); } +void ResultsView::DisableProgressbar() +{ + mUI.mProgress->setEnabled(false); +} diff --git a/gui/resultsview.h b/gui/resultsview.h index b50b0d648..0e50fc97b 100644 --- a/gui/resultsview.h +++ b/gui/resultsview.h @@ -116,6 +116,8 @@ public: * */ void Translate(); + + void DisableProgressbar(); signals: /** diff --git a/gui/threadhandler.h b/gui/threadhandler.h index 8906c7b6b..a1c2ef3e4 100644 --- a/gui/threadhandler.h +++ b/gui/threadhandler.h @@ -98,13 +98,17 @@ signals: * */ void Done(); -protected slots: + +public slots: /** * @brief Slot to stop all threads * */ void Stop(); +protected slots: + + /** * @brief Slot that a single thread is done