Skip to content
Snippets Groups Projects
Commit c0344c6d authored by hjk's avatar hjk
Browse files

Fixes: make "Hello World" plugin compilabe

RevBy:  con

make "Hello World" plugin compilabe
parent b904780f
No related branches found
No related tags found
No related merge requests found
...@@ -33,26 +33,21 @@ ...@@ -33,26 +33,21 @@
#include "helloworldplugin.h" #include "helloworldplugin.h"
#include "helloworldwindow.h"
#include <coreplugin/modemanager.h>
#include <coreplugin/actionmanager/actionmanagerinterface.h> #include <coreplugin/actionmanager/actionmanagerinterface.h>
#include <extensionsystem/pluginmanager.h> #include <coreplugin/basemode.h>
#include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
#include <coreplugin/modemanager.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/qplugin.h> #include <QtCore/QtPlugin>
#include <QtGui/QAction> #include <QtGui/QAction>
#include <QtGui/QMenu> #include <QtGui/QMenu>
#include <QtGui/QMessageBox> #include <QtGui/QMessageBox>
#include <QtGui/QPushButton> #include <QtGui/QPushButton>
#include <coreplugin/CoreTools>
#include "helloworldplugin.h"
using namespace HelloWorld::Internal; using namespace HelloWorld::Internal;
/*! Constructs the Hello World plugin. Normally plugins don't do anything in /*! Constructs the Hello World plugin. Normally plugins don't do anything in
...@@ -77,30 +72,20 @@ HelloWorldPlugin::~HelloWorldPlugin() ...@@ -77,30 +72,20 @@ HelloWorldPlugin::~HelloWorldPlugin()
\a error_message can be used to pass an error message to the plugin system, \a error_message can be used to pass an error message to the plugin system,
if there was any. if there was any.
*/ */
bool HelloWorldPlugin::initialize(const QStringList & /*arguments*/, QString *error_message) bool HelloWorldPlugin::initialize(const QStringList &arguments, QString *error_message)
{ {
Q_UNUSED(arguments)
Q_UNUSED(error_message) Q_UNUSED(error_message)
// Get the primary access point to the workbench. // Get the primary access point to the workbench.
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
// Create our own widget that we want to show in a view in the IDE.
HelloWorldWindow *window = new HelloWorldWindow;
// Create a unique context id for our own view, that will be used for the // Create a unique context id for our own view, that will be used for the
// menu entry later. // menu entry later.
QList<int> context = QList<int>() QList<int> context = QList<int>()
<< core->uniqueIDManager()->uniqueIdentifier( << core->uniqueIDManager()->uniqueIdentifier(
QLatin1String("HelloWorld.MainView")); QLatin1String("HelloWorld.MainView"));
// Create a new view that contains our widget and register it with the
// plugin manager. The view will have the id "HelloWorld.HelloWorldWindow",
// and if it has focus it provides 'context' to the context list in
// Qt Creator. It will be put into the right dock widget area.
addAutoReleasedObject(new Core::BaseView("HelloWorld.HelloWorldWindow",
window, context,
Qt::RightDockWidgetArea));
// Create an action to be triggered by a menu entry // Create an action to be triggered by a menu entry
QAction *helloWorldAction = new QAction("Say \"&Hello World!\"", this); QAction *helloWorldAction = new QAction("Say \"&Hello World!\"", this);
connect(helloWorldAction, SIGNAL(triggered()), SLOT(sayHelloWorld())); connect(helloWorldAction, SIGNAL(triggered()), SLOT(sayHelloWorld()));
...@@ -126,13 +111,15 @@ bool HelloWorldPlugin::initialize(const QStringList & /*arguments*/, QString *er ...@@ -126,13 +111,15 @@ bool HelloWorldPlugin::initialize(const QStringList & /*arguments*/, QString *er
actionManager->actionContainer(Core::Constants::M_TOOLS); actionManager->actionContainer(Core::Constants::M_TOOLS);
toolsMenu->addMenu(helloWorldMenu); toolsMenu->addMenu(helloWorldMenu);
// Add a mode with a push button based on BaseMode. Like the BaseView, it will unregister // Add a mode with a push button based on BaseMode. Like the BaseView,
// itself from the plugin manager when it is deleted. // it will unregister itself from the plugin manager when it is deleted.
addAutoReleasedObject(new Core::BaseMode(tr("Hello world!"), Core::BaseMode *baseMode = new Core::BaseMode;
"HelloWorld.HelloWorldMode", baseMode->setUniqueModeName("HelloWorld.HelloWorldMode");
QIcon(), baseMode->setName(tr("Hello world!"));
0, // priority baseMode->setIcon(QIcon());
new QPushButton(tr("Hello World PushButton!")))); baseMode->setPriority(0);
baseMode->setWidget(new QPushButton(tr("Hello World PushButton!")));
addAutoReleasedObject(baseMode);
// Add the Hello World action command to the mode manager (with 0 priority) // Add the Hello World action command to the mode manager (with 0 priority)
Core::ModeManager *modeManager = core->modeManager(); Core::ModeManager *modeManager = core->modeManager();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment