Commit 1e12e53e authored by Daniel Teske's avatar Daniel Teske

ProjectWindow: Remove special handling for TargetSettingsPanelWidget

Instead hide it in a standard IProjectPanelFactory

Change-Id: I7e49b7be00e26c5f33e32d692079e2b82cbfe087
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 137a2d63
......@@ -84,6 +84,11 @@ public:
};
}
void setCreateWidgetFunction(std::function<QWidget *(Project *)> function)
{
m_createWidgetFunction = function;
}
static bool supportsAllProjects(Project *);
private:
......
......@@ -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);
......
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment