summaryrefslogtreecommitdiff
path: root/src/plugins/projectexplorer
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@nokia.com>2012-04-04 16:20:10 +0200
committerEike Ziller <eike.ziller@nokia.com>2012-04-04 16:20:10 +0200
commitc814538d959353da2911e001001a9022b581cd5b (patch)
treea8ee9657b8de8c2b648182c84996056b43d410e8 /src/plugins/projectexplorer
parent12624eb7f42251f2fd952682120a7184c758b0ec (diff)
parent06aa0363b01b0f3a100f2081e77a0653c70e2a69 (diff)
downloadqt-creator-c814538d959353da2911e001001a9022b581cd5b.tar.gz
Merge remote-tracking branch 'origin/2.5'
Diffstat (limited to 'src/plugins/projectexplorer')
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp8
-rw-r--r--src/plugins/projectexplorer/projectexplorerconstants.h3
-rw-r--r--src/plugins/projectexplorer/projectfilewizardextension.cpp18
-rw-r--r--src/plugins/projectexplorer/projectfilewizardextension.h2
4 files changed, 24 insertions, 7 deletions
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 9f64737e1e..1611a7356d 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -2577,10 +2577,12 @@ void ProjectExplorerPlugin::addNewFile()
QTC_ASSERT(d->m_currentNode, return)
QString location = directoryFor(d->m_currentNode);
+ QVariantMap map;
+ map.insert(QLatin1String(Constants::PREFERED_PROJECT_NODE), d->m_currentNode->projectNode()->path());
Core::ICore::showNewItemDialog(tr("New File", "Title of dialog"),
Core::IWizard::wizardsOfKind(Core::IWizard::FileWizard)
+ Core::IWizard::wizardsOfKind(Core::IWizard::ClassWizard),
- location);
+ location, map);
}
void ProjectExplorerPlugin::addNewSubproject()
@@ -2591,9 +2593,11 @@ void ProjectExplorerPlugin::addNewSubproject()
if (d->m_currentNode->nodeType() == ProjectNodeType
&& d->m_currentNode->projectNode()->supportedActions(
d->m_currentNode->projectNode()).contains(ProjectNode::AddSubProject)) {
+ QVariantMap map;
+ map.insert(QLatin1String(Constants::PREFERED_PROJECT_NODE), d->m_currentNode->projectNode()->path());
Core::ICore::showNewItemDialog(tr("New Subproject", "Title of dialog"),
Core::IWizard::wizardsOfKind(Core::IWizard::ProjectWizard),
- location);
+ location, map);
}
}
diff --git a/src/plugins/projectexplorer/projectexplorerconstants.h b/src/plugins/projectexplorer/projectexplorerconstants.h
index fa845bfeec..decd9d7350 100644
--- a/src/plugins/projectexplorer/projectexplorerconstants.h
+++ b/src/plugins/projectexplorer/projectexplorerconstants.h
@@ -209,6 +209,9 @@ const char PROJECT_WIZARD_CATEGORY_DISPLAY[] = QT_TRANSLATE_NOOP("ProjectExplore
const char IMPORT_WIZARD_CATEGORY[] = "T.Import";
const char IMPORT_WIZARD_CATEGORY_DISPLAY[] = QT_TRANSLATE_NOOP("ProjectExplorer", "Import Project");
+// Wizard extra values
+const char PREFERED_PROJECT_NODE[] = "ProjectExplorer.PreferedProjectNode";
+
// Build step lists ids:
const char BUILDSTEPS_CLEAN[] = "ProjectExplorer.BuildSteps.Clean";
const char BUILDSTEPS_BUILD[] = "ProjectExplorer.BuildSteps.Build";
diff --git a/src/plugins/projectexplorer/projectfilewizardextension.cpp b/src/plugins/projectexplorer/projectfilewizardextension.cpp
index 828948d44b..2386645d07 100644
--- a/src/plugins/projectexplorer/projectfilewizardextension.cpp
+++ b/src/plugins/projectexplorer/projectfilewizardextension.cpp
@@ -231,15 +231,23 @@ static QList<ProjectEntry> findDeployProject(const QList<ProjectEntry> &projects
// the longest matching path (list containing"/project/subproject1" matching
// common path "/project/subproject1/newuserpath").
static int findMatchingProject(const QList<ProjectEntry> &projects,
- const QString &commonPath)
+ const QString &commonPath,
+ const QString &preferedProjectNode)
{
if (projects.isEmpty() || commonPath.isEmpty())
return -1;
+ const int count = projects.size();
+ if (!preferedProjectNode.isEmpty()) {
+ for (int p = 0; p < count; ++p) {
+ if (projects.at(p).node->path() == preferedProjectNode)
+ return p;
+ }
+ }
+
int bestMatch = -1;
int bestMatchLength = 0;
bool bestMatchIsProFile = false;
- const int count = projects.size();
for (int p = 0; p < count; p++) {
// Direct match or better match? (note that the wizards' files are native).
const ProjectEntry &entry = projects.at(p);
@@ -268,7 +276,8 @@ static QString generatedProjectFilePath(const QList<Core::GeneratedFile> &files)
}
void ProjectFileWizardExtension::firstExtensionPageShown(
- const QList<Core::GeneratedFile> &files)
+ const QList<Core::GeneratedFile> &files,
+ const QVariantMap &extraValues)
{
initProjectChoices(generatedProjectFilePath(files));
@@ -302,7 +311,8 @@ void ProjectFileWizardExtension::firstExtensionPageShown(
m_context->page->setAdditionalInfo(text);
bestProjectIndex = -1;
} else {
- bestProjectIndex = findMatchingProject(m_context->projects, m_context->commonDirectory);
+ bestProjectIndex = findMatchingProject(m_context->projects, m_context->commonDirectory,
+ extraValues.value(QLatin1String(Constants::PREFERED_PROJECT_NODE)).toString());
m_context->page->setNoneLabel(tr("<None>"));
}
diff --git a/src/plugins/projectexplorer/projectfilewizardextension.h b/src/plugins/projectexplorer/projectfilewizardextension.h
index f413c4fd4c..c8e3167595 100644
--- a/src/plugins/projectexplorer/projectfilewizardextension.h
+++ b/src/plugins/projectexplorer/projectfilewizardextension.h
@@ -54,7 +54,7 @@ public:
void applyCodeStyle(Core::GeneratedFile *file) const;
public slots:
- void firstExtensionPageShown(const QList<Core::GeneratedFile> &files);
+ void firstExtensionPageShown(const QList<Core::GeneratedFile> &files, const QVariantMap &extraValues);
void initializeVersionControlChoices();
private: