• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Kross

  • sources
  • kde-4.12
  • kdelibs
  • kross
  • qts
qts/plugin.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * plugin.cpp
3  * This file is part of the KDE project
4  * copyright (C)2007 by Sebastian Sauer (mail@dipe.org)
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  * You should have received a copy of the GNU Library General Public License
15  * along with this program; see the file COPYING. If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  ***************************************************************************/
19 
20 #include "plugin.h"
21 #include "values_p.h"
22 
23 #include "../core/manager.h"
24 
25 #include <QDebug>
26 
27 using namespace Kross;
28 
29 Q_EXPORT_PLUGIN2(krossqtsplugin, Kross::EcmaPlugin)
30 
31 namespace Kross {
32 
34  class EcmaPlugin::Private
35  {
36  public:
37  QScriptValue manager;
38  };
39 
40 }
41 
42 EcmaPlugin::EcmaPlugin(QObject* parent)
43  : QScriptExtensionPlugin(parent)
44  , d(new Private)
45 {
46  //qDebug()<<QString("EcmaPlugin Ctor");
47 }
48 
49 EcmaPlugin::~EcmaPlugin()
50 {
51  //qDebug()<<QString("EcmaPlugin Dtor");
52  delete d;
53 }
54 
55 void EcmaPlugin::initialize(const QString& key, QScriptEngine* engine)
56 {
57  if( key.toLower() == "kross" ) {
58  QScriptValue global = engine->globalObject();
59 
60  //QScriptContext *context = engine->currentContext();
61  d->manager = engine->newQObject( &Kross::Manager::self() );
62  global.setProperty("Kross", d->manager);
63 
64  initializeCore(engine);
65  initializeGui(engine);
66  }
67  else
68  qDebug()<<QString("Plugin::initialize unhandled key=%1").arg(key);
69 }
70 
71 QStringList EcmaPlugin::keys() const
72 {
73  //qDebug()<<"> Plugin::keys";
74  return QStringList() << "kross";
75 }
76 
Kross::EcmaPlugin::~EcmaPlugin
virtual ~EcmaPlugin()
Destructor.
Definition: qts/plugin.cpp:49
Kross::EcmaPlugin
Kross QtScript Extension that provides access to the Kross Scripting Framework within the QtScript sc...
Definition: qts/plugin.h:45
QScriptExtensionPlugin
Kross::EcmaPlugin::initialize
virtual void initialize(const QString &key, QScriptEngine *engine)
Initializes this extension.
Definition: qts/plugin.cpp:55
QString
QObject
Kross::initializeCore
void initializeCore(QScriptEngine *engine)
Initialize some core functionality like common used types we like to use within scripts.
Definition: values_p.h:251
QStringList
Kross::initializeGui
void initializeGui(QScriptEngine *engine)
Initialize GUI functionality like widgets the QUiLoader provides and some layout-managers.
Definition: values_p.h:285
Kross::EcmaPlugin::EcmaPlugin
EcmaPlugin(QObject *parent=0)
Constructor.
Definition: qts/plugin.cpp:42
Kross::Manager::self
static Manager & self()
Return the Manager instance.
Definition: manager.cpp:73
plugin.h
Kross::EcmaPlugin::keys
virtual QStringList keys() const
Returns the list of keys this plugin supports.
Definition: qts/plugin.cpp:71
values_p.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:54 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Kross

Skip menu "Kross"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal