Move a bit closer to Qt Creator coding style

- use m_member prefix convention
- bind some * to the identifier
- remove some unusual comments

Change-Id: Ife9b148b54c3f930561e2de79a016dfcfe0487a0
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
hjk
2015-05-29 16:00:15 +02:00
committed by Orgad Shaneh
parent 7389250fcd
commit 29e86d5a31
15 changed files with 183 additions and 209 deletions

View File

@@ -70,7 +70,7 @@ BuildConfiguration::BuildConfiguration(Target* parent, Core::Id const id)
QVariantMap BuildConfiguration::toMap() const
{
QVariantMap map(ProjectExplorer::BuildConfiguration::toMap());
map.insert(QLatin1String(Constants::BC_KEY_WORKDIR), workingDirectory_.toString());
map.insert(QLatin1String(Constants::BC_KEY_WORKDIR), m_workingDirectory.toString());
return map;
}
@@ -111,8 +111,8 @@ BuildConfiguration::buildType() const
Utils::FileName BuildConfiguration::workingDirectory() const
{
Q_ASSERT(!workingDirectory_.isEmpty());
return workingDirectory_;
Q_ASSERT(!m_workingDirectory.isEmpty());
return m_workingDirectory;
}
void BuildConfiguration::setWorkingDirectory(Utils::FileName const& dir)
@@ -121,20 +121,20 @@ void BuildConfiguration::setWorkingDirectory(Utils::FileName const& dir)
if (Target* t = target()) {
QString const dwd
= Project::defaultWorkingDirectory(t->project()->projectDirectory().toString());
workingDirectory_ = Utils::FileName::fromString(dwd);
m_workingDirectory = Utils::FileName::fromString(dwd);
}
} else {
workingDirectory_ = dir;
m_workingDirectory = dir;
}
Q_ASSERT(!workingDirectory_.isEmpty());
Q_ASSERT(!m_workingDirectory.isEmpty());
emitWorkingDirectoryChanged();
}
void BuildConfiguration::emitWorkingDirectoryChanged()
{
if (workingDirectory() != lastEmmitedWorkingDirectory_) {
lastEmmitedWorkingDirectory_= workingDirectory();
if (workingDirectory() != m_lastEmmitedWorkingDirectory) {
m_lastEmmitedWorkingDirectory= workingDirectory();
emit workingDirectoryChanged();
}
}
@@ -332,8 +332,8 @@ BuildConfigurationFactory::defaultWorkingDirectory(QString const& top)
}
BuildSettingsWidget::BuildSettingsWidget(BuildConfiguration* bc)
: bc_(bc)
, buildPathChooser_(0)
: m_bc(bc)
, m_buildPathChooser(0)
{
setDisplayName(tr("Boost.Build Manager"));
@@ -341,28 +341,28 @@ BuildSettingsWidget::BuildSettingsWidget(BuildConfiguration* bc)
fl->setContentsMargins(0, -1, 0, -1);
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
QString const projectPath(bc_->target()->project()->projectDirectory().toString());
QString const projectPath(m_bc->target()->project()->projectDirectory().toString());
// Working directory
workPathChooser_ = new Utils::PathChooser(this);
workPathChooser_->setEnabled(true);
workPathChooser_->setEnvironment(bc_->environment());
workPathChooser_->setBaseDirectory(projectPath);
workPathChooser_->setPath(bc_->workingDirectory().toString());
fl->addRow(tr("Run Boost.Build in:"), workPathChooser_);
m_workPathChooser = new Utils::PathChooser(this);
m_workPathChooser->setEnabled(true);
m_workPathChooser->setEnvironment(m_bc->environment());
m_workPathChooser->setBaseDirectory(projectPath);
m_workPathChooser->setPath(m_bc->workingDirectory().toString());
fl->addRow(tr("Run Boost.Build in:"), m_workPathChooser);
// Build directory
buildPathChooser_ = new Utils::PathChooser(this);
buildPathChooser_->setEnabled(true);
buildPathChooser_->setEnvironment(bc_->environment());
buildPathChooser_->setBaseDirectory(projectPath);
buildPathChooser_->setPath(bc_->rawBuildDirectory().toString());
fl->addRow(tr("Set build directory to:"), buildPathChooser_);
m_buildPathChooser = new Utils::PathChooser(this);
m_buildPathChooser->setEnabled(true);
m_buildPathChooser->setEnvironment(m_bc->environment());
m_buildPathChooser->setBaseDirectory(projectPath);
m_buildPathChooser->setPath(m_bc->rawBuildDirectory().toString());
fl->addRow(tr("Set build directory to:"), m_buildPathChooser);
connect(workPathChooser_, SIGNAL(changed(QString))
connect(m_workPathChooser, SIGNAL(changed(QString))
, this, SLOT(workingDirectoryChanged()));
connect(buildPathChooser_, SIGNAL(changed(QString))
connect(m_buildPathChooser, SIGNAL(changed(QString))
, this, SLOT(buildDirectoryChanged()));
connect(bc, SIGNAL(environmentChanged())
@@ -371,20 +371,20 @@ BuildSettingsWidget::BuildSettingsWidget(BuildConfiguration* bc)
void BuildSettingsWidget::buildDirectoryChanged()
{
QTC_ASSERT(bc_, return);
bc_->setBuildDirectory(Utils::FileName::fromString(buildPathChooser_->rawPath()));
QTC_ASSERT(m_bc, return);
m_bc->setBuildDirectory(Utils::FileName::fromString(m_buildPathChooser->rawPath()));
}
void BuildSettingsWidget::workingDirectoryChanged()
{
QTC_ASSERT(bc_, return);
bc_->setWorkingDirectory(Utils::FileName::fromString(workPathChooser_->rawPath()));
QTC_ASSERT(m_bc, return);
m_bc->setWorkingDirectory(Utils::FileName::fromString(m_workPathChooser->rawPath()));
}
void BuildSettingsWidget::environmentHasChanged()
{
Q_ASSERT(buildPathChooser_);
buildPathChooser_->setEnvironment(bc_->environment());
Q_ASSERT(m_buildPathChooser);
m_buildPathChooser->setEnvironment(m_bc->environment());
}
} // namespace Internal

View File

@@ -12,11 +12,10 @@
#ifndef BBBUILDCONFIGURATION_HPP
#define BBBUILDCONFIGURATION_HPP
// Qt Creator
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/namedwidget.h>
#include <utils/fileutils.h>
// Qt
#include <QList>
#include <QString>
#include <QVariantMap>
@@ -65,8 +64,8 @@ private slots:
void emitWorkingDirectoryChanged();
private:
Utils::FileName workingDirectory_;
Utils::FileName lastEmmitedWorkingDirectory_;
Utils::FileName m_workingDirectory;
Utils::FileName m_lastEmmitedWorkingDirectory;
};
class BuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
@@ -127,9 +126,9 @@ private slots:
void workingDirectoryChanged();
private:
BuildConfiguration* bc_;
Utils::PathChooser* workPathChooser_;
Utils::PathChooser* buildPathChooser_;
BuildConfiguration *m_bc;
Utils::PathChooser *m_workPathChooser;
Utils::PathChooser *m_buildPathChooser;
};
} // namespace Internal

