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:
parent
13b307878a
commit
a7b06d9b7e
|
@ -358,31 +358,6 @@ void MainWindow::CheckDirectory()
|
||||||
DoCheckFiles(SelectFilesToCheck(QFileDialog::DirectoryOnly));
|
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)
|
void MainWindow::AddIncludeDirs(const QStringList &includeDirs, Settings &result)
|
||||||
{
|
{
|
||||||
QString dir;
|
QString dir;
|
||||||
|
@ -412,8 +387,8 @@ Settings MainWindow::GetCppcheckSettings()
|
||||||
AddIncludeDirs(includes, result);
|
AddIncludeDirs(includes, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool projectRead = GetCheckProject();
|
// If project file loaded, read settings from it
|
||||||
if (projectRead)
|
if (mProject)
|
||||||
{
|
{
|
||||||
ProjectFile *pfile = mProject->GetProjectFile();
|
ProjectFile *pfile = mProject->GetProjectFile();
|
||||||
QStringList dirs = pfile->GetIncludeDirs();
|
QStringList dirs = pfile->GetIncludeDirs();
|
||||||
|
|
|
@ -321,15 +321,6 @@ protected:
|
||||||
*/
|
*/
|
||||||
void DoCheckFiles(const QStringList &files);
|
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.
|
* @brief Get our default cppcheck settings and read project file.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue