Home · All Classes · Main Classes · Deprecated
Public Types | Public Slots | Signals | Public Member Functions

MSceneManager Class Reference

MSceneManager manages the MSceneWindows present in a MScene. More...

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

List of all members.

Public Types

enum  TransitionMode { AnimatedTransition, ImmediateTransition }

Public Slots

void setOrientationAngle (M::OrientationAngle angle, TransitionMode mode=AnimatedTransition)
void appearSceneWindow (MSceneWindow *sceneWindow, MSceneWindow::DeletionPolicy policy=MSceneWindow::KeepWhenDone)
void appearSceneWindowNow (MSceneWindow *sceneWindow, MSceneWindow::DeletionPolicy policy=MSceneWindow::KeepWhenDone)
int execDialog (MDialog *dialog)
void disappearSceneWindow (MSceneWindow *sceneWindow)
void disappearSceneWindowNow (MSceneWindow *sceneWindow)
void dismissSceneWindow (MSceneWindow *sceneWindow)
void dismissSceneWindowNow (MSceneWindow *sceneWindow)
void ensureCursorVisible ()

Signals

void orientationAboutToChange (M::Orientation orientation)
void orientationAngleChanged (M::OrientationAngle orientationAngle)
void orientationChanged (M::Orientation orientation)
void orientationChangeFinished (M::Orientation orientation)
void pageHistoryChanged ()

Public Member Functions

 MSceneManager (MScene *scene=0, QObject *parent=0)
virtual ~MSceneManager ()
MScenescene ()
M::Orientation orientation () const
M::OrientationAngle orientationAngle () const
QSize visibleSceneSize (M::Orientation orientation) const
QSize visibleSceneSize () const
QList< MSceneWindow * > pageHistory () const
void setPageHistory (const QList< MSceneWindow * > &list)
Q_DECL_DEPRECATED void requestSoftwareInputPanel (QGraphicsWidget *inputWidget)
Q_DECL_DEPRECATED void closeSoftwareInputPanel ()

Detailed Description

MSceneManager manages the MSceneWindows present in a MScene.

MSceneManager ensures that the MSceneWindows of a MScene are correctly positioned and stacked, similarly to what a window manager does for top level windows in a tradicional windowing system.

MSceneManager also orchestrates MSceneWindow's transitions such as appearance, disappearance and display orientation changes (e.g., from portrait to landscape).

See also:
MSceneWindow

Definition at line 53 of file corelib/scene/mscenemanager.h.


Member Enumeration Documentation

This enum is used to describe whether the orientation change invoked manually should be animated or not.

See also:
setOrientationAngle()
Enumerator:
AnimatedTransition 
ImmediateTransition 

Definition at line 70 of file corelib/scene/mscenemanager.h.

                        {
        AnimatedTransition,
        ImmediateTransition
    };


Constructor & Destructor Documentation

MSceneManager::MSceneManager ( MScene scene = 0,
QObject parent = 0 
)

Constructor of the MSceneManager class, constructs the manager for the given scene.

Note:
You normally don't have to create an instance of this class, the MApplicationWindow class already provides the scene manager.
Parameters:
scene Scene to be used. If 0, scene manager will automatically create his own MScene.

Definition at line 1940 of file mscenemanager.cpp.

                                                           :
    QObject(parent), d_ptr(new MSceneManagerPrivate)
{
    Q_D(MSceneManager);

    if (scene == 0)
        scene = new MScene(this);

    d->q_ptr = this;
    d->init(scene);
    d->scene->d_ptr->setSceneManager(this);
}

MSceneManager::~MSceneManager (  )  [virtual]

Destructor of the MSceneManager class.

Definition at line 1953 of file mscenemanager.cpp.

{
    Q_D(MSceneManager);

    delete d;
}


Member Function Documentation

void MSceneManager::appearSceneWindow ( MSceneWindow sceneWindow,
MSceneWindow::DeletionPolicy  policy = MSceneWindow::KeepWhenDone 
) [slot]

Makes sceneWindow appear on the scene().

According to the given policy, a scene window can be kept or destroyed after disappearing.

If the scene is currently being displayed by any MWindow (according to MWindow::isOnDisplay()), the appearance transition will be animated. Otherwise, it will be immediate.

