GUI: Rename methods in Project
This commit is contained in:
parent
a4dd8f0aa4
commit
6c424709b6
|
@ -362,7 +362,7 @@ void MainWindow::DoCheckProject(ImportProject p)
|
||||||
mIsLogfileLoaded = false;
|
mIsLogfileLoaded = false;
|
||||||
if (mProject) {
|
if (mProject) {
|
||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
foreach (const QString &s, mProject->GetProjectFile()->GetExcludedPaths()) {
|
foreach (const QString &s, mProject->getProjectFile()->GetExcludedPaths()) {
|
||||||
v.push_back(s.toStdString());
|
v.push_back(s.toStdString());
|
||||||
}
|
}
|
||||||
p.ignorePaths(v);
|
p.ignorePaths(v);
|
||||||
|
@ -386,7 +386,7 @@ void MainWindow::DoCheckProject(ImportProject p)
|
||||||
checkSettings.force = false;
|
checkSettings.force = false;
|
||||||
|
|
||||||
if (mProject)
|
if (mProject)
|
||||||
qDebug() << "Checking project file" << mProject->GetProjectFile()->GetFilename();
|
qDebug() << "Checking project file" << mProject->getProjectFile()->GetFilename();
|
||||||
|
|
||||||
if (!checkSettings.buildDir.empty()) {
|
if (!checkSettings.buildDir.empty()) {
|
||||||
std::list<std::string> sourcefiles;
|
std::list<std::string> sourcefiles;
|
||||||
|
@ -409,7 +409,7 @@ void MainWindow::DoCheckFiles(const QStringList &files)
|
||||||
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 {
|
} else {
|
||||||
EnableProjectActions(false);
|
EnableProjectActions(false);
|
||||||
}
|
}
|
||||||
|
@ -441,7 +441,7 @@ void MainWindow::DoCheckFiles(const QStringList &files)
|
||||||
Settings checkSettings = GetCppcheckSettings();
|
Settings checkSettings = GetCppcheckSettings();
|
||||||
|
|
||||||
if (mProject)
|
if (mProject)
|
||||||
qDebug() << "Checking project file" << mProject->GetProjectFile()->GetFilename();
|
qDebug() << "Checking project file" << mProject->getProjectFile()->GetFilename();
|
||||||
|
|
||||||
if (!checkSettings.buildDir.empty()) {
|
if (!checkSettings.buildDir.empty()) {
|
||||||
std::list<std::string> sourcefiles;
|
std::list<std::string> sourcefiles;
|
||||||
|
@ -642,7 +642,7 @@ Library::Error MainWindow::LoadLibrary(Library *library, QString filename)
|
||||||
|
|
||||||
// Try to load the library from the project folder..
|
// Try to load the library from the project folder..
|
||||||
if (mProject) {
|
if (mProject) {
|
||||||
QString path = QFileInfo(mProject->GetProjectFile()->GetFilename()).canonicalPath();
|
QString path = QFileInfo(mProject->getProjectFile()->GetFilename()).canonicalPath();
|
||||||
ret = library->load(NULL, (path+"/"+filename).toLatin1());
|
ret = library->load(NULL, (path+"/"+filename).toLatin1());
|
||||||
if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND)
|
if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -741,7 +741,7 @@ Settings MainWindow::GetCppcheckSettings()
|
||||||
|
|
||||||
// If project file loaded, read settings from it
|
// If project file loaded, read settings from it
|
||||||
if (mProject) {
|
if (mProject) {
|
||||||
ProjectFile *pfile = mProject->GetProjectFile();
|
ProjectFile *pfile = mProject->getProjectFile();
|
||||||
QStringList dirs = pfile->GetIncludeDirs();
|
QStringList dirs = pfile->GetIncludeDirs();
|
||||||
AddIncludeDirs(dirs, result);
|
AddIncludeDirs(dirs, result);
|
||||||
|
|
||||||
|
@ -934,7 +934,7 @@ void MainWindow::ReCheckSelected(QStringList files, bool all)
|
||||||
FileList pathList;
|
FileList pathList;
|
||||||
pathList.AddPathList(files);
|
pathList.AddPathList(files);
|
||||||
if (mProject)
|
if (mProject)
|
||||||
pathList.AddExcludeList(mProject->GetProjectFile()->GetExcludedPaths());
|
pathList.AddExcludeList(mProject->getProjectFile()->GetExcludedPaths());
|
||||||
QStringList fileNames = pathList.GetFileList();
|
QStringList fileNames = pathList.GetFileList();
|
||||||
CheckLockDownUI(); // lock UI while checking
|
CheckLockDownUI(); // lock UI while checking
|
||||||
mUI.mResults->CheckingStarted(fileNames.size());
|
mUI.mResults->CheckingStarted(fileNames.size());
|
||||||
|
@ -965,7 +965,7 @@ void MainWindow::ReCheck(bool all)
|
||||||
mUI.mResults->CheckingStarted(files.size());
|
mUI.mResults->CheckingStarted(files.size());
|
||||||
|
|
||||||
if (mProject)
|
if (mProject)
|
||||||
qDebug() << "Rechecking project file" << mProject->GetProjectFile()->GetFilename();
|
qDebug() << "Rechecking project file" << mProject->getProjectFile()->GetFilename();
|
||||||
|
|
||||||
mThread->SetCheckFiles(all);
|
mThread->SetCheckFiles(all);
|
||||||
mThread->Check(GetCppcheckSettings(), all);
|
mThread->Check(GetCppcheckSettings(), all);
|
||||||
|
@ -1314,16 +1314,16 @@ void MainWindow::LoadProjectFile(const QString &filePath)
|
||||||
|
|
||||||
void MainWindow::CheckProject(Project *project)
|
void MainWindow::CheckProject(Project *project)
|
||||||
{
|
{
|
||||||
if (!project->IsOpen()) {
|
if (!project->isOpen()) {
|
||||||
if (!project->Open()) {
|
if (!project->open()) {
|
||||||
delete mProject;
|
delete mProject;
|
||||||
mProject = 0;
|
mProject = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QFileInfo inf(project->Filename());
|
QFileInfo inf(project->getFilename());
|
||||||
const QString rootpath = project->GetProjectFile()->GetRootPath();
|
const QString rootpath = project->getProjectFile()->GetRootPath();
|
||||||
|
|
||||||
// If the root path is not given or is not "current dir", use project
|
// If the root path is not given or is not "current dir", use project
|
||||||
// file's location directory as root path
|
// file's location directory as root path
|
||||||
|
@ -1334,15 +1334,15 @@ void MainWindow::CheckProject(Project *project)
|
||||||
else
|
else
|
||||||
mCurrentDirectory = rootpath;
|
mCurrentDirectory = rootpath;
|
||||||
|
|
||||||
if (!project->GetProjectFile()->GetImportProject().isEmpty()) {
|
if (!project->getProjectFile()->GetImportProject().isEmpty()) {
|
||||||
ImportProject p;
|
ImportProject p;
|
||||||
QString prjfile = inf.canonicalPath() + '/' + project->GetProjectFile()->GetImportProject();
|
QString prjfile = inf.canonicalPath() + '/' + project->getProjectFile()->GetImportProject();
|
||||||
p.import(prjfile.toStdString());
|
p.import(prjfile.toStdString());
|
||||||
DoCheckProject(p);
|
DoCheckProject(p);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList paths = project->GetProjectFile()->GetCheckPaths();
|
QStringList paths = project->getProjectFile()->GetCheckPaths();
|
||||||
|
|
||||||
// If paths not given then check the root path (which may be the project
|
// If paths not given then check the root path (which may be the project
|
||||||
// file's location, see above). This is to keep the compatibility with
|
// file's location, see above). This is to keep the compatibility with
|
||||||
|
@ -1383,8 +1383,8 @@ void MainWindow::NewProjectFile()
|
||||||
|
|
||||||
delete mProject;
|
delete mProject;
|
||||||
mProject = new Project(filepath, this);
|
mProject = new Project(filepath, this);
|
||||||
mProject->Create();
|
mProject->create();
|
||||||
if (mProject->Edit()) {
|
if (mProject->edit()) {
|
||||||
AddProjectMRU(filepath);
|
AddProjectMRU(filepath);
|
||||||
CheckProject(mProject);
|
CheckProject(mProject);
|
||||||
}
|
}
|
||||||
|
@ -1410,7 +1410,7 @@ void MainWindow::EditProjectFile()
|
||||||
msg.exec();
|
msg.exec();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mProject->Edit())
|
if (mProject->edit())
|
||||||
CheckProject(mProject);
|
CheckProject(mProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,22 +47,22 @@ Project::~Project()
|
||||||
delete mProjectFile;
|
delete mProjectFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Project::Filename() const
|
QString Project::getFilename() const
|
||||||
{
|
{
|
||||||
return mFilename;
|
return mFilename;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::SetFilename(const QString &filename)
|
void Project::setFilename(const QString &filename)
|
||||||
{
|
{
|
||||||
mFilename = filename;
|
mFilename = filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Project::IsOpen() const
|
bool Project::isOpen() const
|
||||||
{
|
{
|
||||||
return mProjectFile != NULL;
|
return mProjectFile != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Project::Open()
|
bool Project::open()
|
||||||
{
|
{
|
||||||
mProjectFile = new ProjectFile(mFilename, this);
|
mProjectFile = new ProjectFile(mFilename, this);
|
||||||
if (!QFile::exists(mFilename))
|
if (!QFile::exists(mFilename))
|
||||||
|
@ -83,7 +83,7 @@ bool Project::Open()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Project::Edit()
|
bool Project::edit()
|
||||||
{
|
{
|
||||||
ProjectFileDialog dlg(mFilename, mParentWidget);
|
ProjectFileDialog dlg(mFilename, mParentWidget);
|
||||||
dlg.LoadFromProjectFile(mProjectFile);
|
dlg.LoadFromProjectFile(mProjectFile);
|
||||||
|
@ -105,7 +105,7 @@ bool Project::Edit()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::Create()
|
void Project::create()
|
||||||
{
|
{
|
||||||
mProjectFile = new ProjectFile(mFilename, this);
|
mProjectFile = new ProjectFile(mFilename, this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,42 +44,42 @@ public:
|
||||||
* @brief Return the filename of the project.
|
* @brief Return the filename of the project.
|
||||||
* @return Project's filename.
|
* @return Project's filename.
|
||||||
*/
|
*/
|
||||||
QString Filename() const;
|
QString getFilename() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set filename for the project file.
|
* @brief Set filename for the project file.
|
||||||
* @param filename Filename.
|
* @param filename Filename.
|
||||||
*/
|
*/
|
||||||
void SetFilename(const QString &filename);
|
void setFilename(const QString &filename);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Is the project open?
|
* @brief Is the project open?
|
||||||
* The project is considered to be open if it has an opened project file.
|
* The project is considered to be open if it has an opened project file.
|
||||||
* @return true if the project is open, false otherwise.
|
* @return true if the project is open, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool IsOpen() const;
|
bool isOpen() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Open existing project file.
|
* @brief Open existing project file.
|
||||||
*/
|
*/
|
||||||
bool Open();
|
bool open();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Edit the project file.
|
* @brief Edit the project file.
|
||||||
* @return true if editing was successful.
|
* @return true if editing was successful.
|
||||||
*/
|
*/
|
||||||
bool Edit();
|
bool edit();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Create new project file.
|
* @brief Create new project file.
|
||||||
*/
|
*/
|
||||||
void Create();
|
void create();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return current project file.
|
* @brief Return current project file.
|
||||||
* @return project file.
|
* @return project file.
|
||||||
*/
|
*/
|
||||||
ProjectFile * GetProjectFile() const {
|
ProjectFile * getProjectFile() const {
|
||||||
return mProjectFile;
|
return mProjectFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ StatsDialog::StatsDialog(QWidget *parent)
|
||||||
|
|
||||||
void StatsDialog::setProject(const Project& project)
|
void StatsDialog::setProject(const Project& project)
|
||||||
{
|
{
|
||||||
ProjectFile *projectFile = project.GetProjectFile();
|
ProjectFile *projectFile = project.getProjectFile();
|
||||||
if (projectFile) {
|
if (projectFile) {
|
||||||
mUI.mProject->setText(projectFile->GetRootPath());
|
mUI.mProject->setText(projectFile->GetRootPath());
|
||||||
mUI.mPaths->setText(projectFile->GetCheckPaths().join(";"));
|
mUI.mPaths->setText(projectFile->GetCheckPaths().join(";"));
|
||||||
|
|
Loading…
Reference in New Issue