radioapp/radiouiengine/src/radiostation.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 18 Aug 2010 09:49:03 +0300
changeset 41 3a6b55c6390c
parent 33 11b6825f0862
child 50 c44f9bb56771
permissions -rw-r--r--
Revision: 201031 Kit: 201033
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     1
/*
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     3
* All rights reserved.
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     8
*
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     9
* Initial Contributors:
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    11
*
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    12
* Contributors:
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    13
*
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    14
* Description:
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    15
*
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    16
*/
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    17
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    18
// System includes
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    19
#include <QTime>
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    20
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    21
// User includes
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    22
#include "radiostation.h"
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    23
#include "radiostation_p.h"
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    24
#include "radiologger.h"
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    25
#include "radio_global.h"
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    26
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    27
// Constants
33
11b6825f0862 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 32
diff changeset
    28
const QLatin1String HTML_TAG_START( "<font color='cyan'><u>" );
11b6825f0862 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 32
diff changeset
    29
const QLatin1String HTML_TAG_END( "</u></font>" );
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    30
28
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    31
const uint LAST_CALLSIGN_CHAR_CODE = 25;
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    32
const uint THREE_LETTER_CALLSIGN_COUNT = 72;
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    33
const uint KXXX_CALLSIGN_PI_FIRST = 0x1000;
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    34
const uint WXXX_CALLSIGN_PI_FIRST = 0x54A8;
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    35
const uint WXXX_CALLSIGN_PI_LAST = 0x994F;
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    36
const uint XXX_CALLSIGN_PI_FIRST = 0x9950;
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    37
const uint XXX_CALLSIGN_PI_LAST = 0x99B9;
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    38
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    39
const char* CALLSIGN_TABLE[THREE_LETTER_CALLSIGN_COUNT] =
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    40
   {"KBW", "KCY", "KDB", "KDF", "KEX", "KFH","KFI","KGA","KGB",
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    41
    "KGO", "KGU", "KGW", "KGY", "KHQ", "KID", "KIT", "KJR", "KLO",
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    42
    "KLZ", "KMA", "KMJ", "KNX", "KOA", "KOB", "KOY", "KPQ", "KQV",
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    43
    "KSD", "KSL", "KUJ", "KUT", "KVI", "KWG", "KXL", "KXO", "KYW",
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    44
    "WBT", "WBZ", "WDZ", "WEW", "WGH", "WGL", "WGN", "WGR", "WGY",
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    45
    "WHA", "WHB", "WHK", "WHO", "WHP", "WIL", "WIP", "WIS", "WJR",
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    46
    "WJW", "WJZ", "WKY", "WLS", "WLW", "WMC", "WMT", "WOC", "WOI",
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    47
    "WOL", "WOR", "WOW", "WRC", "WRR", "WSB", "WSM", "WWJ", "WWL"};
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    48
28
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    49
const uint PI_CODE_TABLE[THREE_LETTER_CALLSIGN_COUNT] =
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    50
   {0x99A5, 0x99A6, 0x9990, 0x99A7, 0x9950, 0x9951, 0x9952, 0x9953,
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    51
    0x9991, 0x9954, 0x9955, 0x9956, 0x9957, 0x99AA, 0x9958, 0x9959,
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    52
    0x995A, 0x995B, 0x995C, 0x995D, 0x995E, 0x995F, 0x9960, 0x99AB,
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    53
    0x9992, 0x9993, 0x9964, 0x9994, 0x9965, 0x9966, 0x9995, 0x9967,
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    54
    0x9968, 0x9996, 0x9997, 0x996B, 0x9999, 0x996D, 0x996E, 0x996F,
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    55
    0x999A, 0x9971, 0x9972, 0x9973, 0x999B, 0x9975, 0x9976, 0x9977,
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    56
    0x9978, 0x999C, 0x999D, 0x997A, 0x99B3, 0x997B, 0x99B4, 0x99B5,
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    57
    0x997C, 0x997D, 0x997E, 0x999E, 0x999F, 0x9981, 0x99A0, 0x9983,
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    58
    0x9984, 0x99A1, 0x99B9, 0x99A2, 0x99A3, 0x99A4, 0x9988, 0x9989};
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    59
28
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    60
const uint DISABLE_LOCAL_AREA_COVERAGE_MASK = 0x0800;
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    61
28
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    62
const int PS_NAME_CHANGE_THRESHOLD_SECONDS = 10;
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    63
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
    64
