GUI: Prevent exiting the application while checking.
This commit is contained in:
parent
6d37cd0371
commit
c9ceccfd3d
|
@ -359,6 +359,22 @@ void MainWindow::UncheckAll()
|
||||||
ToggleAllChecked(false);
|
ToggleAllChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::closeEvent(QCloseEvent *event)
|
||||||
|
{
|
||||||
|
// Check that we aren't checking files
|
||||||
|
if (!mThread.IsChecking())
|
||||||
|
event->accept();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QString msg(tr("Cannot exit while checking.\n\n" \
|
||||||
|
"Stop the checking before exiting."));
|
||||||
|
QMessageBox *box = new QMessageBox(QMessageBox::Warning,
|
||||||
|
tr("cppcheck"), msg);
|
||||||
|
box->show();
|
||||||
|
event->ignore();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::ToggleAllChecked(bool checked)
|
void MainWindow::ToggleAllChecked(bool checked)
|
||||||
{
|
{
|
||||||
mActionShowAll.setChecked(checked);
|
mActionShowAll.setChecked(checked);
|
||||||
|
|
|
@ -141,6 +141,11 @@ protected slots:
|
||||||
void ResultsAdded();
|
void ResultsAdded();
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Event coming when application is about to close.
|
||||||
|
*/
|
||||||
|
virtual void closeEvent(QCloseEvent *event);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Helper function to toggle all show error menu items
|
* @brief Helper function to toggle all show error menu items
|
||||||
* @param checked Should all errors be shown (true) or hidden (false)
|
* @param checked Should all errors be shown (true) or hidden (false)
|
||||||
|
|
|
@ -71,6 +71,11 @@ void ThreadHandler::Check(Settings settings, bool recheck)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ThreadHandler::IsChecking() const
|
||||||
|
{
|
||||||
|
return mRunningThreadCount > 0;
|
||||||
|
}
|
||||||
|
|
||||||
void ThreadHandler::SetThreadCount(const int count)
|
void ThreadHandler::SetThreadCount(const int count)
|
||||||
{
|
{
|
||||||
if (mRunningThreadCount > 0 ||
|
if (mRunningThreadCount > 0 ||
|
||||||
|
|
|
@ -85,6 +85,12 @@ public:
|
||||||
*/
|
*/
|
||||||
void Check(Settings settings, bool recheck);
|
void Check(Settings settings, bool recheck);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Is checking running?
|
||||||
|
*
|
||||||
|
* @return true if check is running, false otherwise.
|
||||||
|
*/
|
||||||
|
bool IsChecking() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue