forked from qt-creator/qt-creator
projectexplorer: s/IPropertiesPanel/PropertiesPanel. No need for subclassing.
This commit is contained in:
@@ -76,40 +76,13 @@ bool BuildSettingsPanelFactory::supports(Target *target)
|
|||||||
return target->buildConfigurationFactory();
|
return target->buildConfigurationFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
IPropertiesPanel *BuildSettingsPanelFactory::createPanel(Target *target)
|
PropertiesPanel *BuildSettingsPanelFactory::createPanel(Target *target)
|
||||||
{
|
{
|
||||||
return new BuildSettingsPanel(target);
|
PropertiesPanel *panel = new PropertiesPanel;
|
||||||
}
|
panel->setWidget(new BuildSettingsWidget(target));
|
||||||
|
panel->setIcon(QIcon(":/projectexplorer/images/BuildSettings.png"));
|
||||||
|
panel->setDisplayName(QCoreApplication::translate("BuildSettingsPanel", "Build Settings"));
|
||||||
///
|
return panel;
|
||||||
// BuildSettingsPanel
|
|
||||||
///
|
|
||||||
|
|
||||||
BuildSettingsPanel::BuildSettingsPanel(Target *target) :
|
|
||||||
m_widget(new BuildSettingsWidget(target)),
|
|
||||||
m_icon(":/projectexplorer/images/BuildSettings.png")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildSettingsPanel::~BuildSettingsPanel()
|
|
||||||
{
|
|
||||||
delete m_widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString BuildSettingsPanel::displayName() const
|
|
||||||
{
|
|
||||||
return QCoreApplication::translate("BuildSettingsPanel", "Build Settings");
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *BuildSettingsPanel::widget() const
|
|
||||||
{
|
|
||||||
return m_widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
QIcon BuildSettingsPanel::icon() const
|
|
||||||
{
|
|
||||||
return m_icon;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@@ -62,23 +62,7 @@ public:
|
|||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
|
|
||||||
bool supports(Target *target);
|
bool supports(Target *target);
|
||||||
IPropertiesPanel *createPanel(Target *target);
|
PropertiesPanel *createPanel(Target *target);
|
||||||
};
|
|
||||||
|
|
||||||
class BuildSettingsWidget;
|
|
||||||
|
|
||||||
class BuildSettingsPanel : public IPropertiesPanel
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BuildSettingsPanel(Target *target);
|
|
||||||
~BuildSettingsPanel();
|
|
||||||
QString displayName() const;
|
|
||||||
QWidget *widget() const;
|
|
||||||
QIcon icon() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
BuildSettingsWidget *m_widget;
|
|
||||||
const QIcon m_icon;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class BuildConfigurationsWidget;
|
class BuildConfigurationsWidget;
|
||||||
@@ -111,7 +95,7 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
void cloneConfiguration(BuildConfiguration *toClone);
|
void cloneConfiguration(BuildConfiguration *toClone);
|
||||||
void deleteConfiguration(BuildConfiguration *toDelete);
|
void deleteConfiguration(BuildConfiguration *toDelete);
|
||||||
QString uniqueName(const QString & name);
|
QString uniqueName(const QString &name);
|
||||||
|
|
||||||
Target *m_target;
|
Target *m_target;
|
||||||
BuildConfiguration *m_buildConfiguration;
|
BuildConfiguration *m_buildConfiguration;
|
||||||
|
@@ -256,36 +256,6 @@ DependenciesWidget::DependenciesWidget(SessionManager *session,
|
|||||||
layout->addSpacerItem(new QSpacerItem(0, 0 , QSizePolicy::Expanding, QSizePolicy::Fixed));
|
layout->addSpacerItem(new QSpacerItem(0, 0 , QSizePolicy::Expanding, QSizePolicy::Fixed));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// DependenciesPanel
|
|
||||||
//
|
|
||||||
|
|
||||||
DependenciesPanel::DependenciesPanel(SessionManager *session, Project *project) :
|
|
||||||
m_widget(new DependenciesWidget(session, project)),
|
|
||||||
m_icon(":/projectexplorer/images/ProjectDependencies.png")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
DependenciesPanel::~DependenciesPanel()
|
|
||||||
{
|
|
||||||
delete m_widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString DependenciesPanel::displayName() const
|
|
||||||
{
|
|
||||||
return QCoreApplication::translate("DependenciesPanel", "Dependencies");
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *DependenciesPanel::widget() const
|
|
||||||
{
|
|
||||||
return m_widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
QIcon DependenciesPanel::icon() const
|
|
||||||
{
|
|
||||||
return m_icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// DependenciesPanelFactory
|
// DependenciesPanelFactory
|
||||||
//
|
//
|
||||||
@@ -311,9 +281,13 @@ bool DependenciesPanelFactory::supports(Project *project)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPropertiesPanel *DependenciesPanelFactory::createPanel(Project *project)
|
PropertiesPanel *DependenciesPanelFactory::createPanel(Project *project)
|
||||||
{
|
{
|
||||||
return new DependenciesPanel(m_session, project);
|
PropertiesPanel *panel = new PropertiesPanel;
|
||||||
|
panel->setWidget(new DependenciesWidget(m_session, project));
|
||||||
|
panel->setIcon(QIcon(":/projectexplorer/images/ProjectDependencies.png"));
|
||||||
|
panel->setDisplayName(QCoreApplication::translate("DependenciesPanel", "Dependencies"));
|
||||||
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -62,26 +62,12 @@ public:
|
|||||||
QString id() const;
|
QString id() const;
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
bool supports(Project *project);
|
bool supports(Project *project);
|
||||||
IPropertiesPanel *createPanel(Project *project);
|
PropertiesPanel *createPanel(Project *project);
|
||||||
private:
|
private:
|
||||||
SessionManager *m_session;
|
SessionManager *m_session;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class DependenciesPanel : public IPropertiesPanel
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DependenciesPanel(SessionManager *session, Project *project);
|
|
||||||
~DependenciesPanel();
|
|
||||||
QString displayName() const;
|
|
||||||
QWidget *widget() const;
|
|
||||||
QIcon icon() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
DependenciesWidget *m_widget;
|
|
||||||
const QIcon m_icon;
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// DependenciesModel
|
// DependenciesModel
|
||||||
//
|
//
|
||||||
|
@@ -55,35 +55,13 @@ bool EditorSettingsPanelFactory::supports(Project *project)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPropertiesPanel *EditorSettingsPanelFactory::createPanel(Project *project)
|
PropertiesPanel *EditorSettingsPanelFactory::createPanel(Project *project)
|
||||||
{
|
{
|
||||||
return new EditorSettingsPanel(project);
|
PropertiesPanel *panel = new PropertiesPanel;
|
||||||
}
|
panel->setDisplayName(QCoreApplication::translate("EditorSettingsPanel", "Editor Settings"));
|
||||||
|
panel->setWidget(new EditorSettingsWidget(project)),
|
||||||
EditorSettingsPanel::EditorSettingsPanel(Project *project) :
|
panel->setIcon(QIcon(":/projectexplorer/images/EditorSettings.png"));
|
||||||
m_widget(new EditorSettingsWidget(project)),
|
return panel;
|
||||||
m_icon(":/projectexplorer/images/EditorSettings.png")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
EditorSettingsPanel::~EditorSettingsPanel()
|
|
||||||
{
|
|
||||||
delete m_widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString EditorSettingsPanel::displayName() const
|
|
||||||
{
|
|
||||||
return QCoreApplication::translate("EditorSettingsPanel", "Editor Settings");
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *EditorSettingsPanel::widget() const
|
|
||||||
{
|
|
||||||
return m_widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
QIcon EditorSettingsPanel::icon() const
|
|
||||||
{
|
|
||||||
return m_icon;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EditorSettingsWidget::EditorSettingsWidget(Project *project) : QWidget(), m_project(project)
|
EditorSettingsWidget::EditorSettingsWidget(Project *project) : QWidget(), m_project(project)
|
||||||
|
@@ -49,26 +49,10 @@ class EditorSettingsPanelFactory : public IProjectPanelFactory
|
|||||||
public:
|
public:
|
||||||
QString id() const;
|
QString id() const;
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
IPropertiesPanel *createPanel(Project *project);
|
PropertiesPanel *createPanel(Project *project);
|
||||||
bool supports(Project *project);
|
bool supports(Project *project);
|
||||||
};
|
};
|
||||||
|
|
||||||
class EditorSettingsWidget;
|
|
||||||
|
|
||||||
class EditorSettingsPanel : public IPropertiesPanel
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
EditorSettingsPanel(Project *project);
|
|
||||||
~EditorSettingsPanel();
|
|
||||||
QString displayName() const;
|
|
||||||
QWidget *widget() const;
|
|
||||||
QIcon icon() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
EditorSettingsWidget *m_widget;
|
|
||||||
const QIcon m_icon;
|
|
||||||
};
|
|
||||||
|
|
||||||
class EditorSettingsWidget : public QWidget
|
class EditorSettingsWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@@ -36,8 +36,8 @@
|
|||||||
#include "projectexplorer_export.h"
|
#include "projectexplorer_export.h"
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
|
#include <QtGui/QIcon>
|
||||||
QT_FORWARD_DECLARE_CLASS(QIcon)
|
#include <QtGui/QWidget>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
class Project;
|
class Project;
|
||||||
@@ -47,17 +47,26 @@ namespace Constants {
|
|||||||
const int PANEL_LEFT_MARGIN = 70;
|
const int PANEL_LEFT_MARGIN = 70;
|
||||||
}
|
}
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT IPropertiesPanel
|
class PROJECTEXPLORER_EXPORT PropertiesPanel
|
||||||
{
|
{
|
||||||
public:
|
Q_DISABLE_COPY(PropertiesPanel)
|
||||||
IPropertiesPanel()
|
|
||||||
{ }
|
|
||||||
virtual ~IPropertiesPanel()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
virtual QString displayName() const = 0;
|
public:
|
||||||
virtual QIcon icon() const = 0;
|
PropertiesPanel() {}
|
||||||
virtual QWidget *widget() const = 0;
|
~PropertiesPanel() { delete m_widget; }
|
||||||
|
|
||||||
|
QString displayName() const { return m_displayName; }
|
||||||
|
QIcon icon() const { return m_icon; }
|
||||||
|
QWidget *widget() const { return m_widget; }
|
||||||
|
|
||||||
|
void setDisplayName(const QString &name) { m_displayName = name; }
|
||||||
|
void setIcon(const QIcon &icon) { m_icon = icon; }
|
||||||
|
void setWidget(QWidget *widget) { m_widget = widget; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_displayName;
|
||||||
|
QWidget *m_widget;
|
||||||
|
QIcon m_icon;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT IPanelFactory : public QObject
|
class PROJECTEXPLORER_EXPORT IPanelFactory : public QObject
|
||||||
@@ -73,7 +82,7 @@ class PROJECTEXPLORER_EXPORT IProjectPanelFactory : public IPanelFactory
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
virtual bool supports(Project *project) = 0;
|
virtual bool supports(Project *project) = 0;
|
||||||
virtual IPropertiesPanel *createPanel(Project *project) = 0;
|
virtual PropertiesPanel *createPanel(Project *project) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT ITargetPanelFactory : public IPanelFactory
|
class PROJECTEXPLORER_EXPORT ITargetPanelFactory : public IPanelFactory
|
||||||
@@ -81,7 +90,7 @@ class PROJECTEXPLORER_EXPORT ITargetPanelFactory : public IPanelFactory
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
virtual bool supports(Target *target) = 0;
|
virtual bool supports(Target *target) = 0;
|
||||||
virtual IPropertiesPanel *createPanel(Target *target) = 0;
|
virtual PropertiesPanel *createPanel(Target *target) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
@@ -162,7 +162,7 @@ PanelsWidget::~PanelsWidget()
|
|||||||
* | widget (with contentsmargins adjusted!) |
|
* | widget (with contentsmargins adjusted!) |
|
||||||
* +--------+-------------------------------------------+ BELOW_CONTENTS_MARGIN
|
* +--------+-------------------------------------------+ BELOW_CONTENTS_MARGIN
|
||||||
*/
|
*/
|
||||||
void PanelsWidget::addPropertiesPanel(IPropertiesPanel *panel)
|
void PanelsWidget::addPropertiesPanel(PropertiesPanel *panel)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(panel, return);
|
QTC_ASSERT(panel, return);
|
||||||
|
|
||||||
@@ -200,7 +200,7 @@ void PanelsWidget::addPropertiesPanel(IPropertiesPanel *panel)
|
|||||||
addPanelWidget(panel, widgetRow);
|
addPanelWidget(panel, widgetRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PanelsWidget::addPanelWidget(IPropertiesPanel *panel, int row)
|
void PanelsWidget::addPanelWidget(PropertiesPanel *panel, int row)
|
||||||
{
|
{
|
||||||
QWidget *widget = panel->widget();
|
QWidget *widget = panel->widget();
|
||||||
widget->setContentsMargins(Constants::PANEL_LEFT_MARGIN,
|
widget->setContentsMargins(Constants::PANEL_LEFT_MARGIN,
|
||||||
@@ -436,7 +436,7 @@ void ProjectWindow::showProperties(int index, int subIndex)
|
|||||||
if (fac) {
|
if (fac) {
|
||||||
removeCurrentWidget();
|
removeCurrentWidget();
|
||||||
|
|
||||||
IPropertiesPanel *panel = 0;
|
PropertiesPanel *panel = 0;
|
||||||
if (ITargetPanelFactory *ipf = qobject_cast<ITargetPanelFactory *>(fac))
|
if (ITargetPanelFactory *ipf = qobject_cast<ITargetPanelFactory *>(fac))
|
||||||
panel = ipf->createPanel(project->activeTarget());
|
panel = ipf->createPanel(project->activeTarget());
|
||||||
else if (IProjectPanelFactory *ipf = qobject_cast<IProjectPanelFactory *>(fac))
|
else if (IProjectPanelFactory *ipf = qobject_cast<IProjectPanelFactory *>(fac))
|
||||||
|
@@ -45,7 +45,7 @@ QT_END_NAMESPACE
|
|||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
class IPropertiesPanel;
|
class PropertiesPanel;
|
||||||
class Project;
|
class Project;
|
||||||
class Target;
|
class Target;
|
||||||
class BuildConfiguration;
|
class BuildConfiguration;
|
||||||
@@ -62,12 +62,12 @@ public:
|
|||||||
PanelsWidget(QWidget *parent);
|
PanelsWidget(QWidget *parent);
|
||||||
~PanelsWidget();
|
~PanelsWidget();
|
||||||
// Adds a widget
|
// Adds a widget
|
||||||
void addPropertiesPanel(IPropertiesPanel *panel);
|
void addPropertiesPanel(PropertiesPanel *panel);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void addPanelWidget(IPropertiesPanel *panel, int row);
|
void addPanelWidget(PropertiesPanel *panel, int row);
|
||||||
|
|
||||||
QList<IPropertiesPanel *> m_panels;
|
QList<PropertiesPanel *> m_panels;
|
||||||
QGridLayout *m_layout;
|
QGridLayout *m_layout;
|
||||||
QWidget *m_root;
|
QWidget *m_root;
|
||||||
};
|
};
|
||||||
|
@@ -89,39 +89,13 @@ bool RunSettingsPanelFactory::supports(Target *target)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPropertiesPanel *RunSettingsPanelFactory::createPanel(Target *target)
|
PropertiesPanel *RunSettingsPanelFactory::createPanel(Target *target)
|
||||||
{
|
{
|
||||||
return new RunSettingsPanel(target);
|
PropertiesPanel *panel = new PropertiesPanel;
|
||||||
}
|
panel->setWidget(new RunSettingsWidget(target));
|
||||||
|
panel->setIcon(QIcon(":/projectexplorer/images/RunSettings.png"));
|
||||||
///
|
panel->setDisplayName(QCoreApplication::translate("RunSettingsPanel", "Run Settings"));
|
||||||
/// RunSettingsPanel
|
return panel;
|
||||||
///
|
|
||||||
|
|
||||||
RunSettingsPanel::RunSettingsPanel(Target *target) :
|
|
||||||
m_widget(new RunSettingsWidget(target)),
|
|
||||||
m_icon(":/projectexplorer/images/RunSettings.png")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
RunSettingsPanel::~RunSettingsPanel()
|
|
||||||
{
|
|
||||||
delete m_widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString RunSettingsPanel::displayName() const
|
|
||||||
{
|
|
||||||
return QCoreApplication::translate("RunSettingsPanel", "Run Settings");
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *RunSettingsPanel::widget() const
|
|
||||||
{
|
|
||||||
return m_widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
QIcon RunSettingsPanel::icon() const
|
|
||||||
{
|
|
||||||
return m_icon;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@@ -61,7 +61,6 @@ namespace Ui {
|
|||||||
class RunSettingsPropertiesPage;
|
class RunSettingsPropertiesPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
class RunSettingsWidget;
|
|
||||||
class BuildStepListWidget;
|
class BuildStepListWidget;
|
||||||
|
|
||||||
class RunSettingsPanelFactory : public ITargetPanelFactory
|
class RunSettingsPanelFactory : public ITargetPanelFactory
|
||||||
@@ -70,22 +69,7 @@ public:
|
|||||||
QString id() const;
|
QString id() const;
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
bool supports(Target *target);
|
bool supports(Target *target);
|
||||||
IPropertiesPanel *createPanel(Target *target);
|
PropertiesPanel *createPanel(Target *target);
|
||||||
};
|
|
||||||
|
|
||||||
class RunSettingsPanel : public IPropertiesPanel
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RunSettingsPanel(Target *target);
|
|
||||||
~RunSettingsPanel();
|
|
||||||
|
|
||||||
QString displayName() const;
|
|
||||||
QWidget *widget() const;
|
|
||||||
QIcon icon() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
RunSettingsWidget *m_widget;
|
|
||||||
QIcon m_icon;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class RunSettingsWidget : public QWidget
|
class RunSettingsWidget : public QWidget
|
||||||
|
@@ -182,12 +182,12 @@ void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subInd
|
|||||||
|
|
||||||
foreach (ITargetPanelFactory *panelFactory, ExtensionSystem::PluginManager::instance()->getObjects<ITargetPanelFactory>()) {
|
foreach (ITargetPanelFactory *panelFactory, ExtensionSystem::PluginManager::instance()->getObjects<ITargetPanelFactory>()) {
|
||||||
if (panelFactory->id() == QLatin1String(BUILDSETTINGS_PANEL_ID)) {
|
if (panelFactory->id() == QLatin1String(BUILDSETTINGS_PANEL_ID)) {
|
||||||
IPropertiesPanel *panel = panelFactory->createPanel(target);
|
PropertiesPanel *panel = panelFactory->createPanel(target);
|
||||||
buildPanel->addPropertiesPanel(panel);
|
buildPanel->addPropertiesPanel(panel);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (panelFactory->id() == QLatin1String(RUNSETTINGS_PANEL_ID)) {
|
if (panelFactory->id() == QLatin1String(RUNSETTINGS_PANEL_ID)) {
|
||||||
IPropertiesPanel *panel = panelFactory->createPanel(target);
|
PropertiesPanel *panel = panelFactory->createPanel(target);
|
||||||
runPanel->addPropertiesPanel(panel);
|
runPanel->addPropertiesPanel(panel);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user