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