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/buildsystem.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectmanager.h>
|
#include <projectexplorer/projectmanager.h>
|
||||||
#include <projectexplorer/projectpanelfactory.h>
|
|
||||||
|
|
||||||
#include <texteditor/textdocument.h>
|
#include <texteditor/textdocument.h>
|
||||||
#include <texteditor/texteditor.h>
|
#include <texteditor/texteditor.h>
|
||||||
@@ -110,11 +109,8 @@ void AxivionPlugin::initialize()
|
|||||||
{
|
{
|
||||||
dd = new AxivionPluginPrivate;
|
dd = new AxivionPluginPrivate;
|
||||||
|
|
||||||
auto panelFactory = new ProjectExplorer::ProjectPanelFactory;
|
AxivionProjectSettings::setupProjectPanel();
|
||||||
panelFactory->setPriority(250);
|
|
||||||
panelFactory->setDisplayName(Tr::tr("Axivion"));
|
|
||||||
panelFactory->setCreateWidgetFunction(&AxivionProjectSettings::createSettingsWidget);
|
|
||||||
ProjectExplorer::ProjectPanelFactory::registerFactory(panelFactory);
|
|
||||||
connect(ProjectExplorer::ProjectManager::instance(),
|
connect(ProjectExplorer::ProjectManager::instance(),
|
||||||
&ProjectExplorer::ProjectManager::startupProjectChanged,
|
&ProjectExplorer::ProjectManager::startupProjectChanged,
|
||||||
dd, &AxivionPluginPrivate::onStartupProjectChanged);
|
dd, &AxivionPluginPrivate::onStartupProjectChanged);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "axiviontr.h"
|
#include "axiviontr.h"
|
||||||
|
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
|
#include <projectexplorer/projectpanelfactory.h>
|
||||||
#include <projectexplorer/projectsettingswidget.h>
|
#include <projectexplorer/projectsettingswidget.h>
|
||||||
|
|
||||||
#include <utils/infolabel.h>
|
#include <utils/infolabel.h>
|
||||||
@@ -248,9 +249,23 @@ void AxivionProjectSettingsWidget::updateEnabledStates()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectSettingsWidget *AxivionProjectSettings::createSettingsWidget(ProjectExplorer::Project *project)
|
class AxivionProjectPanelFactory : public ProjectExplorer::ProjectPanelFactory
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
AxivionProjectPanelFactory()
|
||||||
|
{
|
||||||
|
setPriority(250);
|
||||||
|
setDisplayName(Tr::tr("Axivion"));
|
||||||
|
setCreateWidgetFunction([](ProjectExplorer::Project *project) {
|
||||||
return new AxivionProjectSettingsWidget(project);
|
return new AxivionProjectSettingsWidget(project);
|
||||||
|
});
|
||||||
|
ProjectExplorer::ProjectPanelFactory::registerFactory(this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void AxivionProjectSettings::setupProjectPanel()
|
||||||
|
{
|
||||||
|
static AxivionProjectPanelFactory theAxivionProjectPanelFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Axivion::Internal
|
} // Axivion::Internal
|
||||||
|
|||||||
@@ -5,10 +5,7 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer { class Project; }
|
||||||
class Project;
|
|
||||||
class ProjectSettingsWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Axivion::Internal {
|
namespace Axivion::Internal {
|
||||||
|
|
||||||
@@ -22,7 +19,7 @@ public:
|
|||||||
|
|
||||||
static AxivionProjectSettings *projectSettings(ProjectExplorer::Project *project);
|
static AxivionProjectSettings *projectSettings(ProjectExplorer::Project *project);
|
||||||
static void destroyProjectSettings();
|
static void destroyProjectSettings();
|
||||||
static ProjectExplorer::ProjectSettingsWidget *createSettingsWidget(ProjectExplorer::Project *project);
|
static void setupProjectPanel();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void load();
|
void load();
|
||||||
|
|||||||
Reference in New Issue
Block a user