Fixed #7295 (GUI: 'Edit Project' and 'Close Project' actions getting enabled after Files/Directory check.)

This commit is contained in:
Akhilesh Nema 2016-01-16 09:59:02 +01:00 committed by Daniel Marjamäki
parent 7b1710a44f
commit 2f29efce68
3 changed files with 26 additions and 4 deletions

View File

@ -59,7 +59,8 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
mCStandardActions(new QActionGroup(this)), mCStandardActions(new QActionGroup(this)),
mCppStandardActions(new QActionGroup(this)), mCppStandardActions(new QActionGroup(this)),
mSelectLanguageActions(new QActionGroup(this)), mSelectLanguageActions(new QActionGroup(this)),
mExiting(false) mExiting(false),
mIsLogfileLoaded(false)
{ {
mUI.setupUi(this); mUI.setupUi(this);
mThread = new ThreadHandler(this); mThread = new ThreadHandler(this);
@ -359,10 +360,14 @@ void MainWindow::DoCheckFiles(const QStringList &files)
} }
ClearResults(); ClearResults();
mIsLogfileLoaded = false;
FileList pathList; FileList pathList;
pathList.AddPathList(files); pathList.AddPathList(files);
if (mProject) if (mProject) {
pathList.AddExcludeList(mProject->GetProjectFile()->GetExcludedPaths()); pathList.AddExcludeList(mProject->GetProjectFile()->GetExcludedPaths());
} else {
EnableProjectActions(false);
}
QStringList fileNames = pathList.GetFileList(); QStringList fileNames = pathList.GetFileList();
mUI.mResults->Clear(true); mUI.mResults->Clear(true);
@ -729,7 +734,12 @@ void MainWindow::CheckDone()
EnableCheckButtons(true); EnableCheckButtons(true);
mUI.mActionSettings->setEnabled(true); mUI.mActionSettings->setEnabled(true);
mUI.mActionOpenXML->setEnabled(true); mUI.mActionOpenXML->setEnabled(true);
if (mProject) {
EnableProjectActions(true); EnableProjectActions(true);
} else if (mIsLogfileLoaded) {
mUI.mActionRecheckModified->setEnabled(false);
mUI.mActionRecheckAll->setEnabled(false);
}
EnableProjectOpenActions(true); EnableProjectOpenActions(true);
mPlatformActions->setEnabled(true); mPlatformActions->setEnabled(true);
mCStandardActions->setEnabled(true); mCStandardActions->setEnabled(true);
@ -900,7 +910,12 @@ void MainWindow::OpenResults()
void MainWindow::LoadResults(const QString selectedFile) void MainWindow::LoadResults(const QString selectedFile)
{ {
if (!selectedFile.isEmpty()) { if (!selectedFile.isEmpty()) {
if (mProject)
CloseProjectFile();
mIsLogfileLoaded = true;
mUI.mResults->Clear(true); mUI.mResults->Clear(true);
mUI.mActionRecheckModified->setEnabled(false);
mUI.mActionRecheckAll->setEnabled(false);
mUI.mResults->ReadErrorsXml(selectedFile); mUI.mResults->ReadErrorsXml(selectedFile);
SetPath(SETTINGS_LAST_RESULT_PATH, selectedFile); SetPath(SETTINGS_LAST_RESULT_PATH, selectedFile);
} }
@ -1181,6 +1196,7 @@ void MainWindow::LoadProjectFile(const QString &filePath)
FormatAndSetTitle(tr("Project:") + QString(" ") + filename); FormatAndSetTitle(tr("Project:") + QString(" ") + filename);
AddProjectMRU(filePath); AddProjectMRU(filePath);
mIsLogfileLoaded = false;
mUI.mActionCloseProjectFile->setEnabled(true); mUI.mActionCloseProjectFile->setEnabled(true);
mUI.mActionEditProjectFile->setEnabled(true); mUI.mActionEditProjectFile->setEnabled(true);
delete mProject; delete mProject;

View File

@ -570,6 +570,11 @@ private:
*/ */
bool mExiting; bool mExiting;
/**
* @brief Set in case of loading project file.
*/
bool mIsLogfileLoaded;
/** /**
* @brief Project MRU menu actions. * @brief Project MRU menu actions.
* List of MRU menu actions. Needs also to store the separator. * List of MRU menu actions. Needs also to store the separator.

View File

@ -39,6 +39,7 @@
#include "printablereport.h" #include "printablereport.h"
#include "applicationlist.h" #include "applicationlist.h"
#include "checkstatistics.h" #include "checkstatistics.h"
#include "path.h"
ResultsView::ResultsView(QWidget * parent) : ResultsView::ResultsView(QWidget * parent) :
QWidget(parent), QWidget(parent),
@ -374,7 +375,7 @@ void ResultsView::UpdateDetails(const QModelIndex &index)
.arg(tr("Message")).arg(message); .arg(tr("Message")).arg(message);
const QString file0 = data["file0"].toString(); const QString file0 = data["file0"].toString();
if (file0 != "" && file0 != data["file"].toString()) if (file0 != "" && Path::isHeader(data["file"].toString().toStdString()))
formattedMsg += QString("\n\n%1: %2").arg(tr("First included by")).arg(QDir::toNativeSeparators(file0)); formattedMsg += QString("\n\n%1: %2").arg(tr("First included by")).arg(QDir::toNativeSeparators(file0));
if (mUI.mTree->ShowIdColumn()) if (mUI.mTree->ShowIdColumn())