[mapplauncherd] Remove Qt boosters and related tests

These have been split to a separate repository and package.
pull/1/head
John Brooks 13 years ago
parent 6fd7197814
commit adef09cd6f

@ -75,10 +75,3 @@ if ($ENV{DEBUG_BUILD})
else ($ENV{DEBUG_BUILD}) else ($ENV{DEBUG_BUILD})
install(PROGRAMS src/scripts/applauncherd DESTINATION /usr/bin/) install(PROGRAMS src/scripts/applauncherd DESTINATION /usr/bin/)
endif ($ENV{DEBUG_BUILD}) endif ($ENV{DEBUG_BUILD})
# Install pkg-config and qmake feature files
install(FILES data/pkgconfig/qt-boostable.pc DESTINATION /usr/lib/pkgconfig)
install(FILES data/mkspecs/features/qt-boostable.prf DESTINATION /usr/share/qt4/mkspecs/features)
install(FILES data/pkgconfig/qdeclarative-boostable.pc DESTINATION /usr/lib/pkgconfig)
install(FILES data/mkspecs/features/qdeclarative-boostable.prf DESTINATION /usr/share/qt4/mkspecs/features)

@ -1,5 +0,0 @@
# Tell qmake to use pkg-config to get correct compiler and linker
# flags to make an application usable with applauncherd.
CONFIG += link_pkgconfig
PKGCONFIG += qdeclarative-boostable

@ -1,5 +0,0 @@
# Tell qmake to use pkg-config to get correct compiler and linker
# flags to make an application usable with applauncherd.
CONFIG += link_pkgconfig
PKGCONFIG += qt-boostable

@ -1,6 +0,0 @@
Name: qdeclarative-boostable
Description: make application boostable by applauncherd
Version: 0.2.0
Libs: -pie -rdynamic -lmdeclarativecache
Cflags: -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -I/usr/include/applauncherd

@ -1,5 +0,0 @@
Name: qt-boostable
Description: make application boostable by applauncherd
Version: 0.2.0
Libs: -pie -rdynamic
Cflags: -fPIC -fvisibility=hidden -fvisibility-inlines-hidden

