From a7b06d9b7e9774581e4757fd700bec5f80cec265 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Thu, 12 May 2011 13:53:59 +0300 Subject: [PATCH] GUI: Remove automatic/silent loading of projects. When project files support was added to the GUI there was no GUI for them and automatic/silent loading was added. So that if the directory contained project file with the same name (and .cppcheck extension) then the project file was automatically loaded and used for the checking. This can be very confusing for the user as there is no any indication that the project file is used. But this solution was necessary at that time to get project file support added. Now that we have usable GUI for the project files this automatic/ silent loading can be removed. Nobody really should be using it anymore. And even if the automatic loading is needed one can give the project file for the GUI using command line parameter. --- gui/mainwindow.cpp | 29 ++--------------------------- gui/mainwindow.h | 9 --------- 2 files changed, 2 insertions(+), 36 deletions(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 885e6feb4..61de1f863 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -358,31 +358,6 @@ void MainWindow::CheckDirectory() DoCheckFiles(SelectFilesToCheck(QFileDialog::DirectoryOnly)); } -bool MainWindow::GetCheckProject() -{ - // We have successfully loaded project earlier and use that project - if (mProject) - return true; - - if (!mCurrentDirectory.isEmpty()) - { - // Format project filename (directory name + .cppcheck) and load - // the project file if it is found. - QStringList parts = mCurrentDirectory.split("/"); - const QString filename = parts[parts.count() - 1] + ".cppcheck";; - const QString projfile = mCurrentDirectory + "/" + filename; - if (QFile::exists(projfile)) - { - qDebug() << "Opening project file: " << projfile; - mProject = new Project(); - mProject->SetFilename(projfile); - FormatAndSetTitle(tr("Project: ") + QString(" ") + filename); - return mProject->Open(); - } - } - return false; -} - void MainWindow::AddIncludeDirs(const QStringList &includeDirs, Settings &result) { QString dir; @@ -412,8 +387,8 @@ Settings MainWindow::GetCppcheckSettings() AddIncludeDirs(includes, result); } - bool projectRead = GetCheckProject(); - if (projectRead) + // If project file loaded, read settings from it + if (mProject) { ProjectFile *pfile = mProject->GetProjectFile(); QStringList dirs = pfile->GetIncludeDirs(); diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 62ed4d807..8ea309e84 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -321,15 +321,6 @@ protected: */ void DoCheckFiles(const QStringList &files); - /** - * @brief Check if we have a project for the checked directory. - * This method checks if there is open project for the directory. If no open - * project then we check if there is project file in the directory and load - * it. - * @return true if we have project, false if no project. - */ - bool GetCheckProject(); - /** * @brief Get our default cppcheck settings and read project file. *