videoplayback/videoplaybackview/controlsrc/videoplaybackfullscreencontrol.cpp
author hgs
Mon, 20 Sep 2010 18:25:37 +0300
changeset 63 4707a0db12f6
parent 58 d2b028fd1f7d
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 VideoPlaybackFullScreenControl
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
63
hgs
parents: 58
diff changeset
    18
// Version : %version: da1mmcf#12 %
44
hgs
parents:
diff changeset
    19
hgs
parents:
diff changeset
    20
hgs
parents:
diff changeset
    21
hgs
parents:
diff changeset
    22
#include <w32std.h>
hgs
parents:
diff changeset
    23
hgs
parents:
diff changeset
    24
#include "mpxvideo_debug.h"
hgs
parents:
diff changeset
    25
#include "videoplaybackcontrolbar.h"
hgs
parents:
diff changeset
    26
#include "videoplaybackfullscreencontrol.h"
hgs
parents:
diff changeset
    27
#include "videoplaybackfiledetailswidget.h"
hgs
parents:
diff changeset
    28
#include "videoplaybackcontrolscontroller.h"
hgs
parents:
diff changeset
    29
#include "videoplaybackdetailsplaybackwindow.h"
hgs
parents:
diff changeset
    30
hgs
parents:
diff changeset
    31
hgs
parents:
diff changeset
    32
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    33
// VideoPlaybackFullScreenControl::VideoPlaybackFullScreenControl()
hgs
parents:
diff changeset
    34
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    35
//
58
hgs
parents: 44
diff changeset
    36
VideoPlaybackFullScreenControl::VideoPlaybackFullScreenControl(
hgs
parents: 44
diff changeset
    37
        VideoPlaybackControlsController* controller,
hgs
parents: 44
diff changeset
    38
        TVideoPlaybackControls index,
hgs
parents: 44
diff changeset
    39
        HbWidget* widget,
44
hgs
parents:
diff changeset
    40
        TUint controlproperties )
hgs
parents:
diff changeset
    41
    : mController( controller )
hgs
parents:
diff changeset
    42
    , mControl( widget )
hgs
parents:
diff changeset
    43
    , mControlIndex( index )
hgs
parents:
diff changeset
    44
    , mProperties( controlproperties )
63
hgs
parents: 58
diff changeset
    45
    , mVisible( false )
44
hgs
parents:
diff changeset
    46
{
hgs
parents:
diff changeset
    47
    MPX_ENTER_EXIT(_L("VideoPlaybackFullScreenControl::VideoPlaybackFullScreenControl()"));
hgs
parents:
diff changeset
    48
hgs
parents:
diff changeset
    49
    setParent( mController );
hgs
parents:
diff changeset
    50
}
hgs
parents:
diff changeset
    51
hgs
parents:
diff changeset
    52
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    53
// VideoPlaybackFullScreenControl::~VideoPlaybackFullScreenControl()
hgs
parents:
diff changeset
    54
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    55
//
hgs
parents:
diff changeset
    56
VideoPlaybackFullScreenControl::~VideoPlaybackFullScreenControl()
hgs
parents:
diff changeset
    57
{
hgs
parents:
diff changeset
    58
    MPX_DEBUG(_L("VideoPlaybackControlsController::~VideoPlaybackFullScreenControl"));
hgs
parents:
diff changeset
    59
}
hgs
parents:
diff changeset
    60
hgs
parents:
diff changeset
    61
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    62
// VideoPlaybackFullScreenControl::setVisible()
hgs
parents:
diff changeset
    63
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    64
//
hgs
parents:
diff changeset
    65
