camerauis/cameraxui/cxui/src/cxuifullscreenpopup.cpp
author hgs
Thu, 15 Jul 2010 01:55:05 +0300
changeset 43 0e652f8f1fbd
permissions -rw-r--r--
201027_1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
43
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
     1
/*
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
     3
* All rights reserved.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
     8
*
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
     9
* Initial Contributors:
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    11
*
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    12
* Contributors:
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    13
*
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    14
* Description:
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    15
*
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    16
*/
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    17
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    18
#include <QGraphicsScene>
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    19
#include <QGraphicsRectItem>
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    20
#include <QGraphicsAnchorLayout>
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    21
#include <HbLabel>
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    22
#include <HbPushButton>
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    23
#include <HbInstantFeedback>
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    24
#include "cxutils.h"
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    25
#include "cxuienums.h"
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    26
#include "cxuiview.h"
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    27
#include "cxuidocumentloader.h"
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    28
#include "cxuifullscreenpopup.h"
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    29
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    30
/*!
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    31
* Constructor.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    32
*/
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    33
CxuiFullScreenPopup::CxuiFullScreenPopupLoader::CxuiFullScreenPopupLoader()
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    34
    : HbDocumentLoader()
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    35
{
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    36
}
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    37
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    38
/*!
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    39
* Create object from DocML.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    40
* Custom type of object created when object name matches the full screen dialog one.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    41
* Other items are propagated to HbDocumentLoader for standard handling.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    42
* @param type Object type (class name)
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    43
* @param name Object name, name of the item in DocML.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    44
*/
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    45
QObject *CxuiFullScreenPopup::CxuiFullScreenPopupLoader::createObject(const QString& type, const QString &name)
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    46
{
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    47
    CX_DEBUG_ENTER_FUNCTION();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    48
    QObject *object = NULL;
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    49
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    50
    // HbWidget as type in DocML to support UI layout tool.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    51
    if (type == "HbWidget") {
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    52
        if (name == CxUiLayout::FULL_SCREEN_POPUP) {
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    53
            object = new CxuiFullScreenPopup();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    54
        }
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    55
    }
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    56
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    57
    if (object) {
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    58
        object->setObjectName(name);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    59
    } else {
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    60
        object = HbDocumentLoader::createObject(type, name);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    61
    }
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    62
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    63
    CX_DEBUG_EXIT_FUNCTION();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    64
    return object;
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    65
}
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    66
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    67
/*!
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    68
* Load a full screen popup from DocML and set given message and action text to it.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    69
* @param scene Graphics scene where to insert the popup.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    70
* @param message Popup message text.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    71
* @param action Popup action button text.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    72
*/
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    73
CxuiFullScreenPopup *CxuiFullScreenPopup::create(QGraphicsScene *scene,
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    74
                                                 const QString &message,
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    75
                                                 const QString &action)
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    76
{
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    77
    CX_DEBUG_ENTER_FUNCTION();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    78
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    79
    bool ok(true);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    80
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    81
    // Load popup structure from DocML.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    82
    CxuiFullScreenPopupLoader *loader = new CxuiFullScreenPopupLoader();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    83
    loader->load(CxUiLayout::FULL_SCREEN_POPUP_XML, &ok);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    84
    CX_ASSERT_ALWAYS(ok);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    85
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    86
    // Popup container widget.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    87
    CxuiFullScreenPopup *popup = qobject_cast<CxuiFullScreenPopup *>(loader->findWidget(CxUiLayout::FULL_SCREEN_POPUP));
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    88
    CX_ASSERT_ALWAYS(popup);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    89
    // Popup needs scene to move in front of all widgets.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    90
    popup->setScene(scene);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    91
    // Add background graphic for popup.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    92
    QGraphicsRectItem *bg = new QGraphicsRectItem(popup);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    93
    bg->setRect(popup->geometry());
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    94
    bg->setBrush(Qt::black);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    95
    popup->setBackgroundItem(bg);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    96
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    97
    // Popup text.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    98
    //!@todo: Move text color definition to DocML once supported there.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
    99
    HbLabel *text = qobject_cast<HbLabel*>(loader->findWidget(CxUiLayout::FULL_SCREEN_POPUP_TEXT));
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   100
    CX_ASSERT_ALWAYS(text);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   101
    text->setPlainText(message);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   102
    text->setTextColor(Qt::white);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   103
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   104
    // Action button.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   105
    // Hidden if empty text given.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   106
    HbPushButton *button = qobject_cast<HbPushButton*>(loader->findWidget(CxUiLayout::FULL_SCREEN_POPUP_BUTTON));
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   107
    CX_ASSERT_ALWAYS(button);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   108
    if (action.isEmpty()) {
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   109
        CX_DEBUG(("CxuiFullScreenPopup - no button text given, hiding button.."));
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   110
        button->setVisible(false);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   111
    } else {
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   112
        button->setText(action);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   113
    }
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   114
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   115
    delete loader;
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   116
    loader = NULL;
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   117
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   118
    CX_DEBUG_EXIT_FUNCTION();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   119
    return popup;
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   120
}
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   121
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   122
/*!
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   123
* Popup destructor.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   124
*/
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   125
CxuiFullScreenPopup::~CxuiFullScreenPopup()
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   126
{
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   127
    CX_DEBUG_ENTER_FUNCTION();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   128
    hide();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   129
    CX_DEBUG_EXIT_FUNCTION();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   130
}
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   131
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   132
/*!
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   133
* Handle mouse press event.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   134
*/
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   135
void CxuiFullScreenPopup::handleMousePress()
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   136
{
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   137
    CX_DEBUG_ENTER_FUNCTION();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   138
    // Give standard feedback.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   139
    HbInstantFeedback feedback(HbFeedback::BasicItem);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   140
    feedback.setModalities(HbFeedback::All);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   141
    feedback.play();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   142
    CX_DEBUG_EXIT_FUNCTION();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   143
}
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   144
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   145
/*!
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   146
* Handle mouse release event.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   147
*/
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   148
void CxuiFullScreenPopup::handleMouseRelease()
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   149
{
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   150
    CX_DEBUG_ENTER_FUNCTION();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   151
    //!@todo: sound disabling doesn't work in orbit yet so don't do feedback on release
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   152
    // needs to be enabled when orbit support is done
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   153
    // Give tactile feedback but no sound feedback on mouse release.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   154
    /*
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   155
    HbInstantFeedback feedback(HbFeedback::BasicItem);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   156
    feedback.setModalities(HbFeedback::Tactile);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   157
    feedback.play();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   158
    CX_DEBUG_EXIT_FUNCTION();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   159
    */
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   160
}
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   161
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   162
/*!
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   163
* Show the popup.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   164
* Checks current top most item in the scene and adds this popup in front of it.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   165
* Input to below widgets is blocked.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   166
*/
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   167
void CxuiFullScreenPopup::show()
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   168
{
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   169
    CX_DEBUG_ENTER_FUNCTION();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   170
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   171
    CX_ASSERT_ALWAYS(mScene);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   172
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   173
    if (!mPopupShown) {
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   174
        mPopupShown = true;
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   175
        // Store current top item z value.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   176
        qreal topZ(topZValue());
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   177
        // Add popup widget to scene to actually get it visible.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   178
        mScene->addItem(this);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   179
        // Make sure popup is just above the top item.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   180
        setZValue(topZ + 1);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   181
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   182
        // Block input to other widgets below the popup.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   183
        setWindowFlags(Qt::Dialog);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   184
        setPanelModality(QGraphicsItem::PanelModal);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   185
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   186
        // Show popup.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   187
        HbWidget::show();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   188
    }
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   189
    CX_DEBUG_EXIT_FUNCTION();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   190
}
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   191
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   192
/*!
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   193
* Hide the popup.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   194
*/
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   195
void CxuiFullScreenPopup::hide()
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   196
{
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   197
    CX_DEBUG_ENTER_FUNCTION();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   198
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   199
    if (mPopupShown) {
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   200
        HbWidget::hide();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   201
        // Double check non-nullness.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   202
        if (mScene) {
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   203
            mScene->removeItem(this);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   204
        }
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   205
        mPopupShown = false;
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   206
    }
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   207
    CX_DEBUG_EXIT_FUNCTION();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   208
}
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   209
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   210
/*!
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   211
* Get the z value of top item in scene.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   212
* @return Top (max) z value.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   213
*/
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   214
qreal CxuiFullScreenPopup::topZValue() const
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   215
{
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   216
    CX_DEBUG_ENTER_FUNCTION();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   217
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   218
    qreal z(0);
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   219
    if (mScene) {
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   220
        const QList<QGraphicsItem *> itemList(mScene->items(Qt::DescendingOrder));
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   221
        foreach (QGraphicsItem *item, itemList) {
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   222
            // Max of z values.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   223
            z = (item && item->zValue() > z) ? item->zValue() : z;
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   224
#ifdef CX_DEBUG
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   225
            const QGraphicsObject *gObject(item->toGraphicsObject());
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   226
            CX_DEBUG(("Item of class [%s] z value [%s]",
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   227
                      gObject ? gObject->metaObject()->className() : qPrintable(QString("QGraphicsItem")),
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   228
                      qPrintable(QString::number(item->zValue()))));
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   229
#endif // CX_DEBUG
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   230
        }
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   231
    } else {
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   232
        CX_DEBUG(("[WARNING] No scene found, returning zero"));
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   233
    }
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   234
    CX_DEBUG_EXIT_FUNCTION();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   235
    return z;
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   236
}
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   237
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   238
/*!
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   239
* Store the scene in which this popup is to be shown.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   240
*/
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   241
void CxuiFullScreenPopup::setScene(QGraphicsScene *scene)
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   242
{
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   243
    mScene = scene;
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   244
}
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   245
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   246
/*!
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   247
* Popup (private) constructor.
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   248
*/
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   249
CxuiFullScreenPopup::CxuiFullScreenPopup()
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   250
    : mScene(NULL),
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   251
      mPopupShown(false)
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   252
{
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   253
    CX_DEBUG_IN_FUNCTION();
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   254
}
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   255
0e652f8f1fbd 201027_1
hgs
parents:
diff changeset
   256
// end of file