videoplayback/videoplaybackview/controlsrc/videoplaybackcontrolconfiguration.cpp
author hgs
Fri, 23 Jul 2010 11:10:06 +0300
changeset 49 824471cb468a
parent 44 518105d52e45
child 50 21fe8338c6bf
permissions -rw-r--r--
201029
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
hgs
parents:
diff changeset
    18
// Version : %version: da1mmcf#23 %
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 )
hgs
parents:
diff changeset
    42
{
hgs
parents:
diff changeset
    43
}
hgs
parents:
diff changeset
    44
hgs
parents:
diff changeset
    45
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    46
// VideoPlaybackControlConfiguration::~VideoPlaybackControlConfiguration()
hgs
parents:
diff changeset
    47
// Destructor.
hgs
parents:
diff changeset
    48
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    49
//
hgs
parents:
diff changeset
    50
VideoPlaybackControlConfiguration::~VideoPlaybackControlConfiguration()
hgs
parents:
diff changeset
    51
{
hgs
parents:
diff changeset
    52
    MPX_DEBUG(_L("VideoPlaybackControlConfiguration::~VideoPlaybackControlConfiguration"));
hgs
parents:
diff changeset
    53
hgs
parents:
diff changeset
    54
    mControlsList.clear();
hgs
parents:
diff changeset
    55
}
hgs
parents:
diff changeset
    56
hgs
parents:
diff changeset
    57
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    58
// VideoPlaybackControlConfiguration::createControlList()
hgs
parents:
diff changeset
    59
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    60
//
hgs
parents:
diff changeset
    61
void VideoPlaybackControlConfiguration::createControlList()
hgs
parents:
diff changeset
    62
{
hgs
parents:
diff changeset
    63
    MPX_DEBUG(_L("VideoPlaybackControlConfiguration::createControlList()"));
hgs
parents:
diff changeset
    64
hgs
parents:
diff changeset
    65
    VideoPlaybackViewFileDetails* fileDetails = mControlsController->fileDetails();
hgs
parents:
diff changeset
    66
hgs
parents:
diff changeset
    67
    addControlToList( EStatusPane );
hgs
parents:
diff changeset
    68
hgs
parents:
diff changeset
    69
    if ( fileDetails->mPlaybackMode == EMPXVideoStreaming ||
hgs
parents:
diff changeset
    70
         fileDetails->mPlaybackMode == EMPXVideoLiveStreaming )
hgs
parents:
diff changeset
    71
    {
hgs
parents:
diff changeset
    72
        //
hgs
parents:
diff changeset
    73
        // streaming, add branding animation control to show while initializing
hgs
parents:
diff changeset
    74
        //
hgs
parents:
diff changeset
    75
        addControlToList( EBufferingAnimation );
hgs
parents:
diff changeset
    76
    }
hgs
parents:
diff changeset
    77
    else if ( mControlsController->shouldShowRNLogo() )
hgs
parents:
diff changeset
    78
    {
hgs
parents:
diff changeset
    79
        addControlToList( ERealLogoBitmap );
hgs
parents:
diff changeset
    80
    }
hgs
parents:
diff changeset
    81
hgs
parents:
diff changeset
    82
    emit controlListUpdated();
hgs
parents:
diff changeset
    83
}
hgs
parents:
diff changeset
    84
hgs
parents:
diff changeset
    85
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    86
// VideoPlaybackControlConfiguration::controlList
hgs
parents:
diff changeset
    87
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    88
//
hgs
parents:
diff changeset
    89
QList<TVideoPlaybackControls>& VideoPlaybackControlConfiguration::controlList()
hgs
parents:
diff changeset
    90
{
hgs
parents:
diff changeset
    91
    MPX_DEBUG(_L("VideoPlaybackControlConfiguration::controlList()"));
hgs
parents:
diff changeset
    92
hgs
parents:
diff changeset
    93
    return mControlsList;
hgs
parents:
diff changeset
    94
}
hgs
parents:
diff changeset
    95
hgs
parents:
diff changeset
    96
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    97
// VideoPlaybackControlConfiguration::updateControlList
hgs
parents:
diff changeset
    98
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    99
//
hgs
parents:
diff changeset
   100
