videoplayback/videoplaybackview/controlsrc/videoplaybackcontrolconfiguration.cpp
author hgs
Mon, 20 Sep 2010 18:25:37 +0300
changeset 63 4707a0db12f6
parent 50 21fe8338c6bf
permissions -rw-r--r--
201037
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
44
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description:  Implementation of VideoPlaybackControlConfiguration
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
63
hgs
parents: 50
diff changeset
    18
// Version : %version: da1mmcf#25 %
44
hgs
parents:
diff changeset
    19
hgs
parents:
diff changeset
    20
hgs
parents:
diff changeset
    21
hgs
parents:
diff changeset
    22
// INCLUDE FILES
hgs
parents:
diff changeset
    23
hgs
parents:
diff changeset
    24
#include <QGraphicsWidget>
hgs
parents:
diff changeset
    25
hgs
parents:
diff changeset
    26
#include "mpxvideo_debug.h"
hgs
parents:
diff changeset
    27
#include "videoplaybackdocumentloader.h"
hgs
parents:
diff changeset
    28
#include "videoplaybackviewfiledetails.h"
hgs
parents:
diff changeset
    29
#include "videoplaybackcontrolconfiguration.h"
hgs
parents:
diff changeset
    30
#include "videoplaybackcontrolscontroller.h"
hgs
parents:
diff changeset
    31
hgs
parents:
diff changeset
    32
hgs
parents:
diff changeset
    33
// ================= MEMBER FUNCTIONS ==============================================================
hgs
parents:
diff changeset
    34
hgs
parents:
diff changeset
    35
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    36
// VideoPlaybackControlConfiguration::VideoPlaybackControlConfiguration()
hgs
parents:
diff changeset
    37
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    38
//
hgs
parents:
diff changeset
    39
VideoPlaybackControlConfiguration::VideoPlaybackControlConfiguration(
hgs
parents:
diff changeset
    40
        VideoPlaybackControlsController* controller)
hgs
parents:
diff changeset
    41
    : mControlsController( controller )
50
hgs
parents: 44
diff changeset
    42
    , mSurfaceAttached( false )
44
hgs
parents:
diff changeset
    43
{
hgs
parents:
diff changeset
    44
}
hgs
parents:
diff changeset
    45
hgs
parents:
diff changeset
    46
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    47
// VideoPlaybackControlConfiguration::~VideoPlaybackControlConfiguration()
hgs
parents:
diff changeset
    48
// Destructor.
hgs
parents:
diff changeset
    49
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    50
//
hgs
parents:
diff changeset
    51
VideoPlaybackControlConfiguration::~VideoPlaybackControlConfiguration()
hgs
parents:
diff changeset
    52
{
hgs
parents:
diff changeset
    53
    MPX_DEBUG(_L("VideoPlaybackControlConfiguration::~VideoPlaybackControlConfiguration"));
hgs
parents:
diff changeset
    54
hgs
parents:
diff changeset
    55
    mControlsList.clear();
hgs
parents:
diff changeset
    56
}
hgs
parents:
diff changeset
    57
hgs
parents:
diff changeset
    58
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    59
// VideoPlaybackControlConfiguration::createControlList()
hgs
parents:
diff changeset
    60
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    61
//
hgs
parents:
diff changeset
    62
void VideoPlaybackControlConfiguration::createControlList()
hgs
parents:
diff changeset
    63
{
hgs
parents:
diff changeset
    64
    MPX_DEBUG(_L("VideoPlaybackControlConfiguration::createControlList()"));
hgs
parents:
diff changeset
    65
hgs
parents:
diff changeset
    66
    VideoPlaybackViewFileDetails* fileDetails = mControlsController->fileDetails();
hgs
parents:
diff changeset
    67
hgs
parents:
diff changeset
    68
    addControlToList( EStatusPane );
hgs
parents:
diff changeset
    69
hgs
parents:
diff changeset
    70
    if ( fileDetails->mPlaybackMode == EMPXVideoStreaming ||
hgs
parents:
diff changeset
    71
         fileDetails->mPlaybackMode == EMPXVideoLiveStreaming )
hgs
parents:
diff changeset
    72
    {
hgs
parents:
diff changeset
    73
        //
hgs
parents:
diff changeset
    74
        // streaming, add branding animation control to show while initializing
hgs
parents:
diff changeset
    75
        //
hgs
parents:
diff changeset
    76
        addControlToList( EBufferingAnimation );
63
hgs
parents: 50
diff changeset
    77
hgs
parents: 50
diff changeset
    78
        emit controlListUpdated();
44
hgs
parents:
diff changeset
    79
    }
hgs
parents:
diff changeset
    80
    else if ( mControlsController->shouldShowRNLogo() )
hgs
parents:
diff changeset
    81
    {
hgs
parents:
diff changeset
    82
        addControlToList( ERealLogoBitmap );
63
hgs
parents: 50
diff changeset
    83
hgs
parents: 50
diff changeset
    84
        emit controlListUpdated();
44
hgs
parents:
diff changeset
    85
    }
hgs
parents:
diff changeset
    86
}
hgs
parents:
diff changeset
    87