void VideoPlaybackFullScreenControl::setVisible( bool visible )
hgs
parents:
diff changeset
    66
{
63
hgs
parents: 58
diff changeset
    67
    if( mVisible != visible )
44
hgs
parents:
diff changeset
    68
    {
63
hgs
parents: 58
diff changeset
    69
        mVisible = visible;
hgs
parents: 58
diff changeset
    70
hgs
parents: 58
diff changeset
    71
        switch ( mControlIndex )
44
hgs
parents:
diff changeset
    72
        {
63
hgs
parents: 58
diff changeset
    73
            case EControlBar:
hgs
parents: 58
diff changeset
    74
            {
hgs
parents: 58
diff changeset
    75
                static_cast<VideoPlaybackControlBar*>(mControl)->setVisibleToControlBar( visible );
hgs
parents: 58
diff changeset
    76
                break;
hgs
parents: 58
diff changeset
    77
            }
hgs
parents: 58
diff changeset
    78
            default:
hgs
parents: 58
diff changeset
    79
            {
hgs
parents: 58
diff changeset
    80
                mControl->setVisible( visible );
hgs
parents: 58
diff changeset
    81
                break;
hgs
parents: 58
diff changeset
    82
            }
44
hgs
parents:
diff changeset
    83
        }
hgs
parents:
diff changeset
    84
    }
hgs
parents:
diff changeset
    85
}
hgs
parents:
diff changeset
    86
hgs
parents:
diff changeset
    87
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    88
// VideoPlaybackFullScreenControl::isVisible()
hgs
parents:
diff changeset
    89
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    90
//
hgs
parents:
diff changeset
    91
bool VideoPlaybackFullScreenControl::isVisible()
hgs
parents:
diff changeset
    92
{
hgs
parents:
diff changeset
    93
    return mControl->isVisible();
hgs
parents:
diff changeset
    94
}
hgs
parents:
diff changeset
    95
hgs
parents:
diff changeset
    96
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    97
// VideoPlaybackFullScreenControl::setVisibility()
hgs
parents:
diff changeset
    98
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    99
//
hgs
parents:
diff changeset
   100
void VideoPlaybackFullScreenControl::setVisibility( TMPXPlaybackState state )
hgs
parents:
diff changeset
   101
{
hgs
parents:
diff changeset
   102
    MPX_DEBUG(_L("VideoPlaybackFullScreenControl::setVisibility()"));
hgs
parents:
diff changeset
   103
hgs
parents:
diff changeset
   104
    bool visible = false;
hgs
parents:
diff changeset
   105
hgs
parents:
diff changeset
   106
    switch( state )
hgs
parents:
diff changeset
   107
    {
hgs
parents:
diff changeset
   108
        case EPbStatePlaying:
hgs
parents:
diff changeset
   109
        {
hgs
parents:
diff changeset
   110
            if ( mProperties & EShownWhenPlaying )
hgs
parents:
diff changeset
   111
            {
hgs
parents:
diff changeset
   112
                visible = true;
hgs
parents:
diff changeset
   113
            }
hgs
parents:
diff changeset
   114
            break;
hgs
parents:
diff changeset
   115
        }
hgs
parents:
diff changeset
   116
        case EPbStatePaused:
hgs
parents:
diff changeset
   117
        {
hgs
parents:
diff changeset
   118
            if ( mProperties & EShownWhenPaused )
hgs
parents:
diff changeset
   119
            {
hgs
parents:
diff changeset
   120
                visible = true;
hgs
parents:
diff changeset
   121
            }
hgs
parents:
diff changeset
   122
            break;
hgs
parents:
diff changeset
   123
        }
hgs
parents:
diff changeset
   124
        case EPbStatePluginSeeking:
hgs
parents:
diff changeset
   125
        {
hgs
parents:
diff changeset
   126
            if ( mProperties & EShownWhenSeeking )
hgs
parents:
diff changeset
   127
            {
hgs
parents:
diff changeset
   128
                visible = true;
hgs
parents:
diff changeset
   129
            }
hgs
parents:
diff changeset
   130
            break;
hgs
parents:
diff changeset
   131
        }
hgs
parents:
diff changeset
   132
        case EPbStateBuffering:
hgs
parents:
diff changeset
   133
        {
hgs
parents:
diff changeset
   134
            if ( mProperties & EShownWhenBuffering )
hgs
parents:
diff changeset
   135
            {
hgs
parents:
diff changeset
   136
                visible = true;
hgs
parents:
diff changeset
   137
            }
hgs
parents:
diff changeset
   138
            break;
hgs
parents:
diff changeset
   139
        }
hgs
parents:
diff changeset
   140
        case EPbStateNotInitialised:
hgs
parents:
diff changeset
   141
        case EPbStateInitialising:
hgs
parents:
diff changeset
   142
        {
hgs
parents:
diff changeset
   143
            if ( mProperties & EShownWhenInitializing )
hgs
parents:
diff changeset
   144
            {
hgs
parents:
diff changeset
   145
                visible = true;
hgs
parents:
diff changeset
   146
            }
hgs
parents:
diff changeset
   147
            break;
hgs
parents:
diff changeset
   148
        }
hgs
parents:
diff changeset
   149
    }
hgs
parents:
diff changeset
   150
hgs
parents:
diff changeset
   151
    setVisible( visible );
hgs
parents:
diff changeset
   152
}
hgs
parents:
diff changeset
   153
