| Home · All Classes · Main Classes · Deprecated |
MApplication manages the GUI application's control flow and main settings. More...


Signals | |
| void | localeSettingsChanged () |
| void | prestartReleased () |
| void | prestartRestored () |
Public Member Functions | |
| MApplication (int &argc, char **argv, const QString &appIdentifier=QString(), MApplicationService *service=0) | |
| MApplication (int &argc, char **argv, MApplicationService *service) | |
| virtual | ~MApplication () |
| virtual void | restorePrestart () |
| virtual void | releasePrestart () |
Static Public Member Functions | |
| static MApplication * | instance () |
| static QString | deviceName () |
| static bool | softwareRendering () |
| static bool | fullScreen () |
| static bool | showBoundingRect () |
| static bool | showFps () |
| static bool | logFps () |
| static bool | showSize () |
| static bool | showPosition () |
| static bool | showMargins () |
| static bool | showObjectNames () |
| static bool | showStyleNames () |
| static bool | showCursor () |
| static bool | emulateTwoFingerGestures () |
| static void | setShowPosition (bool show) |
| static void | setShowMargins (bool show) |
| static void | setShowObjectNames (bool show) |
| static void | setShowStyleNames (bool show) |
| static void | setShowSize (bool show) |
| static void | setShowBoundingRect (bool show) |
| static void | setShowFps (bool show) |
| static void | setLogFps (bool show) |
| static void | setShowCursor (bool show) |
| static MApplicationWindow * | activeApplicationWindow () |
| static MWindow * | activeWindow () |
| static QList< MWindow * > | windows () |
| static QString | appName () |
| static QString | binaryName () |
| static MFeedbackPlayer * | feedbackPlayer () |
| static bool | isLoadMInputContextEnabled () |
| static void | setLoadMInputContext (bool enable) |
| static void | setPrestartMode (M::PrestartMode mode) |
| static M::PrestartMode | prestartMode () |
| static bool | isPrestarted () |
| static void | setPrestarted (bool enable) |
Protected Member Functions | |
| MApplication (MApplicationPrivate &dd, int &argc, char **argv, const QString &appIdentifier=QString()) | |
Protected Attributes | |
| MApplicationPrivate *const | d_ptr |
MApplication manages the GUI application's control flow and main settings.
MApplication instance automatically extracts application name from the arguments given in the constructor. It also loads css - stylesheet, svg file and adds application specific image paths to the pixmap search paths used by the current MTheme instance.
CSS and SVG files are searched for in order from the following places:
When first instance of CSS or SVG file is found it is loaded to the current MTheme. Also image - subdirectory of each of the aforementioned paths is appended to the pixmap search paths used by MTheme.
MApplication will also create a QDBus service with name made by prepending 'com.nokia.' to the application name provided in the constructor (or the binary name if no name is provided in the constructor). It will provide an interface called MApplicationIf which calls service methods in an instance of MApplicationService. By default, MApplication will construct an instance of MApplicationService, but the application programmer can derive a class from MApplicationService and provide a pointer to that in the constructor for MApplication to use instead. This way, the application programmer can override the methods in MApplicationService and change the behaviour of the application's interface.
The default behaviour is to only allow a single instance of any application. When an application is launched, it attempts to register itself as a dbus service (as above). Only the first instance of the application will be successful, and subsequent attempts will fail. When dbus registration fails, the default behaviour is to call the first instance's MApplicationService launch() method, and then quit. This causes the first instance to become visible (raises the window).
If other behaviour is required, for example if you want multiple instances of an application, then it is necessary to derive a class from MApplicationService and override its methods.
Definition at line 79 of file corelib/core/mapplication.h.
| MApplication::MApplication | ( | int & | argc, | |
| char ** | argv, | |||
| const QString & | appIdentifier = QString(), |
|||
| MApplicationService * | service = 0 | |||
| ) |
Initializes the window system and constructs an application object.
| argc | number of arguments passed to the application from the command line | |
| argv | argument strings passed to the application from the command line | |
| appIdentifier | an optional identifier for the application. Can contain alphabetical characters, numbers, dashes and underscores. If an empty string is given (the default) the application binary file name is used. |
Definition at line 145 of file mapplication.cpp.
: QApplication(argc, argv), d_ptr(new MApplicationPrivate) { Q_D(MApplication); d->q_ptr = this; d->init(argc, argv, appIdentifier, service); }
| MApplication::MApplication | ( | int & | argc, | |
| char ** | argv, | |||
| MApplicationService * | service | |||
| ) |
Definition at line 155 of file mapplication.cpp.
:
QApplication(argc, argv),
d_ptr(new MApplicationPrivate)
{
Q_D(MApplication);
d->q_ptr = this;
d->init(argc, argv, QString(), service);
}
| MApplication::~MApplication | ( | ) | [virtual] |
Cleans up any window system resources that were allocated by this application.
Definition at line 244 of file mapplication.cpp.
{
delete d_ptr;
}
| MApplication::MApplication | ( | MApplicationPrivate & | dd, | |
| int & | argc, | |||
| char ** | argv, | |||
| const QString & | appIdentifier = QString() | |||
| ) | [protected] |
| MApplicationWindow * MApplication::activeApplicationWindow | ( | ) | [static] |
Returns the currently active application window.
Definition at line 359 of file mapplication.cpp.
{
return MComponentData::activeApplicationWindow();
}
| MWindow * MApplication::activeWindow | ( | ) | [static] |
Returns the currently active window.
Reimplemented from QApplication.
Definition at line 364 of file mapplication.cpp.
{
return MComponentData::activeWindow();
}
| QString MApplication::appName | ( | ) | [static] |
Returns the application's app name.
Definition at line 536 of file mapplication.cpp.
{
return MComponentData::appName();
}
| QString MApplication::binaryName | ( | ) | [static] |
Returns the application's binary name.
Definition at line 541 of file mapplication.cpp.
{
return MComponentData::binaryName();
}
| QString MApplication::deviceName | ( | ) | [static] |
Target device name.
Definition at line 249 of file mapplication.cpp.
{
return MComponentData::deviceName();
}
| bool MApplication::emulateTwoFingerGestures | ( | ) | [static] |
Emulate two finger gestures.
Definition at line 309 of file mapplication.cpp.
{
return MComponentData::emulateTwoFingerGestures();
}
| MFeedbackPlayer * MApplication::feedbackPlayer | ( | ) | [static] |
Returns object which provide interface for nonvisual feedback or NULL.
Definition at line 374 of file mapplication.cpp.
{
return MComponentData::feedbackPlayer();
}
| bool MApplication::fullScreen | ( | ) | [static] |
Full screen command line option set.
Definition at line 259 of file mapplication.cpp.
{
return MComponentData::fullScreen();
}
| MApplication * MApplication::instance | ( | ) | [static] |
Returns a pointer to the application's MApplication instance. If no instance has been allocated, null is returned.
Definition at line 140 of file mapplication.cpp.
{
return qobject_cast<MApplication *>(QCoreApplication::instance());
}
| bool MApplication::isLoadMInputContextEnabled | ( | ) | [static] |
Returns whether automatic loading of MInputContext is enabled.
Definition at line 379 of file mapplication.cpp.
{
return MComponentData::isLoadMInputContextEnabled();
}
| bool MApplication::isPrestarted | ( | ) | [static] |
Return true if application is in the prestarted state.
true if application is in the prestarted state. Definition at line 593 of file mapplication.cpp.
{
return (MComponentData::prestartMode() != M::NoPrestart) && MComponentData::prestarted();
}

