ProjectWindow: Remove special handling for TargetSettingsPanelWidget

Instead hide it in a standard IProjectPanelFactory

Change-Id: I7e49b7be00e26c5f33e32d692079e2b82cbfe087
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Daniel Teske
2014-07-11 18:13:03 +02:00
parent 137a2d63bb
commit 1e12e53e0d
3 changed files with 19 additions and 16 deletions

View File

@@ -84,6 +84,11 @@ public:
};
}
void setCreateWidgetFunction(std::function<QWidget *(Project *)> function)
{
m_createWidgetFunction = function;
}
static bool supportsAllProjects(Project *);
private:

View File

@@ -83,6 +83,7 @@
#include "devicesupport/desktopdevicefactory.h"
#include "devicesupport/devicemanager.h"
#include "devicesupport/devicesettingspage.h"
#include "targetsettingspanel.h"
#ifdef Q_OS_WIN
# include "windebuginterface.h"
@@ -505,6 +506,19 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
unconfiguredProjectPanel->setSimpleCreateWidgetFunction<TargetSetupPageWrapper>(icon);
addAutoReleasedObject(unconfiguredProjectPanel);
auto targetSettingsPanelFactory = new IProjectPanelFactory;
targetSettingsPanelFactory->setPriority(-10);
displayName = QCoreApplication::translate("TargetSettingsPanelFactory", "Build & Run");
targetSettingsPanelFactory->setDisplayName(displayName);
targetSettingsPanelFactory->setSupportsFunction([](Project *project) {
return !project->targets().isEmpty()
|| project->requiresTargetPanel();
});
targetSettingsPanelFactory->setCreateWidgetFunction([](Project *project) {
return new TargetSettingsPanelWidget(project);
});
addAutoReleasedObject(targetSettingsPanelFactory);
addAutoReleasedObject(new ProcessStepFactory);
addAutoReleasedObject(new AllProjectsFind);

View File

@@ -37,7 +37,6 @@
#include "projectexplorer.h"
#include "session.h"
#include "iprojectproperties.h"
#include "targetsettingspanel.h"
#include "target.h"
#include <coreplugin/idocument.h>
@@ -165,9 +164,6 @@ void ProjectWindow::registerProject(ProjectExplorer::Project *project)
bool projectHasTarget = hasTarget(project);
m_hasTarget.insert(project, projectHasTarget);
if (projectHasTarget || project->requiresTargetPanel()) // Use the Targets page
subtabs << QCoreApplication::translate("TargetSettingsPanelFactory", "Build & Run");
// Add the project specific pages
QList<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::getObjects<IProjectPanelFactory>();
Utils::sort(factories, &IProjectPanelFactory::prioritySort);
@@ -216,18 +212,6 @@ void ProjectWindow::showProperties(int index, int subIndex)
int pos = 0;
IProjectPanelFactory *fac = 0;
if (m_hasTarget.value(project) || project->requiresTargetPanel()) {
if (subIndex == 0) {
// Targets page
removeCurrentWidget();
TargetSettingsPanelWidget *panelWidget = new TargetSettingsPanelWidget(project);
m_currentWidget = panelWidget;
m_centralWidget->addWidget(m_currentWidget);
m_centralWidget->setCurrentWidget(m_currentWidget);
}
++pos;
}
QList<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::getObjects<IProjectPanelFactory>();
Utils::sort(factories, &IProjectPanelFactory::prioritySort);
foreach (IProjectPanelFactory *panelFactory, factories) {