aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/extensionmanager/extensionmanagerplugin.cpp
diff options
context:
space:
mode:
authorhjk <[email protected]>2023-11-13 16:35:01 +0100
committerAlessandro Portale <[email protected]>2023-12-11 12:10:36 +0000
commitf97fd83fc911c056404c1d046ee4c390c8612ed3 (patch)
tree72b09e0f323afec5ed330fa4cd414864fc5a3f9a /src/plugins/extensionmanager/extensionmanagerplugin.cpp
parentfb28890eb2107c5ce75cf48945920a13a1a153bc (diff)
Plugins: Add skeleton for new ExtensionManager plugin
This initial commit is merely a mockup of a ExtensionManager concept. Change-Id: I19b2285667678a86097c043cc27a554545559eff Reviewed-by: Alessandro Portale <[email protected]> Reviewed-by: hjk <[email protected]>
Diffstat (limited to 'src/plugins/extensionmanager/extensionmanagerplugin.cpp')
-rw-r--r--src/plugins/extensionmanager/extensionmanagerplugin.cpp91
1 files changed, 91 insertions, 0 deletions
diff --git a/src/plugins/extensionmanager/extensionmanagerplugin.cpp b/src/plugins/extensionmanager/extensionmanagerplugin.cpp
new file mode 100644
index 00000000000..1e7eecff16b
--- /dev/null
+++ b/src/plugins/extensionmanager/extensionmanagerplugin.cpp
@@ -0,0 +1,91 @@
+// 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 "extensionmanagertr.h"
+
+#include "extensionmanagerconstants.h"
+#include "extensionmanagerwidget.h"
+
+#include <coreplugin/actionmanager/actioncontainer.h>
+#include <coreplugin/actionmanager/actionmanager.h>
+#include <coreplugin/actionmanager/command.h>
+#include <coreplugin/coreconstants.h>
+#include <coreplugin/icontext.h>
+#include <coreplugin/icore.h>
+#include <coreplugin/imode.h>
+#include <coreplugin/modemanager.h> // TODO: Remove!
+
+#include <extensionsystem/iplugin.h>
+#include <extensionsystem/pluginspec.h>
+
+#include <utils/icon.h>
+#include <utils/layoutbuilder.h>
+#include <utils/styledbar.h>
+
+#include <QAction>
+#include <QMainWindow>
+
+using namespace ExtensionSystem;
+using namespace Core;
+using namespace Utils;
+
+namespace ExtensionManager::Internal {
+
+class ExtensionManagerMode final : public IMode
+{
+public:
+ ExtensionManagerMode()
+ {
+ setObjectName("ExtensionManagerMode");
+ setId(Constants::C_EXTENSIONMANAGER);
+ setContext(Context(Constants::MODE_EXTENSIONMANAGER));
+ setDisplayName(Tr::tr("Extensions"));
+ const Icon FLAT({{":/extensionmanager/images/mode_extensionmanager_mask.png",
+ Theme::IconsBaseColor}});
+ const Icon FLAT_ACTIVE({{":/extensionmanager/images/mode_extensionmanager_mask.png",
+ Theme::IconsModeWelcomeActiveColor}});
+ setIcon(Utils::Icon::modeIcon(FLAT, FLAT, FLAT_ACTIVE));
+ setPriority(72);
+
+ using namespace Layouting;
+ auto widget = Column {
+ new StyledBar,
+ new ExtensionManagerWidget,
+ noMargin, spacing(0),
+ }.emerge();
+
+ setWidget(widget);
+ }
+
+ ~ExtensionManagerMode() { delete widget(); }
+};
+
+class ExtensionManagerPlugin final : public ExtensionSystem::IPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "ExtensionManager.json")
+
+public:
+ ~ExtensionManagerPlugin() final
+ {
+ delete m_mode;
+ }
+
+ void initialize() final
+ {
+ m_mode = new ExtensionManagerMode;
+ }
+
+ bool delayedInitialize() final
+ {
+ ModeManager::activateMode(m_mode->id()); // TODO: Remove!
+ return true;
+ }
+
+private:
+ ExtensionManagerMode *m_mode = nullptr;
+};
+
+} // ExtensionManager::Internal
+
+#include "extensionmanagerplugin.moc"