Merge remote-tracking branch 'origin/4.1'

Change-Id: I5cacf96b5be4053d3a32a7c2a78fad463b9600d0
This commit is contained in:
Eike Ziller
2016-08-17 15:14:53 +02:00
9 changed files with 17 additions and 9 deletions

View File

@@ -223,7 +223,7 @@ BookmarkView::BookmarkView(BookmarkManager *manager) :
setItemDelegate(new BookmarkDelegate(this)); setItemDelegate(new BookmarkDelegate(this));
setFrameStyle(QFrame::NoFrame); setFrameStyle(QFrame::NoFrame);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setFocusPolicy(Qt::NoFocus); setAttribute(Qt::WA_MacShowFocusRect, false);
setSelectionModel(manager->selectionModel()); setSelectionModel(manager->selectionModel());
setSelectionMode(QAbstractItemView::SingleSelection); setSelectionMode(QAbstractItemView::SingleSelection);
setSelectionBehavior(QAbstractItemView::SelectRows); setSelectionBehavior(QAbstractItemView::SelectRows);

View File

@@ -382,7 +382,10 @@ void BuildDirManager::extractData()
m_files.append(cbpparser.cmakeFileList()); m_files.append(cbpparser.cmakeFileList());
foreach (const ProjectExplorer::FileNode *node, cbpparser.cmakeFileList()) foreach (const ProjectExplorer::FileNode *node, cbpparser.cmakeFileList())
m_cmakeFiles.insert(node->filePath()); m_cmakeFiles.insert(node->filePath());
} else { }
// Make sure the top cmakelists.txt file is always listed:
if (!Utils::contains(m_files, [topCMake](ProjectExplorer::FileNode *fn) { return fn->filePath() == topCMake; })) {
m_files.append(new ProjectExplorer::FileNode(topCMake, ProjectExplorer::ProjectFileType, false)); m_files.append(new ProjectExplorer::FileNode(topCMake, ProjectExplorer::ProjectFileType, false));
} }

View File

