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.
This commit is contained in:
Kimmo Varis 2011-05-12 13:53:59 +03:00
parent 13b307878a
commit a7b06d9b7e
2 changed files with 2 additions and 36 deletions

View File

@ -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();

View File

@ -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.
*