Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

ApplicationLauncher Class Reference
[QtBaseModule]

The ApplicationLauncher class is responsible for fundamental application management and IPC routing within Qtopia. More...

    #include <ApplicationLauncher>

Inherits QObject.

Public Functions

Signals

Additional Inherited Members


Detailed Description

The ApplicationLauncher class is responsible for fundamental application management and IPC routing within Qtopia.

The ApplicationLauncher provides a Qt Extended Server Task. Qt Extended Server Tasks are documented in full in the QtopiaServerApplication class documentation.

Note: This class is part of the Qt Extended server and cannot be used by other Qt Extended applications.

Task NameApplicationLauncher
InterfacesApplicationLauncher
ServicesSuspend

IPC and application control are tightly linked in Qtopia. At any level higher than the ApplicationLauncher itself, Qt Extended does not intrinsically understand the notion of "starting" an application. Qt Extended treats an application as a named IPC endpoint that exposes one or more IPC services for use by other applications or the system itself. The named IPC endpoint is known as the application's "application channel".

The primary role of the ApplicationLauncher is to manage a component's ability to receive and respond to service requests. The ApplicationLauncher considers an application "running" when it is able to receive service messages even though the application may not be thought as such by an end user. Management of end user features of an application (such as when the UI is raised or hidden) is done by other system components.

The application launcher framework consists of three primary parts - the application launcher, a series of application type launchers and the application IPC router.

Internally the ApplicationLauncher class has a very basic model of an application - it is something that can be started, stopped and can receive IPC messages. The specifics of process control is handled by pluggable implementers of the ApplicationTypeLauncher interface. By separating the specifics in this way, Qt Extended can easily be adapted to handle foreign applications, such as Java applications, in a seamless and highly integrated fashion.

The ApplicationLauncher also doesn't intrinsically know the specifics of the IPC bus. Instead an implementation of the ApplicationIpcRouter class abstracts the details from it.

When the system attempts to start an application by sending it a message on its application channel, the ApplicationIpcRouter detects the message and asks the ApplicationLauncher to launch the application, by calling the ApplicationLauncher::launch() method. This instructs the ApplicationLauncher to bring the application to a state where it can receive IPC messages.

If the application is not running, the ApplicationLauncher iterates through the ordered list of tasks implementing the ApplicationTypeLauncher interface. Each task is asked if it can launch the application, and if it can, is asked to do so. The ApplicationLauncher monitors the progress of the ApplicationTypeLauncher through Qt signals, which it consolidates and emits to the rest of the Qt Extended server.

Once the application is ready to receive messages, the ApplicationTypeLauncher informs the router by invoking the ApplicationIpcRouter::addRoute() method, passing an implementation of the ApplicationIpcRouter::RouteDestination interface. This call instructs the IPC Router to forward messages to the application through the ApplicationIpcRouter::RouteDestination. All queued messages will be delivered at this time.

How the ApplicationIpcRouter::RouteDestination implementation (usually the ApplicationTypeLauncher) handles delivery of the message is up to it. This allows more advanced ApplicationTypeLauncher implementations - such as a Java application type launcher - to adapt Qt Extended service messages into a form suitable for the application type they manage. For example, while Qt Extended uses a "raise()" message sent to an application's application channel to cause it to show its main UI, a Java application that has no notion of Qt Extended messages will need to have this message transformed appropriately.

To summarize,

ComponentClassFunctionality
Application LauncherApplicationLauncherManages ApplicationTypeLauncher instances and maintains a consolidated view of applications. Other components within the server may use the ApplicationLauncher to monitor application state, but must remember that this state only represents an applications ability to receive IPC messages, and not necessarily user visible information such as whether the application is visible.
Application Type LaunchersApplicationTypeLauncherHandles the specifics of different types of applications and launching mechanisms on behalf of the ApplicationLauncher. Other components within the server should never need to access these instances directly.
Application Ipc RouterApplicationIpcRouterAbstracts the IPC transport used for application messages from the ApplicationLauncher. On reception of an application message, instructs the ApplicationLauncher to start the application and subsequently delivers messages to ApplicationTypeLauncher instances for possible transformation before delivery to the application.


Member Function Documentation

void ApplicationLauncher::applicationNotFound ( const QString & application )   [signal]

Emitted whenever a non-existant application is asked to launch. The corresponding call to launch() will also return false.

void ApplicationLauncher::applicationStateChanged ( const QString & application, ApplicationTypeLauncher::ApplicationState state )   [signal]

Emitted whenever the application state changes to state.

void ApplicationLauncher::applicationTerminated ( const QString & application, ApplicationTypeLauncher::TerminationReason reason, bool filtered = false )   [signal]

Emitted whenever the application terminates. reason will be set to the termination reason. If filtered is true, an ApplicationTerminationHandler instance has filtered the termination.

QStringList ApplicationLauncher::applications () const

Return the list of starting and running applications. The list order represents the order in which the applications were launched.

bool ApplicationLauncher::canLaunch ( const QString & app )

Returns true if application app can be launched. Returns false otherwise. When true is returned, it means an instance of a subclass of ApplicationTypeLauncher instance exists that knows how to launch the application. The subsequent attempt to launch the application may still fail.

Note that true is also returned if app is already running.

bool ApplicationLauncher::launch ( const QString & app )

Attempts to launch application app. Returns true if app is launched successfully. Also returns true if app is already running. Returns false if no launcher can be found that knows how to launch app.

ApplicationTypeLauncher::ApplicationState ApplicationLauncher::state ( const QString & app ) const

Returns the current state of the application, app.


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3