@ -19,16 +19,16 @@ Source1: mapplauncherd.service
Source100: mapplauncherd.yaml Source100: mapplauncherd.yaml
Requires(post): /sbin/ldconfig Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig Requires(postun): /sbin/ldconfig
BuildRequires: pkgconfig(QtCore)
BuildRequires: pkgconfig(x11) BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(xtst) BuildRequires: pkgconfig(xtst)
BuildRequires: pkgconfig(xextproto) BuildRequires: pkgconfig(xextproto)
BuildRequires: pkgconfig(xi) BuildRequires: pkgconfig(xi)
BuildRequires: pkgconfig(xext) BuildRequires: pkgconfig(xext)
BuildRequires: pkgconfig(systemd) BuildRequires: pkgconfig(systemd)
BuildRequires: pkgconfig(QtCore)
BuildRequires: pkgconfig(QtTest)
BuildRequires: cmake BuildRequires: cmake
BuildRequires: python BuildRequires: python
BuildRequires: desktop-file-utils
Provides: meegotouch-applauncherd > 3.0.3 Provides: meegotouch-applauncherd > 3.0.3
Obsoletes: meegotouch-applauncherd <= 3.0.3 Obsoletes: meegotouch-applauncherd <= 3.0.3
@ -109,9 +109,6 @@ mv %{buildroot}/usr/share/applauncherd-tests %{buildroot}/usr/lib
rm -f %{buildroot}/usr/share/fala_images/fala_qml_helloworld rm -f %{buildroot}/usr/share/fala_images/fala_qml_helloworld
# << install post # << install post
desktop-file-install --delete-original \
--dir %{buildroot}%{_datadir}/applications \
%{buildroot}%{_datadir}/applications/*.desktop
%post -p /sbin/ldconfig %post -p /sbin/ldconfig
@ -122,10 +119,6 @@ desktop-file-install --delete-original \
%{_bindir}/invoker %{_bindir}/invoker
%{_libdir}/libapplauncherd.so* %{_libdir}/libapplauncherd.so*
%{_libdir}/applauncherd/libebooster.so %{_libdir}/applauncherd/libebooster.so
%{_libdir}/applauncherd/libqtbooster.so
%{_libdir}/applauncherd/libqdeclarativebooster.so
%{_libdir}/libmdeclarativecache.so.0
%{_libdir}/libmdeclarativecache.so.0.1
%{_bindir}/applauncherd.bin %{_bindir}/applauncherd.bin
%{_bindir}/applauncherd %{_bindir}/applauncherd
%{_bindir}/single-instance %{_bindir}/single-instance
@ -136,37 +129,18 @@ desktop-file-install --delete-original \
%files devel %files devel
%defattr(-,root,root,-) %defattr(-,root,root,-)
%{_libdir}/pkgconfig/qdeclarative-boostable.pc
%{_libdir}/pkgconfig/qt-boostable.pc
%{_includedir}/applauncherd/* %{_includedir}/applauncherd/*
%{_datadir}/qt4/mkspecs/features/qt-boostable.prf
%{_datadir}/qt4/mkspecs/features/qdeclarative-boostable.prf
%{_libdir}/libmdeclarativecache.so
# >> files devel # >> files devel
# << files devel # << files devel
%files testapps %files testapps
%defattr(-,root,root,-) %defattr(-,root,root,-)
%{_bindir}/fala_dbus
%{_bindir}/fala_focus
%{_bindir}/fala_gettime_ms %{_bindir}/fala_gettime_ms
%{_bindir}/fala_pixelchanged %{_bindir}/fala_pixelchanged
%{_bindir}/fala_status %{_bindir}/fala_status
%{_bindir}/fala_wl
%{_bindir}/fala_wol
%{_bindir}/fala_gettime %{_bindir}/fala_gettime
%{_bindir}/fala_windowid %{_bindir}/fala_windowid
%{_bindir}/fala_qml_helloworld
%{_bindir}/fala_qml_helloworld1
%{_bindir}/fala_qml_helloworld2
%{_bindir}/fala_qml_wl
%{_bindir}/fala_qml_wol
%{_bindir}/fala_wait %{_bindir}/fala_wait
%{_bindir}/fala_windowless
%{_bindir}/xsendevent
%{_datadir}/dbus-1/services/com.nokia.fala_testapp.service
%{_datadir}/fala_images/landscape.jpg
%{_datadir}/fala_images/portrait.jpg
# >> files testapps # >> files testapps
# << files testapps # << files testapps
@ -182,9 +156,7 @@ desktop-file-install --delete-original \
%{_libdir}/applauncherd-tests/ut_daemon %{_libdir}/applauncherd-tests/ut_daemon
%{_libdir}/applauncherd-tests/ut_ebooster %{_libdir}/applauncherd-tests/ut_ebooster
%{_libdir}/applauncherd-tests/ut_connection %{_libdir}/applauncherd-tests/ut_connection
%{_libdir}/applauncherd-tests/ut_qtbooster
%{_libdir}/applauncherd-tests/ut_socketmanager %{_libdir}/applauncherd-tests/ut_socketmanager
%{_libdir}/applauncherd-tests/ut_dbooster
%{_libdir}/applauncherd-tests/libutplugin.so %{_libdir}/applauncherd-tests/libutplugin.so
%{_libdir}/applauncherd-tests/libutwithcreate.so %{_libdir}/applauncherd-tests/libutwithcreate.so
%{_libdir}/applauncherd-tests/libutwithcreatetype.so %{_libdir}/applauncherd-tests/libutwithcreatetype.so
@ -218,12 +190,5 @@ desktop-file-install --delete-original \
%{_datadir}/applauncherd-M-testscripts/utils.py %{_datadir}/applauncherd-M-testscripts/utils.py
%{_datadir}/applauncherd-M-testscripts/utils.pyc %{_datadir}/applauncherd-M-testscripts/utils.pyc
%{_datadir}/applauncherd-M-testscripts/utils.pyo %{_datadir}/applauncherd-M-testscripts/utils.pyo
%{_datadir}/applauncherd-testscripts/view.qml
%{_datadir}/applications/fala_wl.desktop
%{_datadir}/applications/fala_wol.desktop
%{_datadir}/applications/fala_qml_wol.desktop
%{_datadir}/applications/fala_qml_wl.desktop
%{_datadir}/dbus-1/services/com.nokia.fala_wl.service
%{_datadir}/dbus-1/services/com.nokia.fala_wol.service
# >> files tests # >> files tests
# << files tests # << files tests

@ -14,13 +14,15 @@ Description: |
application startup time and share memory. Provides also application startup time and share memory. Provides also
functionality to launch applications as single instances. functionality to launch applications as single instances.
PkgConfigBR: PkgConfigBR:
- QtCore
- x11 - x11
- xtst - xtst
- xextproto - xextproto
- xi - xi
- xext - xext
- systemd - systemd
# For tests only
- QtCore
- QtTest
PkgBR: PkgBR:
- cmake - cmake
- python - python
@ -33,10 +35,6 @@ Files:
- "%{_bindir}/invoker" - "%{_bindir}/invoker"
- "%{_libdir}/libapplauncherd.so*" - "%{_libdir}/libapplauncherd.so*"
- "%{_libdir}/applauncherd/libebooster.so" - "%{_libdir}/applauncherd/libebooster.so"
- "%{_libdir}/applauncherd/libqtbooster.so"
- "%{_libdir}/applauncherd/libqdeclarativebooster.so"
- "%{_libdir}/libmdeclarativecache.so.0"
- "%{_libdir}/libmdeclarativecache.so.0.1"
- "%{_bindir}/applauncherd.bin" - "%{_bindir}/applauncherd.bin"
- "%{_bindir}/applauncherd" - "%{_bindir}/applauncherd"
- "%{_bindir}/single-instance" - "%{_bindir}/single-instance"
@ -55,12 +53,7 @@ SubPackages:
Obsoletes: Obsoletes:
- meegotouch-applauncherd-devel <= 3.0.3 - meegotouch-applauncherd-devel <= 3.0.3
Files: Files:
- "%{_libdir}/pkgconfig/qdeclarative-boostable.pc"
- "%{_libdir}/pkgconfig/qt-boostable.pc"
- "%{_includedir}/applauncherd/*" - "%{_includedir}/applauncherd/*"
- "%{_datadir}/qt4/mkspecs/features/qt-boostable.prf"
- "%{_datadir}/qt4/mkspecs/features/qdeclarative-boostable.prf"
- "%{_libdir}/libmdeclarativecache.so"
- Name: testapps - Name: testapps
Group: Development/Tools Group: Development/Tools
@ -68,27 +61,12 @@ SubPackages:
Description: | Description: |
Test applications used for testing mapplauncherd. Test applications used for testing mapplauncherd.
Files: Files:
- "%{_bindir}/fala_dbus"
- "%{_bindir}/fala_focus"
- "%{_bindir}/fala_gettime_ms" - "%{_bindir}/fala_gettime_ms"
- "%{_bindir}/fala_pixelchanged" - "%{_bindir}/fala_pixelchanged"
- "%{_bindir}/fala_status" - "%{_bindir}/fala_status"
- "%{_bindir}/fala_wl"
- "%{_bindir}/fala_wol"
- "%{_bindir}/fala_gettime" - "%{_bindir}/fala_gettime"
- "%{_bindir}/fala_windowid" - "%{_bindir}/fala_windowid"
- "%{_bindir}/fala_qml_helloworld"
- "%{_bindir}/fala_qml_helloworld1"
- "%{_bindir}/fala_qml_helloworld2"
- "%{_bindir}/fala_qml_wl"
- "%{_bindir}/fala_qml_wol"
- "%{_bindir}/fala_wait" - "%{_bindir}/fala_wait"
- "%{_bindir}/fala_windowless"
- "%{_bindir}/xsendevent"
- "%{_datadir}/dbus-1/services/com.nokia.fala_testapp.service"
- "%{_datadir}/fala_images/landscape.jpg"
- "%{_datadir}/fala_images/portrait.jpg"
- Name: tests - Name: tests
Group: Development/Tools Group: Development/Tools
@ -108,9 +86,7 @@ SubPackages:
- "%{_libdir}/applauncherd-tests/ut_daemon" - "%{_libdir}/applauncherd-tests/ut_daemon"
- "%{_libdir}/applauncherd-tests/ut_ebooster" - "%{_libdir}/applauncherd-tests/ut_ebooster"
- "%{_libdir}/applauncherd-tests/ut_connection" - "%{_libdir}/applauncherd-tests/ut_connection"
- "%{_libdir}/applauncherd-tests/ut_qtbooster"
- "%{_libdir}/applauncherd-tests/ut_socketmanager" - "%{_libdir}/applauncherd-tests/ut_socketmanager"
- "%{_libdir}/applauncherd-tests/ut_dbooster"
- "%{_libdir}/applauncherd-tests/libutplugin.so" - "%{_libdir}/applauncherd-tests/libutplugin.so"
- "%{_libdir}/applauncherd-tests/libutwithcreate.so" - "%{_libdir}/applauncherd-tests/libutwithcreate.so"
- "%{_libdir}/applauncherd-tests/libutwithcreatetype.so" - "%{_libdir}/applauncherd-tests/libutwithcreatetype.so"
@ -144,10 +120,3 @@ SubPackages:
- "%{_datadir}/applauncherd-M-testscripts/utils.py" - "%{_datadir}/applauncherd-M-testscripts/utils.py"
- "%{_datadir}/applauncherd-M-testscripts/utils.pyc" - "%{_datadir}/applauncherd-M-testscripts/utils.pyc"
- "%{_datadir}/applauncherd-M-testscripts/utils.pyo" - "%{_datadir}/applauncherd-M-testscripts/utils.pyo"
- "%{_datadir}/applauncherd-testscripts/view.qml"
- "%{_datadir}/applications/fala_wl.desktop"
- "%{_datadir}/applications/fala_wol.desktop"
- "%{_datadir}/applications/fala_qml_wol.desktop"
- "%{_datadir}/applications/fala_qml_wl.desktop"
- "%{_datadir}/dbus-1/services/com.nokia.fala_wl.service"
- "%{_datadir}/dbus-1/services/com.nokia.fala_wol.service"

@ -10,12 +10,6 @@ add_subdirectory(launcherlib)
# Sub build: ebooster plugin # Sub build: ebooster plugin
add_subdirectory(ebooster) add_subdirectory(ebooster)
# Sub build: qtbooster plugin
add_subdirectory(qtbooster)
# Sub build: qdeclarativebooster plugin
add_subdirectory(qdeclarativebooster)
# Sub build: single-instance binary / library # Sub build: single-instance binary / library
add_subdirectory(single-instance) add_subdirectory(single-instance)

@ -1,42 +0,0 @@
include(FindX11)
# Find Qt4
find_package(Qt4 4.6.0 REQUIRED)
include(${QT_USE_FILE})
if (${QTVERSION} VERSION_LESS 4.6.0)
message(FATAL_ERROR "You need Qt4.6, found ${QTVERSION}.")
endif (${QTVERSION} VERSION_LESS 4.6.0)
set(LAUNCHER "${CMAKE_HOME_DIRECTORY}/src/launcherlib")
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${LAUNCHER} "${CMAKE_HOME_DIRECTORY}/src/common")
# Set sources
set(PLUGINSRC qdeclarativebooster.cpp pluginfactory.cpp)
set(LIBSRC mdeclarativecache.cpp mdeclarativecache.h mdeclarativecache_p.h eventhandler.cpp eventhandler.h)
set(MOC_HDRS eventhandler.h)
qt4_wrap_cpp(MOC_SRC ${MOC_HDRS})
# Set executables
add_library(mdeclarativecache SHARED ${LIBSRC} ${MOC_SRC})
set_target_properties(mdeclarativecache PROPERTIES
VERSION 0.1 SOVERSION 0)
if ($ENV{HARMATTAN})
set_target_properties(mdeclarativecache PROPERTIES COMPILE_FLAGS -DHAVE_PATH_REINIT)
endif ($ENV{HARMATTAN})
target_link_libraries(mdeclarativecache ${LIBDL} ${QT_QTCORE_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} ${QT_QTGUI_LIBRARY} ${X11_LIBRARIES} "-L../launcherlib -lapplauncherd")
add_dependencies(mdeclarativecache applauncherd)
add_library(qdeclarativebooster MODULE ${PLUGINSRC})
set_target_properties(qdeclarativebooster PROPERTIES
COMPILE_FLAGS -fvisibility=hidden)
target_link_libraries(qdeclarativebooster ${LIBDL} "-L. -lmdeclarativecache -L../launcherlib -lapplauncherd")
add_dependencies(qdeclarativebooster applauncherd mdeclarativecache)
# Add install rule
install(TARGETS qdeclarativebooster DESTINATION /usr/lib/applauncherd/)
install(TARGETS mdeclarativecache DESTINATION /usr/lib)
install(FILES mdeclarativecache.h MDeclarativeCache eventhandler.h DESTINATION /usr/include/applauncherd
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)

@ -1,2 +0,0 @@
#include "mdeclarativecache.h"

@ -1,256 +0,0 @@
This File
=========
This document describes how to use to speed up QML application startup
in Harmattan/MeeGo using the applauncherd daemon and the qdeclarative booster.
For a more general description of the launcher concept and technical
details, see the README file in the meegotouch-applauncherd source
tree.
1. COMPILING YOUR APPLICATION TO BE LAUNCHABLE
Binaries intended to be run with applauncherd should be compiled with -fPIC option
to produce position independent code. In order to produce a position independent
executable, -pie option and -rdynamic options can be used in linking. This allows
the result to be executed both traditionally and with the launcher.
To improve linking and loading times of shared object libraries it is
encouraged to hide any unnecessary symbols from the resulting binary by using
-fvisibility=hidden and -fvisibility-inlines-hidden flags as well.
1.1 Build configuration
These instructions describe how to build your application so that it
can be launched using applauncherd. Only Debian packaging is considered,
you have to creatively apply the instructions if you are doing RPM packaging.
Using QMake
-----------
If you are using QMake, making your application boostable is just a
matter of adding a suitable configuration option.
For Qt Declarative (QML) applications, the configuration option is
provided by the applauncherd-dev package. If you are building a
Debian package, you have to add a build dependency to
applauncherd-dev. The configuration option is:
CONFIG += qdeclarative-boostable
If you want to use pkg-config directly for some reason (like getting
error messages), you can add explicit pkg-config calls in the appropriate
flags:
QMAKE_CXXFLAGS += `pkg-config --cflags qdeclarative-boostable`
QMAKE_LFLAGS += `pkg-config --libs qdeclarative-boostable`
You can also manually set the options in your .pro file like this:
QMAKE_CXXFLAGS += -fPIC -fvisibility=hidden -fvisibility-inlines-hidden
QMAKE_LFLAGS += -pie -rdynamic
Note that you have to update the flags manually if there are any changes in
the required flags.
Using CMake
---------------------------
You can utilize pkg-config in CMake by including FindPkgConfig in CMakeLists.txt:
include(FindPkgConfig)
To get Debian packages built correctly, make the package
build-depend on applauncherd-dev. To obtain the compiler and linker
flags, add the following lines in CMakeLists.txt:
pkg_check_modules(QDECLARATIVE_BOOSTABLE REQUIRED qdeclarative-boostable)
add_definitions(${QDECLARATIVE_BOOSTABLE_CFLAGS})
link_libraries(${QDECLARATIVE_BOOSTABLE_LDFLAGS})
If you do not want to use pkg-config for some reason, you can manually add the
compiler and linker flags like this:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fvisibility=hidden
-fvisibility-inlines-hidden")
set(CMAKE_EXE_LINKER_FLAGS "-pie -rdynamic")
Again, this requires you to update the flags if something changes.
Automatic settings with pkg-config (any build system)
-----------------------------------------------------
To get Debian packages built correctly, make the package
build-depend on applauncherd-dev. The correct flags can be
automatically obtained with:
pkg-config --cflags qdeclarative-boostable
pkg-config --libs qdeclarative-boostable
1.3 Changes to the code
With -fvisibility=hidden you must make sure that the symbol for main() is
exported, because otherwise the launcher is not able to find the entry point
for your application. This can be done like this:
#include <QtCore/QtGlobal>
Q_DECL_EXPORT int main(int argc, char **argv)
{
...
}
The application cannot directly instantiate QApplication and
QDeclarativeView. Instead of writing e.g.
QApplication app;
QDeclarativeView view;
you need to pick up instances of QApplication and QDeclarativeView from a cache:
QApplication *app = MDeclarativeCache::qApplication(argc, argv);
QDeclarativeView *window = MDeclarativeCache::qDeclarativeView();
The ownership of the instances is currently transferred from the cache to the
application code, but this is subject to change if there is a need to align
the API with Symbian.
If you plan to use QCoreApplication::applicationDirPath() or
QCoreApplication::applicationFilePath(), please see KNOWN ISSUES below.
2. LAUNCHING YOUR APPLICATION USING INVOKER
The application to be launched must be "invoked" using the invoker binary. The
invoker then sends the application data, essentially arguments and environment
variables, to the launcher daemon via a socket connection. The launched
application will see its real binary name in its argv[0].
2.1 Launch from the command-line
Use --type=d for Qt Declarative applications:
/usr/bin/invoker --type=d <application_name>
2.2 D-Bus launch
If you are using D-Bus to launch your application, it can be done
straightly in the .service-file and without any wrapper scripts slowing
things down:
[D-BUS Service]
Name=com.nokia.<application_name>
Exec=/usr/bin/invoker --type=d /usr/bin/<application_name>
By default, invoker waits for the application to terminate and exits with
the same exit code. Unix signals are also forwarded.
Note 1: If --no-wait and --delay is used, it is important to add enough delay to
invoker so that it won't exit before the launched application gets its
(possible) D-Bus service registered. Otherwise D-Bus daemon may think that the
application just died.
Note 2: There is a slight difference in the application start-up time if you use a
wrapper script instead of the actual binary in Exec-field of .desktop and .service files.
Therefore, it is recommended that you always use the actual invoker call with the
binary name as presented above.
Note 3: When .desktop file contains the X-Maemo-Service field, the application
is started by default through D-Bus. This might cause some delay for
application start-up time. Therefore it is recommended to use the single
instance launch functionality (see below) instead of a X-Maemo-Service if
possible
See invoker --help for all possible command-line parameters.
2.3 Single instance launch
Usually user wants the application to be run as a single instance. This means,
that if the launched application is already running, the existing application
window is activated and no new application processes are started.
This can be achieved by adding --single-instance to the invoker command:
[D-BUS Service]
Name=com.nokia.<application_name>
Exec=/usr/bin/invoker --single-instance --type=d /usr/bin/<application_name>
As a result, a lock file $HOME/.single-instance-locks/<application_name>/instance.lock
is created. If applauncherd cannot acquire the lock, it tries to find the
corresponding window and activates it.
This functionality is implemented in a position-independent executable called
single-instance. Applauncherd uses the executable as a library, but it can be
used as an ordinary program to start anything as a single instance:
/usr/bin/single-instance <application_name>
Note, that in this case the launcher is not used.
Consider using --single-instance instead of the single instance functionality
provided by D-Bus, because it very likely is much faster.
2.4 Splash screen
Applauncherd supports showing a splash screen if there is mcompositor
(the MeeGo window manager) running.
The splash screen is not shown by default. If an application wants it
to be shown, it must pass --splash, and optionally --splash-landscape
arguments to the invoker.
For instance,
/usr/bin/invoker --splash=/usr/share/application_name/splash.jpg \
--splash-landscape=/usr/share/application_name/splash-l.jpg \
--type=d \
/usr/bin/application_name
shows the splash screen with splash.jpg as its content when the device
is in the portrait orientation. Otherwise splash-l.jpg is shown. If
only --splash is given, that image is shown in both orientations.
Invoker passes the splash request to the booster. The booster sends
the splash request to the window manager by setting a window property
to window manager's window.
If the filenames do not include absolute paths, the window manager
looks for the files from a default location.
3. PACKAGE DEPENDENCIES
Applications using the launcher must depend on the applauncherd Debian package.
4. CURRENT KNOWN ISSUES
4.1 Forking
Using QApplication or QDeclarativeView fetched from the cache in a child
process does not work, because they would share the X11 connection with the
parent.
4.2 Non-working QCoreApplication methods
The following methods of QCoreApplication are known not to work with
qdeclarative booster:
QCoreApplication::applicationDirPath()
QCoreApplication::applicationFilePath()
The reason for this that the methods get the path from the /proc file system,
so they return the path to the booster rather than the path to the launched
application. This is unlikely to be fixed for Qt 4.7.
The MDeclarativeCache class provides the replacements
MDeclarativeCache::applicationDirPath() and
MDeclarativeCache::applicationFilePath(), which are identical to the
QCoreApplication counterparts, except that in the boosted case they use argv[0]
of the boosted application.
5. COMMAND-LINE PARAMETERS
All parameters are listed by:
invoker --help
applauncherd --help

@ -1,120 +0,0 @@
#include <QtConcurrentRun>
#include <QApplication>
#include "eventhandler.h"
#include "connection.h"
#include "logger.h"
#include "booster.h"
#include <sys/socket.h>
int EventHandler::m_sighupFd[2];
struct sigaction EventHandler::m_oldSigAction;
EventHandler::EventHandler(Booster* parent)
: m_parent(parent)
{
m_sighupFd[0] = -1;
m_sighupFd[1] = -1;
}
EventHandler::~EventHandler()
{
if (m_sighupFd[0] != -1)
::close(m_sighupFd[0]);
if (m_sighupFd[1] != -1)
::close(m_sighupFd[1]);
}
void EventHandler::runEventLoop()
{
// Exit from event loop when invoker is ready to connect
connect(this, SIGNAL(connectionAccepted()), QApplication::instance(), SLOT(quit()));
connect(this, SIGNAL(connectionRejected()), QApplication::instance(), SLOT(quit()));
// Start another thread to listen connection from invoker
QtConcurrent::run(this, &EventHandler::accept);
// Create socket pair for SIGHUP
bool handlerIsSet = false;
if (::socketpair(AF_UNIX, SOCK_STREAM, 0, m_sighupFd))
{
Logger::logError("EventHandler: Couldn't create HUP socketpair");
}
else
{
// Install signal handler e.g. to exit cleanly if launcher dies.
// This is a problem because MBooster runs a Qt event loop.
EventHandler::setupUnixSignalHandlers();
// Install a socket notifier on the socket
connect(new QSocketNotifier(m_sighupFd[1], QSocketNotifier::Read, this),
SIGNAL(activated(int)), this, SLOT(handleSigHup()));
handlerIsSet = true;
}
// Run event loop so application instance can receive notifications
QApplication::exec();
// Restore signal handlers to previous values
if (handlerIsSet)
{
restoreUnixSignalHandlers();
}
}
void EventHandler::accept()
{
if (m_parent->connection()->accept(m_parent->appData()))
{
emit connectionAccepted();
}
else
{
emit connectionRejected();
}
}
//
// All this signal handling code is taken from Qt's Best Practices:
// http://doc.qt.nokia.com/latest/unix-signals.html
//
void EventHandler::hupSignalHandler(int)
{
char a = 1;
::write(m_sighupFd[0], &a, sizeof(a));
}
void EventHandler::handleSigHup()
{
QApplication::quit();
_exit(EXIT_SUCCESS);
}
bool EventHandler::setupUnixSignalHandlers()
{
struct sigaction hup;
hup.sa_handler = hupSignalHandler;
sigemptyset(&hup.sa_mask);
hup.sa_flags = SA_RESTART;
if (sigaction(SIGHUP, &hup, &m_oldSigAction) > 0)
{
return false;
}
return true;
}
bool EventHandler::restoreUnixSignalHandlers()
{
if (sigaction(SIGHUP, &m_oldSigAction, 0) > 0)
{
return false;
}
return true;
}

@ -1,63 +0,0 @@
#ifndef EVENTHANDLER_H
#define EVENTHANDLER_H
#include <QObject>
#include <QSocketNotifier>
#include <signal.h>
#include <tr1/memory>
using std::tr1::shared_ptr;
class Connection;
class Booster;
class EventHandler : public QObject
{
Q_OBJECT
public:
//! \brief Constructor
EventHandler(Booster* parent);
//! \brief Destructor
virtual ~EventHandler();
void runEventLoop();
//! UNIX signal handler for SIGHUP
static void hupSignalHandler(int unused);
//! Setup UNIX signal handlers
static bool setupUnixSignalHandlers();
//! Restore UNIX signal handlers to previous values
static bool restoreUnixSignalHandlers();
private:
//! wait for socket connection
void accept();
//! Socket pair used to get SIGHUP
static int m_sighupFd[2];
//! Socket notifier used for m_sighupFd
shared_ptr<QSocketNotifier> m_snHup;
//! Old sigaction struct
static struct sigaction m_oldSigAction;
// Parent object
Booster* m_parent;
private slots:
//! Qt signal handler for SIGHUP.
void handleSigHup();
signals:
void connectionAccepted();
void connectionRejected();
};
#endif

@ -1,263 +0,0 @@
/***************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include <Qt/QtDeclarative>
#include <QX11Info>
#include <QtPlugin>
#include <QPluginLoader>
#include <QLibraryInfo>
#include <QApplication>
#include "mdeclarativecache.h"
#include "mdeclarativecache_p.h"
#ifdef Q_WS_X11
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#endif
MDeclarativeCachePrivate * const MDeclarativeCache::d_ptr = new MDeclarativeCachePrivate;
const int MDeclarativeCachePrivate::ARGV_LIMIT = 32;
MDeclarativeCachePrivate::MDeclarativeCachePrivate() :
qApplicationInstance(0),
qDeclarativeViewInstance(0),
initialArgc(ARGV_LIMIT),
initialArgv(new char* [initialArgc]),
appDirPath(QString()),
appFilePath(QString()),
cachePopulated(false),
testabilityInterface(0)
{
}
MDeclarativeCachePrivate::~MDeclarativeCachePrivate()
{
delete qDeclarativeViewInstance;
delete[] initialArgv;
}
void MDeclarativeCachePrivate::populate()
{
// Record the fact that the cache has been populated
cachePopulated = true;
static const char *const emptyString = "";
static const QString appNameFormat = "mdeclarativecache_pre_initialized_qapplication-%1";
static QByteArray appName;
// Append pid to appName to make it unique. This is required because the
// libminputcontext.so instantiates MComponentData, which in turn registers
// a dbus service with the application's name.
appName = appNameFormat.arg(getpid()).toLatin1();
// We support at most ARGV_LIMIT arguments in QCoreApplication. These will be set when real
// arguments are known (in MDeclarativeCachePrivate::qApplication).
initialArgv[0] = const_cast<char *>(appName.constData());
for (int i = 1; i < initialArgc; i++) {
initialArgv[i] = const_cast<char *>(emptyString);
}
if (qApplicationInstance == 0) {
qApplicationInstance = new QApplication(initialArgc, initialArgv);
}
qDeclarativeViewInstance = new QDeclarativeView();
}
QApplication* MDeclarativeCachePrivate::qApplication(int &argc, char **argv)
{
if (qApplicationInstance == 0)
{
qApplicationInstance = new QApplication(argc, argv);
}
else
{
if (argc > ARGV_LIMIT)
{
qWarning("MDeclarativeCache: QCoreApplication::arguments() will not contain all arguments.");
}
// Copy arguments to QCoreApplication
for (int i = 0; i < qMin(argc, ARGV_LIMIT); i++)
{
qApp->argv()[i] = argv[i];
}
// This changes argc in QCoreApplication
initialArgc = qMin(argc, ARGV_LIMIT);
// Take application name from argv
QString appName = QFileInfo(argv[0]).fileName();
// Set object name
qApp->setObjectName(appName);
bool loadTestabilityArg = false;
const char* testabilityArg = "-testability";
for (int i = 0; i < argc; i++)
{
if (strcmp(argv[i], testabilityArg) == 0)
{
loadTestabilityArg = true;
break;
}
}
bool loadTestabilityEnv = !qgetenv("QT_LOAD_TESTABILITY").isNull();
if (loadTestabilityEnv || loadTestabilityArg)
testabilityInit();
#ifdef Q_WS_X11
// Currently QDeclarativeView is "Alien" widget and doesn't have it's XWindow. The procedure below is not needed.
// Call to winId() converts the widget to "Native" and makes it slow.
// If things get changed to use the procedure need to define QDV_USE_NATIVE_WIDGETS
// In this case it should be considered to add XErrorHandler around XSetCommand and XSetClassHint
// because those can generate BadAlloc and BadWindow errors.
#ifdef QDV_USE_NATIVE_WIDGETS
// reinit WM_COMMAND X11 property
if (qDeclarativeViewInstance)
{
Display *display = QX11Info::display();
if (display)
{
qDeclarativeViewInstance->winId();
XSetCommand(display, qDeclarativeViewInstance->effectiveWinId(), argv, argc);
// set correct WM_CLASS properties
QString appClass = appName.left(1).toUpper();
if (appName.length() > 1)
appClass += appName.right(appName.length() - 1);
// reserve memory for C strings
QByteArray arrName(appName.toLatin1());
QByteArray arrClass(appClass.toLatin1());
XClassHint class_hint;
class_hint.res_name = arrName.data();
class_hint.res_class = arrClass.data();
XSetClassHint(display, qDeclarativeViewInstance->effectiveWinId(), &class_hint);
}
}
#endif
#endif
if (cachePopulated)
{
// In Qt 4.7, QCoreApplication::applicationDirPath() and
// QCoreApplication::applicationFilePath() look up the paths in /proc,
// which does not work when the booster is used. As a workaround, we
// use argv[0] to provide the correct values in the cache class.
appFilePath = QString(argv[0]);
appDirPath = QString(argv[0]);
appDirPath.chop(appDirPath.size() - appDirPath.lastIndexOf("/"));
}
}
#ifdef HAVE_PATH_REINIT
// Set the magic attribute so that paths are reinitialized
qApplicationInstance->setAttribute(Qt::AA_LinuxReinitPathsFromArgv0, true);
#endif
return qApplicationInstance;
}
void MDeclarativeCachePrivate::testabilityInit()
{
// Activate testability plugin if exists
QString testabilityPluginPostfix = ".so";
QString testabilityPlugin = "testability/libtestability";
testabilityPlugin = QLibraryInfo::location(QLibraryInfo::PluginsPath) + QDir::separator() + testabilityPlugin + testabilityPluginPostfix;
QPluginLoader loader(testabilityPlugin.toLatin1().data());
QObject *plugin = loader.instance();
if (plugin)
{
testabilityInterface = qobject_cast<TestabilityInterface *>(plugin);
if (testabilityInterface)
{
testabilityInterface->Initialize();
}
}
}
QDeclarativeView* MDeclarativeCachePrivate::qDeclarativeView()
{
QDeclarativeView *returnValue = 0;
if (qDeclarativeViewInstance != 0) {
returnValue = qDeclarativeViewInstance;
qDeclarativeViewInstance = 0;
} else {
returnValue = new QDeclarativeView();
}
return returnValue;
}
QString MDeclarativeCachePrivate::applicationDirPath()
{
if (cachePopulated) {
// In the booster case use the workaround
return appDirPath;
} else {
return QCoreApplication::applicationDirPath();
}
}
QString MDeclarativeCachePrivate::applicationFilePath()
{
if (cachePopulated) {
// In the booster case use the workaround
return appFilePath;
} else {
return QCoreApplication::applicationFilePath();
}
}
QDeclarativeView *MDeclarativeCache::populate()
{
d_ptr->populate();
return d_ptr->qDeclarativeViewInstance;
}
QApplication* MDeclarativeCache::qApplication(int &argc, char **argv)
{
return d_ptr->qApplication(argc, argv);
}
QDeclarativeView* MDeclarativeCache::qDeclarativeView()
{
return d_ptr->qDeclarativeView();
}
QString MDeclarativeCache::applicationDirPath()
{
return d_ptr->applicationDirPath();
}
QString MDeclarativeCache::applicationFilePath()
{
return d_ptr->applicationFilePath();
}

@ -1,96 +0,0 @@
/*!
**
** @copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** @license GNU Lesser General Public License version 2.1
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef MDECLARATIVECACHE_H
#define MDECLARATIVECACHE_H
#include <QString>
class MDeclarativeCachePrivate;
class QApplication;
class QDeclarativeView;
/*!
* \class MDeclarativeCache.
* \brief Cache class for QDeclarativeBooster.
*/
class MDeclarativeCache
{
public:
//! Constructor.
MDeclarativeCache() {};
//! Destructor.
virtual ~MDeclarativeCache() {};
//! Populate cache with QApplication and QDeclarativeView
/*!
* Returns the cached QDeclarativeView instance, which can be used for booster-specific
* initialization.
*/
static QDeclarativeView *populate();
//! Returns QApplication instance from cache or creates a new one.
/*!
* Ownership of the returned object is passed to the caller.
* NOTE: This is subject to change.
*/
static QApplication *qApplication(int &argc, char **argv);
//! Returns QDeclarativeView instance from cache or creates a new one.
/*!
* Ownership of the returned object is passed to the caller.
* NOTE: This is subject to change.
*/
static QDeclarativeView *qDeclarativeView();
//! Returns the directory that contains the application executable.
/*!
* This function is deprecated. It used to be a workaround for QApplication::applicationDirPath()
* not working on harmattan with qdeclarativebooster and Qt 4.7, but this has been fixed.
*/
static QString applicationDirPath() __attribute__ ((deprecated));
//! Returns the file path of the application executable.
/*!
* This function is deprecated. It used to be a workaround for QApplication::applicationFilePath()
* not working on harmattan with qdeclarativebooster and Qt 4.7, but this has been fixed.
*/
static QString applicationFilePath() __attribute__ ((deprecated));
protected:
static MDeclarativeCachePrivate* const d_ptr;
private:
//! Disable copy-constructor
MDeclarativeCache(const MDeclarativeCache & r);
//! Disable assignment operator
MDeclarativeCache & operator= (const MDeclarativeCache & r);
#ifdef UNIT_TEST
friend class Ut_MDeclarativeCache;
#endif
};
#endif //MDECLARATIVECACHE_H

