radiohswidget/tsrc/src/radiohswidget.cpp
branchRCL_3
changeset 20 93c594350b9a
parent 19 cce62ebc198e
equal deleted inserted replaced
19:cce62ebc198e 20:93c594350b9a
     1 /*
       
     2 * Copyright (c) 2010 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:  FM Radio home screen widget
       
    15 *
       
    16 */
       
    17 
       
    18 // User includes
       
    19 #include "radiohswidget.h"
       
    20 #include "radiologger.h"
       
    21 
       
    22 // This is defined in t_radiohswidget.cpp
       
    23 extern int EMPTY_REPLY;
       
    24 
       
    25 /*!
       
    26     \class RadioHsWidget
       
    27     \brief Stub implementation of FM Radio home screen widget for unit
       
    28     testing.
       
    29 
       
    30     RadioHsWidget implements needed functions for the FM Radio home screen
       
    31     widget unit tests.
       
    32 */
       
    33 
       
    34 // ======== MEMBER FUNCTIONS ========
       
    35 
       
    36 /*!
       
    37     Constrcutor.
       
    38  */
       
    39 RadioHsWidget::RadioHsWidget()
       
    40 {
       
    41     LOG_METHOD;
       
    42 }
       
    43 
       
    44 /*!
       
    45     Destructor.
       
    46  */
       
    47 RadioHsWidget::~RadioHsWidget()
       
    48 {
       
    49     LOG_METHOD;
       
    50 }
       
    51 
       
    52 /*!
       
    53     Handles changes in FM Radio information.
       
    54 
       
    55     \param informationType Type of changed information.
       
    56     \param information Actual information.
       
    57  */
       
    58 void RadioHsWidget::handleRadioInformationChange(const int informationType,
       
    59         const QVariant &information)
       
    60 {
       
    61     LOG_METHOD;
       
    62     if (informationType != EMPTY_REPLY) {
       
    63         ReceivedInfo info;
       
    64         info.informationType = informationType;
       
    65         info.information = information;
       
    66         mReceivedInformation.append(info);
       
    67     }
       
    68 }
       
    69 
       
    70 /*!
       
    71     Handles changes in FM Radio state.
       
    72 
       
    73     \param value New state of the radio application.
       
    74 */
       
    75 void RadioHsWidget::handleRadioStateChange(const QVariant &value)
       
    76 {
       
    77     LOG_METHOD;
       
    78     Q_UNUSED(value);
       
    79 }
       
    80 
       
    81 /*!
       
    82     Returns the last received information and removes it from the list.
       
    83 */
       
    84 ReceivedInfo RadioHsWidget::receivedInformation()
       
    85 {
       
    86     LOG_METHOD;
       
    87     ReceivedInfo ret;
       
    88     if (!mReceivedInformation.isEmpty()) {
       
    89         ret = mReceivedInformation.takeLast();
       
    90     }
       
    91     return ret;
       
    92 }
       
    93 /*!
       
    94     Returns the count of received information.
       
    95 */
       
    96 int RadioHsWidget::receivedInformationCount()
       
    97 {
       
    98     return mReceivedInformation.count();
       
    99 }
       
   100 
       
   101 /*!
       
   102     Clears the received info list.
       
   103 */
       
   104 void RadioHsWidget::reset()
       
   105 {
       
   106     mReceivedInformation.clear();
       
   107 }