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

MComponentData Class Reference

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

Inheritance diagram for MComponentData:
Inheritance graph
[legend]
Collaboration diagram for MComponentData:
Collaboration graph
[legend]

List of all members.

Signals

void localeSettingsChanged ()

Public Member Functions

 MComponentData (int &argc, char **argv, const QString &appIdentifier=QString(), MApplicationService *service=0)
 MComponentData (MApplicationService *service)
virtual ~MComponentData ()

Static Public Member Functions

static MComponentDatainstance ()
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 prestarted ()
static M::PrestartMode prestartMode ()
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 void setPrestarted (bool flag)
static void setPrestartMode (M::PrestartMode mode)
static void setEmulateTwoFingerGestures (bool flag)
static bool setSyslogServer (const QUrl &url)
static MApplicationWindowactiveApplicationWindow ()
static MWindowactiveWindow ()
static QList< MWindow * > windows ()
static QString appName ()
static QString binaryName ()
static QString serviceName ()
static MFeedbackPlayerfeedbackPlayer ()
static bool isLoadMInputContextEnabled ()
static void setLoadMInputContext (bool enable)

Protected Member Functions

 MComponentData (MComponentDataPrivate &dd, int &argc, char **argv, const QString &appIdentifier=QString())

Protected Attributes

MComponentDataPrivate *const d_ptr

Detailed Description

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

MComponentData provides all the settings that are necessary for a QApplication in order to initialize the MeeGo Touch UI framework. As such it is used by MApplication, which adds the event loop. MComponentData can be used by plain Qt applications in order to provide access to resources of the MeeGo Touch UI framework.

MComponentData 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:

  1. Directory in which 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 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.

MComponentData 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 MComponentDataIf which calls service methods in an instance of MApplicationService. By default, MComponentData 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 MComponentData to use instead. This way, the application programmer can override the methods in MComponentDataSerivce and change the behaviour of the application's interface.

For some applications, it is necessary to implement a custom MApplicationService. See MApplicationService for more information.

Definition at line 72 of file corelib/core/mcomponentdata.h.


Constructor & Destructor Documentation

MComponentData::MComponentData ( 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.

Definition at line 300 of file mcomponentdata.cpp.

    : QObject(),
      d_ptr(new MComponentDataPrivate)
{
    Q_D(MComponentData);
    d->q_ptr = this;

    Q_ASSERT_X(!self, "MComponentData", "There should be one component data object only.");
    MComponentData::self = this;

    d->init(argc, argv, appIdentifier, service);
}

MComponentData::MComponentData ( MApplicationService service  )  [explicit]

Definition at line 313 of file mcomponentdata.cpp.

                                                           :
    QObject(),
    d_ptr(new MComponentDataPrivate)
{
    Q_D(MComponentData);
    d->q_ptr = this;

    Q_ASSERT_X(!self, "MComponentData", "There should be one component data object only.");
    MComponentData::self = this;

    int argc = 0;
    char *argv[] = {0};

    d->init(argc, argv, QString(), service);
}

MComponentData::~MComponentData (  )  [virtual]

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

Definition at line 777 of file mcomponentdata.cpp.

{
    delete d_ptr;
    gMComponentDataPrivate = 0;
    self = 0;
}

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

Member Function Documentation

MApplicationWindow * MComponentData::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()

Definition at line 1046 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::activeApplicationWindow() - MComponentData instance not yet created.");
    }

    return qobject_cast<MApplicationWindow *>(activeWindow());
}

Here is the call graph for this function:

MWindow * MComponentData::activeWindow (  )  [static]

Returns the currently active window.

Definition at line 1034 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::activeWindow() - MComponentData instance not yet created.");
    }

    if (gMComponentDataPrivate->windows.isEmpty())
        return 0;

    return gMComponentDataPrivate->windows.at(0);
}

QString MComponentData::appName (  )  [static]

Returns the application's app name.

Definition at line 1121 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::appName() - MComponentData instance not yet created.");
    }
    return gMComponentDataPrivate->appName;
}

QString MComponentData::binaryName (  )  [static]

Returns the application's binary name.

Definition at line 1129 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::binaryName() - MComponentData instance not yet created.");
    }
    return gMComponentDataPrivate->binaryName;
}

QString MComponentData::deviceName (  )  [static]

Target device name.