Ownership of sceneWindow is transfered to the scene().

Note:
Normally you don't have to call this method explicitly. MSceneWindow::appear() calls this method for you.

Definition at line 1967 of file mscenemanager.cpp.

{
    Q_D(MSceneManager);

    d->addSceneWindow(window);

    d->appearSceneWindow(window, policy, d->canHaveAnimatedTransitions());
}

void MSceneManager::appearSceneWindowNow ( MSceneWindow sceneWindow,
MSceneWindow::DeletionPolicy  policy = MSceneWindow::KeepWhenDone 
) [slot]

Like appearSceneWindow(), with the difference that it makes sceneWindow appear without animations (instantly). This means that the scene window will transition directly to MSceneWindow::Appeared state, skipping MSceneWindow::Appearing.

Definition at line 1976 of file mscenemanager.cpp.

{
    Q_D(MSceneManager);
    d->addSceneWindow(window);
    d->appearSceneWindow(window, policy, false);
}

void MSceneManager::closeSoftwareInputPanel (  ) 

Sends a request to the application's input context to close a software input panel.

See also:
requestSoftwareInputPanel

Definition at line 2074 of file mscenemanager.cpp.

void MSceneManager::disappearSceneWindow ( MSceneWindow sceneWindow  )  [slot]

Makes a sceneWindow disappear.

If the scene is currently being displayed by any MWindow (according to MWindow::isOnDisplay()), the disappearance transition will be animated. Otherwise, it will be immediate.

Note:
Normally you don't have to call this method explicitly. MSceneWindow::disappear() calls this method for you.

Definition at line 2024 of file mscenemanager.cpp.

{
    Q_D(MSceneManager);

    window->d_func()->dismissed = false;
    d->disappearSceneWindow(window, d->canHaveAnimatedTransitions());
}

void MSceneManager::disappearSceneWindowNow ( MSceneWindow sceneWindow  )  [slot]

Makes a sceneWindow disappear without animations (instantly).

Definition at line 2032 of file mscenemanager.cpp.

{
    Q_D(MSceneManager);
    window->d_func()->dismissed = false;
    d->disappearSceneWindow(window, false);
}

void MSceneManager::dismissSceneWindow ( MSceneWindow sceneWindow  )  [slot]

Dismisses a sceneWindow.

If the scene is currently being displayed by any MWindow (according to MWindow::isOnDisplay()), the dismissal transition will be animated. Otherwise, it will be immediate.

Note:
Normally you don't have to call this method explicitly. MSceneWindow::dismiss() calls this method for you.

Definition at line 2039 of file mscenemanager.cpp.

{
    Q_D(MSceneManager);

    window->d_func()->dismissed = true;
    d->disappearSceneWindow(window, d->canHaveAnimatedTransitions());
}

void MSceneManager::dismissSceneWindowNow ( MSceneWindow sceneWindow  )  [slot]

Dismisses a sceneWindow without animations (instantly).

Definition at line 2047 of file mscenemanager.cpp.

{
    Q_D(MSceneManager);
    window->d_func()->dismissed = true;
    d->disappearSceneWindow(window, false);
}

void MSceneManager::ensureCursorVisible (  )  [slot]

Ensures that the cursor is visible by scrolling the relevant pannable viewport and/or moving the relevant scene window, if necessary.

Definition at line 525 of file mscenemanager.cpp.

{
    Q_D(MSceneManager);
    d->inputWidgetRelocator->update();
}

int MSceneManager::execDialog ( MDialog dialog  )  [slot]

Makes a dialog appear using associated animation and returns its result code. Scene manager takes ownership of dialog.

Note:
Normally you don't have to call this method explicitly. MDialog::exec() calls this method for you.

Definition at line 1983 of file mscenemanager.cpp.

