CompilerExplorer: Inline compilerexplorerplugin.h

Makes adding unwanted functionality in this place harder.

Change-Id: I2b36414b4bf6a58deff3c565936d433ebcdc9d5f
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
hjk
2023-08-17 18:18:17 +02:00
parent c9a9dbc96b
commit 519a95ce5b
4 changed files with 32 additions and 54 deletions

View File

@@ -17,7 +17,6 @@ add_qtc_plugin(CompilerExplorer
compilerexploreraspects.cpp compilerexploreraspects.cpp
compilerexploreraspects.h compilerexploreraspects.h
compilerexplorerplugin.cpp compilerexplorerplugin.cpp
compilerexplorerplugin.h
compilerexplorertr.h compilerexplorertr.h
compilerexplorereditor.cpp compilerexplorereditor.cpp
compilerexplorereditor.h compilerexplorereditor.h

View File

@@ -30,7 +30,6 @@ QtcPlugin {
"compilerexploreroptions.cpp", "compilerexploreroptions.cpp",
"compilerexploreroptions.h", "compilerexploreroptions.h",
"compilerexplorerplugin.cpp", "compilerexplorerplugin.cpp",
"compilerexplorerplugin.h",
"compilerexplorersettings.cpp", "compilerexplorersettings.cpp",
"compilerexplorersettings.h", "compilerexplorersettings.h",
"compilerexplorertr.h", "compilerexplorertr.h",

View File

@@ -1,8 +1,6 @@
// Copyright (C) 2023 The Qt Company Ltd. // Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "compilerexplorerplugin.h"
#include "compilerexplorerconstants.h" #include "compilerexplorerconstants.h"
#include "compilerexplorereditor.h" #include "compilerexplorereditor.h"
#include "compilerexplorersettings.h" #include "compilerexplorersettings.h"
@@ -18,14 +16,22 @@
#include <QMenu> #include <QMenu>
namespace CompilerExplorer { #include <extensionsystem/iplugin.h>
namespace Internal {
CompilerExplorerPlugin::CompilerExplorerPlugin() {} using namespace Core;
CompilerExplorerPlugin::~CompilerExplorerPlugin() {} namespace CompilerExplorer::Internal {
void CompilerExplorerPlugin::initialize() class CompilerExplorerPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "CompilerExplorer.json")
public:
CompilerExplorerPlugin();
~CompilerExplorerPlugin() override;
void initialize() override
{ {
static CompilerExplorer::EditorFactory ceEditorFactory; static CompilerExplorer::EditorFactory ceEditorFactory;
@@ -35,22 +41,20 @@ void CompilerExplorerPlugin::initialize()
const QString src = settings.source(); const QString src = settings.source();
QString name("Compiler Explorer"); QString name("Compiler Explorer");
Core::EditorManager::openEditorWithContents(Constants::CE_EDITOR_ID, &name, src.toUtf8()); EditorManager::openEditorWithContents(Constants::CE_EDITOR_ID, &name, src.toUtf8());
}); });
Core::ActionContainer *mtools = Core::ActionManager::actionContainer(Core::Constants::M_TOOLS); ActionContainer *mtools = ActionManager::actionContainer(Core::Constants::M_TOOLS);
Core::ActionContainer *mCompilerExplorer = Core::ActionManager::createMenu( ActionContainer *mCompilerExplorer = ActionManager::createMenu("Tools.CompilerExplorer");
"Tools.CompilerExplorer");
QMenu *menu = mCompilerExplorer->menu(); QMenu *menu = mCompilerExplorer->menu();
menu->setTitle(Tr::tr("Compiler Explorer")); menu->setTitle(Tr::tr("Compiler Explorer"));
mtools->addMenu(mCompilerExplorer); mtools->addMenu(mCompilerExplorer);
Core::Command *cmd Command *cmd = ActionManager::registerAction(action, "CompilerExplorer.CompilerExplorerAction");
= Core::ActionManager::registerAction(action, "CompilerExplorer.CompilerExplorerAction");
mCompilerExplorer->addAction(cmd); mCompilerExplorer->addAction(cmd);
} }
};
void CompilerExplorerPlugin::extensionsInitialized() {} } // CompilerExplorer::Internl
} // namespace Internal #include "compilerexplorerplugin.moc"
} // namespace CompilerExplorer

View File

@@ -1,24 +0,0 @@
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include <extensionsystem/iplugin.h>
namespace CompilerExplorer::Internal {
class CompilerExplorerPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "CompilerExplorer.json")
public:
CompilerExplorerPlugin();
~CompilerExplorerPlugin() override;
void initialize() override;
void extensionsInitialized() override;
};
} // namespace CompilerExplorer::Internal