Definition at line 784 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::deviceName() - MComponentData instance not yet created.");
    }
    return gMComponentDataPrivate->deviceName;
}

bool MComponentData::emulateTwoFingerGestures (  )  [static]

Emulate two finger gestures.

Definition at line 896 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::emulateTwoFingerGestures() - MComponentData instance not yet created.");
    }
    return gMComponentDataPrivate->emulateTwoFingerGestures;
}

MFeedbackPlayer * MComponentData::feedbackPlayer (  )  [static]

Returns object which provide interface for nonvisual feedback or NULL.

Definition at line 1101 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::feedbackPlayer() - MComponentData instance not yet created.");
    }
    return gMComponentDataPrivate->feedbackPlayer;
}

bool MComponentData::fullScreen (  )  [static]

Full screen command line option set.

Definition at line 800 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::fullScreen() - MComponentData instance not yet created.");
    }
    return gMComponentDataPrivate->fullScreen;
}

MComponentData * MComponentData::instance (  )  [static]

returns the MComponentData instance

Definition at line 293 of file mcomponentdata.cpp.

{
    return self;
}

bool MComponentData::isLoadMInputContextEnabled (  )  [static]

Returns whether automatic loading of MInputContext is enabled.

Definition at line 1110 of file mcomponentdata.cpp.

{
    return g_loadMInputContext;
}

void MComponentData::localeSettingsChanged (  )  [signal]

Signal emitted when the default system locale changes.

bool MComponentData::logFps (  )  [static]

Log frame rate command line option set.

Definition at line 840 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::logFps() - MComponentData instance not yet created.");
    }
    return gMComponentDataPrivate->logFps;
}

bool MComponentData::prestarted (  )  [static]

Return true if prestarted state active.

Definition at line 808 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::prestarted() - MComponentData instance not yet created.");
    }
    return gMComponentDataPrivate->prestarted;
}

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

Returns the prestart mode.

Definition at line 816 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::prestartMode() - MComponentData instance not yet created.");
    }
    return gMComponentDataPrivate->prestartMode;
}

QString MComponentData::serviceName (  )  [static]

Returns the application's service name.

Definition at line 1137 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::serviceName() - MComponentData instance not yet created.");
    } else if (!gMComponentDataPrivate->service) {
        qFatal("MComponentData::serviceName() - MComponentData->service not yet created.");
    }

    return gMComponentDataPrivate->service->registeredName();
}

void MComponentData::setEmulateTwoFingerGestures ( bool  flag  )  [static]

Set if two finger gestures should be emulated or not.

Definition at line 1010 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::setEmulateTwoFingerGestures() - MComponentData instance not yet created.");
    }
    gMComponentDataPrivate->emulateTwoFingerGestures = flag;
}

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

Sets whether MComponentData should automatically load m input context.

Definition at line 1116 of file mcomponentdata.cpp.

{
    g_loadMInputContext = enable;
}

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

Sets if whether fps logging should be enabled or not.

Definition at line 960 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::setLogFps() - MComponentData instance not yet created.");
    }
    gMComponentDataPrivate->logFps = show;
}

void MComponentData::setPrestarted ( bool  flag  )  [static]

Sets the prestarted flag.

Definition at line 994 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::setPrestarted() - MComponentData instance not yet created.");
    }
    gMComponentDataPrivate->prestarted = flag;
}

void MComponentData::setPrestartMode ( M::PrestartMode  mode  )  [static]

Sets the prestart mode.

Definition at line 1002 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::setPrestartMode() - MComponentData instance not yet created.");
    }
    gMComponentDataPrivate->prestartMode = mode;
}

void MComponentData::setShowBoundingRect ( bool  show  )  [static]

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

Definition at line 944 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::setShowBoundingRect() - MComponentData instance not yet created.");
    }
    gMComponentDataPrivate->showBoundingRect = show;
}

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

Sets if the cursor should be shown or not.

Definition at line 968 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::setShowCursor() - MComponentData instance not yet created.");
    }

    if (show) {
#ifdef Q_WS_X11
        XFixesShowCursor(QX11Info::display(), QX11Info::appRootWindow());
#else
        qApp->restoreOverrideCursor();
#endif
    } else {
#ifdef Q_WS_X11
        XFixesHideCursor(QX11Info::display(), QX11Info::appRootWindow());
#else
        QPixmap cursor(QSize(1, 1));
        cursor.fill(Qt::transparent);
        qApp->setOverrideCursor(cursor);
#endif
    }

    gMComponentDataPrivate->showCursor = show;
}