{
    if (dialog == 0) {
        mWarning("MSceneManager") << "Invalid dialog instance";
        return MDialog::Rejected;
    }

    QEventLoop eventLoop;
    QPointer<MDialog> dialog_ptr = dialog;
    connect(dialog, SIGNAL(finished(int)), &eventLoop, SLOT(quit()));
    connect(dialog, SIGNAL(destroyed()), &eventLoop, SLOT(quit()));

    //TODO: Figure better workaround for this (or ask Qt to
    //      fix this for us).
    //
    //Launching of a modal scene window during mouse event handling
    //(mouse press/release callbacks etc.) will block the mainloop and
    //might break the event handling.

    //Release mouse focus from the current mousegrabber, so that the first
    //mouse event wont be sent to wrong widget. This is needed if a
    //modal scene window was executed during mouse release event.
    QGraphicsItem *g = scene()->mouseGrabberItem();
    if (g)
        g->ungrabMouse();

    appearSceneWindow(dialog);
    eventLoop.exec();

    // use QPointer in case of the dialog being deleted in the meantime
    if (dialog_ptr) {
        MButtonModel *clickedButton = dialog->clickedButton();
        if (clickedButton)
            return dialog->standardButton(clickedButton);
        else
            return dialog->result();
    }

    return MDialog::Rejected;
}

Here is the call graph for this function:

M::Orientation MSceneManager::orientation (  )  const

Returns the current orientation. It's a convenience method with which you can get the orientation without querying the application window.

Definition at line 2111 of file mscenemanager.cpp.

{
    Q_D(const MSceneManager);

    return d->orientation(d->angle);
}

void MSceneManager::orientationAboutToChange ( M::Orientation  orientation  )  [signal]

Signal emitted before scene geometry is changed for a rotation.

This is for widgets that need to react when the orientation is about to change, and is emitted before the scene geometry is changed.

This is the preferred way for the widgets to hook to orientation change.

Parameters:
orientation New orientation of the viewport
M::OrientationAngle MSceneManager::orientationAngle (  )  const

Returns the current orientation angle. It's a convenience method with which you can get the orientation angle without querying the application window.

Definition at line 2118 of file mscenemanager.cpp.

{
    Q_D(const MSceneManager);

    return d->angle;
}

void MSceneManager::orientationAngleChanged ( M::OrientationAngle  orientationAngle  )  [signal]

Signal emitted after scene geometry has changed for a rotation.

In comparison to orientationChanged(), this signal is emmitted with every change of the orientation angle. Note, that orientationChanged() won't be emitted when changing e.g. from M::Angle180 to M::Angle0.

Note that this is emitted at the start of the rotation animation.

Parameters:
orientation New orientation of the viewport
void MSceneManager::orientationChanged ( M::Orientation  orientation  )  [signal]

Signal emitted after scene geometry has changed for a rotation.

This is for widgets that need to react when the orientation is about to change, and is emitted after the scene geometry has changed and the rotation animation is about to start.

Note that this is emitted at the start of the rotation animation.

This is the preferred way for the widgets to hook to orientation change.

Parameters:
orientation New orientation of the viewport
void MSceneManager::orientationChangeFinished ( M::Orientation  orientation  )  [signal]

This signal is emitted when the rotation animation has finished.

Note:
It's emitted with every orientation angle change.
Parameters:
orientation New orientation of the viewport
QList< MSceneWindow * > MSceneManager::pageHistory (  )  const

Returns the list of application pages that comprises the current navigation history.

The last page in the list is the previous application page, the one that will automatically reappear when the current one is dismissed.

The first page in the list is the root application page. In regular navigation flows this is the first page that appeared to the user.

See also:
setPageHistory(), pageHistoryChanged()

Definition at line 2144 of file mscenemanager.cpp.

{
    Q_D(const MSceneManager);
    QList<MSceneWindow *> cleanList;
    int pageCount = d->pageHistory.count();
    MSceneWindow *page;

    // We might have some null entries in the history.
    for (int i = 0; i < pageCount; i++) {
        page = d->pageHistory.at(i);
        if (page) {
            cleanList.append(page);
        }
    }

    return cleanList;
}

Here is the call graph for this function:

void MSceneManager::pageHistoryChanged (  )  [signal]

This signal is emitted whenever the page history stack changes. That can happen due to the following reasons:

  • The page navigation history was manually changed by a setPageHistoryStack() call.
  • A new page appeared (and another page was being displayed before that).
  • The current page was dismissed (and the history was not empty).