@ -1,61 +0,0 @@
/***************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef MDECLARATIVECACHE_P_H
#define MDECLARATIVECACHE_P_H
#include <QString>
#include "testabilityinterface.h"
class MDeclarativeCache;
class QApplication;
class QDeclarativeView;
class MDeclarativeCachePrivate
{
public:
MDeclarativeCachePrivate();
virtual ~MDeclarativeCachePrivate();
void populate();
QApplication* qApplication(int &argc, char **argv);
QDeclarativeView* qDeclarativeView();
QString applicationDirPath();
QString applicationFilePath();
void testabilityInit();
static const int ARGV_LIMIT;
QApplication *qApplicationInstance;
QDeclarativeView *qDeclarativeViewInstance;
int initialArgc;
char **initialArgv;
QString appDirPath;
QString appFilePath;
bool cachePopulated;
TestabilityInterface *testabilityInterface;
#ifdef UNIT_TEST
friend class Ut_MDeclarativeCache;
#endif
};
#endif // MDECLARATIVECACHE_P_H

@ -1,45 +0,0 @@
/***************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include <QtCore>
#include "qdeclarativebooster.h"
extern "C"
{
// Create a new plugin instance.
Q_DECL_EXPORT void * create()
{
return new QDeclarativeBooster;
}
Q_DECL_EXPORT char type()
{
return QDeclarativeBooster::type();
}
Q_DECL_EXPORT const char * socketName()
{
return QDeclarativeBooster::socketName().c_str();
}
Q_DECL_EXPORT const char * temporaryProcessName()
{
return QDeclarativeBooster::temporaryProcessName().c_str();
}
}

@ -1,112 +0,0 @@
/***************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include "qdeclarativebooster.h"
#include "mdeclarativecache.h"
#include "connection.h"
const string QDeclarativeBooster::m_socketId = "/tmp/boostd";
const string QDeclarativeBooster::m_temporaryProcessName = "booster-d";
const string & QDeclarativeBooster::socketId() const
{
return m_socketId;
}
const string & QDeclarativeBooster::socketName()
{
return m_socketId;
}
const string & QDeclarativeBooster::temporaryProcessName()
{
return m_temporaryProcessName;
}
const string & QDeclarativeBooster::boosterTemporaryProcessName() const
{
return temporaryProcessName();
}
char QDeclarativeBooster::type()
{
return 'd';
}
bool QDeclarativeBooster::preload()
{
MDeclarativeCache::populate();
return true;
}
bool QDeclarativeBooster::receiveDataFromInvoker(int socketFd)
{
// Use the default implementation if in boot mode
// (it won't require QApplication running).
if (bootMode())
{
return Booster::receiveDataFromInvoker(socketFd);
}
else
{
// Setup the conversation channel with the invoker.
setConnection(new Connection(socketFd));
EventHandler handler(this);
handler.runEventLoop();
if (!connection()->connected())
{
return false;
}
// Receive application data from the invoker
if(!connection()->receiveApplicationData(appData()))
{
connection()->close();
return false;
}
// Close the connection if exit status doesn't need
// to be sent back to invoker
if (!connection()->isReportAppExitStatusNeeded())
{
connection()->close();
}
return true;
}
}
void QDeclarativeBooster::preinit()
{
QString appName = QFileInfo(m_appData->argv()[0]).fileName();
QString appClass = appName.left(1).toUpper();
if (appName.length() > 1)
appClass += appName.right(appName.length() - 1);
// char* app_name = qstrdup(appName.toLatin1().data());
// QApplication::setAppName(app_name);
// char* app_class = qstrdup(appClass.toLatin1().data());
// QApplication::setAppClass(app_class);
}

@ -1,98 +0,0 @@
/***************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef QDECLARATIVEBOOSTER_H
#define QDECLARATIVEBOOSTER_H
#include <QApplication>
#include "QFileInfo"
#include "eventhandler.h"
#include "booster.h"
/*!
* \class QDeclarativeBooster.
* \brief QDeclarative-specific version of the Booster.
*/
class QDeclarativeBooster : public Booster
{
public:
//! Constructor.
QDeclarativeBooster() {};
//! Destructor.
virtual ~QDeclarativeBooster() {};
/*!
* \brief Return the socket name common to all QDeclarativeBooster objects.
* \return Path to the socket file.
*/
static const string & socketName();
//! Return the process name to be used when booster is not
//! yet transformed into a running application
static const string & temporaryProcessName();
//! \reimp
virtual const string & boosterTemporaryProcessName() const;
//! \reimp
virtual char boosterType() const { return type(); }
/*!
* \brief Return a unique character ('d') represtenting the type of QDeclarativeBoosters.
* \return Type character.
*/
static char type();
//! \reimp
virtual bool preload();
protected:
//! \reimp
virtual const string & socketId() const;
//! \reimp
virtual bool receiveDataFromInvoker(int socketFd);
//! \reimp
virtual void preinit();
private:
//! Disable copy-constructor
QDeclarativeBooster(const QDeclarativeBooster & r);
//! Disable assignment operator
QDeclarativeBooster & operator= (const QDeclarativeBooster & r);
static const string m_socketId;
//! Process name to be used when booster is not
//! yet transformed into a running application
static const string m_temporaryProcessName;
#ifdef UNIT_TEST
friend class Ut_DBooster;
#endif
};
#endif //QDECLARATIVEBOOSTER_H