hgs
parents:
diff changeset
   154
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   155
// VideoPlaybackFullScreenControl::controlIndex()
hgs
parents:
diff changeset
   156
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   157
//
hgs
parents:
diff changeset
   158
TVideoPlaybackControls VideoPlaybackFullScreenControl::controlIndex()
hgs
parents:
diff changeset
   159
{
hgs
parents:
diff changeset
   160
    return mControlIndex;
hgs
parents:
diff changeset
   161
}
hgs
parents:
diff changeset
   162
hgs
parents:
diff changeset
   163
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   164
// VideoPlaybackFullScreenControl::durationChanged()
hgs
parents:
diff changeset
   165
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   166
//
hgs
parents:
diff changeset
   167
bool VideoPlaybackFullScreenControl::durationChanged( int duration )
hgs
parents:
diff changeset
   168
{
hgs
parents:
diff changeset
   169
    bool changed = EFalse;
hgs
parents:
diff changeset
   170
hgs
parents:
diff changeset
   171
    if ( mControlIndex == EControlBar )
hgs
parents:
diff changeset
   172
    {
hgs
parents:
diff changeset
   173
        MPX_DEBUG(_L("VideoPlaybackFullScreenControl::DurationChanged() [%d]"), duration);
hgs
parents:
diff changeset
   174
hgs
parents:
diff changeset
   175
        static_cast<VideoPlaybackControlBar*>(mControl)->durationChanged( duration );
hgs
parents:
diff changeset
   176
hgs
parents:
diff changeset
   177
        changed = ETrue;
hgs
parents:
diff changeset
   178
    }
hgs
parents:
diff changeset
   179
hgs
parents:
diff changeset
   180
    return changed;
hgs
parents:
diff changeset
   181
}
hgs
parents:
diff changeset
   182
hgs
parents:
diff changeset
   183
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   184
// VideoPlaybackFullScreenControl::positionChanged()
hgs
parents:
diff changeset
   185
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   186
//
hgs
parents:
diff changeset
   187
bool VideoPlaybackFullScreenControl::positionChanged( int position )
hgs
parents:
diff changeset
   188
{
hgs
parents:
diff changeset
   189
    bool changed = EFalse;
hgs
parents:
diff changeset
   190
hgs
parents:
diff changeset
   191
    if ( mControlIndex == EControlBar )
hgs
parents:
diff changeset
   192
    {
hgs
parents:
diff changeset
   193
        MPX_DEBUG(_L("VideoPlaybackFullScreenControl::positionChanged() [%d]"), position);
hgs
parents:
diff changeset
   194
hgs
parents:
diff changeset
   195
        static_cast<VideoPlaybackControlBar*>(mControl)->positionChanged( position );
hgs
parents:
diff changeset
   196
hgs
parents:
diff changeset
   197
        changed = ETrue;
hgs
parents:
diff changeset
   198
    }
hgs
parents:
diff changeset
   199
hgs
parents:
diff changeset
   200
    return changed;
hgs
parents:
diff changeset
   201
}
hgs
parents:
diff changeset
   202
hgs
parents:
diff changeset
   203
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   204
// VideoPlaybackFullScreenControl::aspectRatioChanged()
hgs
parents:
diff changeset
   205
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   206
//
hgs
parents:
diff changeset
   207
