Commit 66757653 authored by Daniel Teske's avatar Daniel Teske

ProjectExplorer: Remove ITargetPanelFactory

The indirection via a factory is no longer useful, since the
targetsettingspanel is hardcoded for a build and run panel.

Change-Id: I75543f777a4a7df4cadf12667652424056829689
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 1e12e53e
......@@ -41,7 +41,6 @@
#include <projectexplorer/project.h>
#include <projectexplorer/projectwindow.h>
#include <projectexplorer/iprojectproperties.h>
#include <projectexplorer/session.h>
#include <projectexplorer/target.h>
#include <projectexplorer/projectexplorer.h>
......
......@@ -32,8 +32,6 @@
#include "ui_clangprojectsettingspropertiespage.h"
#include <projectexplorer/iprojectproperties.h>
#include <QString>
namespace ClangCodeModel {
......
......@@ -53,35 +53,6 @@
using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
///
// BuildSettingsPanelFactory
///
QString BuildSettingsPanelFactory::id() const
{
return QLatin1String(BUILDSETTINGS_PANEL_ID);
}
bool BuildSettingsPanelFactory::supports(Target *target)
{
return IBuildConfigurationFactory::find(target);
}
PropertiesPanel *BuildSettingsPanelFactory::createPanel(Target *target)
{
PropertiesPanel *panel = new PropertiesPanel;
QWidget *w = new QWidget();
QVBoxLayout *l = new QVBoxLayout(w);
QWidget *b = new BuildSettingsWidget(target);
l->addWidget(b);
l->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
l->setContentsMargins(QMargins());
panel->setWidget(w);
panel->setIcon(QIcon(QLatin1String(":/projectexplorer/images/BuildSettings.png")));
panel->setDisplayName(QCoreApplication::translate("BuildSettingsPanel", "Build Settings"));
return panel;
}
///
// BuildSettingsWidget
///
......
......@@ -30,8 +30,6 @@
#ifndef BUILDSETTINGSPROPERTIESPAGE_H
#define BUILDSETTINGSPROPERTIESPAGE_H
#include "iprojectproperties.h"
#include <QWidget>
QT_BEGIN_NAMESPACE
......@@ -45,24 +43,11 @@ namespace ProjectExplorer {
class BuildConfiguration;
class BuildInfo;
class IBuildStepFactory;
class NamedWidget;
class Target;
namespace Internal {
const char BUILDSETTINGS_PANEL_ID[] = "ProjectExplorer.BuildSettingsPanel";
class BuildSettingsPanelFactory : public ITargetPanelFactory
{
public:
QString id() const;
bool supports(Target *target);
PropertiesPanel *createPanel(Target *target);
};
class BuildConfigurationsWidget;
class BuildSettingsWidget : public QWidget
{
Q_OBJECT
......
......@@ -30,12 +30,11 @@
#ifndef CODESTYLESETTINGSPROPERTIESPAGE_H
#define CODESTYLESETTINGSPROPERTIESPAGE_H
#include "iprojectproperties.h"
#include "ui_codestylesettingspropertiespage.h"
namespace ProjectExplorer {
class EditorConfiguration;
class Project;
namespace Internal {
......
......@@ -30,8 +30,6 @@
#ifndef DEPENDENCIESPANEL_H
#define DEPENDENCIESPANEL_H
#include "iprojectproperties.h"
#include <QAbstractListModel>
#include <QTreeView>
......
......@@ -30,12 +30,11 @@
#ifndef EDITORSETTINGSPROPERTIESPAGE_H
#define EDITORSETTINGSPROPERTIESPAGE_H
#include "iprojectproperties.h"
#include "ui_editorsettingspropertiespage.h"
namespace ProjectExplorer {
class EditorConfiguration;
class Project;
namespace Internal {
......
......@@ -27,7 +27,7 @@
**
****************************************************************************/
#include "iprojectproperties.h"
#include "iprojectpanelfactory.h"
using namespace ProjectExplorer;
......
......@@ -98,16 +98,6 @@ private:
std::function<QWidget *(Project *)> m_createWidgetFunction;
};
class PROJECTEXPLORER_EXPORT ITargetPanelFactory : public QObject
{
Q_OBJECT
public:
virtual bool supports(Target *target) = 0;
virtual PropertiesPanel *createPanel(Target *target) = 0;
virtual QString id() const = 0;
};
} // namespace ProjectExplorer
#endif // IPROJECTPROPERTIES_H
......@@ -84,6 +84,7 @@
#include "devicesupport/devicemanager.h"
#include "devicesupport/devicesettingspage.h"
#include "targetsettingspanel.h"
#include "iprojectpanelfactory.h"
#ifdef Q_OS_WIN
# include "windebuginterface.h"
......@@ -468,9 +469,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
addAutoReleasedObject(new AllProjectsFilter);
addAutoReleasedObject(new CurrentProjectFilter);
addAutoReleasedObject(new BuildSettingsPanelFactory);
addAutoReleasedObject(new RunSettingsPanelFactory);
// ProjectPanelFactories
auto editorSettingsPanelFactory = new IProjectPanelFactory;
editorSettingsPanelFactory->setPriority(30);
......
......@@ -64,7 +64,6 @@ HEADERS += projectexplorer.h \
allprojectsfind.h \
buildstep.h \
buildconfiguration.h \
iprojectproperties.h \
buildsettingspropertiespage.h \
environmentwidget.h \
processstep.h \
......@@ -149,7 +148,8 @@ HEADERS += projectexplorer.h \
addnewmodel.h \
xcodebuildparser.h \
propertiespanel.h \
panelswidget.h
panelswidget.h \
iprojectpanelfactory.h
SOURCES += projectexplorer.cpp \
abi.cpp \
......@@ -284,9 +284,9 @@ SOURCES += projectexplorer.cpp \
selectablefilesmodel.cpp \
addnewmodel.cpp \
xcodebuildparser.cpp \
iprojectproperties.cpp \
propertiespanel.cpp \
panelswidget.cpp
panelswidget.cpp \
iprojectpanelfactory.cpp
FORMS += processstep.ui \
editorsettingspropertiespage.ui \
......
......@@ -85,7 +85,7 @@ QtcPlugin {
"ipotentialkit.cpp",
"ipotentialkit.h",
"iprojectmanager.h",
"iprojectproperties.cpp", "iprojectproperties.h",
"iprojectpanelfactory.cpp", "iprojectpanelfactory.h"
"itaskhandler.h",
"kit.cpp", "kit.h",
"kitchooser.cpp", "kitchooser.h",
......
......@@ -31,12 +31,11 @@
#include "doubletabwidget.h"
#include "panelswidget.h"
#include "kitmanager.h"
#include "project.h"
#include "projectexplorer.h"
#include "iprojectpanelfactory.h"
#include "session.h"
#include "iprojectproperties.h"
#include "target.h"
#include <coreplugin/idocument.h>
......
......@@ -82,36 +82,6 @@ using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
using ExtensionSystem::PluginManager;
///
/// RunSettingsPanelFactory
///
QString RunSettingsPanelFactory::id() const
{
return QLatin1String(RUNSETTINGS_PANEL_ID);
}
bool RunSettingsPanelFactory::supports(Target *target)
{
Q_UNUSED(target);
return true;
}
PropertiesPanel *RunSettingsPanelFactory::createPanel(Target *target)
{
PropertiesPanel *panel = new PropertiesPanel;
QWidget *w = new QWidget();
QVBoxLayout *l = new QVBoxLayout(w);
QWidget *b = new RunSettingsWidget(target);
l->addWidget(b);
l->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
l->setContentsMargins(QMargins());
panel->setWidget(w);
panel->setIcon(QIcon(QLatin1String(":/projectexplorer/images/RunSettings.png")));
panel->setDisplayName(RunSettingsWidget::tr("Run Settings"));
return panel;
}
///
/// RunSettingsWidget
///
......
......@@ -30,8 +30,6 @@
#ifndef RUNSETTINGSPROPERTIESPAGE_H
#define RUNSETTINGSPROPERTIESPAGE_H
#include "iprojectproperties.h"
#include <QWidget>
QT_BEGIN_NAMESPACE
......@@ -51,6 +49,7 @@ class NamedWidget;
class RunConfiguration;
class RunConfigurationModel;
class RunConfigWidget;
class Target;
namespace Internal {
......@@ -58,14 +57,6 @@ const char RUNSETTINGS_PANEL_ID[] = "ProjectExplorer.RunSettingsPanel";
class BuildStepListWidget;
class RunSettingsPanelFactory : public ITargetPanelFactory
{
public:
QString id() const;
bool supports(Target *target);
PropertiesPanel *createPanel(Target *target);
};
class RunSettingsWidget : public QWidget
{
Q_OBJECT
......
......@@ -37,6 +37,7 @@
#include "project.h"
#include "projectimporter.h"
#include "projectwindow.h"
#include "propertiespanel.h"
#include "runsettingspropertiespage.h"
#include "target.h"
#include "targetsettingswidget.h"
......@@ -251,21 +252,33 @@ void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subInd
// Target has changed:
m_currentTarget = target;
auto wrapWidgetInPropertiesPanel
= [](QWidget *widget, const QString &displayName, const QIcon &icon) -> PropertiesPanel *{
PropertiesPanel *panel = new PropertiesPanel;
QWidget *w = new QWidget();
QVBoxLayout *l = new QVBoxLayout(w);
l->addWidget(widget);
l->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
l->setContentsMargins(QMargins());
panel->setWidget(w);
panel->setIcon(icon);
panel->setDisplayName(displayName);
return panel;
};
PropertiesPanel *build = wrapWidgetInPropertiesPanel(new BuildSettingsWidget(target),
QCoreApplication::translate("BuildSettingsPanel", "Build Settings"),
QIcon(QLatin1String(":/projectexplorer/images/BuildSettings.png")));
PropertiesPanel *run= wrapWidgetInPropertiesPanel(new RunSettingsWidget(target),
RunSettingsWidget::tr("Run Settings"),
QIcon(QLatin1String(":/projectexplorer/images/RunSettings.png")));
PanelsWidget *buildPanel = new PanelsWidget(m_centralWidget);
PanelsWidget *runPanel = new PanelsWidget(m_centralWidget);
foreach (ITargetPanelFactory *panelFactory, ExtensionSystem::PluginManager::getObjects<ITargetPanelFactory>()) {
if (panelFactory->id() == QLatin1String(BUILDSETTINGS_PANEL_ID)) {
PropertiesPanel *panel = panelFactory->createPanel(target);
buildPanel->addPropertiesPanel(panel);
continue;
}
if (panelFactory->id() == QLatin1String(RUNSETTINGS_PANEL_ID)) {
PropertiesPanel *panel = panelFactory->createPanel(target);
runPanel->addPropertiesPanel(panel);
continue;
}
}
buildPanel->addPropertiesPanel(build);
runPanel->addPropertiesPanel(run);
m_centralWidget->addWidget(buildPanel);
m_centralWidget->addWidget(runPanel);
......
......@@ -30,14 +30,14 @@
#ifndef UNCONFIGUREDPROJECTPANEL_H
#define UNCONFIGUREDPROJECTPANEL_H
#include "iprojectproperties.h"
#include <QString>
#include <QWidget>
QT_FORWARD_DECLARE_CLASS(QPushButton)
namespace ProjectExplorer {
class Kit;
class Project;
class TargetSetupPage;
namespace Internal {
......
......@@ -42,8 +42,8 @@
#include "bardescriptoreditorpermissionswidget.h"
#include <coreplugin/icore.h>
#include <projectexplorer/iprojectproperties.h>
#include <projectexplorer/panelswidget.h>
#include <projectexplorer/propertiespanel.h>
#include <projectexplorer/task.h>
#include <projectexplorer/taskhub.h>
#include <texteditor/plaintexteditor.h>
......
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