From 6c424709b60e558106573bb85c35ba72dd2570ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 28 Jul 2017 04:57:28 +0200 Subject: [PATCH] GUI: Rename methods in Project --- gui/mainwindow.cpp | 36 ++++++++++++++++++------------------ gui/project.cpp | 12 ++++++------ gui/project.h | 14 +++++++------- gui/statsdialog.cpp | 2 +- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 65bd28990..7c08fcd48 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -362,7 +362,7 @@ void MainWindow::DoCheckProject(ImportProject p) mIsLogfileLoaded = false; if (mProject) { std::vector v; - foreach (const QString &s, mProject->GetProjectFile()->GetExcludedPaths()) { + foreach (const QString &s, mProject->getProjectFile()->GetExcludedPaths()) { v.push_back(s.toStdString()); } p.ignorePaths(v); @@ -386,7 +386,7 @@ void MainWindow::DoCheckProject(ImportProject p) checkSettings.force = false; if (mProject) - qDebug() << "Checking project file" << mProject->GetProjectFile()->GetFilename(); + qDebug() << "Checking project file" << mProject->getProjectFile()->GetFilename(); if (!checkSettings.buildDir.empty()) { std::list sourcefiles; @@ -409,7 +409,7 @@ void MainWindow::DoCheckFiles(const QStringList &files) FileList pathList; pathList.AddPathList(files); if (mProject) { - pathList.AddExcludeList(mProject->GetProjectFile()->GetExcludedPaths()); + pathList.AddExcludeList(mProject->getProjectFile()->GetExcludedPaths()); } else { EnableProjectActions(false); } @@ -441,7 +441,7 @@ void MainWindow::DoCheckFiles(const QStringList &files) Settings checkSettings = GetCppcheckSettings(); if (mProject) - qDebug() << "Checking project file" << mProject->GetProjectFile()->GetFilename(); + qDebug() << "Checking project file" << mProject->getProjectFile()->GetFilename(); if (!checkSettings.buildDir.empty()) { std::list sourcefiles; @@ -642,7 +642,7 @@ Library::Error MainWindow::LoadLibrary(Library *library, QString filename) // Try to load the library from the project folder.. if (mProject) { - QString path = QFileInfo(mProject->GetProjectFile()->GetFilename()).canonicalPath(); + QString path = QFileInfo(mProject->getProjectFile()->GetFilename()).canonicalPath(); ret = library->load(NULL, (path+"/"+filename).toLatin1()); if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND) return ret; @@ -741,7 +741,7 @@ Settings MainWindow::GetCppcheckSettings() // If project file loaded, read settings from it if (mProject) { - ProjectFile *pfile = mProject->GetProjectFile(); + ProjectFile *pfile = mProject->getProjectFile(); QStringList dirs = pfile->GetIncludeDirs(); AddIncludeDirs(dirs, result); @@ -934,7 +934,7 @@ void MainWindow::ReCheckSelected(QStringList files, bool all) FileList pathList; pathList.AddPathList(files); if (mProject) - pathList.AddExcludeList(mProject->GetProjectFile()->GetExcludedPaths()); + pathList.AddExcludeList(mProject->getProjectFile()->GetExcludedPaths()); QStringList fileNames = pathList.GetFileList(); CheckLockDownUI(); // lock UI while checking mUI.mResults->CheckingStarted(fileNames.size()); @@ -965,7 +965,7 @@ void MainWindow::ReCheck(bool all) mUI.mResults->CheckingStarted(files.size()); if (mProject) - qDebug() << "Rechecking project file" << mProject->GetProjectFile()->GetFilename(); + qDebug() << "Rechecking project file" << mProject->getProjectFile()->GetFilename(); mThread->SetCheckFiles(all); mThread->Check(GetCppcheckSettings(), all); @@ -1314,16 +1314,16 @@ void MainWindow::LoadProjectFile(const QString &filePath) void MainWindow::CheckProject(Project *project) { - if (!project->IsOpen()) { - if (!project->Open()) { + if (!project->isOpen()) { + if (!project->open()) { delete mProject; mProject = 0; return; } } - QFileInfo inf(project->Filename()); - const QString rootpath = project->GetProjectFile()->GetRootPath(); + QFileInfo inf(project->getFilename()); + const QString rootpath = project->getProjectFile()->GetRootPath(); // If the root path is not given or is not "current dir", use project // file's location directory as root path @@ -1334,15 +1334,15 @@ void MainWindow::CheckProject(Project *project) else mCurrentDirectory = rootpath; - if (!project->GetProjectFile()->GetImportProject().isEmpty()) { + if (!project->getProjectFile()->GetImportProject().isEmpty()) { ImportProject p; - QString prjfile = inf.canonicalPath() + '/' + project->GetProjectFile()->GetImportProject(); + QString prjfile = inf.canonicalPath() + '/' + project->getProjectFile()->GetImportProject(); p.import(prjfile.toStdString()); DoCheckProject(p); 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 // file's location, see above). This is to keep the compatibility with @@ -1383,8 +1383,8 @@ void MainWindow::NewProjectFile() delete mProject; mProject = new Project(filepath, this); - mProject->Create(); - if (mProject->Edit()) { + mProject->create(); + if (mProject->edit()) { AddProjectMRU(filepath); CheckProject(mProject); } @@ -1410,7 +1410,7 @@ void MainWindow::EditProjectFile() msg.exec(); return; } - if (mProject->Edit()) + if (mProject->edit()) CheckProject(mProject); } diff --git a/gui/project.cpp b/gui/project.cpp index 03cfdb925..14097dcda 100644 --- a/gui/project.cpp +++ b/gui/project.cpp @@ -47,22 +47,22 @@ Project::~Project() delete mProjectFile; } -QString Project::Filename() const +QString Project::getFilename() const { return mFilename; } -void Project::SetFilename(const QString &filename) +void Project::setFilename(const QString &filename) { mFilename = filename; } -bool Project::IsOpen() const +bool Project::isOpen() const { return mProjectFile != NULL; } -bool Project::Open() +bool Project::open() { mProjectFile = new ProjectFile(mFilename, this); if (!QFile::exists(mFilename)) @@ -83,7 +83,7 @@ bool Project::Open() return true; } -bool Project::Edit() +bool Project::edit() { ProjectFileDialog dlg(mFilename, mParentWidget); dlg.LoadFromProjectFile(mProjectFile); @@ -105,7 +105,7 @@ bool Project::Edit() return true; } -void Project::Create() +void Project::create() { mProjectFile = new ProjectFile(mFilename, this); } diff --git a/gui/project.h b/gui/project.h index 186a12703..b88ffdc61 100644 --- a/gui/project.h +++ b/gui/project.h @@ -44,42 +44,42 @@ public: * @brief Return the filename of the project. * @return Project's filename. */ - QString Filename() const; + QString getFilename() const; /** * @brief Set filename for the project file. * @param filename Filename. */ - void SetFilename(const QString &filename); + void setFilename(const QString &filename); /** * @brief Is the project open? * The project is considered to be open if it has an opened project file. * @return true if the project is open, false otherwise. */ - bool IsOpen() const; + bool isOpen() const; /** * @brief Open existing project file. */ - bool Open(); + bool open(); /** * @brief Edit the project file. * @return true if editing was successful. */ - bool Edit(); + bool edit(); /** * @brief Create new project file. */ - void Create(); + void create(); /** * @brief Return current project file. * @return project file. */ - ProjectFile * GetProjectFile() const { + ProjectFile * getProjectFile() const { return mProjectFile; } diff --git a/gui/statsdialog.cpp b/gui/statsdialog.cpp index ee1f6e225..ae20f210d 100644 --- a/gui/statsdialog.cpp +++ b/gui/statsdialog.cpp @@ -42,7 +42,7 @@ StatsDialog::StatsDialog(QWidget *parent) void StatsDialog::setProject(const Project& project) { - ProjectFile *projectFile = project.GetProjectFile(); + ProjectFile *projectFile = project.getProjectFile(); if (projectFile) { mUI.mProject->setText(projectFile->GetRootPath()); mUI.mPaths->setText(projectFile->GetCheckPaths().join(";"));