From 2b767d3f6fd5d012e59f7eb3964be7a07fa1d839 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 19 Nov 2016 21:12:32 +0100 Subject: [PATCH] GUI: Rename --- gui/project.cpp | 54 +++++++++++++++++++-------------------- gui/project.h | 4 +-- gui/projectfiledialog.cpp | 12 ++++++--- 3 files changed, 37 insertions(+), 33 deletions(-) diff --git a/gui/project.cpp b/gui/project.cpp index 14af3f02d..3923ecfac 100644 --- a/gui/project.cpp +++ b/gui/project.cpp @@ -29,7 +29,7 @@ Project::Project(QWidget *parent) : QObject(parent), - mPFile(NULL), + mProjectFile(NULL), mParentWidget(parent) { } @@ -37,14 +37,14 @@ Project::Project(QWidget *parent) : Project::Project(const QString &filename, QWidget *parent) : QObject(parent), mFilename(filename), - mPFile(NULL), + mProjectFile(NULL), mParentWidget(parent) { } Project::~Project() { - delete mPFile; + delete mProjectFile; } QString Project::Filename() const @@ -59,16 +59,16 @@ void Project::SetFilename(const QString &filename) bool Project::IsOpen() const { - return mPFile != NULL; + return mProjectFile != NULL; } bool Project::Open() { - mPFile = new ProjectFile(mFilename, this); + mProjectFile = new ProjectFile(mFilename, this); if (!QFile::exists(mFilename)) return false; - if (!mPFile->Read()) { + if (!mProjectFile->Read()) { QMessageBox msg(QMessageBox::Critical, tr("Cppcheck"), tr("Could not read the project file."), @@ -76,7 +76,7 @@ bool Project::Open() mParentWidget); msg.exec(); mFilename = QString(); - mPFile->SetFilename(mFilename); + mProjectFile->SetFilename(mFilename); return false; } @@ -86,30 +86,30 @@ bool Project::Open() bool Project::Edit() { ProjectFileDialog dlg(mFilename, mParentWidget); - dlg.SetRootPath(mPFile->GetRootPath()); - dlg.SetBuildDir(mPFile->GetBuildDir()); - dlg.SetIncludepaths(mPFile->GetIncludeDirs()); - dlg.SetDefines(mPFile->GetDefines()); - dlg.SetPaths(mPFile->GetCheckPaths()); - dlg.SetImportProject(mPFile->GetImportProject()); - dlg.SetExcludedPaths(mPFile->GetExcludedPaths()); - dlg.SetLibraries(mPFile->GetLibraries()); - dlg.SetSuppressions(mPFile->GetSuppressions()); + dlg.SetRootPath(mProjectFile->GetRootPath()); + dlg.SetBuildDir(mProjectFile->GetBuildDir()); + dlg.SetIncludepaths(mProjectFile->GetIncludeDirs()); + dlg.SetDefines(mProjectFile->GetDefines()); + dlg.SetPaths(mProjectFile->GetCheckPaths()); + dlg.SetImportProject(mProjectFile->GetImportProject()); + dlg.SetExcludedPaths(mProjectFile->GetExcludedPaths()); + dlg.SetLibraries(mProjectFile->GetLibraries()); + dlg.SetSuppressions(mProjectFile->GetSuppressions()); if (dlg.exec() != QDialog::Accepted) return false; - mPFile->SetRootPath(dlg.GetRootPath()); - mPFile->SetBuildDir(dlg.GetBuildDir()); - mPFile->SetImportProject(dlg.GetImportProject()); - mPFile->SetIncludes(dlg.GetIncludePaths()); - mPFile->SetDefines(dlg.GetDefines()); - mPFile->SetCheckPaths(dlg.GetPaths()); - mPFile->SetExcludedPaths(dlg.GetExcludedPaths()); - mPFile->SetLibraries(dlg.GetLibraries()); - mPFile->SetSuppressions(dlg.GetSuppressions()); + mProjectFile->SetRootPath(dlg.GetRootPath()); + mProjectFile->SetBuildDir(dlg.GetBuildDir()); + mProjectFile->SetImportProject(dlg.GetImportProject()); + mProjectFile->SetIncludes(dlg.GetIncludePaths()); + mProjectFile->SetDefines(dlg.GetDefines()); + mProjectFile->SetCheckPaths(dlg.GetPaths()); + mProjectFile->SetExcludedPaths(dlg.GetExcludedPaths()); + mProjectFile->SetLibraries(dlg.GetLibraries()); + mProjectFile->SetSuppressions(dlg.GetSuppressions()); - if (!mPFile->Write()) { + if (!mProjectFile->Write()) { QMessageBox msg(QMessageBox::Critical, tr("Cppcheck"), tr("Could not write the project file."), @@ -124,5 +124,5 @@ bool Project::Edit() void Project::Create() { - mPFile = new ProjectFile(mFilename, this); + mProjectFile = new ProjectFile(mFilename, this); } diff --git a/gui/project.h b/gui/project.h index f059c9e2f..186a12703 100644 --- a/gui/project.h +++ b/gui/project.h @@ -80,13 +80,13 @@ public: * @return project file. */ ProjectFile * GetProjectFile() const { - return mPFile; + return mProjectFile; } private: QString mFilename; - ProjectFile *mPFile; + ProjectFile *mProjectFile; QWidget *mParentWidget; }; diff --git a/gui/projectfiledialog.cpp b/gui/projectfiledialog.cpp index 8abb5bd5e..4086115cb 100644 --- a/gui/projectfiledialog.cpp +++ b/gui/projectfiledialog.cpp @@ -121,7 +121,8 @@ void ProjectFileDialog::SaveSettings() const } -QString ProjectFileDialog::getExistingDirectory(const QString &caption, bool trailingSlash) { +QString ProjectFileDialog::getExistingDirectory(const QString &caption, bool trailingSlash) +{ const QFileInfo inf(mFilePath); const QString rootpath = inf.absolutePath(); QString selectedDir = QFileDialog::getExistingDirectory(this, @@ -213,7 +214,8 @@ QString ProjectFileDialog::GetRootPath() const return root; } -QString ProjectFileDialog::GetBuildDir() const { +QString ProjectFileDialog::GetBuildDir() const +{ return mUI.buildDirEdit->text(); } @@ -290,11 +292,13 @@ QStringList ProjectFileDialog::GetSuppressions() const return suppressions; } -void ProjectFileDialog::SetRootPath(const QString &root) { +void ProjectFileDialog::SetRootPath(const QString &root) +{ mUI.mEditProjectRoot->setText(QDir::toNativeSeparators(root)); } -void ProjectFileDialog::SetBuildDir(const QString &buildDir) { +void ProjectFileDialog::SetBuildDir(const QString &buildDir) +{ mUI.buildDirEdit->setText(buildDir); }