Home · All Namespaces · All Classes
Public Member Functions | Static Public Member Functions

MainWindow Class Reference

#include <mainwindow.h>

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

List of all members.

Public Member Functions

 ~MainWindow ()
virtual void keyPressEvent (QKeyEvent *event)
 REIMPLEMENTATION
virtual void closeEvent (QCloseEvent *event)

Static Public Member Functions

static MainWindowinstance (bool create=false)
static QGLContext * glContext ()

Detailed Description

Main window for the Home application. Contains a MHome widget.

Definition at line 34 of file mainwindow.h.


Constructor & Destructor Documentation

MainWindow::~MainWindow (  ) 

Destroys the MainWindow.

Definition at line 81 of file mainwindow.cpp.

{
    mainWindowInstance = NULL;
    openGLContext = NULL;
    delete home;
}


Member Function Documentation

void MainWindow::closeEvent ( QCloseEvent *  event  )  [virtual]

Definition at line 167 of file mainwindow.cpp.

{
    // Don't allow closing the main window
    event->ignore();
}

QGLContext * MainWindow::glContext (  )  [static]

Returns the OpenGL context.

Returns:
the GL context

Definition at line 98 of file mainwindow.cpp.

{
    return openGLContext;
}

MainWindow * MainWindow::instance ( bool  create = false  )  [static]

Returns an instance to MainWindow, creating it if requested. The ownership of the created MainWindow is transferred to the caller.

Parameters:
create true if a MainWindow should be created if it doesn't exist, false otherwise
Returns:
an instance to MainWindow or NULL if it has not been created

Definition at line 88 of file mainwindow.cpp.

{
    if (mainWindowInstance == NULL && create) {
        // The static instance variable is set in the constructor
        new MainWindow;
    }

    return mainWindowInstance;
}

void MainWindow::keyPressEvent ( QKeyEvent *  event  )  [virtual]

REIMPLEMENTATION

Definition at line 142 of file mainwindow.cpp.

{
    int key = event->key();
    if (key < Qt::Key_Escape && !event->modifiers().testFlag(Qt::ControlModifier)) {
        // Special keys and CTRL-anything should do nothing
        QString keyPresses = event->text();
        if (!keyPresses.isEmpty()) {
            // Append keypresses to the presses to be sent
            keyPressesToBeSent.append(keyPresses);

            if (keyPressesBeingSent.isEmpty()) {
                // Select the service to send the keypresses to
                if (isCallUILaunchingKey(key)) {
                    setupExternalService(CALL_UI_DBUS_SERVICE, CALL_UI_DBUS_PATH, CALL_UI_DBUS_INTERFACE, CALL_UI_DBUS_METHOD);
                } else {
                    setupExternalService(CONTENT_SEARCH_DBUS_SERVICE, CONTENT_SEARCH_DBUS_PATH, CONTENT_SEARCH_DBUS_INTERFACE, CONTENT_SEARCH_DBUS_METHOD);
                }

                // Call the external service
                sendKeyPresses();
            }
        }
    }
}


The documentation for this class was generated from the following files:

Copyright © 2010 Nokia Corporation Generated on Thu Nov 4 2010 18:20:42
Doxygen 1.7.1
MeeGo Touch