Here is the call graph for this function:

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

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

Definition at line 952 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::setShowFps() - MComponentData instance not yet created.");
    }
    gMComponentDataPrivate->showFps = show;
}

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

Sets if margins of widgets should be shown or not.

Definition at line 920 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::setMargins() - MComponentData instance not yet created.");
    }
    gMComponentDataPrivate->showMargins = show;
}

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

Sets if names of objects should be shown or not.

Definition at line 928 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::setShowObjectNames() - MComponentData instance not yet created.");
    }
    gMComponentDataPrivate->showObjectNames = show;
}

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

Sets if position of widgets should be shown or not.

Definition at line 904 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::setPositions() - MComponentData instance not yet created.");
    }
    gMComponentDataPrivate->showPosition = show;
}

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

Sets if sizes of widgets should be shown or not.

Definition at line 912 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::setPositions() - MComponentData instance not yet created.");
    }
    gMComponentDataPrivate->showSize = show;
}

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

Sets if names of styles should be shown or not.

Definition at line 936 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::setShowStyleNames() - MComponentData instance not yet created.");
    }
    gMComponentDataPrivate->showStyleNames = show;
}

bool MComponentData::setSyslogServer ( const QUrl url  )  [static]

Set the syslog server to log to:

Parameters:
url can point to either a local domain socket, for example 'file:///dev/log', or a remote server specified as 'udp://servername[:port]'.
Note:
It is not safe to change the syslog server, while your process has more than one active threads.

Definition at line 1018 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::setSyslogServer() - MComponentData instance not yet created.");
    }
    return gMComponentDataPrivate->initSyslogConnection(url);
}

bool MComponentData::showBoundingRect (  )  [static]

Show bounding rectangles command line option set.

Definition at line 824 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::showBoundingRect() - MComponentData instance not yet created.");
    }
    return gMComponentDataPrivate->showBoundingRect;
}

bool MComponentData::showCursor (  )  [static]

Show cursor.

Definition at line 888 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::showCursor() - MComponentData instance not yet created.");
    }
    return gMComponentDataPrivate->showCursor;
}

bool MComponentData::showFps (  )  [static]

Show frame rate command line option set.

Definition at line 832 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::showFps() - MComponentData instance not yet created.");
    }
    return gMComponentDataPrivate->showFps;
}

bool MComponentData::showMargins (  )  [static]

Show widgets margins.

Definition at line 864 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::showMargins() - MComponentData instance not yet created.");
    }
    return gMComponentDataPrivate->showMargins;
}

bool MComponentData::showObjectNames (  )  [static]

Show object names.

Definition at line 872 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::showObject() - MComponentData instance not yet created.");
    }
    return gMComponentDataPrivate->showObjectNames;
}

bool MComponentData::showPosition (  )  [static]

Show widgets positions.

Definition at line 856 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::showPositions() - MComponentData instance not yet created.");
    }
    return gMComponentDataPrivate->showPosition;
}

bool MComponentData::showSize (  )  [static]

Show widgets sizes.

Definition at line 848 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::showSizes() - MComponentData instance not yet created.");
    }
    return gMComponentDataPrivate->showSize;
}

bool MComponentData::showStyleNames (  )  [static]

Show style names.

Definition at line 880 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::showStyleNames() - MComponentData instance not yet created.");
    }
    return gMComponentDataPrivate->showStyleNames;
}

bool MComponentData::softwareRendering (  )  [static]

Software rendering command line option set.

Definition at line 792 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::softwareRendering() - MComponentData instance not yet created.");
    }
    return gMComponentDataPrivate->softwareRendering;
}

QList< MWindow * > MComponentData::windows (  )  [static]

Returns a list of all windows in the application.

Definition at line 1026 of file mcomponentdata.cpp.

{
    if (!gMComponentDataPrivate) {
        qFatal("MComponentData::windows() - MComponentData instance not yet created.");
    }
    return gMComponentDataPrivate->windows;
}


Member Data Documentation

MComponentDataPrivate* const MComponentData::d_ptr [protected]

Definition at line 223 of file corelib/core/mcomponentdata.h.


Copyright © 2010 Nokia Corporation Generated on Thu Nov 4 2010 18:14:24 (PDT)
Doxygen 1.7.1
MeeGo Touch