// Macros to help protect shared null and manual station instances to help debugging
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
    65
// Enabled in emulator or win32 builds by default
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
    66
#if defined __WINS__ || defined BUILD_WIN32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
    67
#   define PROTECT_SHAREDNULL_AND_MANUALSTATION
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
    68
#endif
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
    69
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
    70
#ifdef PROTECT_SHAREDNULL_AND_MANUALSTATION
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
    71
#   define ASSERT_SHARED_NULL_IS_INTACT \
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
    72
        Q_ASSERT_X( mData->mPresetIndex != SharedNull, "RadioStation", "Shared null modified illegally!" );
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
    73
#   define ASSERT_MANUAL_STATION \
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
    74
        Q_ASSERT_X( mData->mPresetIndex != ManualStation, "RadioStation", "Illegally modifying manual station" );
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
    75
#else
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
    76
#   define ASSERT_SHARED_NULL_IS_INTACT
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
    77
#   define ASSERT_MANUAL_STATION
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
    78
#endif // PROTECT_SHAREDNULL_AND_MANUALSTATION
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
    79
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    80
/**
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    81
 * Static shared data instance that is used by all default-constructed RadioStation instances
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    82
 */
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
    83
static RadioStationPrivate shared_null( RadioStation::SharedNull, 0 );
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    84
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    85
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    86
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    87
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    88
QString RadioStation::parseFrequency( uint frequency )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    89
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    90
    QString freqString;