View File

@@ -13,11 +13,10 @@
#define BBBUILDINFO_HPP
#include "b2buildconfiguration.h"
// Qt Creator
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/buildinfo.h>
#include <utils/fileutils.h>
// Qt
namespace BoostBuildProjectManager {
namespace Internal {

View File

@@ -15,7 +15,7 @@
#include "b2projectmanagerconstants.h"
#include "b2utility.h"
#include "filesselectionwizardpage.h"
// Qt Creator
#include <coreplugin/iwizardfactory.h>
#include <coreplugin/icore.h>
#include <projectexplorer/customwizard/customwizard.h>
@@ -23,7 +23,7 @@
#include <utils/pathchooser.h>
#include <utils/qtcassert.h>
#include <utils/mimetypes/mimedatabase.h>
// Qt
#include <QFileInfo>
#include <QFormLayout>
#include <QLabel>
@@ -37,12 +37,12 @@ namespace Internal {
//////////////////////////////////////////////////////////////////////////////////////////
OpenProjectWizard::OpenProjectWizard(Project const* const project)
: project_(project)
, projectOpened_(false)
: m_project(project)
, m_projectOpened(false)
{
// Project instance has been created, but it's only partially initialised and
// rest of the initialization takes place after this wizard completes.
Q_ASSERT(project_);
Q_ASSERT(m_project);
setDisplayName(tr("Open %1 Project").arg(BBPM_C(BOOSTBUILD)));
setId(BBPM_C(PROJECT_WIZARD_ID));
@@ -58,21 +58,21 @@ bool OpenProjectWizard::run(QString const& platform, QVariantMap const& extraVal
// Project name should be passed by caller, but,
// since we have Project instance handy, double-check.
if (!extraValuesCopy.contains(BBPM_C(P_KEY_PROJECTNAME)))
extraValuesCopy.insert(BBPM_C(P_KEY_PROJECTNAME), project_->displayName());
extraValuesCopy.insert(BBPM_C(P_KEY_PROJECTNAME), m_project->displayName());
projectOpened_ = false;
outputValues_.clear();
m_projectOpened = false;
m_outputValues.clear();
runWizard(project_->projectFilePath().toString(), 0, platform, extraValuesCopy);
runWizard(m_project->projectFilePath().toString(), 0, platform, extraValuesCopy);
return projectOpened_;
return m_projectOpened;
}
Core::BaseFileWizard *OpenProjectWizard::create(QWidget* parent, Core::WizardDialogParameters const& parameters) const
{
OpenProjectWizardDialog* wizard(new OpenProjectWizardDialog(parent
, parameters.defaultPath(), parameters.extraValues()
, const_cast<OpenProjectWizard*>(this)->outputValues_));
, const_cast<OpenProjectWizard*>(this)->m_outputValues));
foreach (QWizardPage* p, parameters.extensionPages())
wizard->addPage(p);
@@ -84,7 +84,7 @@ Core::GeneratedFiles
OpenProjectWizard::generateFiles(QWizard const* wizard, QString* errorMessage) const
{
Q_UNUSED(errorMessage)
Q_ASSERT(project_);
Q_ASSERT(m_project);
OpenProjectWizardDialog const* openWizard
= qobject_cast<OpenProjectWizardDialog const*>(wizard);
@@ -121,10 +121,10 @@ OpenProjectWizard::generateFiles(QWizard const* wizard, QString* errorMessage) c
QStringList sources = openWizard->selectedFiles();
Utility::makeRelativePaths(projectDir.absolutePath(), sources);
Core::GeneratedFile generatedFilesFile(project_->filesFilePath());
Core::GeneratedFile generatedFilesFile(m_project->filesFilePath());
generatedFilesFile.setContents(sources.join(QLatin1String("\n")));
Core::GeneratedFile generatedIncludesFile(project_->includesFilePath());
Core::GeneratedFile generatedIncludesFile(m_project->includesFilePath());
generatedIncludesFile.setContents(includePaths.join(QLatin1String("\n")));
Core::GeneratedFiles files;
@@ -139,10 +139,10 @@ OpenProjectWizard::postGenerateFiles(QWizard const* wizard
{
Q_UNUSED(wizard);
projectOpened_
m_projectOpened
= ProjectExplorer::CustomProjectWizard::postGenerateOpen(files, errorMessage);
return projectOpened_;
return m_projectOpened;
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -150,20 +150,20 @@ OpenProjectWizardDialog::OpenProjectWizardDialog(QWidget* parent
, QString const& projectFile
, QVariantMap const& extraValues, QVariantMap& outputValues)
: Core::BaseFileWizard(parent)
, outputValues_(outputValues)
, extraValues_(extraValues)
, projectFile_(projectFile)
, m_outputValues(outputValues)
, m_extraValues(extraValues)
, m_projectFile(projectFile)
{
setWindowTitle(tr("Open %1 Project").arg(BBPM_C(BOOSTBUILD)));
pathsPage_ = new PathsSelectionWizardPage(this);
pathsPage_->setTitle(tr("Project Name and Paths"));
int const pathsPageId = addPage(pathsPage_);
m_pathsPage = new PathsSelectionWizardPage(this);
m_pathsPage->setTitle(tr("Project Name and Paths"));
int const pathsPageId = addPage(m_pathsPage);
wizardProgress()->item(pathsPageId)->setTitle(tr("Location"));
filesPage_ = new FilesSelectionWizardPage(this);
filesPage_->setTitle(tr("File Selection"));
int const filesPageId = addPage(filesPage_);
m_filesPage = new FilesSelectionWizardPage(this);
m_filesPage->setTitle(tr("File Selection"));
int const filesPageId = addPage(m_filesPage);
wizardProgress()->item(filesPageId)->setTitle(tr("Files"));
}
@@ -178,38 +178,38 @@ QString OpenProjectWizardDialog::path() const
QString OpenProjectWizardDialog::projectFile() const
{
return projectFile_;
return m_projectFile;
}
QString OpenProjectWizardDialog::projectName() const
{
return pathsPage_->projectName();
return m_pathsPage->projectName();
}
QString OpenProjectWizardDialog::defaultProjectName() const
{
return extraValues_.value(BBPM_C(P_KEY_PROJECTNAME)).toString();
return m_extraValues.value(BBPM_C(P_KEY_PROJECTNAME)).toString();
}
QStringList OpenProjectWizardDialog::selectedFiles() const
{
return filesPage_->selectedFiles();
return m_filesPage->selectedFiles();
}
QStringList OpenProjectWizardDialog::selectedPaths() const
{
return filesPage_->selectedPaths();
return m_filesPage->selectedPaths();
}
void OpenProjectWizardDialog::setProjectName(QString const& name)
{
outputValues_.insert(QLatin1String(Constants::P_KEY_PROJECTNAME), name);
m_outputValues.insert(QLatin1String(Constants::P_KEY_PROJECTNAME), name);
}
//////////////////////////////////////////////////////////////////////////////////////////
PathsSelectionWizardPage::PathsSelectionWizardPage(OpenProjectWizardDialog* wizard)
: QWizardPage(wizard)
, wizard_(wizard)
, m_wizard(wizard)
{
QFormLayout *fl = new QFormLayout();
setLayout(fl);
@@ -221,18 +221,18 @@ PathsSelectionWizardPage::PathsSelectionWizardPage(OpenProjectWizardDialog* wiza
QLineEdit* pathLine = new QLineEdit(this);
pathLine->setReadOnly(true);
pathLine->setDisabled(true);
pathLine->setText(wizard_->projectFile());
pathLine->setText(m_wizard->projectFile());
fl->addRow(pathLine);
QString projectName(Utility::parseJamfileProjectName(wizard_->projectFile()));
QString projectName(Utility::parseJamfileProjectName(m_wizard->projectFile()));
if (projectName.isEmpty())
projectName = wizard_->defaultProjectName();
projectName = m_wizard->defaultProjectName();
nameLineEdit_ = new QLineEdit(this);
connect(nameLineEdit_, &QLineEdit::textChanged
, wizard_, &OpenProjectWizardDialog::setProjectName);
nameLineEdit_->setText(projectName);
fl->addRow(tr("Project name:"), nameLineEdit_);
m_nameLineEdit = new QLineEdit(this);
connect(m_nameLineEdit, &QLineEdit::textChanged
, m_wizard, &OpenProjectWizardDialog::setProjectName);
m_nameLineEdit->setText(projectName);
fl->addRow(tr("Project name:"), m_nameLineEdit);
QLabel* defaultsLabel = new QLabel(this);
defaultsLabel->setText(tr("Default Boost.Build runtime locations:"));
@@ -241,13 +241,13 @@ PathsSelectionWizardPage::PathsSelectionWizardPage(OpenProjectWizardDialog* wiza
QLineEdit* workingLine = new QLineEdit(this);
workingLine->setReadOnly(true);
workingLine->setDisabled(true);
workingLine->setText(Project::defaultWorkingDirectory(wizard_->projectFile()));
workingLine->setText(Project::defaultWorkingDirectory(m_wizard->projectFile()));
fl->addRow(tr("Working directory:"), workingLine);
QLineEdit* buildLine = new QLineEdit(this);
buildLine->setReadOnly(true);
buildLine->setDisabled(true);
buildLine->setText(Project::defaultBuildDirectory(wizard_->projectFile()));
buildLine->setText(Project::defaultBuildDirectory(m_wizard->projectFile()));
fl->addRow(tr("Build directory:"), buildLine);
// TODO: indicate if we can find Boost.Build executable?
@@ -265,7 +265,7 @@ PathsSelectionWizardPage::PathsSelectionWizardPage(OpenProjectWizardDialog* wiza
QString PathsSelectionWizardPage::projectName() const
{
return nameLineEdit_->text();
return m_nameLineEdit->text();
}
} // namespace Internal

View File

@@ -13,14 +13,14 @@
#ifndef BBOPENPROJECTWIZARD_HPP
#define BBOPENPROJECTWIZARD_HPP
// Qt Creator
#include <coreplugin/basefilewizard.h>
#include <coreplugin/basefilewizardfactory.h>
#include <coreplugin/generatedfile.h>
#include <utils/wizard.h>
// Qt
#include <QString>
#include <QStringList>
QT_BEGIN_NAMESPACE
class QVBoxLayout;
class QLabel;
@@ -28,9 +28,7 @@ class QTreeView;
class QLineEdit;
QT_END_NAMESPACE
namespace Utils {
class PathChooser;
}
namespace Utils { class PathChooser; }
namespace BoostBuildProjectManager {
namespace Internal {
@@ -57,7 +55,7 @@ public:
bool run(QString const& platform, QVariantMap const& extraValues);
QVariantMap outputValues() const { return outputValues_; }
QVariantMap outputValues() const { return m_outputValues; }
protected:
@@ -72,9 +70,9 @@ protected:
, Core::GeneratedFiles const& files, QString* errorMessage);
private:
Project const* const project_;
QVariantMap outputValues_;
bool projectOpened_;
Project const* const m_project;
QVariantMap m_outputValues;
bool m_projectOpened;
};
//////////////////////////////////////////////////////////////////////////////////////////
@@ -98,11 +96,11 @@ public slots:
void setProjectName(QString const& name);
private:
QVariantMap& outputValues_;
QVariantMap extraValues_;
QString projectFile_;
PathsSelectionWizardPage* pathsPage_;
FilesSelectionWizardPage* filesPage_;
QVariantMap &m_outputValues;
QVariantMap m_extraValues;
QString m_projectFile;
PathsSelectionWizardPage *m_pathsPage;
FilesSelectionWizardPage *m_filesPage;
};
//////////////////////////////////////////////////////////////////////////////////////////
@@ -117,8 +115,8 @@ public:
void setProjectName(QString const& name);
private:
OpenProjectWizardDialog* wizard_;
QLineEdit* nameLineEdit_;
OpenProjectWizardDialog *m_wizard;
QLineEdit *m_nameLineEdit;
};
} // namespace Internal

View File

@@ -19,8 +19,7 @@
#include "b2projectmanagerconstants.h"
#include "b2projectnode.h"
#include "b2utility.h"
// Qt Creator
#include <app/app_version.h>
#include <coreplugin/icontext.h>
#include <coreplugin/icore.h>
#include <coreplugin/generatedfile.h>
@@ -38,7 +37,7 @@
#include <qtsupport/customexecutablerunconfiguration.h>
#include <utils/fileutils.h>
#include <utils/QtConcurrentTools>
// Qt
#include <QDir>
#include <QFileInfo>
#include <QMessageBox>
@@ -47,13 +46,13 @@ namespace BoostBuildProjectManager {
namespace Internal {
Project::Project(ProjectManager* manager, QString const& fileName)
: manager_(manager)
, filePath_(fileName)
, projectFile_(new ProjectFile(this, filePath_)) // enables projectDirectory()
, projectNode_(new ProjectNode(this, projectFile_))
: m_manager(manager)
, m_filePath(fileName)
, m_projectFile(new ProjectFile(this, m_filePath)) // enables projectDirectory()
, m_projectNode(new ProjectNode(this, m_projectFile))
{
Q_ASSERT(manager_);
Q_ASSERT(!filePath_.isEmpty());
Q_ASSERT(m_manager);
Q_ASSERT(!m_filePath.isEmpty());
setProjectContext(Core::Context(Constants::PROJECT_CONTEXT));
setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));
@@ -61,17 +60,17 @@ Project::Project(ProjectManager* manager, QString const& fileName)
setId(Constants::PROJECT_ID);
#endif
QFileInfo const projectFileInfo(filePath_);
QFileInfo const projectFileInfo(m_filePath);
QDir const projectDir(projectFileInfo.dir());
projectName_ = defaultProjectName(filePath_);
filesFilePath_ = QFileInfo(projectDir
, filePath_ + QLatin1String(Constants::EXT_JAMFILE_FILES)).absoluteFilePath();
includesFilePath_ = QFileInfo(projectDir
, filePath_ + QLatin1String(Constants::EXT_JAMFILE_INCLUDES)).absoluteFilePath();
m_projectName = defaultProjectName(m_filePath);
m_filesFilePath = QFileInfo(projectDir
, m_filePath + QLatin1String(Constants::EXT_JAMFILE_FILES)).absoluteFilePath();
m_includesFilePath = QFileInfo(projectDir
, m_filePath + QLatin1String(Constants::EXT_JAMFILE_INCLUDES)).absoluteFilePath();
projectNode_->setDisplayName(displayName());
m_projectNode->setDisplayName(displayName());
manager_->registerProject(this);
m_manager->registerProject(this);
// TODO: Add file watchers
//projectFileWatcher_->addPath(projectFilePath);
@@ -82,13 +81,13 @@ Project::Project(ProjectManager* manager, QString const& fileName)
Project::~Project()
{
manager_->unregisterProject(this);
delete projectNode_;
m_manager->unregisterProject(this);
delete m_projectNode;
}
QString Project::displayName() const
{
return projectName_;
return m_projectName;
}
#if defined(IDE_VERSION_MAJOR) && (IDE_VERSION_MAJOR == 3 && IDE_VERSION_MINOR == 0)
@@ -100,17 +99,17 @@ Core::Id Project::id() const
Core::IDocument* Project::document() const
{
return projectFile_;
return m_projectFile;
}
ProjectExplorer::IProjectManager* Project::projectManager() const
{
return manager_;
return m_manager;
}
ProjectExplorer::ProjectNode* Project::rootProjectNode() const
{
return projectNode_;
return m_projectNode;
}
QStringList Project::files(FilesMode fileMode) const
@@ -118,7 +117,7 @@ QStringList Project::files(FilesMode fileMode) const
// TODO: handle ExcludeGeneratedFiles, but what files exactly?
// *.qtcreator.files, *.qtcreator.includes and *.user?
Q_UNUSED(fileMode);
return files_;
return m_files;
}
QStringList Project::files() const
@@ -128,14 +127,14 @@ QStringList Project::files() const
QString Project::filesFilePath() const
{
Q_ASSERT(!filesFilePath_.isEmpty());
return filesFilePath_;
Q_ASSERT(!m_filesFilePath.isEmpty());
return m_filesFilePath;
}
QString Project::includesFilePath() const
{
Q_ASSERT(!includesFilePath_.isEmpty());
return includesFilePath_;
Q_ASSERT(!m_includesFilePath.isEmpty());
return m_includesFilePath;
}
bool Project::needsConfiguration() const
@@ -173,9 +172,9 @@ QString Project::defaultWorkingDirectory(QString const& top)
void Project::setProjectName(QString const& name)
{
if (projectName_ != name) {
projectName_ = name;
projectNode_->setDisplayName(projectName_);
if (m_projectName != name) {
m_projectName = name;
m_projectNode->setDisplayName(m_projectName);
// TODO: signal?
}
}
@@ -183,7 +182,7 @@ void Project::setProjectName(QString const& name)
QVariantMap Project::toMap() const
{
QVariantMap map(ProjectExplorer::Project::toMap());
map.insert(QLatin1String(Constants::P_KEY_PROJECTNAME), projectName_);
map.insert(QLatin1String(Constants::P_KEY_PROJECTNAME), m_projectName);
return map;
}
@@ -192,14 +191,14 @@ QVariantMap Project::toMap() const
bool Project::fromMap(QVariantMap const& map)
{
BBPM_QDEBUG(displayName());
QTC_ASSERT(projectNode_, return false);
QTC_ASSERT(m_projectNode, return false);
if (!ProjectExplorer::Project::fromMap(map))
return false;
QVariantMap extraValues(map);
if (!extraValues.contains(BBPM_C(P_KEY_PROJECTNAME)))
extraValues.insert(BBPM_C(P_KEY_PROJECTNAME), projectName_);
extraValues.insert(BBPM_C(P_KEY_PROJECTNAME), m_projectName);
setProjectName(map.value(BBPM_C(P_KEY_PROJECTNAME)).toString());
// Check required auxiliary files, run wizard of necessary
@@ -264,14 +263,14 @@ void Project::refresh()
QTC_ASSERT(QFileInfo(includesFilePath()).exists(), return);
QSet<QString> oldFileList;
oldFileList = files_.toSet();
oldFileList = m_files.toSet();
// Parse project:
// The manager does not parse Jamfile files.
// Only generates and parses list of source files in Jamfile.${JAMFILE_FILES_EXT}
QString const projectPath(projectDirectory().toString());
filesRaw_ = Utility::readLines(filesFilePath());
files_ = Utility::makeAbsolutePaths(projectPath, filesRaw_);
m_filesRaw = Utility::readLines(filesFilePath());
m_files = Utility::makeAbsolutePaths(projectPath, m_filesRaw);
QStringList includePaths =
Utility::makeAbsolutePaths(projectPath,
@@ -279,7 +278,7 @@ void Project::refresh()
emit fileListChanged();
projectNode_->refresh(oldFileList);
m_projectNode->refresh(oldFileList);
// TODO: Does it make sense to move this to separate asynchronous task?
// TODO: extract updateCppCodeModel
@@ -292,13 +291,13 @@ void Project::refresh()
//builder.setDefines(); // TODO: waiting for Jamfile parser
builder.setIncludePaths(QStringList() << projectDirectory().toString() << includePaths);
const QList<Core::Id> languages = builder.createProjectPartsForFiles(files_);
const QList<Core::Id> languages = builder.createProjectPartsForFiles(m_files);
foreach (Core::Id language, languages)
setProjectLanguage(language, true);
cppModelFuture_.cancel();
m_cppModelFuture.cancel();
pinfo.finish();
cppModelFuture_ = modelmanager->updateProjectInfo(pinfo);
m_cppModelFuture = modelmanager->updateProjectInfo(pinfo);
}
}

View File

@@ -12,15 +12,12 @@
#ifndef BBPROJECT_HPP
#define BBPROJECT_HPP
// Qt Creator
#include <app/app_version.h>
#include <coreplugin/idocument.h>
#include <projectexplorer/project.h>
#include <utils/fileutils.h>
// Qt
#include <QString>
#include <QFuture>
#include <QFutureInterface>
#include <QString>
namespace BoostBuildProjectManager {
namespace Internal {
@@ -38,9 +35,6 @@ public:
Project(ProjectManager* manager, QString const& fileName);
~Project();
#if defined(IDE_VERSION_MAJOR) && (IDE_VERSION_MAJOR == 3 && IDE_VERSION_MINOR == 0)
Core::Id id() const;
#endif
QString displayName() const;
Core::IDocument* document() const;
ProjectExplorer::IProjectManager* projectManager() const;
@@ -61,43 +55,38 @@ public:
static QString defaultWorkingDirectory(QString const& top);
protected:
QVariantMap toMap() const;
// Deserializes all project data from the map object
// Calls the base ProjectExplorer::Project::fromMap function first.
QVariantMap toMap() const;
bool fromMap(QVariantMap const& map);
private:
void setProjectName(QString const& name);
// Corresponding project manager passed to the constructor
ProjectManager* manager_;
ProjectManager *m_manager;
// By default, name of directory with Jamfile.
// Boost.Build treats each Jamfile is a separate project,
// where hierarchy of Jamfiles makes hierarchy of projects.
QString projectName_;
QString m_projectName;
// Jamfile passed to the constructor (Jamroot, Jamfile, Jamfile.v2).
QString filePath_;
QString m_filePath;
// Auxiliary file Jamfile.${JAMFILE_FILES_EXT} with list of source files.
// Role of this file is similar to the .files file in the GenericProjectManager,
// hence managing of this file is implemented in very similar manner.
QString filesFilePath_;
QStringList files_;
QStringList filesRaw_;
QHash<QString, QString> entriesRaw_;
QString m_filesFilePath;
QStringList m_files;
QStringList m_filesRaw;
QHash<QString, QString> m_entriesRaw;
// Auxiliary file Jamfile.${JAMFILE_INCLUDES_EXT} with list of source files.
QString includesFilePath_;
QString m_includesFilePath;
ProjectFile* projectFile_;
ProjectNode* projectNode_;
ProjectFile *m_projectFile;
ProjectNode *m_projectNode;
QFuture<void> cppModelFuture_;
QFuture<void> m_cppModelFuture;
};
} // namespace Internal

View File

@@ -19,7 +19,7 @@ namespace Internal {
ProjectFile::ProjectFile(Project* project, QString const& fileName)
: Core::IDocument(project)
, project_(project)
, m_project(project)
{
Q_ASSERT(!fileName.isEmpty());

View File

@@ -38,7 +38,7 @@ public:
bool reload(QString* errorString, ReloadFlag flag, ChangeType type);
private:
Project* project_;
Project *m_project;
};
} // namespace Internal

View File

@@ -13,9 +13,9 @@
#include "b2projectmanagerconstants.h"
#include "b2project.h"
#include "b2utility.h"
// Qt Creator
#include <projectexplorer/iprojectmanager.h>
// Qt
#include <QFileInfo>
#include <QString>
@@ -51,13 +51,13 @@ ProjectManager::openProject(QString const& fileName, QString* errorString)
void ProjectManager::registerProject(Project* project)
{
Q_ASSERT(project);
projects_.append(project);
m_projects.append(project);
}
void ProjectManager::unregisterProject(Project* project)
{
Q_ASSERT(project);
projects_.removeAll(project);
m_projects.removeAll(project);
}
} // namespace Internal

View File

@@ -12,15 +12,12 @@
#ifndef BBPROJECTMANAGER_HPP
#define BBPROJECTMANAGER_HPP
// Qt Creator
#include <projectexplorer/iprojectmanager.h>
// Qt
#include <QList>
#include <QString>
namespace ProjectExplorer {
class Project;
}
namespace ProjectExplorer { class Project; }
namespace BoostBuildProjectManager {
namespace Internal {
@@ -45,7 +42,7 @@ public:
void unregisterProject(Project* project);
private:
QList<Project*> projects_;
QList<Project*> m_projects;
};
} // namespace Internal

View File

@@ -21,7 +21,7 @@
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/coreconstants.h>
#include <utils/mimetypes/mimedatabase.h>
// Qt
#include <QAction>
#include <QMessageBox>
#include <QMainWindow>
@@ -29,7 +29,8 @@
#include <QtPlugin>
namespace BoostBuildProjectManager { namespace Internal {
namespace BoostBuildProjectManager {
namespace Internal {
BoostBuildPlugin::BoostBuildPlugin()
{
@@ -80,4 +81,5 @@ ExtensionSystem::IPlugin::ShutdownFlag BoostBuildPlugin::aboutToShutdown()
return SynchronousShutdown;
}
}}
} // namespace Internal
} // namespace BoostBuildProjectManager

View File

@@ -13,11 +13,11 @@
#include "b2projectnode.h"
#include "b2project.h"
#include "b2utility.h"
// Qt Creator
#include <coreplugin/idocument.h>
#include <projectexplorer/projectnodes.h>
#include <utils/qtcassert.h>
// Qt
#include <QFutureInterface>
#include <QHash>
#include <QList>
@@ -30,8 +30,8 @@ namespace Internal {
ProjectNode::ProjectNode(Project* project, Core::IDocument* projectFile)
: ProjectExplorer::ProjectNode(projectFile->filePath())
, project_(project)
, projectFile_(projectFile)
, m_project(project)
, m_projectFile(projectFile)
{
// TODO: setDisplayName(QFileInfo(projectFile->filePath()).completeBaseName());
}
@@ -108,15 +108,15 @@ void ProjectNode::refresh(QSet<QString> oldFileList)
// Only do this once, at first run.
if (oldFileList.isEmpty()) {
using ProjectExplorer::FileNode;
FileNode* projectFileNode = new FileNode(project_->projectFilePath()
FileNode* projectFileNode = new FileNode(m_project->projectFilePath()
, ProjectExplorer::ProjectFileType
, Constants::FileNotGenerated);
FileNode* filesFileNode = new FileNode(Utils::FileName::fromString(project_->filesFilePath())
FileNode* filesFileNode = new FileNode(Utils::FileName::fromString(m_project->filesFilePath())
, ProjectExplorer::ProjectFileType
, Constants::FileNotGenerated);
FileNode* includesFileNode = new FileNode(Utils::FileName::fromString(project_->includesFilePath())
FileNode* includesFileNode = new FileNode(Utils::FileName::fromString(m_project->includesFilePath())
, ProjectExplorer::ProjectFileType
, Constants::FileNotGenerated);
@@ -124,12 +124,12 @@ void ProjectNode::refresh(QSet<QString> oldFileList)
<< projectFileNode << filesFileNode << includesFileNode);
}
oldFileList.remove(project_->filesFilePath());
oldFileList.remove(project_->includesFilePath());
oldFileList.remove(m_project->filesFilePath());
oldFileList.remove(m_project->includesFilePath());
QSet<QString> newFileList = project_->files().toSet();
newFileList.remove(project_->filesFilePath());
newFileList.remove(project_->includesFilePath());
QSet<QString> newFileList = m_project->files().toSet();
newFileList.remove(m_project->filesFilePath());
newFileList.remove(m_project->includesFilePath());
// Calculate set of added and removed files
QSet<QString> removed = oldFileList;

View File

@@ -13,22 +13,17 @@
#ifndef BBPROJECTNODE_HPP
#define BBPROJECTNODE_HPP
// Qt Creator
#include <projectexplorer/projectnodes.h>
// Qt
#include <QFutureInterface>
#include <QList>
#include <QSet>
#include <QString>
#include <QStringList>
namespace Core {
class IDocument;
}
namespace Core { class IDocument; }
namespace ProjectExplorer {
class RunConfiguration;
}
namespace ProjectExplorer { class RunConfiguration; }
namespace BoostBuildProjectManager {
namespace Internal {
@@ -40,7 +35,6 @@ class Project;
// No special operations (addFiles(), removeFiles(), renameFile(), etc.) are offered.
class ProjectNode : public ProjectExplorer::ProjectNode
{
public:
ProjectNode(Project* project, Core::IDocument* projectFile);
@@ -58,7 +52,6 @@ public:
void refresh(QSet<QString> oldFileList);
private:
ProjectExplorer::FolderNode*
createFolderByName(QStringList const& components, int end);
@@ -67,8 +60,8 @@ private:
void removeEmptySubFolders(FolderNode* parent, FolderNode* subParent);
Project* project_;
Core::IDocument* projectFile_;
Project *m_project;
Core::IDocument *m_projectFile;
};
} // namespace Internal

View File

@@ -44,9 +44,7 @@ class QTreeView;
class QLineEdit;
QT_END_NAMESPACE
namespace Utils {
class PathChooser;
}
namespace Utils { class PathChooser; }
namespace BoostBuildProjectManager {
namespace Internal {
@@ -91,8 +89,8 @@ private:
QPushButton *m_applyFilterButton;
QLabel* m_baseDirLabel;
Utils::PathChooser* m_baseDirChooser;
QLabel *m_baseDirLabel;
Utils::PathChooser *m_baseDirChooser;
QString m_lastBaseDir;
QTreeView *m_view;