See also:
pageHistory(), setPageHistory()
void MSceneManager::requestSoftwareInputPanel ( QGraphicsWidget inputWidget  ) 

Sends a request to the application's input context to open a software input panel (e.g. the virtual keyboard) Scene manager makes sure the focused input widget is visible to user. Window decorations may be hidden to gain more screen space when input panel is up.

Parameters:
inputWidget This parameter is ignored.
See also:
closeSoftwareInputPanel

Definition at line 2062 of file mscenemanager.cpp.

{
    MInputMethodState::requestSoftwareInputPanel();

    // This is normally called automatically except in cases where input panel area does not change and we
    // move between two similar text edits, for example. This should be removed if we ever get a change to
    // track focus item changes in the scene (see QTBUG-10570).
    // Calling update immediately here may cause relocated widget not to be set to its optimal position.
    // However, it is guaranteed to be visible on the screen, optimally or not.
    ensureCursorVisible();
}

Here is the call graph for this function:

MScene * MSceneManager::scene (  ) 

Get scene instance that was created by this scene manager.

Returns:
Returns the scene that is managed by this scene manager.

Definition at line 1960 of file mscenemanager.cpp.

{
    Q_D(MSceneManager);

    return d->scene;
}

void MSceneManager::setOrientationAngle ( M::OrientationAngle  angle,
TransitionMode  mode = AnimatedTransition 
) [slot]

Sets the orientation to angle. The mode can be set to ImmediateTransition to disable orientation animation.

/sa TransitionMode

Definition at line 2079 of file mscenemanager.cpp.

{
    Q_D(MSceneManager);

    if (d->orientationAnimation->state() == QAbstractAnimation::Running) {
        // Don't stop the current animation, instead remember the new
        // animation as pending and start it after the current animation
        // has been finished (see _q_applyPendingOrientationChange()).
        if (d->newAngle != angle) {
            if (d->pendingRotation == 0) {
                d->pendingRotation = new MSceneManagerPrivate::Rotation;
            }
            d->pendingRotation->angle = angle;
            d->pendingRotation->mode = mode;
        } else {
            // We are already transitioning to this angle.
            // Thus no need for a pending rotation.
            if (d->pendingRotation) {
                delete d->pendingRotation;
                d->pendingRotation = 0;
            }
        }
    } else {
        if (mode == AnimatedTransition && d->canHaveAnimatedTransitions()) {
            d->rotateToAngle(angle);
        } else {
            d->setOrientationAngleWithoutAnimation(angle);
        }
    }
}

void MSceneManager::setPageHistory ( const QList< MSceneWindow * > &  list  ) 

Sets the list of application pages that comprises the navigation history.

By getting the current history with pageHistory(), modifying it, and then feeding the modified version back to the scene manager with setPageHistory() an application can freely manipulate its page navigation history.

See also:
pageHistory(), pageHistoryChanged()

Definition at line 2162 of file mscenemanager.cpp.

{
    Q_D(MSceneManager);
    int pageCount = list.count();
    QList<MSceneWindow *> currentPageHistory = pageHistory();

    if (currentPageHistory == list) {
        // Nothing changes, thus nothing to be done.
        return;
    }

    d->pageHistory.clear();

    for (int i = 0; i < pageCount; i++) {
        d->pageHistory.append(list.at(i));
    }

    emit pageHistoryChanged();
}

Here is the call graph for this function:

QSize MSceneManager::visibleSceneSize ( M::Orientation  orientation  )  const

Returns the visible scene size in orientation. It's a convenience method with which you can get the scene size without querying the application window.

Definition at line 2125 of file mscenemanager.cpp.

{
    QSize s;

    if (orientation == M::Landscape) {
        s = MDeviceProfile::instance()->resolution();
    } else {
        s = QSize(MDeviceProfile::instance()->resolution().height(),
                  MDeviceProfile::instance()->resolution().width());
    }

    return s;
}

Here is the call graph for this function:

QSize MSceneManager::visibleSceneSize (  )  const

Returns the visible scene size in current orientation. It's a convenience method with which you can get the scene size without querying the application window.

Definition at line 2139 of file mscenemanager.cpp.

Here is the call graph for this function:


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