Home · All Classes · Main Classes · Deprecated
Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

MApplication Class Reference

MApplication manages the GUI application's control flow and main settings. More...

Inherits QApplication.

List of all members.

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 MApplicationinstance ()
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 MApplicationWindowactiveApplicationWindow ()
static MWindowactiveWindow ()
static QList< MWindow * > windows ()
static QString appName ()
static QString binaryName ()
static MFeedbackPlayerfeedbackPlayer ()
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)
static void stdExit (int status)

Protected Member Functions

 MApplication (MApplicationPrivate &dd, int &argc, char **argv, const QString &appIdentifier=QString())

Protected Attributes

MApplicationPrivate *const d_ptr

Detailed Description

MApplication manages the GUI application's control flow and main settings.

The MApplication instance automatically extracts the application name from the arguments given in the constructor. It also loads the CSS stylesheet and the 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:

  1. The directory in which the application was launched.
  2. Application specific theme path (global theme path appended with the application name)
  3. Global theme path (Qt data path appended by themes/m)

When the first instance of the CSS or SVG file is found, it is loaded to the current MTheme. Also the 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 a 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). Due to this, the application name can't contain characters not allowed by dbus. The service 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.

Notice that it is not supported to create, delete and again create an MApplication instance in the same program.


Constructor & Destructor Documentation

MApplication::MApplication ( int &  argc,
char **  argv,
const QString appIdentifier = QString(),
MApplicationService service = 0 
)

Initializes the window system and constructs an application object.

Parameters:
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.
Note:
Warning: The data referred to by argc and argv must stay valid for the entire lifetime of the MApplication object. In addition, argc must be greater than zero and argv must contain at least one valid character string.
MApplication::MApplication ( int &  argc,
char **  argv,
MApplicationService service 
)
MApplication::~MApplication (  )  [virtual]

Cleans up any window system resources that were allocated by this application.

MApplication::MApplication ( MApplicationPrivate &  dd,
int &  argc,
char **  argv,
const QString appIdentifier = QString() 
) [protected]

Member Function Documentation

MApplicationWindow * MApplication::activeApplicationWindow (  )  [static]

Returns the currently active application window.

Note:
If the active window is of type MWindow (and not MApplicationWindow) this method will return a null pointer.
See also:
activeWindow()
MWindow * MApplication::activeWindow (  )  [static]

Returns the currently active window.

Note:
In comparison to QApplication::activeWindow(), this method will return a pointer to the MWindow even if it doesn't have focus. For single-window applications this method will return a pointer to the window once it's created (even before it's shown). For multiple-window applications this method will return a pointer to the current topmost window.

Reimplemented from QApplication.

QString MApplication::appName (  )  [static]

Returns the application's app name.

QString MApplication::binaryName (  )  [static]

Returns the application's binary name.

QString MApplication::deviceName (  )  [static]

Target device name.

bool MApplication::emulateTwoFingerGestures (  )  [static]

Emulate two finger gestures.

MFeedbackPlayer * MApplication::feedbackPlayer (  )  [static]

Returns object which provide interface for nonvisual feedback or NULL.

bool MApplication::fullScreen (  )  [static]

Full screen command line option set.

MApplication * MApplication::instance (  )  [static]

Returns a pointer to the application's MApplication instance. If no instance has been allocated, null is returned.

See also:
QCoreApplication::instance()
bool MApplication::isLoadMInputContextEnabled (  )  [static]

Returns whether automatic loading of MInputContext is enabled.

bool MApplication::isPrestarted (  )  [static]

Return true if application is in the prestarted state.

Returns:
true if application is in the prestarted state.
void MApplication::localeSettingsChanged (  )  [signal]

Signal emitted when the default system locale changes.

bool MApplication::logFps (  )  [static]

Log frame rate command line option set.

M::PrestartMode MApplication::prestartMode (  )  [static]

Return the current prestart mode.

Returns:
prestart mode
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.

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.

void MApplication::setLoadMInputContext ( bool  enable  )  [static]

Sets whether MApplication should automatically load m input context.

void MApplication::setLogFps ( bool  show  )  [static]

Enables or disables logging of frames.

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.

Parameters:
enable If set to true, prestart is restored if lazy shutdown selected. If set to false, prestart is released (equals to MApplicationService::lauch()).
void MApplication::setPrestartMode ( M::PrestartMode  mode  )  [static]

Select the prestart mode.

Parameters:
mode Prestart mode
void MApplication::setShowBoundingRect ( bool  show  )  [static]

Sets if bounding rects of widgets should be shown or not.

void MApplication::setShowCursor ( bool  show  )  [static]

Sets if the cursor should be shown or not.

void MApplication::setShowFps ( bool  show  )  [static]

Sets if a frames-per-second counter should be shown or not.

void MApplication::setShowMargins ( bool  show  )  [static]

Sets if margins of widgets should be shown or not.

void MApplication::setShowObjectNames ( bool  show  )  [static]

Sets if names of objects should be shown or not.

void MApplication::setShowPosition ( bool  show  )  [static]

Sets if position of widgets should be shown or not.

void MApplication::setShowSize ( bool  show  )  [static]

Sets if sizes of widgets should be shown or not.

void MApplication::setShowStyleNames ( bool  show  )  [static]

Sets if names of styles should be shown or not.

bool MApplication::showBoundingRect (  )  [static]

Show bounding rectangles command line option set.

bool MApplication::showCursor (  )  [static]

Show cursor.

bool MApplication::showFps (  )  [static]

Show frame rate command line option set.

bool MApplication::showMargins (  )  [static]

Show widgets margins.

bool MApplication::showObjectNames (  )  [static]

Show object names.

bool MApplication::showPosition (  )  [static]

Show widgets positions.

bool MApplication::showSize (  )  [static]

Show widgets sizes.

bool MApplication::showStyleNames (  )  [static]

Show style names.

bool MApplication::softwareRendering (  )  [static]

Software rendering command line option set.

void MApplication::stdExit ( int  status  )  [static]
QList< MWindow * > MApplication::windows (  )  [static]

Returns a list of all windows in the application.


Member Data Documentation

MApplicationPrivate* const MApplication::d_ptr [protected]

Copyright © 2010 Nokia Corporation
MeeGo Touch