| void MApplication::localeSettingsChanged | ( | ) | [signal] |
Signal emitted when the default system locale changes.
| bool MApplication::logFps | ( | ) | [static] |
Log frame rate command line option set.
Definition at line 274 of file mapplication.cpp.
{
return MComponentData::logFps();
}
| M::PrestartMode MApplication::prestartMode | ( | ) | [static] |
Return the current prestart mode.
Definition at line 566 of file mapplication.cpp.
{
return MComponentData::prestartMode();
}
| void MApplication::prestartReleased | ( | ) | [signal] |
Signal that is emitted when the application has been released from the prestarted state. Next the application should show a window.
| void MApplication::prestartRestored | ( | ) | [signal] |
Signal that is emitted when the application has been restored to the prestarted state.
| void MApplication::releasePrestart | ( | ) | [virtual] |
Called when MApplication is released from the prestarted state. Effectively this method just shows MApplication::activeWindow(). Does nothing by default if multi-windowed prestart is selected. Re-imp this if desired.
Definition at line 571 of file mapplication.cpp.
{
// Show the window only if we are not in a multi-windowed mode.
// In that case the user must re-implement this, because we don't know which
// window needs to be shown.
if (!MApplicationPrivate::prestartModeIsMultiWindowed()) {
if (MApplication::activeWindow()) {
MApplication::activeWindow()->show();
MApplication::activeWindow()->activateWindow();
MApplication::activeWindow()->raise();
}
}
}

| void MApplication::restorePrestart | ( | ) | [virtual] |
Called when MApplication returns to prestarted state (if supported by the mode). Hides all windows by default. Re-imp this if desired.
Definition at line 586 of file mapplication.cpp.
{
if (MApplicationPrivate::prestartModeIsLazyShutdown()) {
MApplicationPrivate::hideWindows();
}
}
| void MApplication::setLoadMInputContext | ( | bool | enable | ) | [static] |
Sets whether MApplication should automatically load m input context.
Definition at line 384 of file mapplication.cpp.
{
MComponentData::setLoadMInputContext(enable);
}
| void MApplication::setLogFps | ( | bool | show | ) | [static] |
Enables or disables logging of frames.
Definition at line 349 of file mapplication.cpp.
{
MComponentData::setLogFps(show);
}
| void MApplication::setPrestarted | ( | bool | enable | ) | [static] |
Manually release/restore the application from/to the prestarted state. Multi-window applications may need this if they want to show some specific window using some other D-Bus service than MApplicationService. This triggers corresponding signals and handlers if the state changes.
| enable | If set to true, prestart is restored if lazy shutdown selected. If set to false, prestart is released (equals to MApplicationService::lauch()). |
Definition at line 223 of file mapplication.cpp.
{
if (enable) {
MApplicationPrivate::restorePrestart();
} else {
MApplicationPrivate::releasePrestart();
}
}