bool VideoPlaybackFullScreenControl::aspectRatioChanged( int aspectRatio )
hgs
parents:
diff changeset
   208
{
hgs
parents:
diff changeset
   209
    bool changed = EFalse;
hgs
parents:
diff changeset
   210
hgs
parents:
diff changeset
   211
    if ( mControlIndex == EControlBar )
hgs
parents:
diff changeset
   212
    {
hgs
parents:
diff changeset
   213
        MPX_DEBUG(
hgs
parents:
diff changeset
   214
            _L("VideoPlaybackFullScreenControl::aspectRatioChanged() [%d]"), aspectRatio);
hgs
parents:
diff changeset
   215
hgs
parents:
diff changeset
   216
        static_cast<VideoPlaybackControlBar*>(mControl)->aspectRatioChanged( aspectRatio );
hgs
parents:
diff changeset
   217
hgs
parents:
diff changeset
   218
        changed = ETrue;
hgs
parents:
diff changeset
   219
    }
hgs
parents:
diff changeset
   220
hgs
parents:
diff changeset
   221
    return changed;
hgs
parents:
diff changeset
   222
}
hgs
parents:
diff changeset
   223
hgs
parents:
diff changeset
   224
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   225
//   VideoPlaybackFullScreenControl::setDownloadSize()
hgs
parents:
diff changeset
   226
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   227
//
hgs
parents:
diff changeset
   228
bool VideoPlaybackFullScreenControl::setDownloadSize( int /*size*/ )
hgs
parents:
diff changeset
   229
{
hgs
parents:
diff changeset
   230
    bool changed = EFalse;
hgs
parents:
diff changeset
   231
hgs
parents:
diff changeset
   232
    /*
hgs
parents:
diff changeset
   233
    if ( mControlIndex == EMPXProgressBar )
hgs
parents:
diff changeset
   234
    {
hgs
parents:
diff changeset
   235
        MPX_DEBUG(_L("VideoPlaybackFullScreenControl::SetDownloadSize() [%d]"), size);
hgs
parents:
diff changeset
   236
hgs
parents:
diff changeset
   237
        //static_cast<VideoPlaybackProgressBar*>(mControl)->SetDownloadSize( size );
hgs
parents:
diff changeset
   238
hgs
parents:
diff changeset
   239
        changed = ETrue;
hgs
parents:
diff changeset
   240
    }
hgs
parents:
diff changeset
   241
*/
hgs
parents:
diff changeset
   242
    return changed;
hgs
parents:
diff changeset
   243
}
hgs
parents:
diff changeset
   244
hgs
parents:
diff changeset
   245
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   246
//   VideoPlaybackFullScreenControl::updateDownloadPosition()
hgs
parents:
diff changeset
   247
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   248
//
hgs
parents:
diff changeset
   249
bool VideoPlaybackFullScreenControl::updateDownloadPosition( int /*size*/ )
hgs
parents:
diff changeset
   250
{
hgs
parents:
diff changeset
   251
    bool changed = EFalse;
hgs
parents:
diff changeset
   252
hgs
parents:
diff changeset
   253
    /*
hgs
parents:
diff changeset
   254
    if ( mControlIndex == EMPXProgressBar )
hgs
parents:
diff changeset
   255
    {
hgs
parents:
diff changeset
   256
        MPX_DEBUG(_L("VideoPlaybackFullScreenControl::UpdateDownloadPosition() [%d]"), size);
hgs
parents:
diff changeset
   257
hgs
parents:
diff changeset
   258
        //static_cast<VideoPlaybackProgressBar*>(mControl)->updateDownloadPosition( size );
hgs
parents:
diff changeset
   259
hgs
parents:
diff changeset
   260
        changed = ETrue;
hgs
parents:
diff changeset
   261
    }*/
hgs
parents:
diff changeset
   262
hgs
parents:
diff changeset
   263
    return changed;
hgs
parents:
diff changeset
   264
}
hgs
parents:
diff changeset
   265
hgs
parents:
diff changeset
   266
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   267
// VideoPlaybackFullScreenControl::updateState()
hgs
parents:
diff changeset
   268
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   269
//
hgs
parents:
diff changeset
   270