hgs
parents:
diff changeset
    88
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    89
// VideoPlaybackControlConfiguration::controlList
hgs
parents:
diff changeset
    90
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    91
//
hgs
parents:
diff changeset
    92
QList<TVideoPlaybackControls>& VideoPlaybackControlConfiguration::controlList()
hgs
parents:
diff changeset
    93
{
hgs
parents:
diff changeset
    94
    MPX_DEBUG(_L("VideoPlaybackControlConfiguration::controlList()"));
hgs
parents:
diff changeset
    95
hgs
parents:
diff changeset
    96
    return mControlsList;
hgs
parents:
diff changeset
    97
}
hgs
parents:
diff changeset
    98
hgs
parents:
diff changeset
    99
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   100
// VideoPlaybackControlConfiguration::updateControlList
hgs
parents:
diff changeset
   101
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   102
//
hgs
parents:
diff changeset
   103
void VideoPlaybackControlConfiguration::updateControlList(
hgs
parents:
diff changeset
   104
    TVideoPlaybackControlCommandIds event )
hgs
parents:
diff changeset
   105
{
hgs
parents:
diff changeset
   106
    MPX_DEBUG(_L("VideoPlaybackControlConfiguration::updateControlList(%d)"), event);
hgs
parents:
diff changeset
   107
50
hgs
parents: 44
diff changeset
   108
    QGraphicsWidget *widget =
44
hgs
parents:
diff changeset
   109
            mControlsController->layoutLoader()->findWidget( QString( "transparentWindow" ) );
hgs
parents:
diff changeset
   110
hgs
parents:
diff changeset
   111
    switch ( event )
hgs
parents:
diff changeset
   112
    {
hgs
parents:
diff changeset
   113
        case EControlCmdFullScreenViewOpened:
hgs
parents:
diff changeset
   114
        {
hgs
parents:
diff changeset
   115
            MPX_DEBUG(_L("VideoPlaybackControlConfiguration::updateControlList() full screen view"));
hgs
parents:
diff changeset
   116
50
hgs
parents: 44
diff changeset
   117
            if ( mSurfaceAttached )
hgs
parents: 44
diff changeset
   118
            {
hgs
parents: 44
diff changeset
   119
                widget->setVisible( true );
hgs
parents: 44
diff changeset
   120
            }
44
hgs
parents:
diff changeset
   121
hgs
parents:
diff changeset
   122
            deleteControlFromList( EDetailsViewPlaybackWindow );
hgs
parents:
diff changeset
   123
            deleteControlFromList( EFileDetailsWidget );
hgs
parents:
diff changeset
   124
            deleteControlFromList( EIndicatorBitmap );
hgs
parents:
diff changeset
   125
63
hgs
parents: 50
diff changeset
   126
            emit controlListUpdated();
hgs
parents: 50
diff changeset
   127
44
hgs
parents:
diff changeset
   128
            break;
hgs
parents:
diff changeset
   129
        }
hgs
parents:
diff changeset
   130
        case EControlCmdDetailsViewOpened:
hgs
parents:
diff changeset
   131
        {
hgs
parents:
diff changeset
   132
            MPX_DEBUG(_L("VideoPlaybackControlConfiguration::updateControlList() details view"));
hgs
parents:
diff changeset
   133
hgs
parents:
diff changeset
   134
            widget->setVisible( false );
hgs
parents:
diff changeset
   135
hgs
parents:
diff changeset
   136
            deleteControlFromList( EIndicatorBitmap );
hgs
parents:
diff changeset
   137
hgs
parents:
diff changeset
   138
            addControlToList( EDetailsViewPlaybackWindow );
63
hgs
parents: 50
diff changeset
   139
            addControlToList( EFileDetailsWidget );
44
hgs
parents:
diff changeset
   140
63
hgs
parents: 50
diff changeset
   141
            emit controlListUpdated();
44
hgs
parents:
diff changeset
   142
hgs
parents:
diff changeset
   143
            break;
hgs
parents:
diff changeset
   144
        }
hgs
parents:
diff changeset
   145
        case EControlCmdTvOutConnected:
hgs
parents:
diff changeset
   146
        case EControlCmdAudionOnlyViewOpened:
hgs
parents:
diff changeset
   147
        {
hgs
parents:
diff changeset
   148
            MPX_DEBUG(_L("VideoPlaybackControlConfiguration::updateControlList() audio only view"));
hgs
parents:
diff changeset
   149
hgs
parents:
diff changeset
   150
            widget->setVisible( false );
hgs
parents:
diff changeset
   151
hgs
parents:
diff changeset
   152
            deleteControlFromList( EDetailsViewPlaybackWindow );
hgs
parents:
diff changeset
   153
hgs
parents:
diff changeset
   154
            addControlToList( EIndicatorBitmap );
hgs
parents:
diff changeset
   155
            addControlToList( EFileDetailsWidget );
hgs
parents:
diff changeset
   156
63
hgs
parents: 50
diff changeset
   157
            emit controlListUpdated();
hgs
parents: 50
diff changeset
   158
44
hgs
parents:
diff changeset
   159
            break;
hgs
parents:
diff changeset
   160
        }
hgs
parents:
diff changeset
   161
        case EControlCmdRemoveRNLogo:
hgs
parents:
diff changeset
   162
        {
hgs
parents:
diff changeset
   163
            MPX_DEBUG(_L("VideoPlaybackControlConfiguration::updateControlList() RN Logo removed"));
hgs
parents:
diff changeset
   164
hgs
parents:
diff changeset
   165
            deleteControlFromList( ERealLogoBitmap );
hgs
parents:
diff changeset
   166
63
hgs
parents: 50
diff changeset
   167
            emit controlListUpdated();
hgs
parents: 50
diff changeset
   168
44
hgs
parents:
diff changeset
   169
            break;
hgs
parents:
diff changeset
   170
        }
50
hgs
parents: 44
diff changeset
   171
        case EControlCmdSurfaceAttached:
hgs
parents: 44
diff changeset
   172
        {
hgs
parents: 44
diff changeset
   173
            MPX_DEBUG(_L("VideoPlaybackControlConfiguration::updateControlList() surface added"));
hgs
parents: 44
diff changeset
   174
hgs
parents: 44
diff changeset
   175
            mSurfaceAttached = true;
hgs
parents: 44
diff changeset
   176
hgs
parents: 44
diff changeset
   177
            widget->setVisible( true );
hgs
parents: 44
diff changeset
   178
hgs
parents: 44
diff changeset
   179
            break;
hgs
parents: 44
diff changeset
   180
        }
hgs
parents: 44
diff changeset
   181
        case EControlCmdSurfaceDetached:
hgs
parents: 44
diff changeset
   182
        {
hgs
parents: 44
diff changeset
   183
            MPX_DEBUG(_L("VideoPlaybackControlConfiguration::updateControlList() surface removed"));
hgs
parents: 44
diff changeset
   184
hgs
parents: 44
diff changeset
   185
            mSurfaceAttached = false;
hgs
parents: 44
diff changeset
   186
hgs
parents: 44
diff changeset
   187
            widget->setVisible( false );
hgs
parents: 44
diff changeset
   188
hgs
parents: 44
diff changeset
   189
            break;
hgs
parents: 44
diff changeset
   190
        }
44
hgs
parents:
diff changeset
   191
        default:
hgs
parents:
diff changeset
   192
        {
hgs
parents:
diff changeset
   193
            break;
hgs
parents:
diff changeset
   194
        }
hgs
parents:
diff changeset
   195
    }
hgs
parents:
diff changeset
   196
}
hgs
parents:
diff changeset
   197