| void MApplication::setPrestartMode | ( | M::PrestartMode | mode | ) | [static] |
Select the prestart mode.
| mode | Prestart mode |
Definition at line 551 of file mapplication.cpp.
{
// Set prestart mode only if the app was started with -prestart.
// This way we can later check if the app was originally prestarted or not.
// Prevent application from exiting after the last window has been closed if
// lazy shutdown was set.
if (MComponentData::prestarted()) {
MComponentData::setPrestartMode(mode);
if (MApplicationPrivate::prestartModeIsLazyShutdown()) {
MApplication::setQuitOnLastWindowClosed(false);
}
}
}

| void MApplication::setShowBoundingRect | ( | bool | show | ) | [static] |
Sets if bounding rects of widgets should be shown or not.
Definition at line 339 of file mapplication.cpp.
{
MComponentData::setShowBoundingRect(show);
}
| void MApplication::setShowCursor | ( | bool | show | ) | [static] |
Sets if the cursor should be shown or not.
Definition at line 354 of file mapplication.cpp.
{
MComponentData::setShowCursor(show);
}
| void MApplication::setShowFps | ( | bool | show | ) | [static] |
Sets if a frames-per-second counter should be shown or not.
Definition at line 344 of file mapplication.cpp.
{
MComponentData::setShowFps(show);
}
| void MApplication::setShowMargins | ( | bool | show | ) | [static] |
Sets if margins of widgets should be shown or not.
Definition at line 324 of file mapplication.cpp.
{
MComponentData::setShowMargins(show);
}
| void MApplication::setShowObjectNames | ( | bool | show | ) | [static] |
Sets if names of objects should be shown or not.
Definition at line 329 of file mapplication.cpp.
{
MComponentData::setShowObjectNames(show);
}
| void MApplication::setShowPosition | ( | bool | show | ) | [static] |
Sets if position of widgets should be shown or not.
Definition at line 314 of file mapplication.cpp.
{
MComponentData::setShowPosition(show);
}
| void MApplication::setShowSize | ( | bool | show | ) | [static] |
Sets if sizes of widgets should be shown or not.
Definition at line 319 of file mapplication.cpp.
{
MComponentData::setShowSize(show);
}
| void MApplication::setShowStyleNames | ( | bool | show | ) | [static] |
Sets if names of styles should be shown or not.
Definition at line 334 of file mapplication.cpp.
{
MComponentData::setShowStyleNames(show);
}
| bool MApplication::showBoundingRect | ( | ) | [static] |
Show bounding rectangles command line option set.
Definition at line 264 of file mapplication.cpp.
{
return MComponentData::showBoundingRect();
}
| bool MApplication::showCursor | ( | ) | [static] |
Show cursor.
Definition at line 304 of file mapplication.cpp.
{
return MComponentData::showCursor();
}
| bool MApplication::showFps | ( | ) | [static] |
Show frame rate command line option set.
Definition at line 269 of file mapplication.cpp.
{
return MComponentData::showFps();
}
| bool MApplication::showMargins | ( | ) | [static] |
Show widgets margins.
Definition at line 289 of file mapplication.cpp.
{
return MComponentData::showMargins();
}
| bool MApplication::showObjectNames | ( | ) | [static] |
Show object names.
Definition at line 294 of file mapplication.cpp.
{
return MComponentData::showObjectNames();
}
| bool MApplication::showPosition | ( | ) | [static] |
Show widgets positions.
Definition at line 284 of file mapplication.cpp.
{
return MComponentData::showPosition();
}
| bool MApplication::showSize | ( | ) | [static] |
Show widgets sizes.
Definition at line 279 of file mapplication.cpp.
{
return MComponentData::showSize();
}
| bool MApplication::showStyleNames | ( | ) | [static] |
Show style names.
Definition at line 299 of file mapplication.cpp.
{
return MComponentData::showStyleNames();
}
| bool MApplication::softwareRendering | ( | ) | [static] |
Software rendering command line option set.
Definition at line 254 of file mapplication.cpp.
{
return MComponentData::softwareRendering();
}
Returns a list of all windows in the application.
Definition at line 369 of file mapplication.cpp.
{
return MComponentData::windows();
}
MApplicationPrivate* const MApplication::d_ptr [protected] |
Definition at line 262 of file corelib/core/mapplication.h.
| Copyright © 2010 Nokia Corporation | Generated on Thu Nov 4 2010 18:14:24 (PDT) Doxygen 1.7.1 |
MeeGo Touch |