utilities/mpnowplayingbanner/tsrc/unittest_mpnowplayingwidget/stub/inc/mpnowplayingbackend.h
branchGCC_SURGE
changeset 44 eff9df3d9c98
parent 30 b95ddb5a0d10
parent 42 79c49924ae23
equal deleted inserted replaced
30:b95ddb5a0d10 44:eff9df3d9c98
     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: mpnowplayingbackend stub for testing MpNowPlayingWidget
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef MPNOWPLAYINGBACKEND_H
       
    19 #define MPNOWPLAYINGBACKEND_H
       
    20 
       
    21 //includes
       
    22 #include <QObject>
       
    23 #include <QMetaType>
       
    24 
       
    25 enum SimplifiedPlayerState {
       
    26     NotPlaying, //When there is no source
       
    27     Playing,    //When it is playing
       
    28     Paused      //When is not in Playing State
       
    29 };
       
    30 
       
    31 // Register so type can be used in signal and slot connection
       
    32 Q_DECLARE_METATYPE(SimplifiedPlayerState)
       
    33 
       
    34 
       
    35 class MpNowPlayingBackEnd : public QObject
       
    36 {
       
    37     Q_OBJECT
       
    38 
       
    39 public:
       
    40 
       
    41     // Test utility functions
       
    42     static int getUpdateCounter();
       
    43     static void resetUpdateCounter();
       
    44     static int getPlayPauseCounter();
       
    45     static void resetPlayPauseCounter();
       
    46     void triggerStateUpdate(SimplifiedPlayerState state);
       
    47     void triggerTitleChanged(const QString &text);
       
    48     void triggerArtistChanged(const QString &text);
       
    49 
       
    50     // Stub functions
       
    51     explicit MpNowPlayingBackEnd(long int playerId=0);
       
    52     virtual ~MpNowPlayingBackEnd();
       
    53 
       
    54 signals:
       
    55     void stateUpdate(SimplifiedPlayerState state);
       
    56     void titleChanged(const QString &text);
       
    57     void artistChanged(const QString &text);
       
    58 
       
    59 public slots:
       
    60     void update();
       
    61     void playPause();
       
    62 
       
    63 };
       
    64 
       
    65 #endif  // MPNOWPLAYINGBACKEND_H