void VideoPlaybackControlConfiguration::updateControlList(
hgs
parents:
diff changeset
   101
    TVideoPlaybackControlCommandIds event )
hgs
parents:
diff changeset
   102
{
hgs
parents:
diff changeset
   103
    MPX_DEBUG(_L("VideoPlaybackControlConfiguration::updateControlList(%d)"), event);
hgs
parents:
diff changeset
   104
hgs
parents:
diff changeset
   105
    QGraphicsWidget *widget = 
hgs
parents:
diff changeset
   106
            mControlsController->layoutLoader()->findWidget( QString( "transparentWindow" ) );
hgs
parents:
diff changeset
   107
hgs
parents:
diff changeset
   108
    switch ( event )
hgs
parents:
diff changeset
   109
    {
hgs
parents:
diff changeset
   110
        case EControlCmdFullScreenViewOpened:
hgs
parents:
diff changeset
   111
        {
hgs
parents:
diff changeset
   112
            MPX_DEBUG(_L("VideoPlaybackControlConfiguration::updateControlList() full screen view"));
hgs
parents:
diff changeset
   113
hgs
parents:
diff changeset
   114
            widget->setVisible( true );
hgs
parents:
diff changeset
   115
hgs
parents:
diff changeset
   116
            deleteControlFromList( EDetailsViewPlaybackWindow );
hgs
parents:
diff changeset
   117
            deleteControlFromList( EFileDetailsWidget );
hgs
parents:
diff changeset
   118
            deleteControlFromList( EIndicatorBitmap );
hgs
parents:
diff changeset
   119
hgs
parents:
diff changeset
   120
            break;
hgs
parents:
diff changeset
   121
        }
hgs
parents:
diff changeset
   122
        case EControlCmdDetailsViewOpened:
hgs
parents:
diff changeset
   123
        {
hgs
parents:
diff changeset
   124
            MPX_DEBUG(_L("VideoPlaybackControlConfiguration::updateControlList() details view"));
hgs
parents:
diff changeset
   125
hgs
parents:
diff changeset
   126
            widget->setVisible( false );
hgs
parents:
diff changeset
   127
hgs
parents:
diff changeset
   128
            deleteControlFromList( EIndicatorBitmap );
hgs
parents:
diff changeset
   129
hgs
parents:
diff changeset
   130
            addControlToList( EDetailsViewPlaybackWindow );
hgs
parents:
diff changeset
   131
hgs
parents:
diff changeset
   132
            addControlToList( EFileDetailsWidget );
hgs
parents:
diff changeset
   133
hgs
parents:
diff changeset
   134
            break;
hgs
parents:
diff changeset
   135
        }
hgs
parents:
diff changeset
   136
        case EControlCmdTvOutConnected:
hgs
parents:
diff changeset
   137
        case EControlCmdAudionOnlyViewOpened:
hgs
parents:
diff changeset
   138
        {
hgs
parents:
diff changeset
   139
            MPX_DEBUG(_L("VideoPlaybackControlConfiguration::updateControlList() audio only view"));
hgs
parents:
diff changeset
   140
hgs
parents:
diff changeset
   141
            widget->setVisible( false );
hgs
parents:
diff changeset
   142
hgs
parents:
diff changeset
   143
            deleteControlFromList( EDetailsViewPlaybackWindow );
hgs
parents:
diff changeset
   144
hgs
parents:
diff changeset
   145
            addControlToList( EIndicatorBitmap );
hgs
parents:
diff changeset
   146
            addControlToList( EFileDetailsWidget );
hgs
parents:
diff changeset
   147
hgs
parents:
diff changeset
   148
            break;
hgs
parents:
diff changeset
   149
        }
hgs
parents:
diff changeset
   150
        case EControlCmdRemoveRNLogo:
hgs
parents:
diff changeset
   151
        {
hgs
parents:
diff changeset
   152
            MPX_DEBUG(_L("VideoPlaybackControlConfiguration::updateControlList() RN Logo removed"));
hgs
parents:
diff changeset
   153
hgs
parents:
diff changeset
   154
            deleteControlFromList( ERealLogoBitmap );
hgs
parents:
diff changeset
   155
hgs
parents:
diff changeset
   156
            break;
hgs
parents:
diff changeset
   157
        }
hgs
parents:
diff changeset
   158
        default:
hgs
parents:
diff changeset
   159
        {
hgs
parents:
diff changeset
   160
            break;
hgs
parents:
diff changeset
   161
        }
hgs
parents:
diff changeset
   162
    }
hgs
parents:
diff changeset
   163
hgs
parents:
diff changeset
   164
    emit controlListUpdated();
hgs
parents:
diff changeset
   165
}
hgs
parents:
diff changeset
   166
