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