summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/coreplugin/coreconstants.h2
-rw-r--r--src/plugins/coreplugin/documentmanager.cpp43
-rw-r--r--src/plugins/coreplugin/documentmanager.h3
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp46
-rw-r--r--src/plugins/projectexplorer/projectexplorerconstants.h11
-rw-r--r--src/plugins/projectexplorer/projectexplorersettingspage.cpp39
-rw-r--r--src/plugins/projectexplorer/projectexplorersettingspage.h6
-rw-r--r--src/plugins/projectexplorer/projectexplorersettingspage.ui78
-rw-r--r--src/plugins/qt4projectmanager/qt4project.cpp78
9 files changed, 155 insertions, 151 deletions
diff --git a/src/plugins/coreplugin/coreconstants.h b/src/plugins/coreplugin/coreconstants.h
index 7c6032cc0e..982a9f2d65 100644
--- a/src/plugins/coreplugin/coreconstants.h
+++ b/src/plugins/coreplugin/coreconstants.h
@@ -227,6 +227,8 @@ const char VARIABLE_SUPPORT_PROPERTY[] = "QtCreator.VariableSupport";
const char TR_CLEAR_MENU[] = QT_TRANSLATE_NOOP("Core", "Clear Menu");
+const char DEFAULT_BUILD_DIRECTORY[] = "../build-%{CurrentProject:Name}-%{CurrentKit:FileSystemName}-%{CurrentBuild:Name}";
+
const int TARGET_ICON_SIZE = 32;
} // namespace Constants
diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp
index 50d818b851..42d8787a6d 100644
--- a/src/plugins/coreplugin/documentmanager.cpp
+++ b/src/plugins/coreplugin/documentmanager.cpp
@@ -98,8 +98,6 @@ static const char directoryGroupC[] = "Directories";
static const char projectDirectoryKeyC[] = "Projects";
static const char useProjectDirectoryKeyC[] = "UseProjectsDirectory";
static const char buildDirectoryKeyC[] = "BuildDirectory";
-static const char useBuildDirectoryKeyC[] = "UseBuildDirectory";
-
namespace Core {
@@ -159,7 +157,6 @@ struct DocumentManagerPrivate
QString m_projectsDirectory;
bool m_useProjectsDirectory;
QString m_buildDirectory;
- bool m_useBuildDirectory;
// When we are callling into a IDocument
// we don't want to receive a changed()
// signal
@@ -202,7 +199,6 @@ DocumentManagerPrivate::DocumentManagerPrivate(QMainWindow *mw) :
m_blockActivated(false),
m_lastVisitedDirectory(QDir::currentPath()),
m_useProjectsDirectory(Utils::HostOsInfo::isMacHost()), // Creator is in bizarre places when launched via finder.
- m_useBuildDirectory(false),
m_blockedIDocument(0)
{
}
@@ -1171,7 +1167,6 @@ void DocumentManager::saveSettings()
s->setValue(QLatin1String(projectDirectoryKeyC), d->m_projectsDirectory);
s->setValue(QLatin1String(useProjectDirectoryKeyC), d->m_useProjectsDirectory);
s->setValue(QLatin1String(buildDirectoryKeyC), d->m_buildDirectory);
- s->setValue(QLatin1String(useBuildDirectoryKeyC), d->m_useBuildDirectory);
s->endGroup();
}
@@ -1197,23 +1192,20 @@ void readSettings()
s->beginGroup(QLatin1String(directoryGroupC));
const QString settingsProjectDir = s->value(QLatin1String(projectDirectoryKeyC),
QString()).toString();
- if (!settingsProjectDir.isEmpty() && QFileInfo(settingsProjectDir).isDir()) {
+ if (!settingsProjectDir.isEmpty() && QFileInfo(settingsProjectDir).isDir())
d->m_projectsDirectory = settingsProjectDir;
- } else {
+ else
d->m_projectsDirectory = Utils::PathChooser::homePath();
- }
d->m_useProjectsDirectory = s->value(QLatin1String(useProjectDirectoryKeyC),
d->m_useProjectsDirectory).toBool();
const QString settingsShadowDir = s->value(QLatin1String(buildDirectoryKeyC),
QString()).toString();
- if (!settingsShadowDir.isEmpty() && QFileInfo(settingsShadowDir).isDir())
+ if (!settingsShadowDir.isEmpty())
d->m_buildDirectory = settingsShadowDir;
else
- d->m_buildDirectory = Utils::PathChooser::homePath();
+ d->m_buildDirectory = QLatin1String(Constants::DEFAULT_BUILD_DIRECTORY);
- d->m_useBuildDirectory = s->value(QLatin1String(useBuildDirectoryKeyC),
- d->m_useBuildDirectory).toBool();
s->endGroup();
}
@@ -1285,30 +1277,9 @@ void DocumentManager::setProjectsDirectory(const QString &dir)
}
/*!
- Returns whether the default shadow build directory is placed adjacent to the source in the
- projects directory or in a separate build tree.
-
- \sa setUseBuildDirectory, setBuildDirectory
-*/
-bool DocumentManager::useBuildDirectory()
-{
- return d->m_useBuildDirectory;
-}
-
-/*!
- Sets whether a separate build directory is to the used when shadow building.
-
- \sa buildDirectory, usebuildDirectory
-*/
-void DocumentManager::setUseBuildDirectory(bool use)
-{
- d->m_useBuildDirectory = use;
-}
-
-/*!
- Returns the shadow build directory.
+ Returns the default build directory.
- \sa setBuildDirectory, useBuildDirectory
+ \sa setBuildDirectory
*/
QString DocumentManager::buildDirectory()
{
@@ -1318,7 +1289,7 @@ QString DocumentManager::buildDirectory()
/*!
Sets the shadow build directory to \a directory.
- \sa buildDirectory, useBuildDirectory
+ \sa buildDirectory
*/
void DocumentManager::setBuildDirectory(const QString &directory)
{
diff --git a/src/plugins/coreplugin/documentmanager.h b/src/plugins/coreplugin/documentmanager.h
index 7d5ba7a84d..31893224ac 100644
--- a/src/plugins/coreplugin/documentmanager.h
+++ b/src/plugins/coreplugin/documentmanager.h
@@ -129,9 +129,6 @@ public:
static QString projectsDirectory();
static void setProjectsDirectory(const QString &);
- static bool useBuildDirectory();
- static void setUseBuildDirectory(bool use);
-
static QString buildDirectory();
static void setBuildDirectory(const QString &directory);
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index d3a40d062b..a26be61a5d 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -155,16 +155,6 @@ namespace {
bool debug = false;
}
-static const char kCurrentProjectPath[] = "CurrentProject:Path";
-static const char kCurrentProjectFilePath[] = "CurrentProject:FilePath";
-static const char kCurrentProjectBuildPath[] = "CurrentProject:BuildPath";
-static const char kCurrentProjectName[] = "CurrentProject:Name";
-static const char kCurrentKitName[] = "CurrentKit:Name";
-static const char kCurrentKitFileSystemName[] = "CurrentKit:FileSystemName";
-static const char kCurrentKitId[] = "CurrentKit:Id";
-static const char kCurrentBuildName[] = "CurrentBuild:Name";
-static const char kCurrentBuildType[] = "CurrentBuild:Type";
-
namespace ProjectExplorer {
struct ProjectExplorerPluginPrivate {
@@ -996,19 +986,19 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
updateWelcomePage();
Core::VariableManager *vm = Core::VariableManager::instance();
- vm->registerVariable(kCurrentProjectFilePath,
+ vm->registerVariable(Constants::VAR_CURRENTPROJECT_FILEPATH,
tr("Full path of the current project's main file, including file name."));
- vm->registerVariable(kCurrentProjectPath,
+ vm->registerVariable(Constants::VAR_CURRENTPROJECT_PATH,
tr("Full path of the current project's main file, excluding file name."));
- vm->registerVariable(kCurrentProjectBuildPath,
+ vm->registerVariable(Constants::VAR_CURRENTPROJECT_BUILDPATH,
tr("Full build path of the current project's active build configuration."));
- vm->registerVariable(kCurrentProjectName, tr("The current project's name."));
- vm->registerVariable(kCurrentKitName, tr("The currently active kit's name."));
- vm->registerVariable(kCurrentKitFileSystemName,
+ vm->registerVariable(Constants::VAR_CURRENTPROJECT_NAME, tr("The current project's name."));
+ vm->registerVariable(Constants::VAR_CURRENTKIT_NAME, tr("The currently active kit's name."));
+ vm->registerVariable(Constants::VAR_CURRENTKIT_FILESYSTEMNAME,
tr("The currently active kit's name in a filesystem friendly version."));
- vm->registerVariable(kCurrentKitId, tr("The currently active kit's id."));
- vm->registerVariable(kCurrentBuildName, tr("The currently active build configuration's name."));
- vm->registerVariable(kCurrentBuildType, tr("The currently active build configuration's type."));
+ vm->registerVariable(Constants::VAR_CURRENTKIT_ID, tr("The currently active kit's id."));
+ vm->registerVariable(Constants::VAR_CURRENTBUILD_NAME, tr("The currently active build configuration's name."));
+ vm->registerVariable(Constants::VAR_CURRENTBUILD_TYPE, tr("The currently active build configuration's type."));
connect(vm, SIGNAL(variableUpdateRequested(QByteArray)),
this, SLOT(updateVariable(QByteArray)));
@@ -1142,58 +1132,58 @@ void ProjectExplorerPlugin::loadCustomWizards()
void ProjectExplorerPlugin::updateVariable(const QByteArray &variable)
{
- if (variable == kCurrentProjectFilePath) {
+ if (variable == Constants::VAR_CURRENTPROJECT_FILEPATH) {
if (currentProject() && currentProject()->document()) {
Core::VariableManager::instance()->insert(variable,
currentProject()->document()->fileName());
} else {
Core::VariableManager::instance()->remove(variable);
}
- } else if (variable == kCurrentProjectPath) {
+ } else if (variable == Constants::VAR_CURRENTPROJECT_PATH) {
if (currentProject() && currentProject()->document()) {
Core::VariableManager::instance()->insert(variable,
QFileInfo(currentProject()->document()->fileName()).path());
} else {
Core::VariableManager::instance()->remove(variable);
}
- } else if (variable == kCurrentProjectBuildPath) {
+ } else if (variable == Constants::VAR_CURRENTPROJECT_BUILDPATH) {
if (currentProject() && currentProject()->activeTarget() && currentProject()->activeTarget()->activeBuildConfiguration()) {
Core::VariableManager::instance()->insert(variable,
currentProject()->activeTarget()->activeBuildConfiguration()->buildDirectory());
} else {
Core::VariableManager::instance()->remove(variable);
}
- } else if (variable == kCurrentProjectName) {
+ } else if (variable == Constants::VAR_CURRENTPROJECT_NAME) {
if (currentProject()) {
Core::VariableManager::instance()->insert(variable, currentProject()->displayName());
} else {
Core::VariableManager::instance()->remove(variable);
}
- } else if (variable == kCurrentKitName) {
+ } else if (variable == Constants::VAR_CURRENTKIT_NAME) {
if (currentProject() && currentProject()->activeTarget() && currentProject()->activeTarget()->kit()) {
Core::VariableManager::instance()->insert(variable, currentProject()->activeTarget()->kit()->displayName());
} else {
Core::VariableManager::instance()->remove(variable);
}
- } else if (variable == kCurrentKitFileSystemName) {
+ } else if (variable == Constants::VAR_CURRENTKIT_FILESYSTEMNAME) {
if (currentProject() && currentProject()->activeTarget() && currentProject()->activeTarget()->kit()) {
Core::VariableManager::instance()->insert(variable, currentProject()->activeTarget()->kit()->fileSystemFriendlyName());
} else {
Core::VariableManager::instance()->remove(variable);
}
- } else if (variable == kCurrentKitId) {
+ } else if (variable == Constants::VAR_CURRENTKIT_ID) {
if (currentProject() && currentProject()->activeTarget() && currentProject()->activeTarget()->kit()) {
Core::VariableManager::instance()->insert(variable, currentProject()->activeTarget()->kit()->id().toString());
} else {
Core::VariableManager::instance()->remove(variable);
}
- } else if (variable == kCurrentBuildName) {
+ } else if (variable == Constants::VAR_CURRENTBUILD_NAME) {
if (currentProject() && currentProject()->activeTarget() && currentProject()->activeTarget()->activeBuildConfiguration()) {
Core::VariableManager::instance()->insert(variable, currentProject()->activeTarget()->activeBuildConfiguration()->displayName());
} else {
Core::VariableManager::instance()->remove(variable);
}
- } else if (variable == kCurrentBuildType) {
+ } else if (variable == Constants::VAR_CURRENTBUILD_TYPE) {
if (currentProject() && currentProject()->activeTarget() && currentProject()->activeTarget()->activeBuildConfiguration()) {
BuildConfiguration::BuildType type = currentProject()->activeTarget()->activeBuildConfiguration()->buildType();
QString typeString;
diff --git a/src/plugins/projectexplorer/projectexplorerconstants.h b/src/plugins/projectexplorer/projectexplorerconstants.h
index 4359e7cae1..cdf2408e75 100644
--- a/src/plugins/projectexplorer/projectexplorerconstants.h
+++ b/src/plugins/projectexplorer/projectexplorerconstants.h
@@ -235,6 +235,17 @@ const char DEFAULT_WORKING_DIR[] = "%{buildDir}";
const char DESKTOP_DEVICE_ID[] = "Desktop Device";
const char DESKTOP_DEVICE_TYPE[] = "Desktop";
+// Variable Names:
+const char VAR_CURRENTPROJECT_PATH[] = "CurrentProject:Path";
+const char VAR_CURRENTPROJECT_FILEPATH[] = "CurrentProject:FilePath";
+const char VAR_CURRENTPROJECT_BUILDPATH[] = "CurrentProject:BuildPath";
+const char VAR_CURRENTPROJECT_NAME[] = "CurrentProject:Name";
+const char VAR_CURRENTKIT_NAME[] = "CurrentKit:Name";
+const char VAR_CURRENTKIT_FILESYSTEMNAME[] = "CurrentKit:FileSystemName";
+const char VAR_CURRENTKIT_ID[] = "CurrentKit:Id";
+const char VAR_CURRENTBUILD_NAME[] = "CurrentBuild:Name";
+const char VAR_CURRENTBUILD_TYPE[] = "CurrentBuild:Type";
+
} // namespace Constants
// Run modes
diff --git a/src/plugins/projectexplorer/projectexplorersettingspage.cpp b/src/plugins/projectexplorer/projectexplorersettingspage.cpp
index bb40f64a20..ce6125e714 100644
--- a/src/plugins/projectexplorer/projectexplorersettingspage.cpp
+++ b/src/plugins/projectexplorer/projectexplorersettingspage.cpp
@@ -32,8 +32,9 @@
#include "projectexplorerconstants.h"
#include "projectexplorer.h"
-#include <coreplugin/icore.h>
+#include <coreplugin/coreconstants.h>
#include <coreplugin/documentmanager.h>
+#include <coreplugin/icore.h>
#include <utils/hostosinfo.h>
#include <QLabel>
@@ -51,10 +52,12 @@ ProjectExplorerSettingsWidget::ProjectExplorerSettingsWidget(QWidget *parent) :
setJomVisible(Utils::HostOsInfo::isWindowsHost());
m_ui.directoryButtonGroup->setId(m_ui.currentDirectoryRadioButton, UseCurrentDirectory);
m_ui.directoryButtonGroup->setId(m_ui.directoryRadioButton, UseProjectDirectory);
+ m_ui.buildDirectoryEdit->setProperty(Core::Constants::VARIABLE_SUPPORT_PROPERTY, true);
+
connect(m_ui.directoryButtonGroup, SIGNAL(buttonClicked(int)),
this, SLOT(slotDirectoryButtonGroupChanged()));
- connect(m_ui.buildDirectoryCheckBox, SIGNAL(toggled(bool)),
- this, SLOT(slotBuildDirectoryCheckBoxChanged(bool)));
+ connect(m_ui.resetButton, SIGNAL(clicked()), this, SLOT(resetDefaultBuildDirectory()));
+ connect(m_ui.buildDirectoryEdit, SIGNAL(textChanged(QString)), this, SLOT(updateResetButton()));
}
void ProjectExplorerSettingsWidget::setJomVisible(bool v)
@@ -120,40 +123,30 @@ void ProjectExplorerSettingsWidget::setUseProjectsDirectory(bool b)
}
}
-bool ProjectExplorerSettingsWidget::useBuildDirectory() const
-{
- return m_ui.buildDirectoryCheckBox->isChecked();
-}
-
-void ProjectExplorerSettingsWidget::setUseBuildDirectory(bool v)
-{
- if (useBuildDirectory() != v) {
- m_ui.buildDirectoryCheckBox->setChecked(v);
- slotBuildDirectoryCheckBoxChanged(v);
- }
-}
-
QString ProjectExplorerSettingsWidget::buildDirectory() const
{
- return m_ui.buildDirectoryPathChooser->path();
+ return m_ui.buildDirectoryEdit->text();
}
void ProjectExplorerSettingsWidget::setBuildDirectory(const QString &bd)
{
- m_ui.buildDirectoryPathChooser->setPath(bd);
+ m_ui.buildDirectoryEdit->setText(bd);
}
void ProjectExplorerSettingsWidget::slotDirectoryButtonGroupChanged()
{
bool enable = useProjectsDirectory();
m_ui.projectsDirectoryPathChooser->setEnabled(enable);
- m_ui.buildDirectoryCheckBox->setEnabled(enable);
- m_ui.buildDirectoryPathChooser->setEnabled(enable && useBuildDirectory());
}
-void ProjectExplorerSettingsWidget::slotBuildDirectoryCheckBoxChanged(bool checked)
+void ProjectExplorerSettingsWidget::resetDefaultBuildDirectory()
+{
+ setBuildDirectory(QLatin1String(Core::Constants::DEFAULT_BUILD_DIRECTORY));
+}
+
+void ProjectExplorerSettingsWidget::updateResetButton()
{
- m_ui.buildDirectoryPathChooser->setEnabled(useProjectsDirectory() && checked);
+ m_ui.resetButton->setEnabled(buildDirectory() != QLatin1String(Core::Constants::DEFAULT_BUILD_DIRECTORY));
}
QString ProjectExplorerSettingsWidget::searchKeywords() const
@@ -200,7 +193,6 @@ QWidget *ProjectExplorerSettingsPage::createPage(QWidget *parent)
m_widget->setSettings(ProjectExplorerPlugin::instance()->projectExplorerSettings());
m_widget->setProjectsDirectory(Core::DocumentManager::projectsDirectory());
m_widget->setUseProjectsDirectory(Core::DocumentManager::useProjectsDirectory());
- m_widget->setUseBuildDirectory(Core::DocumentManager::useBuildDirectory());
m_widget->setBuildDirectory(Core::DocumentManager::buildDirectory());
if (m_searchKeywords.isEmpty())
m_searchKeywords = m_widget->searchKeywords();
@@ -213,7 +205,6 @@ void ProjectExplorerSettingsPage::apply()
ProjectExplorerPlugin::instance()->setProjectExplorerSettings(m_widget->settings());
Core::DocumentManager::setProjectsDirectory(m_widget->projectsDirectory());
Core::DocumentManager::setUseProjectsDirectory(m_widget->useProjectsDirectory());
- Core::DocumentManager::setUseBuildDirectory(m_widget->useBuildDirectory());
Core::DocumentManager::setBuildDirectory(m_widget->buildDirectory());
}
}
diff --git a/src/plugins/projectexplorer/projectexplorersettingspage.h b/src/plugins/projectexplorer/projectexplorersettingspage.h
index 5e37b23eaa..3e0a606ed2 100644
--- a/src/plugins/projectexplorer/projectexplorersettingspage.h
+++ b/src/plugins/projectexplorer/projectexplorersettingspage.h
@@ -55,9 +55,6 @@ public:
bool useProjectsDirectory();
void setUseProjectsDirectory(bool v);
- bool useBuildDirectory() const;
- void setUseBuildDirectory(bool v);
-
QString buildDirectory() const;
void setBuildDirectory(const QString &bd);
@@ -65,7 +62,8 @@ public:
private slots:
void slotDirectoryButtonGroupChanged();
- void slotBuildDirectoryCheckBoxChanged(bool checked);
+ void resetDefaultBuildDirectory();
+ void updateResetButton();
private:
void setJomVisible(bool);
diff --git a/src/plugins/projectexplorer/projectexplorersettingspage.ui b/src/plugins/projectexplorer/projectexplorersettingspage.ui
index ec29fa134b..7963fd4bc7 100644
--- a/src/plugins/projectexplorer/projectexplorersettingspage.ui
+++ b/src/plugins/projectexplorer/projectexplorersettingspage.ui
@@ -33,23 +33,6 @@
</attribute>
</widget>
</item>
- <item row="1" column="1">
- <widget class="Utils::PathChooser" name="projectsDirectoryPathChooser" native="true"/>
- </item>
- <item row="2" column="0">
- <widget class="QCheckBox" name="buildDirectoryCheckBox">
- <property name="text">
- <string>Build directory</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="Utils::PathChooser" name="buildDirectoryPathChooser" native="true">
- <property name="enabled">
- <bool>false</bool>
- </property>
- </widget>
- </item>
<item row="1" column="0">
<widget class="QRadioButton" name="directoryRadioButton">
<property name="text">
@@ -63,6 +46,9 @@
</attribute>
</widget>
</item>
+ <item row="1" column="1">
+ <widget class="Utils::PathChooser" name="projectsDirectoryPathChooser"/>
+ </item>
</layout>
</widget>
</item>
@@ -124,7 +110,7 @@
</property>
</widget>
</item>
- <item row="3" column="1" rowspan="2">
+ <item row="3" column="1">
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
@@ -163,7 +149,21 @@
</layout>
</widget>
</item>
- <item row="7" column="0">
+ <item row="4" column="0">
+ <widget class="QCheckBox" name="showRunOutputCheckBox">
+ <property name="text">
+ <string>Open application output pane when running</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QCheckBox" name="showDebugOutputCheckBox">
+ <property name="text">
+ <string>Open application output pane when debugging</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0">
<widget class="QCheckBox" name="promptToStopRunControlCheckBox">
<property name="toolTip">
<string>Ask before terminating the running application in response to clicking the stop button in Application Output.</string>
@@ -173,7 +173,7 @@
</property>
</widget>
</item>
- <item row="8" column="0" colspan="2">
+ <item row="7" column="0" colspan="2">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
@@ -206,19 +206,29 @@
</item>
</layout>
</item>
- <item row="5" column="0">
- <widget class="QCheckBox" name="showRunOutputCheckBox">
- <property name="text">
- <string>Open application output pane when running</string>
- </property>
- </widget>
- </item>
- <item row="6" column="0">
- <widget class="QCheckBox" name="showDebugOutputCheckBox">
- <property name="text">
- <string>Open application output pane when debugging</string>
+ <item row="8" column="0" colspan="2">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <property name="topMargin">
+ <number>12</number>
</property>
- </widget>
+ <item>
+ <widget class="QLabel" name="buildDirLabel">
+ <property name="text">
+ <string>Default Build Directory:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="buildDirectoryEdit"/>
+ </item>
+ <item>
+ <widget class="QPushButton" name="resetButton">
+ <property name="text">
+ <string>Reset</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
</layout>
<zorder>saveAllFilesCheckBox</zorder>
@@ -252,8 +262,8 @@
<customwidgets>
<customwidget>
<class>Utils::PathChooser</class>
- <extends>QWidget</extends>
- <header location="global">utils/pathchooser.h</header>
+ <extends>QLineEdit</extends>
+ <header>utils/pathchooser.h</header>
<container>1</container>
</customwidget>
</customwidgets>
diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp
index 10e5af5186..4b60ccc7d4 100644
--- a/src/plugins/qt4projectmanager/qt4project.cpp
+++ b/src/plugins/qt4projectmanager/qt4project.cpp
@@ -47,6 +47,7 @@
#include <coreplugin/coreconstants.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/documentmanager.h>
+#include <coreplugin/variablemanager.h>
#include <extensionsystem/pluginmanager.h>
#include <cpptools/ModelManagerInterface.h>
#include <qmljs/qmljsmodelmanagerinterface.h>
@@ -67,6 +68,7 @@
#include <qtsupport/qtsupportconstants.h>
#include <qtsupport/qtversionmanager.h>
#include <utils/QtConcurrentTools>
+#include <utils/stringutils.h>
#include <QDebug>
#include <QDir>
@@ -115,6 +117,53 @@ QString sanitize(const QString &input)
return result;
}
+class Qt4ProjectExpander : public Utils::AbstractQtcMacroExpander
+{
+public:
+ Qt4ProjectExpander(const QString &proFilePath, const Kit *k, const QString &bcName) :
+ m_proFile(proFilePath), m_kit(k), m_bcName(bcName)
+ { }
+
+ bool resolveMacro(const QString &name, QString *ret)
+ {
+ QString result;
+ bool found = false;
+ if (name == QLatin1String(ProjectExplorer::Constants::VAR_CURRENTPROJECT_NAME)) {
+ result = m_proFile.baseName();
+ found = true;
+ } else if (name == QLatin1String(ProjectExplorer::Constants::VAR_CURRENTPROJECT_PATH)) {
+ result = m_proFile.absolutePath();
+ found = true;
+ } else if (name == QLatin1String(ProjectExplorer::Constants::VAR_CURRENTPROJECT_FILEPATH)) {
+ result = m_proFile.absoluteFilePath();
+ found = true;
+ } else if (m_kit && name == QLatin1String(ProjectExplorer::Constants::VAR_CURRENTKIT_NAME)) {
+ result = m_kit->displayName();
+ found = true;
+ } else if (m_kit && name == QLatin1String(ProjectExplorer::Constants::VAR_CURRENTKIT_FILESYSTEMNAME)) {
+ result = m_kit->fileSystemFriendlyName();
+ found = true;
+ } else if (m_kit && name == QLatin1String(ProjectExplorer::Constants::VAR_CURRENTKIT_ID)) {
+ result = m_kit->id().toString();
+ found = true;
+ } else if (name == QLatin1String(ProjectExplorer::Constants::VAR_CURRENTBUILD_NAME)) {
+ result = m_bcName;
+ found = true;
+ } else {
+ result = Core::VariableManager::instance()->value(name.toUtf8(), &found);
+ }
+ if (ret)
+ *ret = result;
+ return found;
+ }
+
+private:
+ QFileInfo m_proFile;
+ const Kit *m_kit;
+ QString m_bcName;
+ Utils::AbstractMacroExpander *m_expander;
+};
+
} // namespace
namespace Qt4ProjectManager {
@@ -1411,35 +1460,20 @@ QString Qt4Project::disabledReasonForRunConfiguration(const QString &proFilePath
.arg(QFileInfo(proFilePath).fileName());
}
-QString Qt4Project::shadowBuildDirectory(const QString &profilePath, const Kit *k, const QString &suffix)
+QString Qt4Project::shadowBuildDirectory(const QString &proFilePath, const Kit *k, const QString &suffix)
{
- if (profilePath.isEmpty())
+ if (proFilePath.isEmpty())
return QString();
- QFileInfo info(profilePath);
+ QFileInfo info(proFilePath);
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
if (version && !version->supportsShadowBuilds())
return info.absolutePath();
- Utils::FileName buildDirBase = Utils::FileName::fromString(projectDirectory(profilePath));
- if (Core::DocumentManager::useProjectsDirectory() &&
- Core::DocumentManager::useBuildDirectory()) {
- const Utils::FileName projectsDirectory =
- Utils::FileName::fromString(Core::DocumentManager::projectsDirectory());
-
- if (buildDirBase.isChildOf(projectsDirectory)) {
- Utils::FileName buildDirectory =
- Utils::FileName::fromString(Core::DocumentManager::buildDirectory());
-
- buildDirectory.appendPath(buildDirBase.relativeChildPath(projectsDirectory).toString());
- buildDirBase = buildDirectory;
- }
- }
-
- buildDirBase.append(QLatin1String("-build-") + buildNameFor(k) +
- QLatin1Char('-') + sanitize(suffix));
-
- return QDir::cleanPath(buildDirBase.toString());
+ Qt4ProjectExpander expander(proFilePath, k, suffix);
+ QDir projectDir = QDir(projectDirectory(proFilePath));
+ QString buildPath = Utils::expandMacros(Core::DocumentManager::buildDirectory(), &expander);
+ return QDir::cleanPath(projectDir.absoluteFilePath(buildPath));
}
QString Qt4Project::buildNameFor(const Kit *k)