@ -1,41 +0,0 @@
/***************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef DBOOSTERTESTABILITYINTERFACE_H
#define DBOOSTERTESTABILITYINTERFACE_H
class TestabilityInterface
{
public:
virtual ~TestabilityInterface() {}
/*!
Initializes the plugin once loaded.
*/
virtual void Initialize() = 0;
};
Q_DECLARE_INTERFACE(TestabilityInterface,
"com.nokia.testability.TestabilityInterface/1.0")
#endif // DBOOSTERTESTABILITYINTERFACE_H

@ -1,27 +0,0 @@
# Find Qt4
find_package(Qt4 4.6.0 REQUIRED)
include(${QT_USE_FILE})
if (${QTVERSION} VERSION_LESS 4.6.0)
message(FATAL_ERROR "You need Qt4.6, found ${QTVERSION}.")
endif (${QTVERSION} VERSION_LESS 4.6.0)
set(LAUNCHER "${CMAKE_HOME_DIRECTORY}/src/launcherlib")
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/src/common ${LAUNCHER})
# Hide all symbols except the ones explicitly exported in the code (like main())
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
# Set sources
set(SRC qtbooster.cpp pluginfactory.cpp)
# Set libraries to be linked.
link_libraries("-L../launcherlib -lapplauncherd" ${LIBDL} ${QT_QTCORE_LIBRARY})
# Set executable
add_library(qtbooster MODULE ${SRC})
add_dependencies(qtbooster applauncherd)
# Add install rule
install(TARGETS qtbooster DESTINATION /usr/lib/applauncherd/)

