2023-07-06 14:11:36 +02:00
|
|
|
// Copyright (C) 2023 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
|
|
|
|
|
|
|
|
#include "compilerexplorerconstants.h"
|
|
|
|
|
#include "compilerexplorereditor.h"
|
|
|
|
|
#include "compilerexplorersettings.h"
|
|
|
|
|
#include "compilerexplorertr.h"
|
|
|
|
|
|
|
|
|
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
|
|
|
|
#include <coreplugin/actionmanager/actionmanager.h>
|
|
|
|
|
#include <coreplugin/coreconstants.h>
|
|
|
|
|
#include <coreplugin/editormanager/editormanager.h>
|
|
|
|
|
#include <coreplugin/icore.h>
|
|
|
|
|
|
|
|
|
|
#include <cppeditor/cppeditorconstants.h>
|
|
|
|
|
|
2023-08-17 18:18:17 +02:00
|
|
|
#include <extensionsystem/iplugin.h>
|
2023-07-06 14:11:36 +02:00
|
|
|
|
2023-09-26 09:20:26 +02:00
|
|
|
#include <projectexplorer/jsonwizard/jsonwizardfactory.h>
|
|
|
|
|
|
2023-09-27 13:33:50 +02:00
|
|
|
#include <utils/fsengine/fileiconprovider.h>
|
|
|
|
|
|
2023-09-26 09:20:26 +02:00
|
|
|
#include <QMenu>
|
|
|
|
|
|
2023-08-17 18:18:17 +02:00
|
|
|
using namespace Core;
|
2023-12-13 16:45:31 +01:00
|
|
|
using namespace Utils;
|
2023-07-06 14:11:36 +02:00
|
|
|
|
2023-08-17 18:18:17 +02:00
|
|
|
namespace CompilerExplorer::Internal {
|
2023-07-06 14:11:36 +02:00
|
|
|
|
2023-08-17 18:18:17 +02:00
|
|
|
class CompilerExplorerPlugin : public ExtensionSystem::IPlugin
|
2023-07-06 14:11:36 +02:00
|
|
|
{
|
2023-08-17 18:18:17 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "CompilerExplorer.json")
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
void initialize() override
|
|
|
|
|
{
|
|
|
|
|
static CompilerExplorer::EditorFactory ceEditorFactory;
|
2023-07-06 14:11:36 +02:00
|
|
|
|
2023-12-13 16:45:31 +01:00
|
|
|
FileIconProvider::registerIconForMimeType(QIcon(":/compilerexplorer/logos/ce.ico"),
|
|
|
|
|
"application/compiler-explorer");
|
2023-09-27 13:33:50 +02:00
|
|
|
|
2023-09-26 09:20:26 +02:00
|
|
|
ProjectExplorer::JsonWizardFactory::addWizardPath(":/compilerexplorer/wizard/");
|
|
|
|
|
|
2023-12-13 16:45:31 +01:00
|
|
|
const Id menuId = "Tools.CompilerExplorer";
|
2023-08-17 18:18:17 +02:00
|
|
|
ActionContainer *mtools = ActionManager::actionContainer(Core::Constants::M_TOOLS);
|
2023-12-13 16:45:31 +01:00
|
|
|
ActionContainer *mCompilerExplorer = ActionManager::createMenu(menuId);
|
2023-08-17 18:18:17 +02:00
|
|
|
QMenu *menu = mCompilerExplorer->menu();
|
|
|
|
|
menu->setTitle(Tr::tr("Compiler Explorer"));
|
|
|
|
|
mtools->addMenu(mCompilerExplorer);
|
2023-07-06 14:11:36 +02:00
|
|
|
|
2023-12-13 16:45:31 +01:00
|
|
|
ActionBuilder openAction(this, "CompilerExplorer.CompilerExplorerAction");
|
|
|
|
|
openAction.setText(Tr::tr("Open Compiler Explorer"));
|
|
|
|
|
openAction.addToContainer(menuId);
|
|
|
|
|
openAction.addOnTriggered(this, [] {
|
|
|
|
|
QString name = "Compiler Explorer $";
|
|
|
|
|
Core::EditorManager::openEditorWithContents(Constants::CE_EDITOR_ID,
|
|
|
|
|
&name,
|
|
|
|
|
settings().defaultDocument().toUtf8());
|
|
|
|
|
});
|
2023-08-17 18:18:17 +02:00
|
|
|
}
|
|
|
|
|
};
|
2023-07-06 14:11:36 +02:00
|
|
|
|
2023-08-17 08:50:33 +02:00
|
|
|
} // namespace CompilerExplorer::Internal
|
2023-07-06 14:11:36 +02:00
|
|
|
|
2023-08-17 18:18:17 +02:00
|
|
|
#include "compilerexplorerplugin.moc"
|