forked from qt-creator/qt-creator
Move Code from ProjectWindow to IProjectProperties
Change-Id: Ib2ad82c8bbbb62dd72b3a2497a7e213206613654 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
|
|
||||||
IProjectPanelFactory::IProjectPanelFactory()
|
IProjectPanelFactory::IProjectPanelFactory()
|
||||||
: m_priority(0),
|
: m_priority(0),
|
||||||
m_supportsFunction(&supportsAllProjects)
|
m_supportsFunction(&supportsAllProjects)
|
||||||
@@ -78,7 +77,7 @@ void IProjectPanelFactory::setSupportsFunction(std::function<bool (Project *)> f
|
|||||||
m_supportsFunction = function;
|
m_supportsFunction = function;
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertiesPanel *IProjectPanelFactory::createPanel(Project *project)
|
QWidget *IProjectPanelFactory::createWidget(Project *project)
|
||||||
{
|
{
|
||||||
return m_createPanelFunction(project);
|
return m_createWidgetFunction(project);
|
||||||
}
|
}
|
||||||
|
@@ -58,7 +58,7 @@ public:
|
|||||||
|
|
||||||
// interface for users of IProjectPanelFactory
|
// interface for users of IProjectPanelFactory
|
||||||
bool supports(Project *project);
|
bool supports(Project *project);
|
||||||
ProjectExplorer::PropertiesPanel *createPanel(ProjectExplorer::Project *project);
|
QWidget *createWidget(ProjectExplorer::Project *project);
|
||||||
|
|
||||||
// interface for "implementations" of IProjectPanelFactory
|
// interface for "implementations" of IProjectPanelFactory
|
||||||
// by default all projects are supported, only set a custom supports function
|
// by default all projects are supported, only set a custom supports function
|
||||||
@@ -71,14 +71,16 @@ public:
|
|||||||
// and uses displayName() for the displayname
|
// and uses displayName() for the displayname
|
||||||
// Note: call setDisplayName before calling this
|
// Note: call setDisplayName before calling this
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void setSimpleCreatePanelFunction(const QIcon &icon)
|
void setSimpleCreateWidgetFunction(const QIcon &icon)
|
||||||
{
|
{
|
||||||
m_createPanelFunction = [icon, this](Project *project) -> PropertiesPanel * {
|
m_createWidgetFunction = [icon, this](Project *project) -> QWidget * {
|
||||||
PropertiesPanel *panel = new PropertiesPanel;
|
PropertiesPanel *panel = new PropertiesPanel;
|
||||||
panel->setDisplayName(this->displayName());
|
panel->setDisplayName(this->displayName());
|
||||||
panel->setWidget(new T(project)),
|
panel->setWidget(new T(project)),
|
||||||
panel->setIcon(icon);
|
panel->setIcon(icon);
|
||||||
return panel;
|
PanelsWidget *panelsWidget = new PanelsWidget();
|
||||||
|
panelsWidget->addPropertiesPanel(panel);
|
||||||
|
return panelsWidget;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +90,7 @@ private:
|
|||||||
int m_priority;
|
int m_priority;
|
||||||
QString m_displayName;
|
QString m_displayName;
|
||||||
std::function<bool (Project *)> m_supportsFunction;
|
std::function<bool (Project *)> m_supportsFunction;
|
||||||
std::function<ProjectExplorer::PropertiesPanel *(Project *)> m_createPanelFunction;
|
std::function<QWidget *(Project *)> m_createWidgetFunction;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT ITargetPanelFactory : public QObject
|
class PROJECTEXPLORER_EXPORT ITargetPanelFactory : public QObject
|
||||||
|
@@ -476,7 +476,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
QString displayName = QCoreApplication::translate("EditorSettingsPanelFactory", "Editor");
|
QString displayName = QCoreApplication::translate("EditorSettingsPanelFactory", "Editor");
|
||||||
editorSettingsPanelFactory->setDisplayName(displayName);
|
editorSettingsPanelFactory->setDisplayName(displayName);
|
||||||
QIcon icon = QIcon(QLatin1String(":/projectexplorer/images/EditorSettings.png"));
|
QIcon icon = QIcon(QLatin1String(":/projectexplorer/images/EditorSettings.png"));
|
||||||
editorSettingsPanelFactory->setSimpleCreatePanelFunction<EditorSettingsWidget>(icon);
|
editorSettingsPanelFactory->setSimpleCreateWidgetFunction<EditorSettingsWidget>(icon);
|
||||||
addAutoReleasedObject(editorSettingsPanelFactory);
|
addAutoReleasedObject(editorSettingsPanelFactory);
|
||||||
|
|
||||||
auto codeStyleSettingsPanelFactory = new IProjectPanelFactory;
|
auto codeStyleSettingsPanelFactory = new IProjectPanelFactory;
|
||||||
@@ -484,7 +484,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
displayName = QCoreApplication::translate("CodeStyleSettingsPanelFactory", "Code Style");
|
displayName = QCoreApplication::translate("CodeStyleSettingsPanelFactory", "Code Style");
|
||||||
codeStyleSettingsPanelFactory->setDisplayName(displayName);
|
codeStyleSettingsPanelFactory->setDisplayName(displayName);
|
||||||
icon = QIcon(QLatin1String(":/projectexplorer/images/CodeStyleSettings.png"));
|
icon = QIcon(QLatin1String(":/projectexplorer/images/CodeStyleSettings.png"));
|
||||||
codeStyleSettingsPanelFactory->setSimpleCreatePanelFunction<CodeStyleSettingsWidget>(icon);
|
codeStyleSettingsPanelFactory->setSimpleCreateWidgetFunction<CodeStyleSettingsWidget>(icon);
|
||||||
addAutoReleasedObject(codeStyleSettingsPanelFactory);
|
addAutoReleasedObject(codeStyleSettingsPanelFactory);
|
||||||
|
|
||||||
auto dependenciesPanelFactory = new IProjectPanelFactory;
|
auto dependenciesPanelFactory = new IProjectPanelFactory;
|
||||||
@@ -492,7 +492,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
displayName = QCoreApplication::translate("DependenciesPanelFactory", "Dependencies");
|
displayName = QCoreApplication::translate("DependenciesPanelFactory", "Dependencies");
|
||||||
dependenciesPanelFactory->setDisplayName(displayName);
|
dependenciesPanelFactory->setDisplayName(displayName);
|
||||||
icon = QIcon(QLatin1String(":/projectexplorer/images/ProjectDependencies.png"));
|
icon = QIcon(QLatin1String(":/projectexplorer/images/ProjectDependencies.png"));
|
||||||
dependenciesPanelFactory->setSimpleCreatePanelFunction<DependenciesWidget>(icon);
|
dependenciesPanelFactory->setSimpleCreateWidgetFunction<DependenciesWidget>(icon);
|
||||||
addAutoReleasedObject(dependenciesPanelFactory);
|
addAutoReleasedObject(dependenciesPanelFactory);
|
||||||
|
|
||||||
auto unconfiguredProjectPanel = new IProjectPanelFactory;
|
auto unconfiguredProjectPanel = new IProjectPanelFactory;
|
||||||
@@ -502,7 +502,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
return project->targets().isEmpty() && !project->requiresTargetPanel();
|
return project->targets().isEmpty() && !project->requiresTargetPanel();
|
||||||
});
|
});
|
||||||
icon = QIcon(QLatin1String(":/projectexplorer/images/unconfigured.png"));
|
icon = QIcon(QLatin1String(":/projectexplorer/images/unconfigured.png"));
|
||||||
unconfiguredProjectPanel->setSimpleCreatePanelFunction<TargetSetupPageWrapper>(icon);
|
unconfiguredProjectPanel->setSimpleCreateWidgetFunction<TargetSetupPageWrapper>(icon);
|
||||||
addAutoReleasedObject(unconfiguredProjectPanel);
|
addAutoReleasedObject(unconfiguredProjectPanel);
|
||||||
|
|
||||||
addAutoReleasedObject(new ProcessStepFactory);
|
addAutoReleasedObject(new ProcessStepFactory);
|
||||||
|
@@ -243,12 +243,10 @@ void ProjectWindow::showProperties(int index, int subIndex)
|
|||||||
if (fac) {
|
if (fac) {
|
||||||
removeCurrentWidget();
|
removeCurrentWidget();
|
||||||
|
|
||||||
PropertiesPanel *panel = fac->createPanel(project);
|
QWidget *widget = fac->createWidget(project);
|
||||||
Q_ASSERT(panel);
|
Q_ASSERT(widget);
|
||||||
|
|
||||||
PanelsWidget *panelsWidget = new PanelsWidget(m_centralWidget);
|
m_currentWidget = widget;
|
||||||
panelsWidget->addPropertiesPanel(panel);
|
|
||||||
m_currentWidget = panelsWidget;
|
|
||||||
m_centralWidget->addWidget(m_currentWidget);
|
m_centralWidget->addWidget(m_currentWidget);
|
||||||
m_centralWidget->setCurrentWidget(m_currentWidget);
|
m_centralWidget->setCurrentWidget(m_currentWidget);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user