GUI: Disable project opening while checking files.

This commit is contained in:
Kimmo Varis 2010-08-25 20:59:30 +03:00
parent b6bef44f61
commit c0c4d18120
2 changed files with 19 additions and 0 deletions

View File

@ -101,6 +101,7 @@ MainWindow::MainWindow() :
mUI.mActionClearResults->setEnabled(false); mUI.mActionClearResults->setEnabled(false);
mUI.mActionSave->setEnabled(false); mUI.mActionSave->setEnabled(false);
mUI.mActionRecheck->setEnabled(false); mUI.mActionRecheck->setEnabled(false);
EnableProjectOpenActions(true);
EnableProjectActions(false); EnableProjectActions(false);
QStringList args = QCoreApplication::arguments(); QStringList args = QCoreApplication::arguments();
@ -238,6 +239,7 @@ void MainWindow::DoCheckFiles(const QStringList &files)
Settings checkSettings = GetCppcheckSettings(); Settings checkSettings = GetCppcheckSettings();
EnableProjectActions(false); EnableProjectActions(false);
EnableProjectOpenActions(false);
mThread->Check(checkSettings, false); mThread->Check(checkSettings, false);
} }
@ -387,6 +389,7 @@ void MainWindow::CheckDone()
mUI.mActionSettings->setEnabled(true); mUI.mActionSettings->setEnabled(true);
mUI.mActionOpenXML->setEnabled(true); mUI.mActionOpenXML->setEnabled(true);
EnableProjectActions(true); EnableProjectActions(true);
EnableProjectOpenActions(true);
if (mUI.mResults->HasResults()) if (mUI.mResults->HasResults())
{ {
@ -762,6 +765,7 @@ void MainWindow::CloseProjectFile()
delete mProject; delete mProject;
mProject = NULL; mProject = NULL;
EnableProjectActions(false); EnableProjectActions(false);
EnableProjectOpenActions(true);
FormatAndSetTitle(); FormatAndSetTitle();
} }
@ -803,3 +807,9 @@ void MainWindow::EnableProjectActions(bool enable)
mUI.mActionCloseProjectFile->setEnabled(enable); mUI.mActionCloseProjectFile->setEnabled(enable);
mUI.mActionEditProjectFile->setEnabled(enable); mUI.mActionEditProjectFile->setEnabled(enable);
} }
void MainWindow::EnableProjectOpenActions(bool enable)
{
mUI.mActionNewProjectFile->setEnabled(enable);
mUI.mActionOpenProjectFile->setEnabled(enable);
}

View File

@ -307,10 +307,19 @@ protected:
/** /**
* @brief Enable or disable project file actions. * @brief Enable or disable project file actions.
* Project editing and closing actions should be only enabled when project is
* open and we are not checking files.
* @param enable If true then actions are enabled. * @param enable If true then actions are enabled.
*/ */
void EnableProjectActions(bool enable); void EnableProjectActions(bool enable);
/**
* @brief Enable or disable project file actions.
* Project opening and creating actions should be disabled when checking.
* @param enable If true then actions are enabled.
*/
void EnableProjectOpenActions(bool enable);
/** /**
* @brief Program settings * @brief Program settings
* *