Changes: The qdeclarativebooster plugin implementation.

pull/1/head
Pertti Kellomäki 16 years ago committed by Antti Kervinen
parent ae6c8b5974
commit 8c32791efd

@ -30,5 +30,6 @@ void invoke_send_str(int fd, char *str);
#define INVOKER_M_SOCK "/tmp/boostm"
#define INVOKER_QT_SOCK "/tmp/boostq"
#define INVOKER_QDECL_SOCK "/tmp/boostd"
#endif

@ -56,10 +56,11 @@ static const unsigned char EXIT_STATUS_APPLICATION_CONNECTION_LOST = 0xfa;
static const unsigned char EXIT_STATUS_APPLICATION_NOT_FOUND = 0x7f;
// Enumeration of possible application types:
// M_APP : MeeGo Touch application
// QT_APP : Qt/generic application
// M_APP : MeeGo Touch application
// QT_APP : Qt/generic application
// QDECL_APP: QDeclarative (QML) application
//
enum APP_TYPE { M_APP, QT_APP, UNKNOWN_APP };
enum APP_TYPE { M_APP, QT_APP, QDECL_APP, UNKNOWN_APP };
// Environment
extern char ** environ;
@ -205,6 +206,10 @@ static int invoker_init(enum APP_TYPE app_type)
{
strncpy(sun.sun_path, INVOKER_QT_SOCK, maxSize);
}
else if (app_type == QDECL_APP)
{
strncpy(sun.sun_path, INVOKER_QDECL_SOCK, maxSize);
}
else
{
die(1, "Unknown type of application: %d\n", app_type);
@ -394,12 +399,13 @@ static void invoker_send_end(int fd)
static void usage(int status)
{
printf("\nUsage: %s [options] [--type=TYPE] [file] [args]\n\n"
"Launch m or qt application compiled as a shared library (-shared) or\n"
"Launch m, qt, or qdeclarative application compiled as a shared library (-shared) or\n"
"a position independent executable (-pie) through %s.\n\n"
"TYPE chooses the type of booster used. Qt-booster may be used to\n"
"launch anything. Possible values for TYPE:\n"
" m Launch a MeeGo Touch application.\n"
" qt Launch a Qt application.\n\n"
" qt Launch a Qt application.\n"
" d Launch a Qt Declarative (QML) application.\n\n"
"Options:\n"
" -c, --creds Print Aegis security credentials (if enabled).\n"
" -d, --delay SECS After invoking sleep for SECS seconds\n"
@ -631,6 +637,8 @@ int main(int argc, char *argv[])
app_type = M_APP;
else if (strcmp(optarg, "q") == 0 || strcmp(optarg, "qt") == 0)
app_type = QT_APP;
else if (strcmp(optarg, "d") == 0)
app_type = QDECL_APP;
else
{
report(report_error, "Unknown application type: %s \n", optarg);

@ -9,12 +9,22 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/src/comm
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
# Set sources
set(PLUGINSRC qdeclarativebooster.cpp pluginfactory.cpp ${LAUNCHER}/appdata.cpp ${LAUNCHER}/booster.cpp
${LAUNCHER}/connection.cpp ${LAUNCHER}/logger.cpp
${LAUNCHER}/singleinstance.cpp ${LAUNCHER}/socketmanager.cpp)
set(LIBSRC qdeclarativeboostercache.cpp qdeclarativeboostercache.h qdeclarativeboostercache_p.h)
set(MOC_HDRS qdeclarativebooster.h)
qt4_wrap_cpp(MOC_SRC ${MOC_HDRS})
# Set executables
add_library(qdeclarativeboostercache SHARED ${LIBSRC})
target_link_libraries(qdeclarativeboostercache ${LIBDL} ${QT_QTCORE_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY})
add_library(qdeclarativebooster MODULE ${PLUGINSRC} ${MOC_SRC})
target_link_libraries(qdeclarativebooster ${LIBDL} ${QT_QTCORE_LIBRARY} "-L. -lqdeclarativeboostercache")
add_dependencies(qdeclarativebooster qdeclarativeboostercache)
# Add install rule
install(FILES libqdeclarativebooster.so DESTINATION /usr/lib/applauncherd/)
install(FILES libqdeclarativeboostercache.so DESTINATION /usr/lib/)
install(FILES qdeclarativeboostercache.h DESTINATION /usr/include)

@ -0,0 +1,45 @@
/***************************************************************************
**
** 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 <QtCore>
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();
}
}

@ -0,0 +1,55 @@
/***************************************************************************
**
** 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 "qdeclarativeboostercache.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()
{
QDeclarativeBoosterCache::populate();
return true;
}

@ -0,0 +1,88 @@
/***************************************************************************
**
** 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 "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;
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
Loading…
Cancel
Save