Remove QtScript dependency

It's not used anywhere.

REVIEW: 127312
This commit is contained in:
David Rosca 2016-03-09 11:29:50 +01:00
parent 5b0ec83c36
commit d405378219
7 changed files with 1 additions and 152 deletions

View File

@ -46,7 +46,7 @@ endif()
set (REQUIRED_QT_VERSION "5.3.0")
find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE COMPONENTS Quick Gui Sql Qml Svg Script)
find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE COMPONENTS Quick Gui Sql Qml Svg)
find_package(KF5Activities ${KF5_DEP_VERSION} REQUIRED)
find_package(KF5Archive ${KF5_DEP_VERSION} REQUIRED)

View File

@ -19,7 +19,6 @@ set(corebindings_SRCS
tooltip.cpp
tooltipdialog.cpp
serviceoperationstatus.cpp
dataenginebindings.cpp
iconitem.cpp
units.cpp
windowthumbnail.cpp
@ -27,7 +26,6 @@ set(corebindings_SRCS
add_library(corebindingsplugin SHARED ${corebindings_SRCS})
target_link_libraries(corebindingsplugin
Qt5::Script
Qt5::Quick
Qt5::Qml
KF5::Declarative

View File

@ -23,7 +23,6 @@
#include "corebindingsplugin.h"
#include <QQmlContext>
#include <QScriptEngine>
#include <kdeclarative/kdeclarative.h>

View File

@ -1,66 +0,0 @@
/*
* Copyright 2007 Richard J. Moore <rich@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License version 2 as
* published by the Free Software Foundation
*
* 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 Library 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 "dataenginebindings_p.h"
typedef Plasma::Service *ServicePtr;
QScriptValue qScriptValueFromService(QScriptEngine *engine, const ServicePtr &service)
{
return engine->newQObject(const_cast<Plasma::Service *>(service), QScriptEngine::AutoOwnership, QScriptEngine::PreferExistingWrapperObject);
}
void serviceFromQScriptValue(const QScriptValue &scriptValue, ServicePtr &service)
{
QObject *obj = scriptValue.toQObject();
service = static_cast<Plasma::Service *>(obj);
}
typedef Plasma::DataEngine *DataEnginePtr;
QScriptValue qScriptValueFromDataEngine(QScriptEngine *engine, const DataEnginePtr &dataEngine)
{
return engine->newQObject(const_cast<Plasma::DataEngine *>(dataEngine), QScriptEngine::AutoOwnership, QScriptEngine::PreferExistingWrapperObject);
}
void dataEngineFromQScriptValue(const QScriptValue &scriptValue, DataEnginePtr &dataEngine)
{
QObject *obj = scriptValue.toQObject();
dataEngine = static_cast<Plasma::DataEngine *>(obj);
}
typedef Plasma::ServiceJob *ServiceJobPtr;
QScriptValue qScriptValueFromServiceJob(QScriptEngine *engine, const ServiceJobPtr &serviceJob)
{
return engine->newQObject(const_cast<Plasma::ServiceJob *>(serviceJob), QScriptEngine::AutoOwnership, QScriptEngine::PreferExistingWrapperObject);
}
void serviceJobFromQScriptValue(const QScriptValue &scriptValue, ServiceJobPtr &serviceJob)
{
QObject *obj = scriptValue.toQObject();
serviceJob = static_cast<Plasma::ServiceJob *>(obj);
}
void registerDataEngineMetaTypes(QScriptEngine *engine)
{
qRegisterMetaType<Plasma::DataEngine::Data>("Plasma::DataEngine::Data");
qRegisterMetaType<Plasma::DataEngine::Data>("DataEngine::Data");
qScriptRegisterMapMetaType<Plasma::DataEngine::Data>(engine);
qScriptRegisterMetaType<Plasma::Service *>(engine, qScriptValueFromService, serviceFromQScriptValue);
qScriptRegisterMetaType<Plasma::DataEngine *>(engine, qScriptValueFromDataEngine, dataEngineFromQScriptValue);
qScriptRegisterMetaType<Plasma::ServiceJob *>(engine, qScriptValueFromServiceJob, serviceJobFromQScriptValue);
}

View File

@ -1,80 +0,0 @@
/*
* Copyright 2007 Richard J. Moore <rich@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License version 2 as
* published by the Free Software Foundation
*
* 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 Library 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.
*/
#ifndef DATAENGINEBIND_H
#define DATAENGINEBIND_H
#include <QScriptEngine>
#include <QScriptValue>
#include <QScriptValueIterator>
#include <plasma/dataengine.h>
#include <plasma/service.h>
#include <plasma/servicejob.h>
Q_DECLARE_METATYPE(Plasma::DataEngine::Dict)
Q_DECLARE_METATYPE(Plasma::DataEngine::Data)
template <class M>
QScriptValue qScriptValueFromMap(QScriptEngine *eng, const M &map)
{
//qDebug() << "qScriptValueFromMap called";
QScriptValue obj = eng->newObject();
typename M::const_iterator begin = map.constBegin();
typename M::const_iterator end = map.constEnd();
typename M::const_iterator it;
for (it = begin; it != end; ++it) {
if (it.value().type() == QVariant::Hash) {
obj.setProperty(it.key(), qScriptValueFromMap(eng, it.value().toHash()));
} else if (it.value().type() == QVariant::Map) {
obj.setProperty(it.key(), qScriptValueFromMap(eng, it.value().toMap()));
} else {
obj.setProperty(it.key(), qScriptValueFromValue(eng, it.value()));
}
}
return obj;
}
template <class M>
void qScriptValueToMap(const QScriptValue &value, M &map)
{
//qDebug() << "qScriptValueToMap called";
QScriptValueIterator it(value);
while (it.hasNext()) {
it.next();
map[it.name()] = qscriptvalue_cast<typename M::mapped_type>(it.value());
}
}
template<typename T>
int qScriptRegisterMapMetaType(
QScriptEngine *engine,
const QScriptValue &prototype = QScriptValue()
#ifndef qdoc
, T * /* dummy */ = 0
#endif
)
{
return qScriptRegisterMetaType<T>(engine, qScriptValueFromMap, qScriptValueToMap, prototype);
}
void registerDataEngineMetaTypes(QScriptEngine *engine);
#endif // DATAENGINE_H

View File

@ -28,7 +28,6 @@ kcoreaddons_desktop_to_json(
target_link_libraries(plasma_appletscript_declarative
Qt5::Quick
Qt5::Qml
Qt5::Script
KF5::Activities
KF5::KIOCore
KF5::KIOWidgets

View File

@ -23,7 +23,6 @@
#define APPLETINTERFACE_H
#include <QQuickItem>
#include <QScriptValue>
#include <QQuickView>
#include <Plasma/Applet>