diff options
author | Daniel Teske <daniel.teske@nokia.com> | 2011-10-28 10:15:04 +0000 |
---|---|---|
committer | hjk <qthjk@ovi.com> | 2012-02-03 09:36:46 +0100 |
commit | e3d14f7c3982f8007fd885a94ad78b47fc9b0acf (patch) | |
tree | 3081c0e1cd6b43b27d8a8e3cc8c20fde30b55d84 /src/plugins/projectexplorer | |
parent | a309c26f1bb76fc1a55faf109d18289e96a2fffa (diff) |
Make Open Project wizard skippable
Task-Nr: QTCREATORBUG-6063
Change-Id: Ieace3e9e68b4e0342c35ac7c279f4b0b61076419
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
Diffstat (limited to 'src/plugins/projectexplorer')
22 files changed, 193 insertions, 33 deletions
diff --git a/src/plugins/projectexplorer/buildmanager.cpp b/src/plugins/projectexplorer/buildmanager.cpp index a614271f10..d466219939 100644 --- a/src/plugins/projectexplorer/buildmanager.cpp +++ b/src/plugins/projectexplorer/buildmanager.cpp @@ -314,7 +314,7 @@ bool BuildManager::tasksAvailable() const return count > 0; } -void BuildManager::startBuildQueue() +void BuildManager::startBuildQueue(const QStringList &preambleMessage) { if (d->m_buildQueue.isEmpty()) { emit buildQueueFinished(true); @@ -326,6 +326,8 @@ void BuildManager::startBuildQueue() d->m_progressFutureInterface = new QFutureInterface<void>; d->m_progressWatcher.setFuture(d->m_progressFutureInterface->future()); d->m_outputWindow->clearContents(); + foreach (const QString &str, preambleMessage) + addToOutputWindow(str, BuildStep::MessageOutput, BuildStep::DontAppendNewline); d->m_taskHub->clearTasks(Core::Id(Constants::TASK_CATEGORY_COMPILE)); d->m_taskHub->clearTasks(Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)); progressManager->setApplicationLabel(QString()); @@ -537,7 +539,7 @@ bool BuildManager::buildList(BuildStepList *bsl, const QString &stepListName) return buildLists(QList<BuildStepList *>() << bsl, QStringList() << stepListName); } -bool BuildManager::buildLists(QList<BuildStepList *> bsls, const QStringList &stepListNames) +bool BuildManager::buildLists(QList<BuildStepList *> bsls, const QStringList &stepListNames, const QStringList &preambelMessage) { QList<BuildStep *> steps; foreach(BuildStepList *list, bsls) @@ -559,7 +561,7 @@ bool BuildManager::buildLists(QList<BuildStepList *> bsls, const QStringList &st if (ProjectExplorerPlugin::instance()->projectExplorerSettings().showCompilerOutput) d->m_outputWindow->popup(false); - startBuildQueue(); + startBuildQueue(preambelMessage); return true; } diff --git a/src/plugins/projectexplorer/buildmanager.h b/src/plugins/projectexplorer/buildmanager.h index f4c98450d5..572609ef13 100644 --- a/src/plugins/projectexplorer/buildmanager.h +++ b/src/plugins/projectexplorer/buildmanager.h @@ -60,7 +60,8 @@ public: bool tasksAvailable() const; - bool buildLists(QList<BuildStepList *> bsls, const QStringList &stepListNames); + bool buildLists(QList<BuildStepList *> bsls, const QStringList &stepListNames, + const QStringList &preambelMessage = QStringList()); bool buildList(BuildStepList *bsl, const QString &stepListName); bool isBuilding(Project *p); @@ -103,7 +104,7 @@ private slots: void finish(); private: - void startBuildQueue(); + void startBuildQueue(const QStringList &preambleMessage = QStringList()); void nextStep(); void clearBuildQueue(); bool buildQueueAppend(QList<BuildStep *> steps, QStringList names); diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp index c9ad2820fd..7b609fcfaa 100644 --- a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp @@ -73,6 +73,11 @@ QString BuildSettingsPanelFactory::displayName() const return QCoreApplication::translate("BuildSettingsPanelFactory", "Build Settings"); } +int BuildSettingsPanelFactory::priority() const +{ + return 10; +} + bool BuildSettingsPanelFactory::supports(Target *target) { return target->buildConfigurationFactory(); diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.h b/src/plugins/projectexplorer/buildsettingspropertiespage.h index 7532b113a2..5899bae2cf 100644 --- a/src/plugins/projectexplorer/buildsettingspropertiespage.h +++ b/src/plugins/projectexplorer/buildsettingspropertiespage.h @@ -60,6 +60,7 @@ class BuildSettingsPanelFactory : public ITargetPanelFactory public: QString id() const; QString displayName() const; + int priority() const; bool supports(Target *target); PropertiesPanel *createPanel(Target *target); diff --git a/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp b/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp index 2162d1fe9e..7d2d5f5e2c 100644 --- a/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp @@ -53,6 +53,11 @@ QString CodeStyleSettingsPanelFactory::displayName() const return QCoreApplication::translate("CodeStyleSettingsPanelFactory", "Code Style Settings"); } +int CodeStyleSettingsPanelFactory::priority() const +{ + return 40; +} + bool CodeStyleSettingsPanelFactory::supports(Project *project) { Q_UNUSED(project); diff --git a/src/plugins/projectexplorer/codestylesettingspropertiespage.h b/src/plugins/projectexplorer/codestylesettingspropertiespage.h index a14e11c719..a032db042e 100644 --- a/src/plugins/projectexplorer/codestylesettingspropertiespage.h +++ b/src/plugins/projectexplorer/codestylesettingspropertiespage.h @@ -49,6 +49,7 @@ class CodeStyleSettingsPanelFactory : public IProjectPanelFactory public: QString id() const; QString displayName() const; + int priority() const; PropertiesPanel *createPanel(Project *project); bool supports(Project *project); }; diff --git a/src/plugins/projectexplorer/dependenciespanel.cpp b/src/plugins/projectexplorer/dependenciespanel.cpp index 40a251ed91..754b5a0858 100644 --- a/src/plugins/projectexplorer/dependenciespanel.cpp +++ b/src/plugins/projectexplorer/dependenciespanel.cpp @@ -275,6 +275,11 @@ QString DependenciesPanelFactory::displayName() const return QCoreApplication::translate("DependenciesPanelFactory", "Dependencies"); } +int DependenciesPanelFactory::priority() const +{ + return 50; +} + bool DependenciesPanelFactory::supports(Project *project) { Q_UNUSED(project); diff --git a/src/plugins/projectexplorer/dependenciespanel.h b/src/plugins/projectexplorer/dependenciespanel.h index a000e570e9..3cccd98d13 100644 --- a/src/plugins/projectexplorer/dependenciespanel.h +++ b/src/plugins/projectexplorer/dependenciespanel.h @@ -61,6 +61,7 @@ public: QString id() const; QString displayName() const; + int priority() const; bool supports(Project *project); PropertiesPanel *createPanel(Project *project); private: diff --git a/src/plugins/projectexplorer/editorsettingspropertiespage.cpp b/src/plugins/projectexplorer/editorsettingspropertiespage.cpp index e048cb2b01..ec5f9e2e2d 100644 --- a/src/plugins/projectexplorer/editorsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/editorsettingspropertiespage.cpp @@ -49,6 +49,11 @@ QString EditorSettingsPanelFactory::displayName() const return QCoreApplication::translate("EditorSettingsPanelFactory", "Editor Settings"); } +int EditorSettingsPanelFactory::priority() const +{ + return 30; +} + bool EditorSettingsPanelFactory::supports(Project *project) { Q_UNUSED(project); diff --git a/src/plugins/projectexplorer/editorsettingspropertiespage.h b/src/plugins/projectexplorer/editorsettingspropertiespage.h index cf3d626f52..fedd6f521e 100644 --- a/src/plugins/projectexplorer/editorsettingspropertiespage.h +++ b/src/plugins/projectexplorer/editorsettingspropertiespage.h @@ -49,6 +49,7 @@ class EditorSettingsPanelFactory : public IProjectPanelFactory public: QString id() const; QString displayName() const; + int priority() const; PropertiesPanel *createPanel(Project *project); bool supports(Project *project); }; diff --git a/src/plugins/projectexplorer/images/unconfigured.png b/src/plugins/projectexplorer/images/unconfigured.png Binary files differnew file mode 100644 index 0000000000..7966af8d21 --- /dev/null +++ b/src/plugins/projectexplorer/images/unconfigured.png diff --git a/src/plugins/projectexplorer/iprojectproperties.h b/src/plugins/projectexplorer/iprojectproperties.h index 3be8d4bf10..d78f630551 100644 --- a/src/plugins/projectexplorer/iprojectproperties.h +++ b/src/plugins/projectexplorer/iprojectproperties.h @@ -75,6 +75,10 @@ class PROJECTEXPLORER_EXPORT IPanelFactory : public QObject public: virtual QString id() const = 0; virtual QString displayName() const = 0; + virtual int priority() const = 0; + static bool prioritySort(IPanelFactory *a, IPanelFactory *b) + { return (a->priority() == b->priority() && a->id() < b->id()) + || a->priority() < b->priority(); } }; class PROJECTEXPLORER_EXPORT IProjectPanelFactory : public IPanelFactory @@ -83,6 +87,8 @@ class PROJECTEXPLORER_EXPORT IProjectPanelFactory : public IPanelFactory public: virtual bool supports(Project *project) = 0; virtual PropertiesPanel *createPanel(Project *project) = 0; +signals: + void projectUpdated(ProjectExplorer::Project *project); }; class PROJECTEXPLORER_EXPORT ITargetPanelFactory : public IPanelFactory diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.cpp b/src/plugins/projectexplorer/miniprojecttargetselector.cpp index f4ce6dea35..8608c5b780 100644 --- a/src/plugins/projectexplorer/miniprojecttargetselector.cpp +++ b/src/plugins/projectexplorer/miniprojecttargetselector.cpp @@ -40,6 +40,7 @@ #include <coreplugin/ifile.h> #include <coreplugin/icore.h> #include <coreplugin/coreconstants.h> +#include <coreplugin/modemanager.h> #include <projectexplorer/projectexplorer.h> #include <projectexplorer/session.h> @@ -487,6 +488,8 @@ MiniProjectTargetSelector::MiniProjectTargetSelector(QAction *targetSelectorActi m_summaryLabel->setMargin(3); m_summaryLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop); m_summaryLabel->setStyleSheet(QString::fromLatin1("background: #464646;")); + m_summaryLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + m_summaryLabel->setTextInteractionFlags(m_summaryLabel->textInteractionFlags() | Qt::LinksAccessibleByMouse); grid->addWidget(m_summaryLabel, 0, 0, 1, 2 * LAST - 1); @@ -519,6 +522,9 @@ MiniProjectTargetSelector::MiniProjectTargetSelector(QAction *targetSelectorActi if (m_sessionManager->startupProject()) activeTargetChanged(m_sessionManager->startupProject()->activeTarget()); + connect(m_summaryLabel, SIGNAL(linkActivated(QString)), + this, SLOT(switchToProjectsMode())); + connect(m_sessionManager, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)), this, SLOT(changeStartupProject(ProjectExplorer::Project*))); @@ -994,6 +1000,7 @@ QSize MiniProjectTargetSelector::sizeHint() const static QWidget *actionBar = Core::ICore::mainWindow()->findChild<QWidget*>(QLatin1String("actionbar")); Q_ASSERT(actionBar); + // At least the size of the actionbar int alignedWithActionHeight = actionBar->height() - statusBar->height(); QSize s = QWidget::sizeHint(); @@ -1057,23 +1064,55 @@ void MiniProjectTargetSelector::updateActionAndSummary() } } m_projectAction->setProperty("heading", projectName); - m_projectAction->setProperty("subtitle", buildConfig); + if (project && project->needsConfiguration()) { + m_projectAction->setProperty("subtitle", tr("Unconfigured")); + } else { + m_projectAction->setProperty("subtitle", buildConfig); + } m_projectAction->setIcon(targetIcon); - QString targetTip = targetName.isEmpty() ? QLatin1String("") - : tr("<b>Target:</b> %1<br/>").arg(targetName); - QString buildTip = buildConfig.isEmpty() ? QLatin1String("") - : tr("<b>Build:</b> %1<br/>").arg(buildConfig); - QString deployTip = deployConfig.isEmpty() ? QLatin1String("") - : tr("<b>Deploy:</b> %1<br/>").arg(deployConfig); - QString targetToolTip = targetToolTipText.isEmpty() ? QLatin1String("") - : tr("<br/>%1").arg(targetToolTipText); - QString toolTip = tr("<html><nobr><b>Project:</b> %1<br/>%2%3%4<b>Run:</b> %5%6</html>"); - m_projectAction->setToolTip(toolTip.arg(projectName, targetTip, buildTip, deployTip, runConfig, targetToolTip)); + QStringList lines; + lines << tr("<b>Project:</b> %1").arg(projectName); + if (!targetName.isEmpty()) + lines << tr("<b>Target:</b> %1").arg(targetName); + if (!buildConfig.isEmpty()) + lines << tr("<b>Build:</b> %1").arg(buildConfig); + if (!deployConfig.isEmpty()) + lines << tr("<b>Deploy:</b> %1").arg(deployConfig); + if (!runConfig.isEmpty()) + lines << tr("<b>Run:</b> %1").arg(runConfig); + if (!targetToolTipText.isEmpty()) + lines << tr("%1").arg(targetToolTipText); + QString toolTip = tr("<html><nobr>%1</html>") + .arg(lines.join(QLatin1String("<br/>"))); + m_projectAction->setToolTip(toolTip); updateSummary(); } void MiniProjectTargetSelector::updateSummary() { + // Count the number of lines + int visibleLineCount = m_projectListWidget->isVisibleTo(this) ? 0 : 1; + for (int i = TARGET; i < LAST; ++i) + visibleLineCount += m_listWidgets[i]->isVisibleTo(this) ? 0 : 1; + + if (visibleLineCount == LAST) { + m_summaryLabel->setMinimumHeight(0); + m_summaryLabel->setMaximumHeight(800); + } else { + if (visibleLineCount < 3) { + foreach (Project *p, m_sessionManager->projects()) { + if (p->needsConfiguration()) { + visibleLineCount = 3; + break; + } + } + } + + int height = visibleLineCount * QFontMetrics(m_summaryLabel->font()).height() + m_summaryLabel->margin() *2; + m_summaryLabel->setMinimumHeight(height); + m_summaryLabel->setMaximumHeight(height); + } + QString summary; if (Project *startupProject = m_sessionManager->startupProject()) { if (!m_projectListWidget->isVisibleTo(this)) @@ -1090,10 +1129,24 @@ void MiniProjectTargetSelector::updateSummary() if (!m_listWidgets[RUN]->isVisibleTo(this) && activeTarget->activeRunConfiguration()) summary.append(tr("Run: <b>%1</b><br/>").arg( activeTarget->activeRunConfiguration()->displayName())); + } else if (startupProject->needsConfiguration()) { + summary = tr("<style type=text/css>" + "a:link {color: rgb(128, 128, 255, 240);}</style>" + "The project <b>%1</b> is not yet configured<br/><br/>" + "You can configure it in the <a href=\"projectmode\">Projects mode</a><br/>") + .arg(startupProject->displayName()); + } else { + if (!m_listWidgets[TARGET]->isVisibleTo(this)) + summary.append("<br/>"); + if (!m_listWidgets[BUILD]->isVisibleTo(this)) + summary.append("<br/>"); + if (!m_listWidgets[DEPLOY]->isVisibleTo(this)) + summary.append("<br/>"); + if (!m_listWidgets[RUN]->isVisibleTo(this)) + summary.append("<br/>"); } } m_summaryLabel->setText(summary); - } void MiniProjectTargetSelector::paintEvent(QPaintEvent *) @@ -1107,3 +1160,9 @@ void MiniProjectTargetSelector::paintEvent(QPaintEvent *) static QImage image(QLatin1String(":/projectexplorer/images/targetpanel_bottom.png")); Utils::StyleHelper::drawCornerImage(image, &painter, bottomRect, 1, 1, 1, 1); } + +void MiniProjectTargetSelector::switchToProjectsMode() +{ + Core::ICore::instance()->modeManager()->activateMode(Constants::MODE_SESSION); + hide(); +} diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.h b/src/plugins/projectexplorer/miniprojecttargetselector.h index 8965287447..b370ed4abe 100644 --- a/src/plugins/projectexplorer/miniprojecttargetselector.h +++ b/src/plugins/projectexplorer/miniprojecttargetselector.h @@ -54,7 +54,6 @@ class SessionManager; namespace Internal { // helper classes - class ListWidget : public QListWidget { Q_OBJECT @@ -144,6 +143,7 @@ private slots: void delayedHide(); void updateActionAndSummary(); + void switchToProjectsMode(); private: void updateProjectListVisible(); void updateTargetListVisible(); diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index d0fda764ac..ce9dfbef9f 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -383,4 +383,9 @@ void Project::setNamedSettings(const QString &name, QVariant &value) d->m_pluginSettings.insert(name, value); } +bool Project::needsConfiguration() const +{ + return false; +} + } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/project.h b/src/plugins/projectexplorer/project.h index d31d106956..7e5b977b54 100644 --- a/src/plugins/projectexplorer/project.h +++ b/src/plugins/projectexplorer/project.h @@ -117,6 +117,8 @@ public: QVariant namedSettings(const QString &name) const; void setNamedSettings(const QString &name, QVariant &value); + virtual bool needsConfiguration() const; + signals: void fileListChanged(); diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 474834bb46..2262a5289b 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1340,8 +1340,21 @@ QList<Project *> ProjectExplorerPlugin::openProjects(const QStringList &fileName } updateActions(); - if (!openedPro.isEmpty()) - Core::ModeManager::activateMode(QLatin1String(Core::Constants::MODE_EDIT)); + bool switchToProjectsMode = false; + foreach (Project *p, openedPro) { + if (p->needsConfiguration()) { + switchToProjectsMode = true; + break; + } + } + + if (!openedPro.isEmpty()) { + if (switchToProjectsMode) + Core::ModeManager::activateMode(QLatin1String(ProjectExplorer::Constants::MODE_SESSION)); + else + Core::ModeManager::activateMode(QLatin1String(Core::Constants::MODE_EDIT)); + Core::ModeManager::setFocusToCurrentMode(); + } return openedPro; } @@ -1812,6 +1825,12 @@ int ProjectExplorerPlugin::queue(QList<Project *> projects, QStringList stepIds) QList<BuildStepList *> stepLists; QStringList names; + QStringList preambleMessage; + + foreach (Project *pro, projects) + if (pro && pro->needsConfiguration()) + preambleMessage.append(tr("The project %1 is not configured, skipping it.\n") + .arg(pro->displayName())); foreach (const QString id, stepIds) { foreach (Project *pro, projects) { if (!pro || !pro->activeTarget()) @@ -1833,7 +1852,7 @@ int ProjectExplorerPlugin::queue(QList<Project *> projects, QStringList stepIds) if (stepLists.isEmpty()) return 0; - if (!d->m_buildManager->buildLists(stepLists, names)) + if (!d->m_buildManager->buildLists(stepLists, names, preambleMessage)) return -1; return stepLists.count(); } @@ -1982,6 +2001,9 @@ QPair<bool, QString> ProjectExplorerPlugin::buildSettingsEnabled(Project *pro) } else if (d->m_buildManager->isBuilding(pro)) { result.first = false; result.second = tr("Currently building the active project."); + } else if (pro->needsConfiguration()) { + result.first = false; + result.second = tr("The project %1 is not configured.").arg(pro->displayName()); } else if (!hasBuildSettings(pro)) { result.first = false; result.second = tr("Project has no build settings."); @@ -2055,8 +2077,9 @@ bool ProjectExplorerPlugin::hasDeploySettings(Project *pro) { const QList<Project *> & projects = d->m_session->projectOrder(pro); foreach(Project *project, projects) - if (project->activeTarget()->activeDeployConfiguration() && - !project->activeTarget()->activeDeployConfiguration()->stepList()->isEmpty()) + if (project->activeTarget() + && project->activeTarget()->activeDeployConfiguration() + && !project->activeTarget()->activeDeployConfiguration()->stepList()->isEmpty()) return true; return false; } @@ -2066,7 +2089,9 @@ void ProjectExplorerPlugin::runProject(Project *pro, RunMode mode, const bool fo if (!pro) return; - runRunConfiguration(pro->activeTarget()->activeRunConfiguration(), mode, forceSkipDeploy); + if (Target *target = pro->activeTarget()) + if (RunConfiguration *rc = target->activeRunConfiguration()) + runRunConfiguration(rc, mode, forceSkipDeploy); } void ProjectExplorerPlugin::runRunConfiguration(ProjectExplorer::RunConfiguration *rc, @@ -2285,6 +2310,9 @@ QString ProjectExplorerPlugin::cannotRunReason(Project *project, RunMode runMode if (!project) return tr("No active project."); + if (project->needsConfiguration()) + return tr("The project %1 is not configured.").arg(project->displayName()); + if (!project->activeTarget()) return tr("The project '%1' has no active target.").arg(project->displayName()); diff --git a/src/plugins/projectexplorer/projectexplorer.qrc b/src/plugins/projectexplorer/projectexplorer.qrc index a4b8daf4f7..8ece0bc962 100644 --- a/src/plugins/projectexplorer/projectexplorer.qrc +++ b/src/plugins/projectexplorer/projectexplorer.qrc @@ -41,5 +41,6 @@ <file>images/window.png</file> <file>images/stop_small.png</file> <file>images/disabledbuildstep.png</file> + <file>images/unconfigured.png</file> </qresource> </RCC> diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp index 5e904e8691..4192180396 100644 --- a/src/plugins/projectexplorer/projectwindow.cpp +++ b/src/plugins/projectexplorer/projectwindow.cpp @@ -142,6 +142,7 @@ PanelsWidget::PanelsWidget(QWidget *parent) : setWidget(m_root); setFrameStyle(QFrame::NoFrame); setWidgetResizable(true); + setFocusPolicy(Qt::NoFocus); } PanelsWidget::~PanelsWidget() @@ -263,6 +264,12 @@ void ProjectWindow::extensionsInitialized() connect(fac, SIGNAL(supportedTargetIdsChanged()), this, SLOT(targetFactoriesChanged())); + QList<IProjectPanelFactory *> list = ExtensionSystem::PluginManager::instance()->getObjects<IProjectPanelFactory>(); + qSort(list.begin(), list.end(), &IPanelFactory::prioritySort); + foreach (IProjectPanelFactory *fac, list) + connect (fac, SIGNAL(projectUpdated(ProjectExplorer::Project *)), + this, SLOT(projectUpdated(ProjectExplorer::Project *))); + } void ProjectWindow::aboutToShutdown() @@ -272,6 +279,15 @@ void ProjectWindow::aboutToShutdown() disconnect(ProjectExplorerPlugin::instance()->session(), 0, this, 0); } +void ProjectWindow::projectUpdated(Project *p) +{ + // Called after a project was configured + int index = m_tabWidget->currentIndex(); + deregisterProject(p); + registerProject(p); + m_tabWidget->setCurrentIndex(index); +} + void ProjectWindow::targetFactoriesChanged() { bool changed = false; @@ -290,6 +306,8 @@ void ProjectWindow::targetFactoriesChanged() bool ProjectWindow::useTargetPage(ProjectExplorer::Project *project) { + if (project->targets().isEmpty()) + return false; if (project->targets().size() > 1) return true; QStringList tmp; @@ -323,12 +341,15 @@ void ProjectWindow::registerProject(ProjectExplorer::Project *project) if (!usesTargetPage){ // Show the target specific pages directly - QList<ITargetPanelFactory *> factories = - ExtensionSystem::PluginManager::instance()->getObjects<ITargetPanelFactory>(); + if (project->activeTarget()) { + QList<ITargetPanelFactory *> factories = + ExtensionSystem::PluginManager::instance()->getObjects<ITargetPanelFactory>(); + + qSort(factories.begin(), factories.end(), &IPanelFactory::prioritySort); - foreach (ITargetPanelFactory *factory, factories) { - if (factory->supports(project->activeTarget())) - subtabs << factory->displayName(); + foreach (ITargetPanelFactory *factory, factories) + if (factory->supports(project->activeTarget())) + subtabs << factory->displayName(); } } else { // Use the Targets page @@ -336,8 +357,8 @@ void ProjectWindow::registerProject(ProjectExplorer::Project *project) } // Add the project specific pages - QList<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<IProjectPanelFactory>(); + qSort(factories.begin(), factories.end(), &IPanelFactory::prioritySort); foreach (IProjectPanelFactory *panelFactory, factories) { if (panelFactory->supports(project)) subtabs << panelFactory->displayName(); @@ -404,9 +425,11 @@ void ProjectWindow::showProperties(int index, int subIndex) m_centralWidget->setCurrentWidget(m_currentWidget); } ++pos; - } else { + } else if (project->activeTarget()) { // No Targets page, target specific pages are first in the list - foreach (ITargetPanelFactory *panelFactory, ExtensionSystem::PluginManager::instance()->getObjects<ITargetPanelFactory>()) { + QList<ITargetPanelFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<ITargetPanelFactory>(); + qSort(factories.begin(), factories.end(), &ITargetPanelFactory::prioritySort); + foreach (ITargetPanelFactory *panelFactory, factories) { if (panelFactory->supports(project->activeTarget())) { if (subIndex == pos) { fac = panelFactory; @@ -418,7 +441,9 @@ void ProjectWindow::showProperties(int index, int subIndex) } if (!fac) { - foreach (IProjectPanelFactory *panelFactory, ExtensionSystem::PluginManager::instance()->getObjects<IProjectPanelFactory>()) { + QList<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<IProjectPanelFactory>(); + qSort(factories.begin(), factories.end(), &IPanelFactory::prioritySort); + foreach (IProjectPanelFactory *panelFactory, factories) { if (panelFactory->supports(project)) { if (subIndex == pos) { fac = panelFactory; diff --git a/src/plugins/projectexplorer/projectwindow.h b/src/plugins/projectexplorer/projectwindow.h index 41a09d37dd..1cf711e87e 100644 --- a/src/plugins/projectexplorer/projectwindow.h +++ b/src/plugins/projectexplorer/projectwindow.h @@ -90,6 +90,7 @@ private slots: void registerProject(ProjectExplorer::Project*); void deregisterProject(ProjectExplorer::Project*); void startupProjectChanged(ProjectExplorer::Project *); + void projectUpdated(ProjectExplorer::Project *p); private: bool useTargetPage(ProjectExplorer::Project *project); diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.cpp b/src/plugins/projectexplorer/runsettingspropertiespage.cpp index a40521b160..de5ae10b7e 100644 --- a/src/plugins/projectexplorer/runsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/runsettingspropertiespage.cpp @@ -94,6 +94,11 @@ QString RunSettingsPanelFactory::displayName() const return RunSettingsWidget::tr("Run Settings"); } +int RunSettingsPanelFactory::priority() const +{ + return 20; +} + bool RunSettingsPanelFactory::supports(Target *target) { Q_UNUSED(target); diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.h b/src/plugins/projectexplorer/runsettingspropertiespage.h index 1d79feef4e..aa897947d0 100644 --- a/src/plugins/projectexplorer/runsettingspropertiespage.h +++ b/src/plugins/projectexplorer/runsettingspropertiespage.h @@ -67,6 +67,7 @@ class RunSettingsPanelFactory : public ITargetPanelFactory public: QString id() const; QString displayName() const; + int priority() const; bool supports(Target *target); PropertiesPanel *createPanel(Target *target); }; |