forked from qt-creator/qt-creator
Axivion: Use new construction pattern for project panel factory
Change-Id: I49b71d1fec4c174446f758b4b44b374a979f4300 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
#include <projectexplorer/buildsystem.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectmanager.h>
|
||||
#include <projectexplorer/projectpanelfactory.h>
|
||||
|
||||
#include <texteditor/textdocument.h>
|
||||
#include <texteditor/texteditor.h>
|
||||
@@ -110,11 +109,8 @@ void AxivionPlugin::initialize()
|
||||
{
|
||||
dd = new AxivionPluginPrivate;
|
||||
|
||||
auto panelFactory = new ProjectExplorer::ProjectPanelFactory;
|
||||
panelFactory->setPriority(250);
|
||||
panelFactory->setDisplayName(Tr::tr("Axivion"));
|
||||
panelFactory->setCreateWidgetFunction(&AxivionProjectSettings::createSettingsWidget);
|
||||
ProjectExplorer::ProjectPanelFactory::registerFactory(panelFactory);
|
||||
AxivionProjectSettings::setupProjectPanel();
|
||||
|
||||
connect(ProjectExplorer::ProjectManager::instance(),
|
||||
&ProjectExplorer::ProjectManager::startupProjectChanged,
|
||||
dd, &AxivionPluginPrivate::onStartupProjectChanged);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "axiviontr.h"
|
||||
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectpanelfactory.h>
|
||||
#include <projectexplorer/projectsettingswidget.h>
|
||||
|
||||
#include <utils/infolabel.h>
|
||||
@@ -248,9 +249,23 @@ void AxivionProjectSettingsWidget::updateEnabledStates()
|
||||
}
|
||||
}
|
||||
|
||||
ProjectSettingsWidget *AxivionProjectSettings::createSettingsWidget(ProjectExplorer::Project *project)
|
||||
class AxivionProjectPanelFactory : public ProjectExplorer::ProjectPanelFactory
|
||||
{
|
||||
return new AxivionProjectSettingsWidget(project);
|
||||
public:
|
||||
AxivionProjectPanelFactory()
|
||||
{
|
||||
setPriority(250);
|
||||
setDisplayName(Tr::tr("Axivion"));
|
||||
setCreateWidgetFunction([](ProjectExplorer::Project *project) {
|
||||
return new AxivionProjectSettingsWidget(project);
|
||||
});
|
||||
ProjectExplorer::ProjectPanelFactory::registerFactory(this);
|
||||
}
|
||||
};
|
||||
|
||||
void AxivionProjectSettings::setupProjectPanel()
|
||||
{
|
||||
static AxivionProjectPanelFactory theAxivionProjectPanelFactory;
|
||||
}
|
||||
|
||||
} // Axivion::Internal
|
||||
|
||||
@@ -5,10 +5,7 @@
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class Project;
|
||||
class ProjectSettingsWidget;
|
||||
}
|
||||
namespace ProjectExplorer { class Project; }
|
||||
|
||||
namespace Axivion::Internal {
|
||||
|
||||
@@ -22,7 +19,7 @@ public:
|
||||
|
||||
static AxivionProjectSettings *projectSettings(ProjectExplorer::Project *project);
|
||||
static void destroyProjectSettings();
|
||||
static ProjectExplorer::ProjectSettingsWidget *createSettingsWidget(ProjectExplorer::Project *project);
|
||||
static void setupProjectPanel();
|
||||
|
||||
private:
|
||||
void load();
|
||||
|
||||
Reference in New Issue
Block a user