diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index de692e8..725556d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -63,3 +63,6 @@ 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) diff --git a/tests/Common/TestApps/fala_qml_helloworld/CMakeLists.txt b/tests/Common/TestApps/fala_qml_helloworld/CMakeLists.txt new file mode 100644 index 0000000..1217c77 --- /dev/null +++ b/tests/Common/TestApps/fala_qml_helloworld/CMakeLists.txt @@ -0,0 +1,39 @@ +# Set sources +set(SRC main.cpp) + +# Use the compiler and linker flags given in meegotouch-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) + +# Enable Qt-support +include(${QT_USE_FILE}) + +link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} "-L${CMAKE_SOURCE_DIR}/src/qdeclarativebooster ${booster_libs}") +add_executable(fala_qml_helloworld.launch ${SRC}) + +# Install +install(PROGRAMS fala_qml_helloworld.launch DESTINATION /usr/bin/) +install(PROGRAMS scripts/fala_qml_helloworld DESTINATION /usr/bin/) +install(FILES main.qml DESTINATION /usr/share/fala_qml_helloworld) +install(FILES fala_qml_helloworld_wl.desktop DESTINATION /usr/share/applications) +install(FILES fala_qml_helloworld_wol.desktop DESTINATION /usr/share/applications) + +# Install symlinks so that /usr/bin/fala_qml_helloworldX launches /usr/bin/fala_qml_helloworldX.launch +install(SCRIPT scripts/create_links.cmake) diff --git a/tests/Common/TestApps/fala_qml_helloworld/fala_qml_helloworld_wl.desktop b/tests/Common/TestApps/fala_qml_helloworld/fala_qml_helloworld_wl.desktop new file mode 100644 index 0000000..6dd496d --- /dev/null +++ b/tests/Common/TestApps/fala_qml_helloworld/fala_qml_helloworld_wl.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Type=Application +Name=qml_wl_helloworld +Icon=icon-l-video +Exec=invoker --single-instance --type=d /usr/bin/fala_qml_helloworld.launch +Categories=X-MeeGo;Demos; +OnlyShowIn=X-MeeGo; diff --git a/tests/Common/TestApps/fala_qml_helloworld/fala_qml_helloworld_wol.desktop b/tests/Common/TestApps/fala_qml_helloworld/fala_qml_helloworld_wol.desktop new file mode 100644 index 0000000..a7594b7 --- /dev/null +++ b/tests/Common/TestApps/fala_qml_helloworld/fala_qml_helloworld_wol.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Type=Application +Name=qml_wol_helloworld +Icon=icon-l-video +Exec=single-instance /usr/bin/fala_qml_helloworld.launch +Categories=X-MeeGo;Demos; +OnlyShowIn=X-MeeGo; diff --git a/tests/Common/TestApps/fala_qml_helloworld/main.cpp b/tests/Common/TestApps/fala_qml_helloworld/main.cpp new file mode 100644 index 0000000..4590c80 --- /dev/null +++ b/tests/Common/TestApps/fala_qml_helloworld/main.cpp @@ -0,0 +1,69 @@ +/*************************************************************************** +** +** 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 +#include +#include +#include "qdeclarativeboostercache.h" + +void FANGORNLOG(const char* s) +{ + QFile f("/tmp/testapp.log"); + f.open(QIODevice::Append); + f.write(s, qstrlen(s)); + f.write("\n", 1); + f.close(); +} + +void timestamp(const char *s) +{ + timeval tim; + char msg[80]; + gettimeofday(&tim, NULL); + snprintf(msg, 80, "%d%03d %s\n", + static_cast(tim.tv_sec), static_cast(tim.tv_usec/1000), s); + FANGORNLOG(msg); +} + +Q_DECL_EXPORT int main(int argc, char **argv) +{ + timestamp("application main"); +#ifdef __arm__ + QApplication::setGraphicsSystem("meego"); +#else + QApplication::setGraphicsSystem("raster"); +#endif + + QApplication *app = QDeclarativeBoosterCache::qApplication(argc, argv); + timestamp("QApplication from cache"); + + QDeclarativeView *window = QDeclarativeBoosterCache::qDeclarativeView(); + timestamp("QDeclarativeView from cache"); + + window->setWindowTitle("Applauncherd QML testapp"); + + window->setResizeMode(QDeclarativeView::SizeRootObjectToView); + + window->setSource(QUrl::fromLocalFile("/usr/share/fala_qml_helloworld/main.qml")); + window->showFullScreen(); + + timestamp("Calling app->exec()"); + return app->exec(); +} + diff --git a/tests/Common/TestApps/fala_qml_helloworld/main.qml b/tests/Common/TestApps/fala_qml_helloworld/main.qml new file mode 100644 index 0000000..d2b77e0 --- /dev/null +++ b/tests/Common/TestApps/fala_qml_helloworld/main.qml @@ -0,0 +1,12 @@ +import Qt 4.7 + +Rectangle { + width: 854 + height: 480 + Text { + id: text1 + anchors.centerIn: parent + text: "Hello QML World!" + font.pixelSize: 80 + } +} diff --git a/tests/Common/TestApps/fala_qml_helloworld/scripts/create_links.cmake b/tests/Common/TestApps/fala_qml_helloworld/scripts/create_links.cmake new file mode 100644 index 0000000..a47e704 --- /dev/null +++ b/tests/Common/TestApps/fala_qml_helloworld/scripts/create_links.cmake @@ -0,0 +1,6 @@ +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) +execute_process(COMMAND ln -v -s /usr/bin/fala_qml_helloworld.launch $ENV{DESTDIR}/usr/bin/fala_qml_helloworld1.launch) +execute_process(COMMAND ln -v -s /usr/bin/fala_qml_helloworld.launch $ENV{DESTDIR}/usr/bin/fala_qml_helloworld2.launch) + diff --git a/tests/Common/TestApps/fala_qml_helloworld/scripts/fala_qml_helloworld b/tests/Common/TestApps/fala_qml_helloworld/scripts/fala_qml_helloworld new file mode 100644 index 0000000..8307668 --- /dev/null +++ b/tests/Common/TestApps/fala_qml_helloworld/scripts/fala_qml_helloworld @@ -0,0 +1,4 @@ +#!/bin/sh + +echo "/usr/bin/invoker --single-instance --type=d --no-wait" $0.launch $@ +exec /usr/bin/invoker --single-instance --type=d --no-wait $0.launch $@