summaryrefslogtreecommitdiff
path: root/src/plugins/projectexplorer
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@nokia.com>2012-08-07 10:05:19 +0200
committerEike Ziller <eike.ziller@nokia.com>2012-08-07 15:29:36 +0200
commit7c7477eedc3ab3ade50fd05cd1260cb3c5b8bbca (patch)
tree2ba82acb6c39bc93870c06da1a458f4a06ee0dcb /src/plugins/projectexplorer
parent350868528579c32b193a4f5a7c5d3ad1bd2226ba (diff)
downloadqt-creator-7c7477eedc3ab3ade50fd05cd1260cb3c5b8bbca.tar.gz
Show target page (in project mode) even if project only has one target.
The distinction doesn't really make sense anymore. This is also a prerequisite for 1. adding a "manage" button for managing targets to the target page, and 2. using the "add" button to import builds even for "configured" projects Change-Id: Ib8287dc7d11efa84c54933a591ef15a76042318f Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
Diffstat (limited to 'src/plugins/projectexplorer')
-rw-r--r--src/plugins/projectexplorer/projectwindow.cpp71
-rw-r--r--src/plugins/projectexplorer/projectwindow.h4
2 files changed, 17 insertions, 58 deletions
diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp
index f1cadcbc51..8e84ccc54c 100644
--- a/src/plugins/projectexplorer/projectwindow.cpp
+++ b/src/plugins/projectexplorer/projectwindow.cpp
@@ -294,7 +294,7 @@ void ProjectWindow::handleProfilesChanges()
int index = m_tabWidget->currentIndex();
QList<Project *> projects = m_tabIndexToProject;
foreach (ProjectExplorer::Project *project, projects) {
- if (m_usesTargetPage.value(project) != useTargetPage(project)) {
+ if (m_hasTarget.value(project) != hasTarget(project)) {
changed = true;
deregisterProject(project);
registerProject(project);
@@ -304,21 +304,9 @@ void ProjectWindow::handleProfilesChanges()
m_tabWidget->setCurrentIndex(index);
}
-bool ProjectWindow::useTargetPage(ProjectExplorer::Project *project)
+bool ProjectWindow::hasTarget(ProjectExplorer::Project *project)
{
- if (project->targets().isEmpty())
- return false;
- if (project->targets().size() > 1)
- return true;
- int count = 0;
- QList<Profile *> profiles = ProfileManager::instance()->profiles();
- foreach (Profile *p, profiles) {
- if (project->supportsProfile(p))
- ++count;
- if (count > 1)
- return true;
- }
- return false;
+ return !project->targets().isEmpty();
}
void ProjectWindow::registerProject(ProjectExplorer::Project *project)
@@ -338,25 +326,11 @@ void ProjectWindow::registerProject(ProjectExplorer::Project *project)
QStringList subtabs;
- bool usesTargetPage = useTargetPage(project);
- m_usesTargetPage.insert(project, usesTargetPage);
-
- if (!usesTargetPage){
- // Show the target specific pages directly
- if (project->activeTarget()) {
- QList<ITargetPanelFactory *> factories =
- ExtensionSystem::PluginManager::getObjects<ITargetPanelFactory>();
-
- qSort(factories.begin(), factories.end(), &IPanelFactory::prioritySort);
+ bool projectHasTarget = hasTarget(project);
+ m_hasTarget.insert(project, projectHasTarget);
- foreach (ITargetPanelFactory *factory, factories)
- if (factory->supports(project->activeTarget()))
- subtabs << factory->displayName();
- }
- } else {
- // Use the Targets page
+ if (projectHasTarget) // Use the Targets page
subtabs << QCoreApplication::translate("TargetSettingsPanelFactory", "Targets");
- }
// Add the project specific pages
QList<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::getObjects<IProjectPanelFactory>();
@@ -410,7 +384,7 @@ void ProjectWindow::showProperties(int index, int subIndex)
m_previousTargetSubIndex = previousPanelWidget->currentSubIndex();
}
- if (m_usesTargetPage.value(project)) {
+ if (m_hasTarget.value(project)) {
if (subIndex == 0) {
// Targets page
removeCurrentWidget();
@@ -422,32 +396,17 @@ void ProjectWindow::showProperties(int index, int subIndex)
m_centralWidget->setCurrentWidget(m_currentWidget);
}
++pos;
- } else if (project->activeTarget()) {
- // No Targets page, target specific pages are first in the list
- QList<ITargetPanelFactory *> factories = ExtensionSystem::PluginManager::getObjects<ITargetPanelFactory>();
- qSort(factories.begin(), factories.end(), &ITargetPanelFactory::prioritySort);
- foreach (ITargetPanelFactory *panelFactory, factories) {
- if (panelFactory->supports(project->activeTarget())) {
- if (subIndex == pos) {
- fac = panelFactory;
- break;
- }
- ++pos;
- }
- }
}
- if (!fac) {
- QList<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::getObjects<IProjectPanelFactory>();
- qSort(factories.begin(), factories.end(), &IPanelFactory::prioritySort);
- foreach (IProjectPanelFactory *panelFactory, factories) {
- if (panelFactory->supports(project)) {
- if (subIndex == pos) {
- fac = panelFactory;
- break;
- }
- ++pos;
+ QList<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::getObjects<IProjectPanelFactory>();
+ qSort(factories.begin(), factories.end(), &IPanelFactory::prioritySort);
+ foreach (IProjectPanelFactory *panelFactory, factories) {
+ if (panelFactory->supports(project)) {
+ if (subIndex == pos) {
+ fac = panelFactory;
+ break;
}
+ ++pos;
}
}
diff --git a/src/plugins/projectexplorer/projectwindow.h b/src/plugins/projectexplorer/projectwindow.h
index 2028f597c3..6fa3d5d19b 100644
--- a/src/plugins/projectexplorer/projectwindow.h
+++ b/src/plugins/projectexplorer/projectwindow.h
@@ -93,14 +93,14 @@ private slots:
void removedTarget(ProjectExplorer::Target*);
private:
- bool useTargetPage(ProjectExplorer::Project *project);
+ bool hasTarget(ProjectExplorer::Project *project);
void removeCurrentWidget();
DoubleTabWidget *m_tabWidget;
QStackedWidget *m_centralWidget;
QWidget *m_currentWidget;
QList<ProjectExplorer::Project *> m_tabIndexToProject;
- QMap<ProjectExplorer::Project *, bool> m_usesTargetPage;
+ QMap<ProjectExplorer::Project *, bool> m_hasTarget;
int m_previousTargetSubIndex;
};