Page MenuHomePhorge

No OneTemporary

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a451335419..55b9539764 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,408 +1,408 @@
cmake_minimum_required(VERSION 2.8.7)
project(kdelibs)
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
# Make CPack available to easy generate binary packages
include(CPack)
find_file(FOUND_KDE4_HEADERS kglobal.h)
if (${FOUND_KDE4_HEADERS})
string(REGEX MATCH ${CMAKE_INSTALL_PREFIX} COMPATIBLE_HEADERS_TEST ${FOUND_KDE4_HEADERS})
if (NOT ${COMPATIBLE_HEADERS_TEST})
message("Found KDE4 headers. This will cause compiling failures while developing KDE Frameworks 5. Uninstall distro installed headers if applicable")
message("FOUND: ${FOUND_KDE4_HEADERS}")
return()
endif()
endif()
################# set KDE specific information #################
set (KDE_VERSION_MAJOR 4)
set (KDE_VERSION_MINOR 90)
set (KDE_VERSION_RELEASE 00)
set (KDE_VERSION "${KDE_VERSION_MAJOR}.${KDE_VERSION_MINOR}.${KDE_VERSION_RELEASE}" )
set (KDE_VERSION_STRING "${KDE_VERSION} (4.90.0 (KDE Frameworks >= 20120113)")
set (KDE_DISTRIBUTION_TEXT "compiled sources" CACHE STRING "Indicate the distribution in bug reports" )
# win32: give kde home in debug mode a different name as the release home dir because the settings and caches are different
if (WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug")
set (_KDE_DEFAULT_HOME_POSTFIX "-debug" CACHE STRING "default KDE home directory postfix" )
endif (WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug")
set (KDE_DEFAULT_HOME ".kde${_KDE_DEFAULT_HOME_POSTFIX}" CACHE STRING "The default KDE home directory" )
# this must be before FindKDE4Internal in order to preset the result of the visibility test, so that it will be skipped
option(KHTML_BUILD_TESTREGRESSION "Build KHTML's testregression. Note: this disables hidden visibility")
# Disable visibility if testregression is built, because the symbols are needed then
if (KHTML_BUILD_TESTREGRESSION)
set (__KDE_HAVE_GCC_VISIBILITY 0)
endif (KHTML_BUILD_TESTREGRESSION)
option(STATIC_LIBRARY "Build kdelibs as static libraries." FALSE)
option(QT5_BUILD "Build kdelibs against Qt5." FALSE)
find_package(extra-cmake-modules 0.0.2 REQUIRED)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${EXTRA_CMAKE_MODULES_MODULE_PATH})
if (NOT QT5_BUILD)
add_subdirectory( libinqt5 )
set(INQT5_LIBRARY inqt5)
include_directories(
${CMAKE_SOURCE_DIR}/libinqt5/src/
${CMAKE_BINARY_DIR}/libinqt5/src/
)
endif()
add_subdirectory( libqtmimetypes )
add_subdirectory( tier1 )
set(CMAKE_AUTOMOC ON)
# By default don't add any linked libraries to the "exported"
# link interfaces of shared libraries, so that executables linking
# against these libraries will not automatically add implicit
# dependencies to their link list.
#
# This reduces inter-package dependencies and makes it easier to remove
# dependencies of shared libraries without breaking binary compatibility.
set(CMAKE_LINK_INTERFACE_LIBRARIES "")
################# write platform profile file which will be installed #################
include(CreateKDEPlatformProfile.cmake)
if(KDE_PLATFORM_FEATURE_DISABLE_DEPRECATED)
set(KDE_NO_DEPRECATED TRUE)
endif(KDE_PLATFORM_FEATURE_DISABLE_DEPRECATED)
############### Load the CTest options ###############
# CTestCustom.cmake has to be in the CTEST_BINARY_DIR.
# in the KDE build system, this is the same as CMAKE_BINARY_DIR.
configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}/CTestCustom.cmake COPYONLY)
################# now find all used packages #################
set (QT_MIN_VERSION "4.7.0")
find_package(KDE4Internal REQUIRED)
include(KDE4Defaults)
include (MacroLibrary)
if (APPLE)
find_package(Carbon REQUIRED)
endif (APPLE)
if(UNIX AND Q_WS_X11)
#X11 Session Management (SM) is required
#X11_SM_FOUND is set in FindX11, which is required by KDE4Internal
if(NOT X11_SM_FOUND)
message(FATAL_ERROR "\nThe X11 Session Management (SM) development package could not be found.\nPlease install libSM.\n")
endif(NOT X11_SM_FOUND)
endif(UNIX AND Q_WS_X11)
#required features:
# Perl is used e.g. in khtml, kjs, kjsembed and others
find_package(Perl)
macro_log_feature(PERL_FOUND "Perl" "Needed for building kdelibs" "http://www.perl.org" TRUE "" "")
find_package(ZLIB)
macro_log_feature(ZLIB_FOUND "ZLib" "Support for gzip compressed files and data streams" "http://www.zlib.net" TRUE "" "Required by the core KDE libraries and some critical kioslaves")
set(STRIGI_MIN_VERSION 0.6.3)
find_package(Strigi)
if (WIN32)
set (STRIGI_REQUIRED FALSE)
set (STRIGI_EXTRA_TEXT "")
else (WIN32)
set (STRIGI_REQUIRED TRUE)
set (STRIGI_EXTRA_TEXT "Required by some critical kioslaves")
endif (WIN32)
macro_log_feature(STRIGI_FOUND "Strigi" "Desktop indexing and search support" "http://strigi.sourceforge.net" ${STRIGI_REQUIRED} "${STRIGI_MIN_VERSION}" ${STRIGI_EXTRA_TEXT})
set(LIBATTICA_MIN_VERSION "0.1.90")
find_package(LibAttica)
macro_log_feature(LIBATTICA_FOUND "libattica" "Support for Get Hot New Stuff" "git clone git://anongit.kde.org/attica" TRUE "${LIBATTICA_MIN_VERSION}" "")
#optional features
if(X11_FOUND)
#X11_Xrender discovery is done by FindX11
macro_log_feature(X11_Xrender_FOUND "X Rendering Extension (libXrender)" "Support for compositing, rendering operations, and alpha-blending" "http://www.x.org" FALSE "" "STRONGLY RECOMMENDED")
macro_bool_to_01(X11_Xscreensaver_FOUND HAVE_XSCREENSAVER)
macro_bool_to_01(X11_XSync_FOUND HAVE_XSYNC)
macro_log_feature(HAVE_XSCREENSAVER "X Screensaver Extension (libXss)" "Support for KIdleTime (fallback mode)" "http://www.x.org/" FALSE "" "")
macro_log_feature(HAVE_XSYNC "X Sync Extension (libXext)" "Efficient operation of KIdleTime" "http://www.x.org/" FALSE "" "STRONGLY RECOMMENDED")
if(NOT HAVE_XSYNC AND NOT HAVE_XSCREENSAVER)
message(FATAL_ERROR "\nNeither the XSync (libXext) nor XScreensaver (libXss) development package was found.\nPlease install one of them (XSync is recommended)\n")
endif(NOT HAVE_XSYNC AND NOT HAVE_XSCREENSAVER)
endif(X11_FOUND)
find_package(OpenSSL)
macro_log_feature(OPENSSL_FOUND "OpenSSL" "Support for secure network communications (SSL and TLS)" "http://openssl.org" FALSE "" "STRONGLY RECOMMENDED: KDE uses OpenSSL for the bulk of secure communications, including secure web browsing via HTTPS")
find_package(Libintl)
macro_log_feature(LIBINTL_FOUND "Libintl" "Support for multiple languages" "http://www.gnu.org/software/gettext" FALSE "" "STRONGLY RECOMMENDED: Enables KDE to be available in many different languages")
find_package(QCA2)
macro_log_feature(QCA2_FOUND "QCA2" "Support for remote plasma widgets" "http://delta.affinix.com/qca" FALSE "2.0.0" "")
find_package(DBusMenuQt)
macro_log_feature(DBUSMENUQT_FOUND "DBusMenuQt" "Support for notification area menus via the DBusMenu protocol" "https://launchpad.net/libdbusmenu-qt" TRUE "" "")
################# Disallow in-source build #################
macro_ensure_out_of_source_build("kdelibs requires an out of source build. Please create a separate build directory and run 'cmake path_to_kdelibs [options]' there.")
# ... and warn in case of an earlier in-source build
set(generatedFileInSourceDir EXISTS ${kdelibs_SOURCE_DIR}/kdemacros.h OR EXISTS ${kdelibs_SOURCE_DIR}/config.h)
if(${generatedFileInSourceDir})
message(STATUS "kdemacros.h or config.h exists in your source directory.")
message(FATAL_ERROR "Please run svn-clean, it would seem that your source directory has generated files in it.")
endif(${generatedFileInSourceDir})
#########################################################################
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
remove_definitions(-DQT3_SUPPORT_WARNINGS -DQT3_SUPPORT)
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
################# setup the include directories #################
# for including config.h and for includes like <kparts/foo.h>
include_directories( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/interfaces)
if(QCA2_FOUND)
include_directories(
${QCA2_INCLUDE_DIR}
)
endif(QCA2_FOUND)
# Those variables for are only valid inside of kdelibs, of course.
# Use the one variable for the lib you depend upon.
# E.g. kdeui uses ${KDE4_KDECORE_INCLUDES}. Something that depends on kparts uses ${KDE4_KPARTS_INCLUDES}.
set(KDE4_KJS_INCLUDES ${CMAKE_SOURCE_DIR}/kjs
${CMAKE_BINARY_DIR}/kjs)
if(NOT WINCE)
set(KDE4_KDECORE_INCLUDES ${KDE4_KJS_INCLUDES} )
endif(NOT WINCE)
set(KDE4_KCONFIG_INCLUDES ${CMAKE_SOURCE_DIR}/kdecore/config
${CMAKE_SOURCE_DIR}/staging/kcoreaddons/src/io # for kurl.h
${CMAKE_BINARY_DIR}/staging/kcoreaddons/src
)
# kdecore depends on Qt and kcoreaddons (need only headers from kjs)
set(KDE4_KDECORE_INCLUDES ${KDE4_KDECORE_INCLUDES}
${CMAKE_SOURCE_DIR}/kdecore
${CMAKE_BINARY_DIR}/kdecore
${CMAKE_SOURCE_DIR}/kdecore/compression
${CMAKE_SOURCE_DIR}/kdecore/config
${CMAKE_SOURCE_DIR}/kdecore/date
${CMAKE_SOURCE_DIR}/kdecore/io
${CMAKE_SOURCE_DIR}/kdecore/kernel
${CMAKE_SOURCE_DIR}/kdecore/network
${CMAKE_SOURCE_DIR}/kdecore/services
${CMAKE_SOURCE_DIR}/kdecore/localization
${CMAKE_SOURCE_DIR}/kdecore/sycoca
${CMAKE_SOURCE_DIR}/kdecore/text
${CMAKE_SOURCE_DIR}/kdecore/util
${CMAKE_SOURCE_DIR}/kdecore/sonnet
${CMAKE_SOURCE_DIR}/staging/kcoreaddons/src/io
${CMAKE_SOURCE_DIR}/staging/kcoreaddons/src/kernel
${CMAKE_SOURCE_DIR}/staging/kcoreaddons/src/jobs
${CMAKE_SOURCE_DIR}/staging/kcoreaddons/src/text
${CMAKE_BINARY_DIR}/staging/kcoreaddons/src
${CMAKE_BINARY_DIR}/staging/kde4support/src
${CMAKE_SOURCE_DIR}/staging/kde4support/src
${CMAKE_SOURCE_DIR}/libqtmimetypes/include/QtMimeTypes
${QT_INCLUDES}
${_KDE4_PLATFORM_INCLUDE_DIRS})
# kdeui depends on kdecore
set(KDE4_KDEUI_INCLUDES ${CMAKE_SOURCE_DIR}/kdeui
${CMAKE_SOURCE_DIR}/kdeui/actions
${CMAKE_SOURCE_DIR}/kdeui/colors
${CMAKE_SOURCE_DIR}/kdeui/config
${CMAKE_SOURCE_DIR}/kdeui/dialogs
${CMAKE_SOURCE_DIR}/kdeui/findreplace
${CMAKE_SOURCE_DIR}/kdeui/fonts
${CMAKE_SOURCE_DIR}/kdeui/icons
${CMAKE_SOURCE_DIR}/kdeui/itemviews
${CMAKE_SOURCE_DIR}/kdeui/jobs
${CMAKE_SOURCE_DIR}/kdeui/kernel
${CMAKE_SOURCE_DIR}/kdeui/notifications
${CMAKE_SOURCE_DIR}/kdeui/paged
${CMAKE_SOURCE_DIR}/kdeui/plotting
${CMAKE_SOURCE_DIR}/kdeui/shortcuts
${CMAKE_SOURCE_DIR}/kdeui/sonnet
${CMAKE_SOURCE_DIR}/kdeui/util
${CMAKE_SOURCE_DIR}/kdeui/widgets
${CMAKE_SOURCE_DIR}/kdeui/windowmanagement
${CMAKE_SOURCE_DIR}/kdeui/xmlgui
${KDE4_KDECORE_INCLUDES})
# kio depends on kdeui
set(KDE4_KIO_INCLUDES ${CMAKE_SOURCE_DIR}/kio
${CMAKE_SOURCE_DIR}/kio/bookmarks
${CMAKE_SOURCE_DIR}/kio/kio
${CMAKE_SOURCE_DIR}/kio/kfile
${KDE4_KDEUI_INCLUDES})
# kpty
set(KDE4_KPTY_INCLUDES ${CMAKE_SOURCE_DIR}/kpty ${KDE4_KIO_INCLUDES} )
# kparts depends on kio
set(KDE4_KPARTS_INCLUDES ${CMAKE_SOURCE_DIR}/kparts
${KDE4_KIO_INCLUDES})
# kde3support depends on kparts
set(KDE4_KDE3SUPPORT_INCLUDES ${CMAKE_SOURCE_DIR}/kde3support
${CMAKE_SOURCE_DIR}/kde3support/kdecore
${CMAKE_SOURCE_DIR}/kde3support/kdeui
${CMAKE_SOURCE_DIR}/kde3support/kio
${KDE4_KPARTS_INCLUDES})
if(NOT WINCE)
set(KDE4_KHTML_INCLUDES ${CMAKE_SOURCE_DIR}/khtml)
endif(NOT WINCE)
################# configure checks and create the configured files #################
if(WINCE)
set(STATIC_LIBRARY ON)
add_definitions(-DSTATIC_INSTALL_PATH=L\\\"/programme/kde\\\")
endif(WINCE)
if(STATIC_LIBRARY)
set(LIBRARY_TYPE STATIC)
add_definitions(-DKDELIBS_STATIC_LIBS)
message(STATUS "Building kdelibs as static libraries")
else(STATIC_LIBRARY)
set(LIBRARY_TYPE SHARED)
endif(STATIC_LIBRARY)
# ACL stuff (used in kio/ and kioslaves/)
find_package(ACL)
macro_bool_to_01(ACL_FOUND HAVE_LIBACL HAVE_POSIX_ACL)
macro_log_feature(ACL_FOUND "LibACL" "Support for manipulating access control lists" "ftp://oss.sgi.com/projects/xfs/cmd_tars" FALSE "" "STRONGLY RECOMMENDED")
configure_file(config-acl.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-acl.h )
include(ConfigureChecks.cmake)
# now create config headers
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
configure_file(config-prefix.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-prefix.h )
configure_file(config-compiler.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-compiler.h )
configure_file(config-pty.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-pty.h )
configure_file(kdemacros.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdemacros.h )
# these two calls here should go somewhere else, Alex
check_library_exists(nsl gethostbyname "" HAVE_NSL_LIBRARY)
check_library_exists(socket connect "" HAVE_SOCKET_LIBRARY)
# TODO: Port away from this:
add_definitions(-DKDE_NO_WINDOWSYSTEM)
################# list the subdirectories #################
add_subdirectory( cmake )
add_subdirectory( kdecore )
add_subdirectory( staging )
add_subdirectory( tier2 )
if (UNIX)
add_subdirectory( kpty )
add_subdirectory( kdesu )
endif (UNIX)
if(NOT WINCE)
add_subdirectory( kjs )
add_subdirectory( kjsembed )
endif(NOT WINCE)
add_subdirectory( kconf_update )
add_subdirectory( licenses )
add_subdirectory( mimetypes )
add_subdirectory( kdeui )
add_subdirectory( dnssd )
add_subdirectory( security )
add_subdirectory( kio )
add_subdirectory( kded )
if (QT_QT3SUPPORT_FOUND)
add_subdirectory( kde3support )
endif (QT_QT3SUPPORT_FOUND)
add_subdirectory( kfile )
if(NOT WINCE)
add_subdirectory( kdoctools )
endif(NOT WINCE)
add_subdirectory( kioslave )
add_subdirectory( kparts )
add_subdirectory( kunitconversion )
if(NOT WINCE)
# TO BE SPLITTED OUT add_subdirectory( khtml )
endif(NOT WINCE)
add_subdirectory( interfaces )
add_subdirectory( kdewidgets )
+add_subdirectory( kross )
if (QT5_BUILD)
# This should be moved down and eventually removed when everything
# can be built with Qt5.
# The current problem is kdeui because it uses X11 stuff which is no longer in Qt.
return()
endif()
add_subdirectory( knewstuff )
add_subdirectory( kutils )
add_subdirectory( kinit )
add_subdirectory( knotify )
if(NOT WINCE)
add_subdirectory( kimgio )
endif(NOT WINCE)
-add_subdirectory( kross )
find_package(KdepimLibs 4.5.60)
macro_log_feature(KDEPIMLIBS_FOUND "kdepimlibs" "KDE PIM libraries" "http://www.kde.org" FALSE "" "Needed for building several Plasma DataEngines")
# Plasma needs gpgme++
if(KDEPIMLIBS_FOUND AND NOT WINCE)
add_subdirectory( plasma )
endif()
add_subdirectory( kdewebkit )
add_subdirectory( includes )
add_subdirectory( experimental )
macro_optional_add_subdirectory( doc )
################# write dependency file which will be installed #################
# Used in configure_file() and install(EXPORT)
set(KDE4_TARGET_PREFIX KDE4__)
include(CreateKDELibsDependenciesFile.cmake)
################# install files #################
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/kdemacros.h DESTINATION ${INCLUDE_INSTALL_DIR} )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/KDELibsDependencies.cmake DESTINATION ${DATA_INSTALL_DIR}/cmake/modules)
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/KDEPlatformProfile.cmake DESTINATION ${DATA_INSTALL_DIR}/cmake/modules)
# run a script before installing the exports files which deletes previously installed
# configuration specific export files KDELibs4(Library|Tools)Targets-<config>.cmake
# if the main exports file KDELibs4(Library|Tools)Targets.cmake has changed. This makes sure
# that this main file doesn't include older and different configuration specific exports files,
# which might have a different set of targets or targets with different names.
# The code for installing the exports files will soon go into a macro. Alex
install(CODE "set(EXPORT_FILES KDELibs4LibraryTargets.cmake KDELibs4ToolsTargets.cmake)"
CODE "set(EXPORT_INSTALL_DIR \"${DATA_INSTALL_DIR}/cmake/modules\")"
SCRIPT "${CMAKE_SOURCE_DIR}/cmake/modules/check_installed_exports_file.cmake" )
# No longer applicable, replaced with individual frameworks
# install( EXPORT kdelibsToolsTargets DESTINATION ${DATA_INSTALL_DIR}/cmake/modules NAMESPACE ${KDE4_TARGET_PREFIX} FILE KDELibs4ToolsTargets.cmake )
# the following will be the correct locations once cmake has the improved FIND_PACKAGE()
# install( FILES ${CMAKE_CURRENT_BINARY_DIR}/KDELibsDependencies.cmake DESTINATION ${PLUGIN_INSTALL_DIR}/cmake RENAME KDE4Config.cmake)
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
macro_display_feature_log()
diff --git a/kross/core/manager.cpp b/kross/core/manager.cpp
index 497405c797..b3ecec5d01 100644
--- a/kross/core/manager.cpp
+++ b/kross/core/manager.cpp
@@ -1,429 +1,430 @@
/***************************************************************************
* manager.cpp
* This file is part of the KDE project
* copyright (C)2004-2007 by Sebastian Sauer (mail@dipe.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
* You should have received a copy of the GNU Library General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
***************************************************************************/
#include "manager.h"
#include "interpreter.h"
#include "action.h"
#include "actioncollection.h"
#include <QtCore/QObject>
#include <QtCore/QArgument>
#include <QtCore/QFile>
#include <QtCore/QRegExp>
#include <QtCore/QFileInfo>
#include <QtCore/QPointer>
#include <QtCore/QLibrary>
#include <QtCore/QCoreApplication>
#include <kstandarddirs.h>
#include <klocale.h>
extern "C"
{
typedef QObject* (*def_module_func)();
}
using namespace Kross;
namespace Kross {
/// @internal
class Manager::Private
{
public:
/// List of \a InterpreterInfo instances.
QHash< QString, InterpreterInfo* > interpreterinfos;
/// List of the interpreter names.
QStringList interpreters;
/// Loaded modules.
QHash< QString, QPointer<QObject> > modules;
/// The collection of \a Action instances.
ActionCollection* collection;
/// List with custom handlers for metatypes.
QHash<QByteArray, MetaTypeHandler*> wrappers;
/// Strict type handling enabled or disabled.
bool strictTypesEnabled;
};
}
Q_GLOBAL_STATIC(Manager, _self)
Manager& Manager::self()
{
return *_self();
}
void* loadLibrary(const char* libname, const char* functionname)
{
QLibrary lib(libname);
lib.setLoadHints( QLibrary::ExportExternalSymbolsHint );
if( ! lib.load() ) {
const QString err = QString("Error: %1").arg(lib.errorString());
//TODO move that functionality out of Kross since we like to be Qt-only
foreach(const QString &dir, KStandardDirs().resourceDirs("module")) {
lib.setFileName( QFileInfo(dir, libname).filePath() );
lib.setLoadHints( QLibrary::ExportExternalSymbolsHint );
if( lib.load() )
break;
}
/*
if( ! lib.isLoaded() ) {
foreach(const QString& path, QCoreApplication::instance()->libraryPaths()) {
lib.setFileName( QFileInfo(path, libname).filePath() );
lib.setLoadHints( QLibrary::ExportExternalSymbolsHint );
if( lib.load() )
break;
}
}
*/
if( ! lib.isLoaded() ) {
#ifdef KROSS_INTERPRETER_DEBUG
if( strcmp(functionname, "krossinterpreter") == 0 )
krossdebug( QString("Kross Interpreter '%1' not available: %2").arg(libname).arg(err) );
else if( strcmp(functionname, "krossmodule") == 0 )
krossdebug( QString("Kross Module '%1' not available: %2").arg(libname).arg(err) );
else
krosswarning( QString("Failed to load unknown type of '%1' library: %2").arg(libname).arg(err) );
#endif
return 0;
}
}
- void* funcPtr = lib.resolve(functionname);
+#warning QT5 Port kross to QFunctionPointer
+ void* funcPtr = (void*)lib.resolve(functionname);
Q_ASSERT(funcPtr);
return funcPtr;
}
Manager::Manager()
: QObject()
, QScriptable()
, ChildrenInterface()
, d( new Private() )
{
d->strictTypesEnabled = true;
setObjectName("Kross");
d->collection = new ActionCollection("main");
#ifdef KROSS_PYTHON_LIBRARY
if( void* funcPtr = loadLibrary(KROSS_PYTHON_LIBRARY, "krossinterpreter") ) {
d->interpreterinfos.insert("python",
new InterpreterInfo("python",
funcPtr, // library
"*.py", // file filter-wildcard
QStringList() << "text/x-python" // mimetypes
)
);
}
#endif
#ifdef KROSS_RUBY_LIBRARY
if( void* funcPtr = loadLibrary(KROSS_RUBY_LIBRARY, "krossinterpreter") ) {
InterpreterInfo::Option::Map options;
options.insert("safelevel", new InterpreterInfo::Option(
i18n("Level of safety of the Ruby interpreter"),
QVariant(0) )); // 0 -> unsafe, 4 -> very safe
d->interpreterinfos.insert("ruby",
new InterpreterInfo("ruby",
funcPtr, // library
"*.rb", // file filter-wildcard
QStringList() << /* "text/x-ruby" << */ "application/x-ruby", // mimetypes
options // options
)
);
}
#endif
#ifdef KROSS_JAVA_LIBRARY
if( void* funcPtr = loadLibrary(KROSS_JAVA_LIBRARY, "krossinterpreter") ) {
d->interpreterinfos.insert("java",
new InterpreterInfo("java",
funcPtr, // library
"*.java *.class *.jar", // file filter-wildcard
QStringList() << "application/java" // mimetypes
)
);
}
#endif
#ifdef KROSS_KJS_LIBRARY
if( void* funcPtr = loadLibrary(KROSS_KJS_LIBRARY, "krossinterpreter") ) {
d->interpreterinfos.insert("javascript",
new InterpreterInfo("javascript",
funcPtr, // library
"*.js", // file filter-wildcard
QStringList() << "application/javascript" // mimetypes
)
);
}
#endif
#ifdef KROSS_FALCON_LIBRARY
if( void* funcPtr = loadLibrary(KROSS_FALCON_LIBRARY, "krossinterpreter") ) {
d->interpreterinfos.insert("falcon",
new InterpreterInfo("falcon",
funcPtr, // library
"*.fal", // file filter-wildcard
QStringList() << "application/x-falcon" // mimetypes
)
);
}
#endif
#ifdef KROSS_QTSCRIPT_LIBRARY
if( void* funcPtr = loadLibrary(KROSS_QTSCRIPT_LIBRARY, "krossinterpreter") ) {
d->interpreterinfos.insert("qtscript",
new InterpreterInfo("qtscript",
funcPtr, // library
"*.es", // file filter-wildcard
QStringList() << "application/ecmascript" // mimetypes
)
);
}
#endif
#ifdef KROSS_LUA_LIBRARY
if( void* funcPtr = loadLibrary(KROSS_LUA_LIBRARY, "krossinterpreter") ) {
d->interpreterinfos.insert("lua",
new InterpreterInfo("lua",
funcPtr, // library
"*.lua *.luac", // file filter-wildcard
QStringList() << "application/x-lua" // mimetypes
)
);
}
#endif
// fill the list of supported interpreternames.
QHash<QString, InterpreterInfo*>::Iterator it( d->interpreterinfos.begin() );
for(; it != d->interpreterinfos.end(); ++it)
if( it.value() )
d->interpreters << it.key();
d->interpreters.sort();
// publish ourself.
ChildrenInterface::addObject(this, "Kross");
}
Manager::~Manager()
{
qDeleteAll(d->wrappers);
qDeleteAll(d->interpreterinfos);
qDeleteAll(d->modules);
delete d->collection;
delete d;
}
QHash< QString, InterpreterInfo* > Manager::interpreterInfos() const
{
return d->interpreterinfos;
}
bool Manager::hasInterpreterInfo(const QString& interpretername) const
{
return d->interpreterinfos.contains(interpretername) && d->interpreterinfos[interpretername];
}
InterpreterInfo* Manager::interpreterInfo(const QString& interpretername) const
{
return hasInterpreterInfo(interpretername) ? d->interpreterinfos[interpretername] : 0;
}
const QString Manager::interpreternameForFile(const QString& file)
{
QRegExp rx;
rx.setPatternSyntax(QRegExp::Wildcard);
for(QHash<QString, InterpreterInfo*>::Iterator it = d->interpreterinfos.begin(); it != d->interpreterinfos.end(); ++it) {
if( ! it.value() )
continue;
foreach(const QString &wildcard, it.value()->wildcard().split(' ', QString::SkipEmptyParts)) {
rx.setPattern( wildcard );
if( rx.exactMatch(file) )
return it.value()->interpreterName();
}
}
return QString();
}
Interpreter* Manager::interpreter(const QString& interpretername) const
{
if( ! hasInterpreterInfo(interpretername) ) {
krosswarning( QString("No such interpreter '%1'").arg(interpretername) );
return 0;
}
return d->interpreterinfos[interpretername]->interpreter();
}
QStringList Manager::interpreters() const
{
return d->interpreters;
}
ActionCollection* Manager::actionCollection() const
{
return d->collection;
}
bool Manager::hasAction(const QString& name)
{
return findChild< Action* >(name) != 0L;
}
QObject* Manager::action(const QString& name)
{
Action* action = findChild< Action* >(name);
if(! action) {
action = new Action(this, name);
#if 0
d->actioncollection->insert(action); //FIXME should we really remember the action?
#endif
}
return action;
}
QObject* Manager::module(const QString& modulename)
{
if( d->modules.contains(modulename) ) {
QObject* obj = d->modules[modulename];
if( obj )
return obj;
}
if( modulename.isEmpty() || modulename.contains( QRegExp("[^a-zA-Z0-9]") ) ) {
krosswarning( QString("Invalid module name '%1'").arg(modulename) );
return 0;
}
QByteArray libraryname = QString("krossmodule%1").arg(modulename).toLower().toLatin1();
#if 0
KLibLoader* loader = KLibLoader::self();
KLibrary* lib = loader->library( libraryname, QLibrary::ExportExternalSymbolsHint );
if( ! lib ) { //FIXME this fallback-code should be in KLibLoader imho.
lib = loader->library( QString("lib%1").arg(libraryname), QLibrary::ExportExternalSymbolsHint );
if( ! lib ) {
krosswarning( QString("Failed to load module '%1': %2").arg(modulename).arg(loader->lastErrorMessage()) );
return 0;
}
}
def_module_func func;
func = (def_module_func) lib->resolveFunction("krossmodule");
if( ! func ) {
krosswarning( QString("Failed to determinate init function in module '%1'").arg(modulename) );
return 0;
}
QObject* module = (QObject*) (func)(); // call the function
lib->unload(); // unload the library
if( ! module ) {
krosswarning( QString("Failed to load module object '%1'").arg(modulename) );
return 0;
}
#else
if( void* funcPtr = loadLibrary(libraryname, "krossmodule") ) {
def_module_func func = (def_module_func) funcPtr;
Q_ASSERT( func );
QObject* module = (QObject*) (func)(); // call the function
Q_ASSERT( module );
//krossdebug( QString("Manager::module Module successfully loaded: modulename=%1 module.objectName=%2 module.className=%3").arg(modulename).arg(module->objectName()).arg(module->metaObject()->className()) );
d->modules.insert(modulename, module);
return module;
}
else {
krosswarning( QString("Failed to load module '%1'").arg(modulename) );
}
#endif
return 0;
}
void Manager::deleteModules()
{
qDeleteAll(d->modules);
d->modules.clear();
}
bool Manager::executeScriptFile(const QUrl& file)
{
krossdebug( QString("Manager::executeScriptFile() file='%1'").arg(file.toString()) );
Action* action = new Action(0 /*no parent*/, file);
action->trigger();
bool ok = ! action->hadError();
delete action; //action->delayedDestruct();
return ok;
}
void Manager::addQObject(QObject* obj, const QString &name)
{
this->addObject(obj, name);
}
QObject* Manager::qobject(const QString &name) const
{
return this->object(name);
}
QStringList Manager::qobjectNames() const
{
return this->objects().keys();
}
MetaTypeHandler* Manager::metaTypeHandler(const QByteArray& typeName) const
{
return d->wrappers.contains(typeName) ? d->wrappers[typeName] : 0;
}
void Manager::registerMetaTypeHandler(const QByteArray& typeName, MetaTypeHandler::FunctionPtr* handler)
{
d->wrappers.insert(typeName, new MetaTypeHandler(handler));
}
void Manager::registerMetaTypeHandler(const QByteArray& typeName, MetaTypeHandler::FunctionPtr2* handler)
{
d->wrappers.insert(typeName, new MetaTypeHandler(handler));
}
void Manager::registerMetaTypeHandler(const QByteArray& typeName, MetaTypeHandler* handler)
{
d->wrappers.insert(typeName, handler);
}
bool Manager::strictTypesEnabled() const
{
return d->strictTypesEnabled;
}
void Manager::setStrictTypesEnabled(bool enabled)
{
d->strictTypesEnabled = enabled;
}
bool Manager::hasHandlerAssigned(const QByteArray& typeName) const
{
return d->wrappers.contains(typeName);
}

File Metadata

Mime Type
text/x-diff
Expires
Fri, Nov 1, 8:56 AM (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
10075359
Default Alt Text
(31 KB)

Event Timeline