@ -1,45 +0,0 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include <QtCore>
#include "qtbooster.h"
extern "C"
{
// Create a new plugin instance.
Q_DECL_EXPORT void * create()
{
return new QtBooster;
}
Q_DECL_EXPORT char type()
{
return QtBooster::type();
}
Q_DECL_EXPORT const char * socketName()
{
return QtBooster::socketName().c_str();
}
Q_DECL_EXPORT const char * temporaryProcessName()
{
return QtBooster::temporaryProcessName().c_str();
}
}

@ -1,53 +0,0 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include "qtbooster.h"
const string QtBooster::m_socketId = "/tmp/boostq";
const string QtBooster::m_temporaryProcessName = "booster-q";
const string & QtBooster::socketId() const
{
return m_socketId;
}
const string & QtBooster::socketName()
{
return m_socketId;
}
const string & QtBooster::temporaryProcessName()
{
return m_temporaryProcessName;
}
const string & QtBooster::boosterTemporaryProcessName() const
{
return temporaryProcessName();
}
char QtBooster::type()
{
return 'q';
}
bool QtBooster::preload()
{
return true;
}

@ -1,88 +0,0 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef QTBOOSTER_H
#define QTBOOSTER_H
#include "booster.h"
/*!
* \class QtBooster.
* \brief Qt-specific version of the Booster.
*/
class QtBooster : public Booster
{
public:
//! Constructor.
QtBooster() {};
//! Destructor.
virtual ~QtBooster() {};
/*!
* \brief Return the socket name common to all QtBooster objects.
* \return Path to the socket file.
*/
static const string & socketName();
//! Return the process name to be used when booster is not
//! yet transformed into a running application
static const string & temporaryProcessName();
//! \reimp
virtual const string & boosterTemporaryProcessName() const;
//! \reimp
virtual char boosterType() const { return type(); }
/*!
* \brief Return a unique character ('q') represtenting the type of QtBoosters.
* \return Type character.
*/
static char type();
protected:
//! \reimp
virtual bool preload();
//! \reimp
virtual const string & socketId() const;
private:
//! Disable copy-constructor
QtBooster(const QtBooster & r);
//! Disable assignment operator
QtBooster & operator= (const QtBooster & r);
static const string m_socketId;
//! Process name to be used when booster is not
//! yet transformed into a running application
static const string m_temporaryProcessName;
#ifdef UNIT_TEST
friend class Ut_QtBooster;
#endif
};
#endif //QTBOOSTER_H

@ -1,10 +1,3 @@
# Find Qt4
find_package(Qt4 4.6.0 REQUIRED)
include(${QT_USE_FILE})
if (${QTVERSION} VERSION_LESS 4.6.0)
message(FATAL_ERROR "You need Qt4.6, found ${QTVERSION}.")
endif (${QTVERSION} VERSION_LESS 4.6.0)
# Sub build: meego/testscripts # Sub build: meego/testscripts
add_subdirectory(meego/testscripts) add_subdirectory(meego/testscripts)
@ -29,12 +22,6 @@ add_subdirectory(common/testapps/fala_status)
# Sub build: common/testapps/fala_wait # Sub build: common/testapps/fala_wait
add_subdirectory(common/testapps/fala_wait) add_subdirectory(common/testapps/fala_wait)
# Sub build: common/testapps/focustest
add_subdirectory(common/testapps/focustest)
# Sub build: common/testapps/testapp
add_subdirectory(common/testapps/testapp)
# Sub build: common/testapps/fala_gettime # Sub build: common/testapps/fala_gettime
add_subdirectory(common/testapps/fala_gettime) add_subdirectory(common/testapps/fala_gettime)
@ -47,15 +34,3 @@ add_subdirectory(common/testapps/pixelchanged)
# Sub build: common/testapps/fala_windowid # Sub build: common/testapps/fala_windowid
add_subdirectory(common/testapps/fala_windowid) add_subdirectory(common/testapps/fala_windowid)
# Sub build: common/testapps/xsendevent
add_subdirectory(common/testapps/xsendevent)
# Sub build: common/testapps/fala_qml_helloworld
add_subdirectory(common/testapps/fala_qml_helloworld)
# Sub build: common/testapps/fala_windowless
add_subdirectory(common/testapps/fala_windowless)
# Sub build: common/testapps/fala_dbus
add_subdirectory(common/testapps/fala_dbus)

