mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpplaybackview/stub/src/mpplaybackdata.cpp
changeset 48 af3740e3753f
equal deleted inserted replaced
42:79c49924ae23 48:af3740e3753f
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: MpPlaybackData stub for testing mpnowplayingwidget
       
    15 *
       
    16 */
       
    17 
       
    18 #include "../inc/mpplaybackdata.h"
       
    19 
       
    20 
       
    21 int gUpdateCounter = 0;
       
    22 
       
    23 
       
    24 /*!
       
    25  Returns gUpdateCounter.
       
    26  gUpdateCounter counts the number of MpNowPlayingBackEnd::update calls.
       
    27  */
       
    28 int MpPlaybackData::getUpdateCounter()
       
    29 {
       
    30     return gUpdateCounter;
       
    31 }
       
    32 
       
    33 /*!
       
    34  Resets gUpdateCounter to zero.
       
    35  */
       
    36 void MpPlaybackData::resetUpdateCounter()
       
    37 {
       
    38     gUpdateCounter = 0;
       
    39 }
       
    40 
       
    41 /*!
       
    42  Causes signal stateUpdate to be emitted.
       
    43  */
       
    44 void MpPlaybackData::triggerStateUpdate(SimplifiedState state)
       
    45 {
       
    46     mPlaybackState = state;
       
    47     emit playbackStateChanged();
       
    48     
       
    49 }
       
    50 
       
    51 /*!
       
    52  Causes signal titleChanged to be emitted.
       
    53  */
       
    54 void MpPlaybackData::triggerLabelsChanged(const QString &title, const QString &artist )
       
    55 {
       
    56     mArtist = artist;
       
    57     mTitle = title;
       
    58     emit playbackInfoChanged();;
       
    59 }
       
    60 
       
    61 /*!
       
    62  Stub function.
       
    63  */
       
    64 MpPlaybackData::MpPlaybackData()
       
    65     : mPlaybackState(NotPlaying)
       
    66 {
       
    67     gUpdateCounter++;
       
    68 }
       
    69 
       
    70 /*!
       
    71  Stub function.
       
    72  */
       
    73 MpPlaybackData::~MpPlaybackData()
       
    74 {
       
    75 }
       
    76 
       
    77 /*!
       
    78  Stub function.
       
    79  */
       
    80 const QString& MpPlaybackData::title() const
       
    81 {
       
    82     return mTitle;
       
    83 }
       
    84 
       
    85 /*!
       
    86  Stub function.
       
    87  */
       
    88 const QString& MpPlaybackData::artist() const
       
    89 {
       
    90     return mArtist;
       
    91 }
       
    92 
       
    93 /*!
       
    94  Stub function.
       
    95  */
       
    96 
       
    97 MpPlaybackData::SimplifiedState MpPlaybackData::playbackState() const
       
    98 {
       
    99     return mPlaybackState;
       
   100 }
       
   101 
       
   102 const QString& MpPlaybackData::uri() const
       
   103 {
       
   104     return mUri;
       
   105 }
       
   106 
       
   107 void MpPlaybackData::setPlaybackState(MpPlaybackData::SimplifiedState state)
       
   108 {
       
   109     mPlaybackState=state;
       
   110 }
       
   111 
       
   112 void MpPlaybackData::setUri(QString uri)
       
   113 {
       
   114     mUri = uri;
       
   115 }