hgs
parents:
diff changeset
   167
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   168
// VideoPlaybackControlConfiguration::deleteControlFromList
hgs
parents:
diff changeset
   169
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   170
//
hgs
parents:
diff changeset
   171
void VideoPlaybackControlConfiguration::deleteControlFromList( TVideoPlaybackControls control )
hgs
parents:
diff changeset
   172
{
hgs
parents:
diff changeset
   173
    MPX_DEBUG(_L("VideoPlaybackControlConfiguration::deleteControlFromList(%d)"), control);
hgs
parents:
diff changeset
   174
hgs
parents:
diff changeset
   175
    mControlsList.removeAll( control );
hgs
parents:
diff changeset
   176
}
hgs
parents:
diff changeset
   177
hgs
parents:
diff changeset
   178
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   179
// VideoPlaybackControlConfiguration::addControlToList
hgs
parents:
diff changeset
   180
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   181
//
hgs
parents:
diff changeset
   182
void VideoPlaybackControlConfiguration::addControlToList(
hgs
parents:
diff changeset
   183
        TVideoPlaybackControls control )
hgs
parents:
diff changeset
   184
{
hgs
parents:
diff changeset
   185
    MPX_DEBUG(_L("VideoPlaybackControlConfiguration::addControlToList(%d)"), control);
hgs
parents:
diff changeset
   186
hgs
parents:
diff changeset
   187
    if ( ! mControlsList.contains( control ) )
hgs
parents:
diff changeset
   188
    {
hgs
parents:
diff changeset
   189
        mControlsList.append( control );
hgs
parents:
diff changeset
   190
    }
hgs
parents:
diff changeset
   191
}
hgs
parents:
diff changeset
   192
hgs
parents:
diff changeset
   193
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   194
// VideoPlaybackControlConfiguration::updateControlsWithFileDetails
hgs
parents:
diff changeset
   195
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   196
//
hgs
parents:
diff changeset
   197
void VideoPlaybackControlConfiguration::updateControlsWithFileDetails()
hgs
parents:
diff changeset
   198
{
hgs
parents:
diff changeset
   199
    MPX_DEBUG(_L("VideoPlaybackControlConfiguration::updateControlsWithFileDetails()"));
hgs
parents:
diff changeset
   200
hgs
parents:
diff changeset
   201
    addControlToList( EControlBar );
hgs
parents:
diff changeset
   202
hgs
parents:
diff changeset
   203
    if ( mControlsController->fileDetails()->mVideoEnabled )
hgs
parents:
diff changeset
   204
    {
hgs
parents:
diff changeset
   205
        MPX_DEBUG(_L("VideoPlaybackControlConfiguration::updateControlsWithFileDetails() video enabled"));
hgs
parents:
diff changeset
   206
hgs
parents:
diff changeset
   207
        QGraphicsWidget *widget = 
hgs
parents:
diff changeset
   208
                mControlsController->layoutLoader()->findWidget( QString( "transparentWindow" ) );
hgs
parents:
diff changeset
   209
        widget->setVisible( true );
hgs
parents:
diff changeset
   210
    }
hgs
parents:
diff changeset
   211
hgs
parents:
diff changeset
   212
    emit controlListUpdated();
hgs
parents:
diff changeset
   213
}
hgs
parents:
diff changeset
   214
hgs
parents:
diff changeset
   215
// End of File