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