mirror of https://github.com/cutefishos/appmotor
Changes: Add QML Helloworld test application.
parent
b8dc5dfe50
commit
26ddcc35d0
@ -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)
|
||||||
@ -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;
|
||||||
@ -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;
|
||||||
@ -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 <Qt/QtDeclarative>
|
||||||
|
#include <QFile>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#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<int>(tim.tv_sec), static_cast<int>(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();
|
||||||
|
}
|
||||||
|
|
||||||
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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)
|
||||||
|
|
||||||
@ -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 $@
|
||||||
Loading…
Reference in New Issue