@@ -193,7 +193,7 @@ FileName CMakeBuildConfiguration::shadowBuildDirectory(const FileName &projectFi
return FileName(); return FileName();
const QString projectName = projectFilePath.parentDir().fileName(); const QString projectName = projectFilePath.parentDir().fileName();
ProjectMacroExpander expander(projectName, k, bcName, buildType); ProjectMacroExpander expander(projectFilePath.toString(), projectName, k, bcName, buildType);
QDir projectDir = QDir(Project::projectDirectory(projectFilePath).toString()); QDir projectDir = QDir(Project::projectDirectory(projectFilePath).toString());
QString buildPath = expander.expand(Core::DocumentManager::buildDirectory()); QString buildPath = expander.expand(Core::DocumentManager::buildDirectory());
return FileName::fromUserInput(projectDir.absoluteFilePath(buildPath)); return FileName::fromUserInput(projectDir.absoluteFilePath(buildPath));

View File

@@ -105,6 +105,7 @@ CMakeProject::~CMakeProject()
{ {
setRootProjectNode(nullptr); setRootProjectNode(nullptr);
m_codeModelFuture.cancel(); m_codeModelFuture.cancel();
qDeleteAll(m_watchedFiles);
qDeleteAll(m_extraCompilers); qDeleteAll(m_extraCompilers);
} }

View File

@@ -180,7 +180,7 @@ FileName NimBuildConfigurationFactory::defaultBuildDirectory(const Kit *k,
{ {
QFileInfo projectFileInfo(projectFilePath); QFileInfo projectFileInfo(projectFilePath);
ProjectMacroExpander expander(projectFileInfo.baseName(), k, bc, buildType); ProjectMacroExpander expander(projectFilePath, projectFileInfo.baseName(), k, bc, buildType);
QString buildDirectory = expander.expand(Core::DocumentManager::buildDirectory()); QString buildDirectory = expander.expand(Core::DocumentManager::buildDirectory());
if (FileUtils::isAbsolutePath(buildDirectory)) if (FileUtils::isAbsolutePath(buildDirectory))

View File

@@ -29,10 +29,14 @@
namespace ProjectExplorer { namespace ProjectExplorer {
ProjectMacroExpander::ProjectMacroExpander(const QString &projectName, ProjectMacroExpander::ProjectMacroExpander(const QString &mainFilePath, const QString &projectName,
const Kit *kit, const QString &bcName, const Kit *kit, const QString &bcName,
BuildConfiguration::BuildType buildType) BuildConfiguration::BuildType buildType)
{ {
registerFileVariables(Constants::VAR_CURRENTPROJECT_PREFIX,
QCoreApplication::translate("ProjectExplorer", "Main file of current project"),
[mainFilePath]() -> QString { return mainFilePath; });
registerVariable(Constants::VAR_CURRENTPROJECT_NAME, registerVariable(Constants::VAR_CURRENTPROJECT_NAME,
QCoreApplication::translate("ProjectExplorer", "Name of current project"), QCoreApplication::translate("ProjectExplorer", "Name of current project"),
[projectName] { return projectName; }); [projectName] { return projectName; });

View File

@@ -37,8 +37,8 @@ class Kit;
class PROJECTEXPLORER_EXPORT ProjectMacroExpander : public Utils::MacroExpander class PROJECTEXPLORER_EXPORT ProjectMacroExpander : public Utils::MacroExpander
{ {
public: public:
ProjectMacroExpander(const QString &projectName, const Kit *kit, const QString &bcName, ProjectMacroExpander(const QString &mainFilePath, const QString &projectName, const Kit *kit,
BuildConfiguration::BuildType buildType); const QString &bcName, BuildConfiguration::BuildType buildType);
}; };
} // namespace ProjectExplorer } // namespace ProjectExplorer

View File

@@ -398,7 +398,7 @@ static Utils::FileName defaultBuildDirectory(const QString &projectFilePath, con
BuildConfiguration::BuildType buildType) BuildConfiguration::BuildType buildType)
{ {
const QString projectName = QFileInfo(projectFilePath).completeBaseName(); const QString projectName = QFileInfo(projectFilePath).completeBaseName();
ProjectMacroExpander expander(projectName, k, bcName, buildType); ProjectMacroExpander expander(projectFilePath, projectName, k, bcName, buildType);
QString projectDir = Project::projectDirectory(Utils::FileName::fromString(projectFilePath)).toString(); QString projectDir = Project::projectDirectory(Utils::FileName::fromString(projectFilePath)).toString();
QString buildPath = expander.expand(Core::DocumentManager::buildDirectory()); QString buildPath = expander.expand(Core::DocumentManager::buildDirectory());
return Utils::FileName::fromString(Utils::FileUtils::resolvePath(projectDir, buildPath)); return Utils::FileName::fromString(Utils::FileUtils::resolvePath(projectDir, buildPath));

View File

@@ -78,7 +78,7 @@ QString QmakeBuildConfiguration::shadowBuildDirectory(const QString &proFilePath
return QString(); return QString();
const QString projectName = QFileInfo(proFilePath).completeBaseName(); const QString projectName = QFileInfo(proFilePath).completeBaseName();
ProjectMacroExpander expander(projectName, k, suffix, buildType); ProjectMacroExpander expander(proFilePath, projectName, k, suffix, buildType);
QString projectDir = Project::projectDirectory(FileName::fromString(proFilePath)).toString(); QString projectDir = Project::projectDirectory(FileName::fromString(proFilePath)).toString();
QString buildPath = expander.expand(Core::DocumentManager::buildDirectory()); QString buildPath = expander.expand(Core::DocumentManager::buildDirectory());
return FileUtils::resolvePath(projectDir, buildPath); return FileUtils::resolvePath(projectDir, buildPath);