-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebBrowserPlugin.cpp
More file actions
85 lines (68 loc) · 2.43 KB
/
WebBrowserPlugin.cpp
File metadata and controls
85 lines (68 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//
/// \file KDevelop-WebBrowser/WebBrowserPlugin.cpp
/// \brief Plugin for a simple webbrowser in KDevelop
//
// Copyright (C) 2012 Kenneth Perry (thothonegan@gmail.com)
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
#include "WebBrowserPlugin.h"
#include <kaboutdata.h>
#include <kpluginfactory.h>
#include <kpluginloader.h>
#include <interfaces/icore.h>
#include <interfaces/iuicontroller.h>
#include "WebBrowserView.h"
K_PLUGIN_FACTORY (WebBrowserFactory, registerPlugin<WebBrowserPlugin>(); )
K_EXPORT_PLUGIN (WebBrowserFactory (KAboutData ("WebBrowser", "WebBrowser",
ki18n("WebBrowser Plugin"), "1.0", ki18n("Simple webbrowser for KDevelop"),
KAboutData ::License_GPL)))
class WebBrowserViewFactory : public KDevelop::IToolViewFactory
{
public:
WebBrowserViewFactory (WebBrowserPlugin* plugin)
: m_plugin (plugin)
{}
virtual QWidget* create (QWidget* parent = NULL)
{ return new WebBrowserView (m_plugin, parent); }
QList<QAction*> toolBarActions (QWidget* w) const
{
WebBrowserView* view = qobject_cast<WebBrowserView*> (w);
if (view)
return view->toolBarActions();
return KDevelop::IToolViewFactory::toolBarActions(w);
}
virtual Qt::DockWidgetArea defaultPosition (void)
{ return Qt::RightDockWidgetArea; }
virtual QString id() const
{ return "com.hackerguild.KDevelop.WebBrowser"; }
private:
WebBrowserPlugin* m_plugin;
};
WebBrowserPlugin::WebBrowserPlugin (QObject* parent, const QVariantList& args)
: IPlugin(WebBrowserFactory::componentData(), parent)
{
init();
}
WebBrowserPlugin::~WebBrowserPlugin (void)
{}
void WebBrowserPlugin::unload (void)
{}
// --- private slots ---
void WebBrowserPlugin::init (void)
{
m_factory = new WebBrowserViewFactory (this);
core()->uiController()->addToolView("WebBrowser", m_factory);
}