void VideoPlaybackFullScreenControl::updateState( TMPXPlaybackState state )
hgs
parents:
diff changeset
   271
{
hgs
parents:
diff changeset
   272
    switch ( mControlIndex )
hgs
parents:
diff changeset
   273
    {
hgs
parents:
diff changeset
   274
        case EControlBar:
hgs
parents:
diff changeset
   275
        {
hgs
parents:
diff changeset
   276
            static_cast<VideoPlaybackControlBar*>(mControl)->updateState( state );
hgs
parents:
diff changeset
   277
            break;
hgs
parents:
diff changeset
   278
        }
hgs
parents:
diff changeset
   279
        case EDetailsViewPlaybackWindow:
hgs
parents:
diff changeset
   280
        {
hgs
parents:
diff changeset
   281
            static_cast<VideoPlaybackDetailsPlaybackWindow*>(mControl)->updateState( state );
hgs
parents:
diff changeset
   282
            break;
hgs
parents:
diff changeset
   283
        }
hgs
parents:
diff changeset
   284
    }
hgs
parents:
diff changeset
   285
}
hgs
parents:
diff changeset
   286
hgs
parents:
diff changeset
   287
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   288
// VideoPlaybackFullScreenControl::updateControlsWithFileDetails()
hgs
parents:
diff changeset
   289
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   290
//
hgs
parents:
diff changeset
   291
void VideoPlaybackFullScreenControl::updateControlsWithFileDetails(
hgs
parents:
diff changeset
   292
        VideoPlaybackViewFileDetails* details )
hgs
parents:
diff changeset
   293
{
hgs
parents:
diff changeset
   294
    switch ( mControlIndex )
hgs
parents:
diff changeset
   295
    {
hgs
parents:
diff changeset
   296
        case EControlBar:
hgs
parents:
diff changeset
   297
        {
hgs
parents:
diff changeset
   298
            static_cast<VideoPlaybackControlBar*>(mControl)->updateWithFileDetails( details );
hgs
parents:
diff changeset
   299
            break;
hgs
parents:
diff changeset
   300
        }
hgs
parents:
diff changeset
   301
        case EFileDetailsWidget:
hgs
parents:
diff changeset
   302
        {
hgs
parents:
diff changeset
   303
            static_cast<VideoPlaybackFileDetailsWidget*>(mControl)->updateWithFileDetails( details );
hgs
parents:
diff changeset
   304
            break;
hgs
parents:
diff changeset
   305
        }
hgs
parents:
diff changeset
   306
    }
hgs
parents:
diff changeset
   307
}
hgs
parents:
diff changeset
   308
hgs
parents:
diff changeset
   309
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   310
// VideoPlaybackFullScreenControl::updateControlProperties()
hgs
parents:
diff changeset
   311
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   312
//
hgs
parents:
diff changeset
   313
void VideoPlaybackFullScreenControl::updateControlProperties( TUint properties )
hgs
parents:
diff changeset
   314
{
hgs
parents:
diff changeset
   315
    mProperties = properties;
hgs
parents:
diff changeset
   316
}
hgs
parents:
diff changeset
   317
58
hgs
parents: 44
diff changeset
   318
// -------------------------------------------------------------------------------------------------
hgs
parents: 44
diff changeset
   319
// VideoPlaybackFullScreenControl::resetControl()
hgs
parents: 44
diff changeset
   320
// -------------------------------------------------------------------------------------------------
hgs
parents: 44
diff changeset
   321
//
hgs
parents: 44
diff changeset
   322
void VideoPlaybackFullScreenControl::resetControl()
hgs
parents: 44
diff changeset
   323
{
hgs
parents: 44
diff changeset
   324
    if ( mControlIndex == EControlBar )
hgs
parents: 44
diff changeset
   325
    {
hgs
parents: 44
diff changeset
   326
        static_cast<VideoPlaybackControlBar*>(mControl)->resetControl();
hgs
parents: 44
diff changeset
   327
    }
hgs
parents: 44
diff changeset
   328
}
hgs
parents: 44
diff changeset
   329
44
hgs
parents:
diff changeset
   330
// End of file