24
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// System includes
|
|
19 |
#include <HbEffect>
|
|
20 |
|
|
21 |
// User includes
|
|
22 |
#include "radiouiutilities.h"
|
|
23 |
#include "radiofrequencystrip.h"
|
|
24 |
#include "radiostationcarousel.h"
|
|
25 |
#include "radiofrequencyscanner.h"
|
|
26 |
#include "radiologger.h"
|
|
27 |
|
|
28 |
// Constants
|
|
29 |
|
|
30 |
static RadioUiUtilities* theInstance = 0;
|
|
31 |
|
|
32 |
/*!
|
|
33 |
*
|
|
34 |
*/
|
|
35 |
RadioUiUtilities::RadioUiUtilities()
|
|
36 |
{
|
|
37 |
}
|
|
38 |
|
|
39 |
/*!
|
|
40 |
*
|
|
41 |
*/
|
|
42 |
RadioUiUtilities::~RadioUiUtilities()
|
|
43 |
{
|
|
44 |
}
|
|
45 |
|
|
46 |
/*!
|
|
47 |
*
|
|
48 |
*/
|
|
49 |
bool RadioUiUtilities::addEffects( QEffectList list )
|
|
50 |
{
|
|
51 |
bool allAvailable = true;
|
|
52 |
QEffectList added;
|
|
53 |
foreach ( EffectInfo info, list ) {
|
|
54 |
#ifdef USE_LAYOUT_FROM_E_DRIVE
|
|
55 |
info.mPath.replace( QString( ":/" ), QString( "e:/radiotest/" ) );
|
|
56 |
#endif
|
|
57 |
if ( HbEffect::add( info.mItem, info.mPath, info.mEvent ) ) {
|
|
58 |
added.append( info );
|
|
59 |
} else {
|
|
60 |
allAvailable = false;
|
|
61 |
break;
|
|
62 |
}
|
|
63 |
}
|
|
64 |
|
|
65 |
if ( !allAvailable ) {
|
|
66 |
foreach ( const EffectInfo& info, added ) {
|
|
67 |
HbEffect::remove( info.mItem, info.mPath, info.mEvent );
|
|
68 |
}
|
|
69 |
}
|
|
70 |
|
|
71 |
return allAvailable;
|
|
72 |
}
|
|
73 |
|
|
74 |
|
|
75 |
/*!
|
|
76 |
*
|
|
77 |
*/
|
|
78 |
RadioFrequencyStrip* RadioUiUtilities::frequencyStrip()
|
|
79 |
{
|
|
80 |
return instance().mFrequencyStrip;
|
|
81 |
}
|
|
82 |
|
|
83 |
/*!
|
|
84 |
*
|
|
85 |
*/
|
|
86 |
RadioStationCarousel* RadioUiUtilities::carousel()
|
|
87 |
{
|
|
88 |
return instance().mCarousel;
|
|
89 |
}
|
|
90 |
|
|
91 |
/*!
|
|
92 |
*
|
|
93 |
*/
|
|
94 |
bool RadioUiUtilities::isScannerAlive()
|
|
95 |
{
|
|
96 |
RadioFrequencyScanner* scanner = instance().mScanner;
|
|
97 |
if ( scanner ) {
|
|
98 |
return scanner->isAlive();
|
|
99 |
}
|
|
100 |
return false;
|
|
101 |
}
|
|
102 |
|
|
103 |
/*!
|
|
104 |
*
|
|
105 |
*/
|
|
106 |
void RadioUiUtilities::setFrequencyStrip( RadioFrequencyStrip* frequencyStrip )
|
|
107 |
{
|
|
108 |
instance().mFrequencyStrip = frequencyStrip;
|
|
109 |
}
|
|
110 |
|
|
111 |
/*!
|
|
112 |
*
|
|
113 |
*/
|
|
114 |
void RadioUiUtilities::setCarousel( RadioStationCarousel* carousel )
|
|
115 |
{
|
|
116 |
instance().mCarousel = carousel;
|
|
117 |
}
|
|
118 |
|
|
119 |
/*!
|
|
120 |
*
|
|
121 |
*/
|
|
122 |
void RadioUiUtilities::setFrequencyScanner( RadioFrequencyScanner* scanner )
|
|
123 |
{
|
|
124 |
instance().mScanner = scanner;
|
|
125 |
}
|
|
126 |
|
|
127 |
/*!
|
|
128 |
*
|
|
129 |
*/
|
|
130 |
RadioUiUtilities& RadioUiUtilities::instance()
|
|
131 |
{
|
|
132 |
if ( !::theInstance ) {
|
|
133 |
::theInstance = new RadioUiUtilities;
|
|
134 |
}
|
|
135 |
return *::theInstance;
|
|
136 |
}
|
|
137 |
|