hgs
parents:
diff changeset
   198
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   199
// VideoPlaybackControlConfiguration::deleteControlFromList
hgs
parents:
diff changeset
   200
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   201
//
hgs
parents:
diff changeset
   202
void VideoPlaybackControlConfiguration::deleteControlFromList( TVideoPlaybackControls control )
hgs
parents:
diff changeset
   203
{
hgs
parents:
diff changeset
   204
    MPX_DEBUG(_L("VideoPlaybackControlConfiguration::deleteControlFromList(%d)"), control);
hgs
parents:
diff changeset
   205
hgs
parents:
diff changeset
   206
    mControlsList.removeAll( control );
hgs
parents:
diff changeset
   207
}
hgs
parents:
diff changeset
   208
hgs
parents:
diff changeset
   209
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   210
// VideoPlaybackControlConfiguration::addControlToList
hgs
parents:
diff changeset
   211
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   212
//
hgs
parents:
diff changeset
   213
void VideoPlaybackControlConfiguration::addControlToList(
hgs
parents:
diff changeset
   214
        TVideoPlaybackControls control )
hgs
parents:
diff changeset
   215
{
hgs
parents:
diff changeset
   216
    MPX_DEBUG(_L("VideoPlaybackControlConfiguration::addControlToList(%d)"), control);
hgs
parents:
diff changeset
   217
hgs
parents:
diff changeset
   218
    if ( ! mControlsList.contains( control ) )
hgs
parents:
diff changeset
   219
    {
hgs
parents:
diff changeset
   220
        mControlsList.append( control );
hgs
parents:
diff changeset
   221
    }
hgs
parents:
diff changeset
   222
}
hgs
parents:
diff changeset
   223
hgs
parents:
diff changeset
   224
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   225
// VideoPlaybackControlConfiguration::updateControlsWithFileDetails
hgs
parents:
diff changeset
   226
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   227
//
hgs
parents:
diff changeset
   228
void VideoPlaybackControlConfiguration::updateControlsWithFileDetails()
hgs
parents:
diff changeset
   229
{
hgs
parents:
diff changeset
   230
    MPX_DEBUG(_L("VideoPlaybackControlConfiguration::updateControlsWithFileDetails()"));
hgs
parents:
diff changeset
   231
hgs
parents:
diff changeset
   232
    addControlToList( EControlBar );
hgs
parents:
diff changeset
   233
hgs
parents:
diff changeset
   234
    emit controlListUpdated();
hgs
parents:
diff changeset
   235
}
hgs
parents:
diff changeset
   236
hgs
parents:
diff changeset
   237
// End of File