28
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    91
    freqString.sprintf( "%.1f", qreal( frequency ) / FREQUENCY_MULTIPLIER );
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    92
    return freqString;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    93
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    94
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    95
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    96
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    97
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    98
RadioStation::RadioStation() :
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
    99
    mData( &shared_null )
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   100
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   101
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   102
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   103
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   104
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   105
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   106
RadioStation::RadioStation( const RadioStation& other ) :
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   107
    mData( other.mData )
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   108
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   109
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   110
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   111
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   112
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   113
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   114
RadioStation::RadioStation( int presetIndex, uint frequency ) :
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   115
    mData( new RadioStationPrivate( presetIndex, frequency ) )
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   116
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   117
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   118
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   119
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   120
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   121
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   122
RadioStation::~RadioStation()
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   123
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   124
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   125
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   126
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   127
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   128
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   129
RadioStation& RadioStation::operator=( const RadioStation& other )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   130
{
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   131
    mData = other.mData;
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   132
    return *this;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   133
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   134
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   135
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   136
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   137
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   138
void RadioStation::reset()
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   139
{
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   140
    mData = &shared_null;
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   141
    ASSERT_SHARED_NULL_IS_INTACT
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   142
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   143
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   144
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   145
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   146
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   147
void RadioStation::setChangeFlags( RadioStation::Change flags )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   148
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   149
    if ( mData->mChangeFlags != flags ) {
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   150
        mData->mChangeFlags = flags;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   151
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   152
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   153
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   154
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   155
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   156
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   157
void RadioStation::setPresetIndex( int presetIndex )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   158
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   159
    if ( mData->mPresetIndex != presetIndex ) {
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   160
        ASSERT_MANUAL_STATION
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   161
        mData->mPresetIndex = presetIndex;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   162
        mData->mChangeFlags |= RadioStation::PersistentDataChanged;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   163
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   164
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   165
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   166
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   167
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   168
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   169
void RadioStation::setFrequency( uint frequency )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   170
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   171
    if ( mData->mFrequency != frequency ) {
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   172
        mData->mFrequency = frequency;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   173
        mData->mChangeFlags |= RadioStation::PersistentDataChanged;
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   174
        ASSERT_SHARED_NULL_IS_INTACT
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   175
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   176
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   177
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   178
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   179
 * Sets the preset name
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   180
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   181
void RadioStation::setName( const QString& name )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   182
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   183
    // Name emptiness is checked because this name setter is used by incoming RDS PS name
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   184
    // and empty names should be ignored
41
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   185
    if ( !name.isEmpty() && !mData->isRenamedByUser() && mData->mName.compare( name ) != 0 ) {
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   186
        mData->mName = name.trimmed();
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   187
        mData->mChangeFlags |= RadioStation::PersistentDataChanged | RadioStation::NameChanged;
41
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   188
        mData->setStationHasSentRds( true );
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   189
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   190
        // Save the time when PS name changed and if the last change was too close to the current time
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   191
        // change the PS type to dynamic if it has already been incorrectly determined to be static.
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   192
        QTime previousChange = mData->mLastPsNameChangeTime;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   193
        mData->mLastPsNameChangeTime = QTime::currentTime();
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   194
        if ( previousChange.isValid() && mData->mPsType == RadioStation::Static &&
28
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   195
             previousChange.secsTo( mData->mLastPsNameChangeTime ) < PS_NAME_CHANGE_THRESHOLD_SECONDS ) {
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   196
            LOG( "Station changed PS name too often. PS type changed to Dynamic" );
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   197
            mData->mPsType = RadioStation::Dynamic;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   198
            mData->mDynamicPsText = mData->mName;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   199
            mData->mName = "";
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   200
            mData->mChangeFlags |= RadioStation::PsTypeChanged | RadioStation::DynamicPsChanged;
41
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   201
            mData->setCallSignCheckDone( false );
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   202
        }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   203
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   204
        //TODO: This is a temporary thing to see some URL. Remove this
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   205
        if ( !mData->mName.isEmpty() ) {
33
11b6825f0862 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 32
diff changeset
   206
            QString url = mData->mName.toLower().remove( " " );
41
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   207
            mData->mUrl = "http://www." + url + ".fi";
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   208
        } else {
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   209
            mData->mUrl = "";
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   210
        }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   211
        mData->mChangeFlags |= RadioStation::UrlChanged;
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   212
        ASSERT_SHARED_NULL_IS_INTACT
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   213
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   214
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   215
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   216
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   217
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   218
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   219
void RadioStation::setGenre( const int genre )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   220
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   221
    if ( mData->mGenre != genre ) {
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   222
        mData->mGenre = genre;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   223
        mData->mChangeFlags |= RadioStation::PersistentDataChanged | RadioStation::GenreChanged;
41
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   224
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   225
        // Note that setStationHasSentRds() is not set when genre or pi code arrives.
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   226
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   227
        ASSERT_SHARED_NULL_IS_INTACT
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   228
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   229
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   230
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   231
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   232
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   233
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   234
void RadioStation::setUrl( const QString& url )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   235
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   236
    if ( mData->mUrl.compare( url ) != 0 ) {
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   237
        mData->mUrl = url;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   238
        mData->mChangeFlags |= RadioStation::PersistentDataChanged | RadioStation::UrlChanged;
41
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   239
        mData->setStationHasSentRds( true );
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   240
        ASSERT_SHARED_NULL_IS_INTACT
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   241
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   242
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   243
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   244
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   245
 * Sets the PI code
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   246
 * @return true if code was changed, false if not
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   247
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   248
bool RadioStation::setPiCode( int piCode, RadioRegion::Region region )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   249
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   250
    LOG_FORMAT( "RadioStation::setPiCode new PI: %d", piCode );
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   251
    // toggling local area coverage bit code must not be interpreted as new PI code
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   252
    if ( region != RadioRegion::America ) {
28
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   253
        piCode &= ~DISABLE_LOCAL_AREA_COVERAGE_MASK;
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   254
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   255
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   256
    LOG_FORMAT( "stored PI: %d", mData->mPiCode );
41
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   257
    LOG_FORMAT( "call sign check done: %d", mData->isCallSignCheckDone() );
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   258
    //prevent executing the below code when unnessesary
41
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   259
    if ( mData->mPiCode != piCode || !mData->isCallSignCheckDone() ) {
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   260
        mData->mPiCode = piCode;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   261
        mData->mChangeFlags |= RadioStation::PersistentDataChanged | RadioStation::PiCodeChanged;
41
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   262
        // Note that setStationHasSentRds() is not set when genre or pi code arrives.
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   263
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   264
        // call sign not calculated for clear channel stations
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   265
		//TODO: Remove magic numbers
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   266
        if ( ( (mData->mPiCode & 0xF000 ) >> 12 ) == 0x1 ) {
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   267
            LOG( "Clear channel station" );
41
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   268
            mData->setCallSignCheckDone( true );
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   269
        } else if ( region == RadioRegion::America && mData->mName.isEmpty() && !isRenamed() ) {
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   270
            LOG( "Calculate call sign" );
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   271
            mData->mName = piCodeToCallSign( mData->mPiCode );
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   272
            mData->mChangeFlags |= RadioStation::NameChanged;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   273
        }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   274
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   275
        if ( mData->mChangeFlags.testFlag( RadioStation::PsTypeChanged ) ) {
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   276
            LOG( "Call sign check done" );
41
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   277
            mData->setCallSignCheckDone( true );
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   278
        }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   279
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   280
        ASSERT_SHARED_NULL_IS_INTACT
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   281
        return true;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   282
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   283
    return false;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   284
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   285
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   286
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   287
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   288
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   289
void RadioStation::setPsType( PsType psType )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   290
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   291
    if ( mData->mPsType != psType ) {
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   292
        mData->mPsType = psType;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   293
        mData->mChangeFlags |= RadioStation::PsTypeChanged;
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   294
        ASSERT_SHARED_NULL_IS_INTACT
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   295
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   296
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   297
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   298
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   299
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   300
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   301
void RadioStation::setRadioText( const QString& radioText )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   302
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   303
    if ( mData->mRadioText.compare( radioText ) != 0 ) {
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   304
        mData->mRadioText = radioText.isEmpty() ? "" : radioText.trimmed();
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   305
        mData->mChangeFlags |= RadioStation::RadioTextChanged;
41
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   306
        mData->setStationHasSentRds( true );
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   307
        ASSERT_SHARED_NULL_IS_INTACT
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   308
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   309
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   310
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   311
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   312
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   313
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   314
void RadioStation::setRadioTextPlus( const int rtPlusClass, const QString& rtPlusItem )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   315
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   316
    if ( !mData->mRadioText.isEmpty() &&
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   317
         !rtPlusItem.isEmpty() &&
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   318
         ( rtPlusClass == RtPlus::Artist || rtPlusClass == RtPlus::Title || rtPlusClass == RtPlus::Homepage) )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   319
    {
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   320
        // Url is saved to its own variable and it is not highlighted from the radiotext
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   321
        if ( rtPlusClass == RtPlus::Homepage ) {
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   322
            setUrl( rtPlusItem );
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   323
            return;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   324
        }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   325
33
11b6825f0862 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 32
diff changeset
   326
        const QString replacement = HTML_TAG_START + rtPlusItem + HTML_TAG_END;
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   327
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   328
        mData->mRadioText.replace( rtPlusItem, replacement );
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   329
        mData->mChangeFlags |= RadioStation::RadioTextChanged;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   330
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   331
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   332
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   333
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   334
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   335
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   336
void RadioStation::setDynamicPsText( const QString& dynamicPsText )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   337
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   338
    if ( mData->mDynamicPsText.compare( dynamicPsText ) != 0 ) {
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   339
        mData->mDynamicPsText = dynamicPsText;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   340
        mData->mChangeFlags |= RadioStation::DynamicPsChanged;
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   341
        ASSERT_SHARED_NULL_IS_INTACT
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   342
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   343
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   344
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   345
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   346
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   347
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   348
bool RadioStation::isValid() const
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   349
{
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   350
    return mData->mFrequency > 0 && ( isType( ManualStation ) || mData->mPresetIndex >= 0 );
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   351
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   352
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   353
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   354
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   355
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   356
QString RadioStation::name() const
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   357
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   358
    return mData->mName.isEmpty() ? "" : mData->mName;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   359
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   360
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   361
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   362
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   363
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   364
void RadioStation::setUserDefinedName( const QString& name )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   365
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   366
    // We don't check for name emptiness because this setter is used also to remove the renaming
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   367
    // of a station by setting an empty name
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   368
    if ( mData->mName.compare( name ) != 0 ) {
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   369
        mData->mName = name;
41
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   370
        mData->setRenamedByUser( !name.isEmpty() );
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   371
        mData->mChangeFlags |= RadioStation::PersistentDataChanged | RadioStation::NameChanged;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   372
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   373
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   374
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   375
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   376
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   377
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   378
bool RadioStation::isRenamed() const
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   379
{
41
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   380
    return mData->isRenamedByUser();
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   381
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   382
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   383
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   384
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   385
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   386
int RadioStation::genre() const
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   387
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   388
    return mData->mGenre;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   389
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   390
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   391
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   392
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   393
 */
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   394
QString RadioStation::frequencyString() const
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   395
{
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   396
    return parseFrequency( mData->mFrequency );
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   397
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   398
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   399
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   400
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   401
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   402
uint RadioStation::frequency() const
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   403
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   404
    return mData->mFrequency;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   405
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   406
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   407
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   408
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   409
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   410
int RadioStation::presetIndex() const
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   411
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   412
    return mData->mPresetIndex;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   413
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   414
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   415
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   416
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   417
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   418
void RadioStation::setFavorite( bool favorite )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   419
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   420
    if ( isFavorite() != favorite ) {
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   421
        favorite ? setType( RadioStation::Favorite ) : unsetType( RadioStation::Favorite );
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   422
        mData->mChangeFlags |= RadioStation::PersistentDataChanged | RadioStation::FavoriteChanged;
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   423
        ASSERT_SHARED_NULL_IS_INTACT
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   424
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   425
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   426
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   427
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   428
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   429
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   430
bool RadioStation::isFavorite() const
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   431
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   432
    return mData->mType.testFlag( RadioStation::Favorite );
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   433
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   434
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   435
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   436
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   437
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   438
QString RadioStation::url() const
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   439
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   440
    return mData->mUrl;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   441
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   442
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   443
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   444
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   445
 */
33
11b6825f0862 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 32
diff changeset
   446
int RadioStation::piCode() const
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   447
{
33
11b6825f0862 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 32
diff changeset
   448
    return mData->mPiCode;
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   449
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   450
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   451
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   452
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   453
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   454
void RadioStation::setType( RadioStation::Type type )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   455
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   456
    if ( !isType( type ) ) {
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   457
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   458
        // Check if favorite-status changed
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   459
        if ( mData->mType.testFlag( RadioStation::Favorite ) != type.testFlag( RadioStation::Favorite ) ) {
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   460
            mData->mChangeFlags |= RadioStation::FavoriteChanged;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   461
        }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   462
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   463
        mData->mType |= type;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   464
        mData->mChangeFlags |= RadioStation::PersistentDataChanged | RadioStation::TypeChanged;
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   465
        ASSERT_SHARED_NULL_IS_INTACT
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   466
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   467
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   468
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   469
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   470
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   471
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   472
void RadioStation::unsetType( RadioStation::Type type )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   473
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   474
    if ( isType( type ) ) {
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   475
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   476
        // Check if favorite-status changed
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   477
        if ( mData->mType.testFlag( RadioStation::Favorite ) != type.testFlag( RadioStation::Favorite ) ) {
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   478
            mData->mChangeFlags |= RadioStation::FavoriteChanged;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   479
        }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   480
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   481
        mData->mType &= ~type;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   482
        mData->mChangeFlags |= RadioStation::PersistentDataChanged | RadioStation::TypeChanged;
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   483
        ASSERT_SHARED_NULL_IS_INTACT
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   484
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   485
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   486
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   487
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   488
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   489
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   490
bool RadioStation::isType( RadioStation::Type type ) const
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   491
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   492
    return ( mData->mType & type ) == type;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   493
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   494
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   495
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   496
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   497
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   498
RadioStation::PsType RadioStation::psType() const
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   499
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   500
    return mData->mPsType;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   501
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   502
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   503
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   504
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   505
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   506
QString RadioStation::radioText() const
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   507
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   508
    return mData->mRadioText;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   509
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   510
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   511
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   512
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   513
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   514
QString RadioStation::dynamicPsText() const
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   515
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   516
    return mData->mDynamicPsText;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   517
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   518
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   519
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   520
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   521
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   522
RadioStation::Change RadioStation::changeFlags() const
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   523
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   524
    return mData->mChangeFlags;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   525
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   526
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   527
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   528
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   529
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   530
bool RadioStation::hasDataChanged( RadioStation::Change flags ) const
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   531
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   532
    return ( mData->mChangeFlags & flags ) == flags;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   533
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   534
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   535
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   536
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   537
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   538
bool RadioStation::hasChanged() const
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   539
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   540
    return mData->mChangeFlags != RadioStation::NoChange;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   541
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   542
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   543
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   544
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   545
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   546
void RadioStation::resetChangeFlags()
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   547
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   548
    if ( mData->mChangeFlags != RadioStation::NoChange ) {
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   549
        mData->mChangeFlags = RadioStation::NoChange;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   550
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   551
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   552
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   553
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   554
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   555
 */
41
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   556
bool RadioStation::hasSentRds() const
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   557
{
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   558
    return mData->hasStationSentRds();
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   559
}
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   560
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   561
/*!
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   562
 *
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   563
 */
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   564
 QString RadioStation::piCodeToCallSign( uint programmeIdentification )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   565
 {
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   566
    QString callSign;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   567
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   568
    LOG_FORMAT( "RadioStation::piCodeToCallSign PI: %d", programmeIdentification );
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   569
    // call signs beginning with 'K'
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   570
    if ( ( programmeIdentification>=KXXX_CALLSIGN_PI_FIRST ) && ( programmeIdentification < WXXX_CALLSIGN_PI_FIRST ) ) {
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   571
        callSign += "K";
28
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   572
        callSign += iterateCallSign( KXXX_CALLSIGN_PI_FIRST, programmeIdentification );
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   573
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   574
    // call signs beginning with 'W'
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   575
    else if ( ( programmeIdentification >= WXXX_CALLSIGN_PI_FIRST ) && ( programmeIdentification <= WXXX_CALLSIGN_PI_LAST ) ) {
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   576
        callSign += "W";
28
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   577
        callSign += iterateCallSign( WXXX_CALLSIGN_PI_FIRST, programmeIdentification );
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   578
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   579
    // 3 letter only call signs
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   580
    else if ( ( programmeIdentification >= XXX_CALLSIGN_PI_FIRST ) && ( programmeIdentification <= XXX_CALLSIGN_PI_LAST ) ) {
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   581
        callSign += callSignString( programmeIdentification );
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   582
    } else {
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   583
        LOG( "RadioStation::piCodeToCallSign - Unhandled else" );
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   584
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   585
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   586
    LOG_FORMAT( "RadioStation::piCodeToCallSign, call sign: %s", GETSTRING(callSign) );
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   587
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   588
    return callSign;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   589
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   590
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   591
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   592
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   593
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   594
QString RadioStation::iterateCallSign( int piBase, int programmeIdentification )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   595
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   596
    QString callSign;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   597
    LOG_FORMAT( "RadioStation::iterateCallSign base: %d", piBase );
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   598
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   599
    int sum = 0;
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   600
    int i = 0;
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   601
    while( sum < programmeIdentification ) {
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   602
        ++i;
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   603
        sum = piBase + i * 676 + 0 + 0;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   604
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   605
    callSign += callSignChar( i - 1 );
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   606
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   607
    int tmpSum( sum - 676 );
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   608
    sum -= 676;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   609
    i = 0;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   610
    while( sum <= programmeIdentification ) {
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   611
        ++i;
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   612
        sum = tmpSum + 0 + i * 26 + 0;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   613
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   614
    callSign += callSignChar( i - 1 );
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   615
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   616
    tmpSum = sum - 26;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   617
    sum -= 26;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   618
    i = 0;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   619
    while( sum <= programmeIdentification ) {
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   620
        ++i;
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   621
        sum = tmpSum + 0 + 0 + i;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   622
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   623
    callSign += callSignChar( i - 1 );
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   624
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   625
    return callSign;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   626
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   627
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   628
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   629
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   630
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   631
QString RadioStation::callSignString( uint programmeIdentification )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   632
{
28
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   633
    for ( uint i = 0; i < THREE_LETTER_CALLSIGN_COUNT; ++i ) {
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   634
        if( PI_CODE_TABLE[i] == programmeIdentification ) {
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   635
            return CALLSIGN_TABLE[i];
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   636
        }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   637
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   638
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   639
    LOG_FORMAT( "RadioStation::callSignString, Not found PI: %d", programmeIdentification );
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   640
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
   641
    return QString( "????" );
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   642
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   643
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   644
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   645
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   646
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   647
char RadioStation::callSignChar( uint decimalValue )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   648
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   649
    LOG_FORMAT( "RadioStation::callSignChar A+: %d", decimalValue );
28
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   650
    if ( decimalValue <= LAST_CALLSIGN_CHAR_CODE ) {
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   651
        return static_cast<char>( 'A' + decimalValue );
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   652
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   653
    return '?';
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   654
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   655
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   656
/**
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   657
 * Checks if the class is detached from implicitly shared data
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   658
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   659
bool RadioStation::isDetached() const
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   660
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   661
    return mData->ref == 1;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   662
}