forked from qt-creator/qt-creator
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: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -41,7 +41,6 @@
|
|||||||
|
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectwindow.h>
|
#include <projectexplorer/projectwindow.h>
|
||||||
#include <projectexplorer/iprojectproperties.h>
|
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
|
@@ -32,8 +32,6 @@
|
|||||||
|
|
||||||
#include "ui_clangprojectsettingspropertiespage.h"
|
#include "ui_clangprojectsettingspropertiespage.h"
|
||||||
|
|
||||||
#include <projectexplorer/iprojectproperties.h>
|
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
namespace ClangCodeModel {
|
namespace ClangCodeModel {
|
||||||
|
@@ -53,35 +53,6 @@
|
|||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace ProjectExplorer::Internal;
|
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
|
// BuildSettingsWidget
|
||||||
///
|
///
|
||||||
|
@@ -30,8 +30,6 @@
|
|||||||
#ifndef BUILDSETTINGSPROPERTIESPAGE_H
|
#ifndef BUILDSETTINGSPROPERTIESPAGE_H
|
||||||
#define BUILDSETTINGSPROPERTIESPAGE_H
|
#define BUILDSETTINGSPROPERTIESPAGE_H
|
||||||
|
|
||||||
#include "iprojectproperties.h"
|
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@@ -45,24 +43,11 @@ namespace ProjectExplorer {
|
|||||||
|
|
||||||
class BuildConfiguration;
|
class BuildConfiguration;
|
||||||
class BuildInfo;
|
class BuildInfo;
|
||||||
class IBuildStepFactory;
|
|
||||||
class NamedWidget;
|
class NamedWidget;
|
||||||
|
class Target;
|
||||||
|
|
||||||
namespace Internal {
|
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
|
class BuildSettingsWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@@ -30,12 +30,11 @@
|
|||||||
#ifndef CODESTYLESETTINGSPROPERTIESPAGE_H
|
#ifndef CODESTYLESETTINGSPROPERTIESPAGE_H
|
||||||
#define CODESTYLESETTINGSPROPERTIESPAGE_H
|
#define CODESTYLESETTINGSPROPERTIESPAGE_H
|
||||||
|
|
||||||
#include "iprojectproperties.h"
|
|
||||||
#include "ui_codestylesettingspropertiespage.h"
|
#include "ui_codestylesettingspropertiespage.h"
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
class EditorConfiguration;
|
class EditorConfiguration;
|
||||||
|
class Project;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
@@ -30,8 +30,6 @@
|
|||||||
#ifndef DEPENDENCIESPANEL_H
|
#ifndef DEPENDENCIESPANEL_H
|
||||||
#define DEPENDENCIESPANEL_H
|
#define DEPENDENCIESPANEL_H
|
||||||
|
|
||||||
#include "iprojectproperties.h"
|
|
||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
|
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
|
@@ -30,12 +30,11 @@
|
|||||||
#ifndef EDITORSETTINGSPROPERTIESPAGE_H
|
#ifndef EDITORSETTINGSPROPERTIESPAGE_H
|
||||||
#define EDITORSETTINGSPROPERTIESPAGE_H
|
#define EDITORSETTINGSPROPERTIESPAGE_H
|
||||||
|
|
||||||
#include "iprojectproperties.h"
|
|
||||||
#include "ui_editorsettingspropertiespage.h"
|
#include "ui_editorsettingspropertiespage.h"
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
class EditorConfiguration;
|
class EditorConfiguration;
|
||||||
|
class Project;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "iprojectproperties.h"
|
#include "iprojectpanelfactory.h"
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
@@ -98,16 +98,6 @@ private:
|
|||||||
std::function<QWidget *(Project *)> m_createWidgetFunction;
|
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
|
} // namespace ProjectExplorer
|
||||||
|
|
||||||
#endif // IPROJECTPROPERTIES_H
|
#endif // IPROJECTPROPERTIES_H
|
@@ -84,6 +84,7 @@
|
|||||||
#include "devicesupport/devicemanager.h"
|
#include "devicesupport/devicemanager.h"
|
||||||
#include "devicesupport/devicesettingspage.h"
|
#include "devicesupport/devicesettingspage.h"
|
||||||
#include "targetsettingspanel.h"
|
#include "targetsettingspanel.h"
|
||||||
|
#include "iprojectpanelfactory.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
# include "windebuginterface.h"
|
# include "windebuginterface.h"
|
||||||
@@ -468,9 +469,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
addAutoReleasedObject(new AllProjectsFilter);
|
addAutoReleasedObject(new AllProjectsFilter);
|
||||||
addAutoReleasedObject(new CurrentProjectFilter);
|
addAutoReleasedObject(new CurrentProjectFilter);
|
||||||
|
|
||||||
addAutoReleasedObject(new BuildSettingsPanelFactory);
|
|
||||||
addAutoReleasedObject(new RunSettingsPanelFactory);
|
|
||||||
|
|
||||||
// ProjectPanelFactories
|
// ProjectPanelFactories
|
||||||
auto editorSettingsPanelFactory = new IProjectPanelFactory;
|
auto editorSettingsPanelFactory = new IProjectPanelFactory;
|
||||||
editorSettingsPanelFactory->setPriority(30);
|
editorSettingsPanelFactory->setPriority(30);
|
||||||
|
@@ -64,7 +64,6 @@ HEADERS += projectexplorer.h \
|
|||||||
allprojectsfind.h \
|
allprojectsfind.h \
|
||||||
buildstep.h \
|
buildstep.h \
|
||||||
buildconfiguration.h \
|
buildconfiguration.h \
|
||||||
iprojectproperties.h \
|
|
||||||
buildsettingspropertiespage.h \
|
buildsettingspropertiespage.h \
|
||||||
environmentwidget.h \
|
environmentwidget.h \
|
||||||
processstep.h \
|
processstep.h \
|
||||||
@@ -149,7 +148,8 @@ HEADERS += projectexplorer.h \
|
|||||||
addnewmodel.h \
|
addnewmodel.h \
|
||||||
xcodebuildparser.h \
|
xcodebuildparser.h \
|
||||||
propertiespanel.h \
|
propertiespanel.h \
|
||||||
panelswidget.h
|
panelswidget.h \
|
||||||
|
iprojectpanelfactory.h
|
||||||
|
|
||||||
SOURCES += projectexplorer.cpp \
|
SOURCES += projectexplorer.cpp \
|
||||||
abi.cpp \
|
abi.cpp \
|
||||||
@@ -284,9 +284,9 @@ SOURCES += projectexplorer.cpp \
|
|||||||
selectablefilesmodel.cpp \
|
selectablefilesmodel.cpp \
|
||||||
addnewmodel.cpp \
|
addnewmodel.cpp \
|
||||||
xcodebuildparser.cpp \
|
xcodebuildparser.cpp \
|
||||||
iprojectproperties.cpp \
|
|
||||||
propertiespanel.cpp \
|
propertiespanel.cpp \
|
||||||
panelswidget.cpp
|
panelswidget.cpp \
|
||||||
|
iprojectpanelfactory.cpp
|
||||||
|
|
||||||
FORMS += processstep.ui \
|
FORMS += processstep.ui \
|
||||||
editorsettingspropertiespage.ui \
|
editorsettingspropertiespage.ui \
|
||||||
|
@@ -85,7 +85,7 @@ QtcPlugin {
|
|||||||
"ipotentialkit.cpp",
|
"ipotentialkit.cpp",
|
||||||
"ipotentialkit.h",
|
"ipotentialkit.h",
|
||||||
"iprojectmanager.h",
|
"iprojectmanager.h",
|
||||||
"iprojectproperties.cpp", "iprojectproperties.h",
|
"iprojectpanelfactory.cpp", "iprojectpanelfactory.h"
|
||||||
"itaskhandler.h",
|
"itaskhandler.h",
|
||||||
"kit.cpp", "kit.h",
|
"kit.cpp", "kit.h",
|
||||||
"kitchooser.cpp", "kitchooser.h",
|
"kitchooser.cpp", "kitchooser.h",
|
||||||
|
@@ -31,12 +31,11 @@
|
|||||||
|
|
||||||
#include "doubletabwidget.h"
|
#include "doubletabwidget.h"
|
||||||
#include "panelswidget.h"
|
#include "panelswidget.h"
|
||||||
|
|
||||||
#include "kitmanager.h"
|
#include "kitmanager.h"
|
||||||
#include "project.h"
|
#include "project.h"
|
||||||
#include "projectexplorer.h"
|
#include "projectexplorer.h"
|
||||||
|
#include "iprojectpanelfactory.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "iprojectproperties.h"
|
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
|
|
||||||
#include <coreplugin/idocument.h>
|
#include <coreplugin/idocument.h>
|
||||||
|
@@ -82,36 +82,6 @@ using namespace ProjectExplorer;
|
|||||||
using namespace ProjectExplorer::Internal;
|
using namespace ProjectExplorer::Internal;
|
||||||
using ExtensionSystem::PluginManager;
|
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
|
/// RunSettingsWidget
|
||||||
///
|
///
|
||||||
|
@@ -30,8 +30,6 @@
|
|||||||
#ifndef RUNSETTINGSPROPERTIESPAGE_H
|
#ifndef RUNSETTINGSPROPERTIESPAGE_H
|
||||||
#define RUNSETTINGSPROPERTIESPAGE_H
|
#define RUNSETTINGSPROPERTIESPAGE_H
|
||||||
|
|
||||||
#include "iprojectproperties.h"
|
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@@ -51,6 +49,7 @@ class NamedWidget;
|
|||||||
class RunConfiguration;
|
class RunConfiguration;
|
||||||
class RunConfigurationModel;
|
class RunConfigurationModel;
|
||||||
class RunConfigWidget;
|
class RunConfigWidget;
|
||||||
|
class Target;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -58,14 +57,6 @@ const char RUNSETTINGS_PANEL_ID[] = "ProjectExplorer.RunSettingsPanel";
|
|||||||
|
|
||||||
class BuildStepListWidget;
|
class BuildStepListWidget;
|
||||||
|
|
||||||
class RunSettingsPanelFactory : public ITargetPanelFactory
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QString id() const;
|
|
||||||
bool supports(Target *target);
|
|
||||||
PropertiesPanel *createPanel(Target *target);
|
|
||||||
};
|
|
||||||
|
|
||||||
class RunSettingsWidget : public QWidget
|
class RunSettingsWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@@ -37,6 +37,7 @@
|
|||||||
#include "project.h"
|
#include "project.h"
|
||||||
#include "projectimporter.h"
|
#include "projectimporter.h"
|
||||||
#include "projectwindow.h"
|
#include "projectwindow.h"
|
||||||
|
#include "propertiespanel.h"
|
||||||
#include "runsettingspropertiespage.h"
|
#include "runsettingspropertiespage.h"
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
#include "targetsettingswidget.h"
|
#include "targetsettingswidget.h"
|
||||||
@@ -251,21 +252,33 @@ void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subInd
|
|||||||
// Target has changed:
|
// Target has changed:
|
||||||
m_currentTarget = target;
|
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 *buildPanel = new PanelsWidget(m_centralWidget);
|
||||||
PanelsWidget *runPanel = new PanelsWidget(m_centralWidget);
|
PanelsWidget *runPanel = new PanelsWidget(m_centralWidget);
|
||||||
|
|
||||||
foreach (ITargetPanelFactory *panelFactory, ExtensionSystem::PluginManager::getObjects<ITargetPanelFactory>()) {
|
buildPanel->addPropertiesPanel(build);
|
||||||
if (panelFactory->id() == QLatin1String(BUILDSETTINGS_PANEL_ID)) {
|
runPanel->addPropertiesPanel(run);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_centralWidget->addWidget(buildPanel);
|
m_centralWidget->addWidget(buildPanel);
|
||||||
m_centralWidget->addWidget(runPanel);
|
m_centralWidget->addWidget(runPanel);
|
||||||
|
|
||||||
|
@@ -30,14 +30,14 @@
|
|||||||
#ifndef UNCONFIGUREDPROJECTPANEL_H
|
#ifndef UNCONFIGUREDPROJECTPANEL_H
|
||||||
#define UNCONFIGUREDPROJECTPANEL_H
|
#define UNCONFIGUREDPROJECTPANEL_H
|
||||||
|
|
||||||
#include "iprojectproperties.h"
|
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QPushButton)
|
QT_FORWARD_DECLARE_CLASS(QPushButton)
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
class Kit;
|
class Kit;
|
||||||
|
class Project;
|
||||||
class TargetSetupPage;
|
class TargetSetupPage;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
@@ -42,8 +42,8 @@
|
|||||||
#include "bardescriptoreditorpermissionswidget.h"
|
#include "bardescriptoreditorpermissionswidget.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <projectexplorer/iprojectproperties.h>
|
|
||||||
#include <projectexplorer/panelswidget.h>
|
#include <projectexplorer/panelswidget.h>
|
||||||
|
#include <projectexplorer/propertiespanel.h>
|
||||||
#include <projectexplorer/task.h>
|
#include <projectexplorer/task.h>
|
||||||
#include <projectexplorer/taskhub.h>
|
#include <projectexplorer/taskhub.h>
|
||||||
#include <texteditor/plaintexteditor.h>
|
#include <texteditor/plaintexteditor.h>
|
||||||
|
Reference in New Issue
Block a user