@ -1,33 +0,0 @@
# Set sources
set(SRC fala_dbus.cpp)
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTDBUS_LIBRARY})
include(${QT_USE_FILE})
SET (QT_USE_QTDBUS true)
INCLUDE_DIRECTORIES(${QT_QTDBUS_INCLUDE_DIR})
execute_process(COMMAND "env"
"PKG_CONFIG_PATH=${CMAKE_SOURCE_DIR}/data/pkgconfig"
"/usr/bin/pkg-config"
"--cflags"
"qt-boostable"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE booster_cflags
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND "env"
"PKG_CONFIG_PATH=${CMAKE_SOURCE_DIR}/data/pkgconfig"
"/usr/bin/pkg-config" "--libs"
"qt-boostable"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE booster_libs
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${booster_cflags}")
set(CMAKE_EXE_LINKER_FLAGS ${booster_libs})
add_executable(fala_dbus ${SRC})
# Install
install(PROGRAMS fala_dbus DESTINATION /usr/bin/ )

@ -1,40 +0,0 @@
/***************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include <QApplication>
#include <QDBusConnection>
#include <QDBusMessage>
#include <QString>
#include <syslog.h>
#include <iostream>
Q_DECL_EXPORT int main(int argc, char ** argv)
{
QApplication app(argc, argv);
Q_UNUSED(app);
QDBusConnection bus = QDBusConnection::systemBus();
QDBusMessage msg = QDBusMessage::createMethodCall("com.nokia.dsme", "/com/nokia/dsme/request", "com.nokia.dsme.request", "req_powerup");
QDBusMessage reply = bus.call(msg,QDBus::AutoDetect, 5);
QString dbusReplyError = reply.errorName();
openlog ("qfala_dbus", LOG_NDELAY | LOG_PID | LOG_PERROR, LOG_DAEMON);
syslog (LOG_DAEMON | LOG_NOTICE, "fala_dbus connection error: '%s'", dbusReplyError.toLocal8Bit().data());
closelog();
std::cerr << "fala_dbus connection error:" << dbusReplyError.toLocal8Bit().data() << "\n";
_exit(0);
}

@ -1,42 +0,0 @@
# Set sources
set(SRC main.cpp)
# Use the compiler and linker flags given in qdeclarative-boostable.pc
# in the source tree.
execute_process(COMMAND "env"
"PKG_CONFIG_PATH=${CMAKE_SOURCE_DIR}/data/pkgconfig"
"/usr/bin/pkg-config"
"--cflags"
"qdeclarative-boostable"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE booster_cflags
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND "env"
"PKG_CONFIG_PATH=${CMAKE_SOURCE_DIR}/data/pkgconfig"
"/usr/bin/pkg-config" "--libs"
"qdeclarative-boostable"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE booster_libs
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${booster_cflags}")
include_directories(${CMAKE_SOURCE_DIR}/src/qdeclarativebooster)
# Compile resources
QT4_ADD_RESOURCES(RESOURCE_SRC main.qrc)
# Enable Qt-support
include(${QT_USE_FILE})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} "-L${CMAKE_SOURCE_DIR}/src/launcherlib -lapplauncherd -L${CMAKE_SOURCE_DIR}/src/qdeclarativebooster ${booster_libs}")
add_executable(fala_qml ${SRC} ${RESOURCE_SRC})
add_dependencies(fala_qml applauncherd mdeclarativecache)
# Install
install(PROGRAMS fala_qml DESTINATION /usr/bin/ RENAME fala_qml_wol)
install(PROGRAMS fala_qml DESTINATION /usr/bin/ RENAME fala_qml_helloworld)
install(PROGRAMS fala_qml DESTINATION /usr/bin/ RENAME fala_qml_wl)
install(PROGRAMS fala_qml DESTINATION /usr/share/fala_images RENAME fala_qml_helloworld)
install(FILES fala_qml_wl.desktop DESTINATION /usr/share/applications)
install(FILES fala_qml_wol.desktop DESTINATION /usr/share/applications)
install(SCRIPT scripts/create_links.cmake)

@ -1,7 +0,0 @@
[Desktop Entry]
Type=Application
Name=fala_qml_wl
Icon=icon-l-video
Exec=invoker --single-instance --type=d /usr/bin/fala_qml_wl
Categories=X-MeeGo;X-Demos;
OnlyShowIn=X-MeeGo;

@ -1,7 +0,0 @@
[Desktop Entry]
Type=Application
Name=fala_qml_wol
Icon=icon-l-video
Exec=single-instance /usr/bin/fala_qml_wol
Categories=X-MeeGo;X-Demos;
OnlyShowIn=X-MeeGo;

@ -1,144 +0,0 @@
/***************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include <Qt/QtDeclarative>
#include <QFile>
#include <sys/time.h>
#include "mdeclarativecache.h"
#include <exception>
QString log_file = "/tmp/fala_qml_helloworld.log";
void FANGORNLOG(const char* s, bool eol = true)
{
QFile f(log_file);
f.open(QIODevice::Append);
f.write(s, qstrlen(s));
if (eol) {
f.write("\n", 1);
}
f.close();
}
void FANGORNLOG(const QString& s, bool eol = true)
{
QByteArray ba = s.toLocal8Bit();
char *p = new char[ba.size() + 1];
strcpy(p, ba.data());
FANGORNLOG(p, eol);
}
void timestamp(const char *s)
{
timeval tim;
char msg[80];
gettimeofday(&tim, NULL);
snprintf(msg, 80, "%d%03d %s",
static_cast<int>(tim.tv_sec), static_cast<int>(tim.tv_usec/1000), s);
FANGORNLOG(msg);
}
void timestamp(const QString& s)
{
QByteArray ba = s.toLocal8Bit();
char *p = new char[ba.size() + 1];
strcpy(p, ba.data());
timestamp(p);
}
Q_DECL_EXPORT int main(int argc, char **argv)
{
QApplication *app;
try
{
QString appName(argv[0]);
if (appName.endsWith("fala_qml_wl"))
{
log_file = "/tmp/fala_qml_wl.log";
}
else if (appName.endsWith("fala_qml_wol"))
{
log_file = "/tmp/fala_qml_wol.log";
}
timestamp("application main");
app = MDeclarativeCache::qApplication(argc, argv);
timestamp("QApplication from cache");
QDeclarativeView *window = NULL;
bool bWindowNotFromCache = false;
const QString sWindowNotFromCache = "window-not-from-cache";
for (int i = 1; i < argc; i++) {
QString sArg = QString(argv[i]);
if (sArg.contains(sWindowNotFromCache,Qt::CaseInsensitive)) {
bWindowNotFromCache = true;
break;
}
}
if (bWindowNotFromCache) {
window = new QDeclarativeView();
timestamp("QDeclarativeView NOT from cache");
} else {
window = MDeclarativeCache::qDeclarativeView();
timestamp("QDeclarativeView from cache");
}
timestamp(QString("applicationDirPath: ").append(QApplication::applicationDirPath()));
timestamp(QString("applicationFilePath: ").append(QApplication::applicationFilePath()));
if (argc > 2 && QString(argv[1]) == QString("--log-args")) {
FANGORNLOG("argv:", false);
for (int i = 0; i < argc; i++) {
FANGORNLOG(" ", false);
FANGORNLOG(argv[i], false);
}
FANGORNLOG("");
FANGORNLOG("argv:", false);
QStringList args = QCoreApplication::arguments();
for (int i = 0; i < args.size(); i++) {
FANGORNLOG(" ", false);
FANGORNLOG(args.at(i), false);
}
FANGORNLOG("");
}
window->setWindowTitle("Applauncherd QML testapp");
window->setResizeMode(QDeclarativeView::SizeRootObjectToView);
//window->setSource(QUrl::fromLocalFile("/usr/share/fala_qml_helloworld/main.qml"));
window->setSource(QUrl("qrc:/main.qml"));
window->showFullScreen();
timestamp("Calling app->exec()");
}
catch(std::exception& e)
{
return -1;
}
_exit(app->exec());
}

@ -1,12 +0,0 @@
import Qt 4.7
Rectangle {
width: 853
height: 480
Text {
id: text1
anchors.centerIn: parent
text: "Hello QML World!"
font.pixelSize: 80
}
}

@ -1,5 +0,0 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
</qresource>
</RCC>

@ -1,4 +0,0 @@
execute_process(COMMAND echo "Creating symlinks for fala_qml_helloworld..")
execute_process(COMMAND ln -v -s /usr/bin/fala_qml_helloworld $ENV{DESTDIR}/usr/bin/fala_qml_helloworld1)
execute_process(COMMAND ln -v -s /usr/bin/fala_qml_helloworld $ENV{DESTDIR}/usr/bin/fala_qml_helloworld2)

@ -1,28 +1,6 @@
# Set sources # Set sources
set(SRC fala_status.cpp) set(SRC fala_status.cpp)
include(${QT_USE_FILE})
execute_process(COMMAND "env"
"PKG_CONFIG_PATH=${CMAKE_SOURCE_DIR}/data/pkgconfig"
"/usr/bin/pkg-config"
"--cflags"
"qt-boostable"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE booster_cflags
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND "env"
"PKG_CONFIG_PATH=${CMAKE_SOURCE_DIR}/data/pkgconfig"
"/usr/bin/pkg-config" "--libs"
"qt-boostable"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE booster_libs
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${booster_cflags}")
set(CMAKE_EXE_LINKER_FLAGS ${booster_libs})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
add_executable(fala_status ${SRC}) add_executable(fala_status ${SRC})
# Install # Install

@ -17,19 +17,17 @@
** **
****************************************************************************/ ****************************************************************************/
#include <QApplication>
#include <QTimer>
#include <iostream> #include <iostream>
#include <unistd.h>
Q_DECL_EXPORT int main(int argc, char ** argv) int main(int argc, char ** argv)
{ {
QApplication app(argc, argv);
QTimer::singleShot(5, &app, SLOT(quit()));
int usr_id = getuid(); int usr_id = getuid();
int grp_id = getgid(); int grp_id = getgid();
std::cerr << "uid=" << usr_id <<"\n"; std::cerr << "uid=" << usr_id <<"\n";
std::cerr << "gid=" << grp_id <<"\n"; std::cerr << "gid=" << grp_id <<"\n";
app.exec();
usleep(5000);
_exit(29); _exit(29);
} }

@ -1,27 +1,6 @@
# Set sources # Set sources
set(SRC fala_wait.cpp) set(SRC fala_wait.cpp)
include(${QT_USE_FILE})
execute_process(COMMAND "env"
"PKG_CONFIG_PATH=${CMAKE_SOURCE_DIR}/data/pkgconfig"
"/usr/bin/pkg-config"
"--cflags"
"qt-boostable"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE booster_cflags
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND "env"
"PKG_CONFIG_PATH=${CMAKE_SOURCE_DIR}/data/pkgconfig"
"/usr/bin/pkg-config" "--libs"
"qt-boostable"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE booster_libs
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${booster_cflags}")
set(CMAKE_EXE_LINKER_FLAGS ${booster_libs})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
add_executable(fala_wait ${SRC}) add_executable(fala_wait ${SRC})
# Install # Install

@ -17,13 +17,11 @@
** **
****************************************************************************/ ****************************************************************************/
#include <QApplication>
#include <QTimer>
#include <iostream> #include <iostream>
#include <unistd.h>
Q_DECL_EXPORT int main(int argc, char ** argv) int main(int argc, char ** argv)
{ {
QApplication app(argc, argv); sleep(6);
QTimer::singleShot(6000, &app, SLOT(quit())); return 0;
app.exec();
} }

@ -1,30 +0,0 @@
# Set sources
set(SRC fala_windowless.cpp)
execute_process(COMMAND "env"
"PKG_CONFIG_PATH=${CMAKE_SOURCE_DIR}/data/pkgconfig"
"/usr/bin/pkg-config"
"--cflags"
"qt-boostable"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE booster_cxxflags
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND "env"
"PKG_CONFIG_PATH=${CMAKE_SOURCE_DIR}/data/pkgconfig"
"/usr/bin/pkg-config" "--libs"
"qt-boostable"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE booster_libs
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${booster_cxxflags}")
set(CMAKE_EXE_LINKER_FLAGS ${booster_libs})
include(${QT_USE_FILE})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
add_executable(fala_windowless ${SRC})
install(PROGRAMS fala_windowless DESTINATION /usr/bin/)

@ -1,26 +0,0 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include <QApplication>
Q_DECL_EXPORT int main(int argc, char ** argv)
{
QApplication app(argc, argv);
app.exec();
}

@ -1,4 +0,0 @@
# Install
install(PROGRAMS fala_focus DESTINATION /usr/bin/ )
install(FILES view.qml DESTINATION /usr/share/applauncherd-testscripts/)

@ -1,18 +0,0 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from PySide.QtCore import *
from PySide.QtGui import *
from PySide.QtDeclarative import QDeclarativeView
# Create Qt application and the QDeclarative view
app = QApplication(sys.argv)
view = QDeclarativeView()
# Create an URL to the QML file
url = QUrl('/usr/share/applauncherd-testscripts/view.qml')
# Set the QML file and show
view.setSource(url)
view.show()
# Enter Qt main loop
sys.exit(app.exec_())

@ -1,12 +0,0 @@
import Qt 4.7
Rectangle {
width: 200
height: 200
color: "red"
Text {
text: "Hello World"
anchors.centerIn: parent
}
}

@ -1,34 +0,0 @@
# Set sources
set(SRC main.cpp)
execute_process(COMMAND "env"
"PKG_CONFIG_PATH=${CMAKE_SOURCE_DIR}/data/pkgconfig"
"/usr/bin/pkg-config"
"--cflags"
"qt-boostable"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE booster_cflags
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND "env"
"PKG_CONFIG_PATH=${CMAKE_SOURCE_DIR}/data/pkgconfig"
"/usr/bin/pkg-config" "--libs"
"qt-boostable"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE booster_libs
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${booster_cflags}")
set(CMAKE_EXE_LINKER_FLAGS ${booster_libs})
# Enable Qt-support
include(${QT_USE_FILE})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
add_executable(fala_testapp ${SRC})
# Install
install(PROGRAMS fala_testapp DESTINATION /usr/bin RENAME fala_wol)
install(PROGRAMS fala_testapp DESTINATION /usr/bin RENAME fala_wl)
install(FILES com.nokia.fala_testapp.service com.nokia.fala_wl.service com.nokia.fala_wol.service DESTINATION /usr/share/dbus-1/services)
install(FILES fala_wl.desktop fala_wol.desktop DESTINATION /usr/share/applications/)
install(FILES images/landscape.jpg DESTINATION /usr/share/fala_images/)
install(FILES images/portrait.jpg DESTINATION /usr/share/fala_images/)

@ -1,4 +0,0 @@
[D-BUS Service]
Name=com.nokia.fala_testapp
Exec=/usr/bin/fala_testapp -prestart

@ -1,3 +0,0 @@
[D-BUS Service]
Name=com.nokia.fala_wl
Exec=/usr/bin/fala_wl

@ -1,3 +0,0 @@
[D-BUS Service]
Name=com.nokia.fala_wol
Exec=/usr/bin/fala_wol.sh

@ -1,7 +0,0 @@
[Desktop Entry]
Type=Application
Name=fala_wl
Icon=icon-l-video
Exec=/usr/bin/invoker --test-mode --type=q /usr/bin/fala_wl
Categories=X-MeeGo;X-Demos;
OnlyShowIn=X-MeeGo;

@ -1,7 +0,0 @@
[Desktop Entry]
Type=Application
Name=fala_wol
Icon=icon-l-video
Exec=/usr/bin/fala_wol
Categories=X-MeeGo;X-Demos;
OnlyShowIn=X-MeeGo;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

@ -1,102 +0,0 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include <QApplication>
#include <QFile>
#include <QBrush>
#include <QColor>
#include <sys/time.h>
#include <exception>
QString log_file = "/tmp/fala_testapp.log";
void FANGORNLOG(const char* s, bool eol = true)
{
QFile f(log_file);
f.open(QIODevice::Append);
f.write(s, qstrlen(s));
if (eol) {
f.write("\n", 1);
}
f.close();
}
void FANGORNLOG(const QString& s, bool eol = true)
{
QByteArray ba = s.toLocal8Bit();
char *p = new char[ba.size() + 1];
strcpy(p, ba.data());
FANGORNLOG(p, eol);
}
void timestamp(const char *s)
{
timeval tim;
char msg[80];
gettimeofday(&tim, NULL);
snprintf(msg, 80, "%d%03d %s",
static_cast<int>(tim.tv_sec), static_cast<int>(tim.tv_usec)/1000, s);
FANGORNLOG(msg);
}
Q_DECL_EXPORT int main(int argc, char **argv)
{
QApplication *app;
try
{
QString appName(argv[0]);
if (appName.endsWith("fala_wl"))
{
log_file = "/tmp/fala_wl.log";
}
else if (appName.endsWith("fala_wol"))
{
log_file = "/tmp/fala_wol.log";
}
timestamp("application main");
app = new QApplication(argc, argv);
timestamp("app created without cache");
if (argc > 2 && QString(argv[1]) == QString("--log-args")) {
FANGORNLOG("argv:", false);
for (int i = 0; i < argc; i++) {
FANGORNLOG(" ", false);
FANGORNLOG(argv[i], false);
}
FANGORNLOG("");
FANGORNLOG("argv:", false);
QStringList args = QCoreApplication::arguments();
for (int i = 0; i < args.size(); i++) {
FANGORNLOG(" ", false);
FANGORNLOG(args.at(i), false);
}
FANGORNLOG("");
}
}
catch(std::exception& e)
{
return -1;
}
_exit(app->exec());
}

@ -1,9 +0,0 @@
# Set sources
set(SRC main.cpp)
link_libraries(-lX11 ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
add_executable(xsendevent ${SRC})
# Install
install(PROGRAMS xsendevent DESTINATION /usr/bin/)

@ -1,10 +0,0 @@
xsendevent - tool for sending various xevents to windows on command line
# Usage:
# Close window
xsendevent close [windowId]
# Move window to task switcher
xsendevent iconify [windowId]

@ -1,90 +0,0 @@
#include <QApplication>
#include <QX11Info>
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
void printUsage()
{
printf("Usage: xsendevent [event windowid]...\n");
printf("Supported events:\n");
printf(" close - sends _NET_CLOSE_WINDOW(windowid) the root window\n");
}
void sendCloseEvent(Window window)
{
Display *display = QX11Info::display();
Window rootWin = QX11Info::appRootWindow(QX11Info::appScreen());
XEvent ev;
memset(&ev, 0, sizeof(ev));
Atom closeWindowAtom = XInternAtom(display, "_NET_CLOSE_WINDOW", False);
ev.xclient.type = ClientMessage;
ev.xclient.window = window;
ev.xclient.message_type = closeWindowAtom;
ev.xclient.format = 32;
ev.xclient.data.l[0] = CurrentTime;
ev.xclient.data.l[1] = rootWin;
XSendEvent(display, rootWin, False, SubstructureRedirectMask, &ev);
}
void iconifyWindow(Window window)
{
Display *display = QX11Info::display();
Window rootWin = QX11Info::appRootWindow(QX11Info::appScreen());
XEvent e;
memset(&e, 0, sizeof(e));
Atom iconicAtom = XInternAtom(display, "WM_CHANGE_STATE", True);
e.xclient.type = ClientMessage;
e.xclient.message_type = iconicAtom;
e.xclient.display = display;
e.xclient.window = window;
e.xclient.format = 32;
e.xclient.data.l[0] = IconicState;
XSendEvent(display, rootWin, False, SubstructureRedirectMask, &e);
}
int main (int argc, char **argv)
{
QApplication app(argc, argv); // connect to the X server
for (int i = 1; i < argc; i++)
{
if (QString(argv[i]) == "-h" ||
QString(argv[i]) == "-help" ||
QString(argv[i]) == "--help"
) {
printUsage();
return 0;
}
if (QString(argv[i]) == "close") {
Window window;
// coverity[secure_coding]
sscanf(argv[++i], "%lx", &window);
sendCloseEvent(window);
return 0;
}
if (QString(argv[i]) == "iconify") {
Window window;
// coverity[secure_coding]
sscanf(argv[++i], "%lx", &window);
iconifyWindow(window);
return 0;
}
}
}

@ -1,9 +1,14 @@
# Find Qt4
find_package(Qt4 4.6.0 REQUIRED)
include(${QT_USE_FILE})
if (${QTVERSION} VERSION_LESS 4.6.0)
message(FATAL_ERROR "You need Qt4.6, found ${QTVERSION}.")
endif (${QTVERSION} VERSION_LESS 4.6.0)
add_subdirectory(ut_booster) add_subdirectory(ut_booster)
add_subdirectory(ut_connection) add_subdirectory(ut_connection)
add_subdirectory(ut_daemon) add_subdirectory(ut_daemon)
add_subdirectory(ut_dbooster)
add_subdirectory(ut_ebooster) add_subdirectory(ut_ebooster)
add_subdirectory(ut_qtbooster)
add_subdirectory(ut_socketmanager) add_subdirectory(ut_socketmanager)
add_subdirectory(ut_singleinstance) add_subdirectory(ut_singleinstance)
add_subdirectory(ut_boosterpluginregistry) add_subdirectory(ut_boosterpluginregistry)

@ -34,18 +34,10 @@
<step expected_result="0">/usr/share/applauncherd-tests/ut_booster</step> <step expected_result="0">/usr/share/applauncherd-tests/ut_booster</step>
</case> </case>
<case name="QtBooster" type="Functional" description="Unit tests for QtBooster class" level="Component" timeout="20">
<step expected_result="0">su - user -c 'source /tmp/session_bus_address.user &amp;&amp; DISPLAY=:0 /usr/share/applauncherd-tests/ut_qtbooster'</step>
</case>
<case name="EBooster" type="Functional" description="Unit tests for EBooster class" level="Component" timeout="20"> <case name="EBooster" type="Functional" description="Unit tests for EBooster class" level="Component" timeout="20">
<step expected_result="0">su - user -c 'source /tmp/session_bus_address.user &amp;&amp; DISPLAY=:0 /usr/share/applauncherd-tests/ut_ebooster'</step> <step expected_result="0">su - user -c 'source /tmp/session_bus_address.user &amp;&amp; DISPLAY=:0 /usr/share/applauncherd-tests/ut_ebooster'</step>
</case> </case>
<case name="DBooster" type="Functional" description="Unit tests for DBooster class" level="Component" timeout="20">
<step expected_result="0">su - user -c 'source /tmp/session_bus_address.user &amp;&amp; DISPLAY=:0 /usr/share/applauncherd-tests/ut_dbooster'</step>
</case>
<environments> <environments>
<scratchbox>true</scratchbox> <scratchbox>true</scratchbox>
<hardware>true</hardware> <hardware>true</hardware>

@ -1,31 +0,0 @@
set(LAUNCHER ${CMAKE_HOME_DIRECTORY}/src/launcherlib)
set(DBOOSTER ${CMAKE_HOME_DIRECTORY}/src/qdeclarativebooster)
# Set sources
set(SRC ut_dbooster.cpp ${LAUNCHER}/appdata.cpp ${LAUNCHER}/booster.cpp
${LAUNCHER}/connection.cpp ${LAUNCHER}/logger.cpp ${DBOOSTER}/qdeclarativebooster.cpp
${LAUNCHER}/singleinstance.cpp ${LAUNCHER}/socketmanager.cpp)
# Set moc headers
set(MOC_HDRS ut_dbooster.h)
# Run moc
qt4_wrap_cpp(MOC_SRC ${MOC_HDRS})
# Enable test library
set(QT_USE_QTTEST TRUE)
# Set include paths
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${LAUNCHER} ${CMAKE_HOME_DIRECTORY}/src/common ${DBOOSTER})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTTEST_LIBRARY} "-L${CMAKE_SOURCE_DIR}/src/qdeclarativebooster -lmdeclarativecache" -ldl -lX11)
# Enable Qt (may not be needed, because already defined on higher level)
include(${QT_USE_FILE})
add_executable(ut_dbooster ${SRC} ${MOC_SRC} )
add_dependencies(ut_dbooster mdeclarativecache)
# Install
install(PROGRAMS ut_dbooster DESTINATION /usr/share/applauncherd-tests/)

@ -1,81 +0,0 @@
/***************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include "ut_dbooster.h"
#include "qdeclarativebooster.h"
#include "mdeclarativecache.h"
Ut_DBooster::Ut_DBooster() :
m_subject(new QDeclarativeBooster)
{}
Ut_DBooster::~Ut_DBooster()
{}
void Ut_DBooster::initTestCase()
{}
void Ut_DBooster::cleanupTestCase()
{}
void Ut_DBooster::testSocketName()
{
QVERIFY(QDeclarativeBooster::socketName() == QDeclarativeBooster::m_socketId);
QVERIFY(m_subject->socketId() == QDeclarativeBooster::m_socketId);
}
void Ut_DBooster::testType()
{
QVERIFY(QDeclarativeBooster::type() == 'd');
QVERIFY(m_subject->boosterType() == 'd');
}
void Ut_DBooster::testPreload()
{
m_subject->preload();
const char * argv[] = {"foo"};
int argc = 1;
// TODO: Somehow make sure that MDeclarativeCache really returns the cached
// QApplication instead of creating a new one here.
QApplication * app = MDeclarativeCache::qApplication(argc, const_cast<char **>(argv));
QVERIFY(app);
QStringList args = app->arguments();
QVERIFY(args.length() == 1);
QVERIFY(args[0] == "foo");
QVERIFY(MDeclarativeCache::qDeclarativeView());
}
void Ut_DBooster::testTemporaryProcessName()
{
QVERIFY(QDeclarativeBooster::temporaryProcessName() == QDeclarativeBooster::m_temporaryProcessName);
QVERIFY(m_subject->temporaryProcessName() == QDeclarativeBooster::m_temporaryProcessName);
QVERIFY(m_subject->boosterTemporaryProcessName() == QDeclarativeBooster::m_temporaryProcessName);
}
void Ut_DBooster::testReceiveDataFromInvokerWithBadSocket()
{
QVERIFY(m_subject->receiveDataFromInvoker(-100) == false);
}
QTEST_APPLESS_MAIN(Ut_DBooster);

@ -1,53 +0,0 @@
/***************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef UT_DBOOSTER_H
#define UT_DBOOSTER_H
#include<QtTest/QtTest>
#include<QObject>
#include <tr1/memory>
#define UNIT_TEST
class QDeclarativeBooster;
class Ut_DBooster : public QObject
{
Q_OBJECT
public:
Ut_DBooster();
virtual ~Ut_DBooster();
private Q_SLOTS:
void initTestCase();
void cleanupTestCase();
void testSocketName();
void testType();
void testPreload();
void testTemporaryProcessName();
void testReceiveDataFromInvokerWithBadSocket();
private:
std::tr1::shared_ptr<QDeclarativeBooster> m_subject;
};
#endif // UT_DBOOSTER_H

@ -1,27 +0,0 @@
set(LAUNCHER ${CMAKE_HOME_DIRECTORY}/src/launcherlib)
set(QTBOOSTER ${CMAKE_HOME_DIRECTORY}/src/qtbooster)
# Set sources
set(SRC ut_qtbooster.cpp ${LAUNCHER}/appdata.cpp ${LAUNCHER}/booster.cpp
${LAUNCHER}/connection.cpp ${LAUNCHER}/logger.cpp ${QTBOOSTER}/qtbooster.cpp
${LAUNCHER}/singleinstance.cpp ${LAUNCHER}/socketmanager.cpp)
# Set moc headers
set(MOC_HDRS ut_qtbooster.h)
# Run moc
qt4_wrap_cpp(MOC_SRC ${MOC_HDRS})
# Enable test library
set(QT_USE_QTTEST TRUE)
# Set include paths
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/src/common ${LAUNCHER} ${QTBOOSTER})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${X11_LIBRARIES} -ldl)
# Enable Qt (may not be needed, because already defined on higher level)
include(${QT_USE_FILE})
add_executable(ut_qtbooster ${SRC} ${MOC_SRC})
# Install
install(PROGRAMS ut_qtbooster DESTINATION /usr/share/applauncherd-tests/)

@ -1,56 +0,0 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include "ut_qtbooster.h"
#include "qtbooster.h"
Ut_QtBooster::Ut_QtBooster() :
m_subject(new QtBooster)
{}
Ut_QtBooster::~Ut_QtBooster()
{}
void Ut_QtBooster::initTestCase()
{}
void Ut_QtBooster::cleanupTestCase()
{}
void Ut_QtBooster::testSocketName()
{
QVERIFY2(QtBooster::socketName() == QtBooster::m_socketId, "Failure");
QVERIFY2(m_subject->socketId() == QtBooster::m_socketId, "Failure");
}
void Ut_QtBooster::testType()
{
QVERIFY2(QtBooster::type() == 'q', "Failure");
QVERIFY2(m_subject->boosterType() == 'q', "Failure");
}
void Ut_QtBooster::testTemporaryProcessName()
{
QVERIFY(QtBooster::temporaryProcessName() == QtBooster::m_temporaryProcessName);
QVERIFY(m_subject->temporaryProcessName() == QtBooster::m_temporaryProcessName);
QVERIFY(m_subject->boosterTemporaryProcessName() == QtBooster::m_temporaryProcessName);
}
QTEST_APPLESS_MAIN(Ut_QtBooster);

@ -1,51 +0,0 @@
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of applauncherd
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef UT_QTBOOSTER_H
#define UT_QTBOOSTER_H
#include<QtTest/QtTest>
#include<QObject>
#include <tr1/memory>
#define UNIT_TEST
class QtBooster;
class Ut_QtBooster : public QObject
{
Q_OBJECT
public:
Ut_QtBooster();
virtual ~Ut_QtBooster();
private Q_SLOTS:
void initTestCase();
void cleanupTestCase();
void testSocketName();
void testType();
void testTemporaryProcessName();
private:
std::tr1::shared_ptr<QtBooster> m_subject;
};
#endif // UT_QTBOOSTER_H
Loading…
Cancel
Save