Copilot: Use new construction pattern for project panel factory

Change-Id: Id703f377f353390e63535a0c98078c66909cbdd4
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2023-11-15 09:08:13 +01:00
parent 9967877b7a
commit 9f0198d8ed
3 changed files with 25 additions and 19 deletions

View File

@@ -2,21 +2,22 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "copilotprojectpanel.h"
#include "copilotconstants.h"
#include "copilotsettings.h"
#include "copilottr.h"
#include <projectexplorer/project.h>
#include <projectexplorer/projectpanelfactory.h>
#include <projectexplorer/projectsettingswidget.h>
#include <utils/layoutbuilder.h>
#include <QWidget>
using namespace ProjectExplorer;
namespace Copilot::Internal {
class CopilotProjectSettingsWidget : public ProjectExplorer::ProjectSettingsWidget
class CopilotProjectSettingsWidget final : public ProjectSettingsWidget
{
public:
CopilotProjectSettingsWidget()
@@ -26,10 +27,9 @@ public:
}
};
ProjectSettingsWidget *createCopilotProjectPanel(Project *project)
static ProjectSettingsWidget *createCopilotProjectPanel(Project *project)
{
using namespace Layouting;
using namespace ProjectExplorer;
auto widget = new CopilotProjectSettingsWidget;
auto settings = new CopilotProjectSettings(project);
@@ -57,4 +57,21 @@ ProjectSettingsWidget *createCopilotProjectPanel(Project *project)
return widget;
}
class CopilotProjectPanelFactory final : public ProjectPanelFactory
{
public:
CopilotProjectPanelFactory()
{
setPriority(1000);
setDisplayName(Tr::tr("Copilot"));
setCreateWidgetFunction(&createCopilotProjectPanel);
ProjectPanelFactory::registerFactory(this);
}
};
void setupCopilotProjectPanel()
{
static CopilotProjectPanelFactory theCopilotProjectPanelFactory;
}
} // namespace Copilot::Internal