author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 23 Jun 2010 18:12:57 +0300 | |
changeset 32 | 189d20c34778 |
parent 28 | 075425b8d9a4 |
child 33 | 11b6825f0862 |
permissions | -rw-r--r-- |
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 <QPainter> |
|
20 |
#include <QStringListModel> |
|
21 |
#include <QGraphicsSceneResizeEvent> |
|
22 |
#include <QPen> |
|
23 |
#include <HbPushButton> |
|
24 |
#include <QTimer> |
|
25 |
#include <HbColorScheme> |
|
26 |
#include <HbEvent> |
|
27 |
#include <HbSwipeGesture> |
|
28 |
||
29 |
#include "radiofrequencystrip.h" |
|
30 |
#include "radiofrequencyitem.h" |
|
31 |
#include "radiouiengine.h" |
|
32 |
#include "radiostation.h" |
|
33 |
#include "radiostationmodel.h" |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
34 |
#include "radioutil.h" |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
35 |
#include "radiouiloader.h" |
24 | 36 |
#include "radiologger.h" |
37 |
||
38 |
// Frequency lines |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
39 |
const int TAB_HEIGHT_SMALL = 10; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
40 |
const int TAB_HEIGHT_BIG = 15; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
41 |
const int PEN_WIDTH_FAVORITE = 4; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
42 |
const qreal INDICATOR_WIDTH = 2.0; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
43 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
44 |
const qreal ROUNDER = 0.5; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
45 |
const int SELECTOR_WIDTH = 2; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
46 |
const int SELECTOR_Z_POS = 100; |
24 | 47 |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
48 |
const int HALF_HERTZ = ONE_HERTZ / 2; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
49 |
const int ONE_TAB_DISTANCE = 20; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
50 |
const uint ONE_TAB_IN_HZ = uint( 0.2 * ONE_HERTZ ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
51 |
const qreal PIXEL_IN_HZ = ONE_TAB_IN_HZ / ONE_TAB_DISTANCE; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
52 |
const qreal PIXMAP_OVERLAP = qreal( ONE_TAB_DISTANCE ) / 2; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
53 |
const int ITEM_WIDTH = ONE_TAB_DISTANCE * 5; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
54 |
const int PIXMAP_WIDTH = ITEM_WIDTH + (int)PIXMAP_OVERLAP; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
55 |
const int STRIP_HEIGHT = 50; |
24 | 56 |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
57 |
const uint ONE_HUNDRED_KHZ = 100000; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
58 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
59 |
const char* DECIMAL_TEXT = ".0"; |
24 | 60 |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
61 |
#ifdef BUILD_WIN32 |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
62 |
const int FREQUENCY_FONT_SIZE = 12; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
63 |
const int DECIMAL_FONT_SIZE = 8; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
64 |
#else |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
65 |
const int FREQUENCY_FONT_SIZE = 6; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
66 |
const int DECIMAL_FONT_SIZE = 4; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
67 |
#endif // BUILD_WIN32 |
24 | 68 |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
69 |
const QFont FREQUENCY_FONT( "", FREQUENCY_FONT_SIZE ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
70 |
const QFont DECIMAL_FONT( "", DECIMAL_FONT_SIZE ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
71 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
72 |
const char* SLIDE_TO_LEFT = "SlideToLeft"; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
73 |
const char* SLIDE_FROM_LEFT = "SlideFromLeft"; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
74 |
const char* SLIDE_TO_RIGHT = "SlideToRight"; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
75 |
const char* SLIDE_FROM_RIGHT = "SlideFromRight"; |
24 | 76 |
const char* LEFT_BUTTON = "tv:left_button"; |
77 |
const char* RIGHT_BUTTON = "tv:right_button"; |
|
78 |
||
79 |
const char* TEXT_COLOR_ATTRIBUTE = "text"; |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
80 |
const int MANUALSEEK_START_TIMEOUT = 400; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
81 |
const int MANUALSEEK_END_TIMEOUT = 2000; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
82 |
const int MANUALSEEK_SIGNAL_DELAY = 300; |
24 | 83 |
|
84 |
/*! |
|
85 |
* |
|
86 |
*/ |
|
87 |
static QLineF makeTab( qreal pos, int height ) |
|
88 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
89 |
return QLineF( pos, STRIP_HEIGHT - height, pos, STRIP_HEIGHT ); |
24 | 90 |
} |
91 |
||
92 |
/*! |
|
93 |
* |
|
94 |
*/ |
|
95 |
RadioFrequencyStrip::RadioFrequencyStrip() : |
|
96 |
RadioStripBase(), |
|
97 |
mUiEngine( NULL ), |
|
98 |
mMinFrequency( 87500000 ), |
|
99 |
mMaxFrequency( 108000000 ), |
|
100 |
mFrequencyStepSize( 100000 ), |
|
101 |
mFrequency( 87500000 ), |
|
102 |
mSelectorImage( new QGraphicsPixmapItem( this ) ), |
|
103 |
mSeparatorPos( 0.0 ), |
|
104 |
mMaxWidth( 0 ), |
|
105 |
mSelectorPos( 0.0 ), |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
106 |
mLeftButton( 0 ), |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
107 |
mRightButton( 0 ), |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
108 |
mManualSeekTimer( NULL ), |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
109 |
mManualSeekMode( false ), |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
110 |
mLastReportedFrequency( 0 ), |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
111 |
mManualSeekTimerId( 0 ), |
24 | 112 |
mForegroundColor( Qt::white )//HbColorScheme::color( TEXT_COLOR_ATTRIBUTE ) ) |
113 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
114 |
RadioUtil::setFrequencyStrip( this ); |
24 | 115 |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
116 |
setScrollingStyle( HbScrollArea::PanWithFollowOn ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
117 |
setItemSize( QSizeF( ITEM_WIDTH + PIXMAP_OVERLAP / 2, STRIP_HEIGHT ) ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
118 |
setOverlap( PIXMAP_OVERLAP / 2 ); |
24 | 119 |
|
120 |
initModel(); |
|
121 |
||
122 |
initSelector(); |
|
123 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
124 |
initEmptyItems(); |
24 | 125 |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
126 |
initPositions(); |
24 | 127 |
|
128 |
mFrequency = RadioUiEngine::lastTunedFrequency(); |
|
129 |
} |
|
130 |
||
131 |
/*! |
|
132 |
* |
|
133 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
134 |
void RadioFrequencyStrip::init( RadioUiEngine* engine, RadioUiLoader& uiLoader ) |
24 | 135 |
{ |
136 |
mUiEngine = engine; |
|
137 |
mMinFrequency = mUiEngine->minFrequency(); |
|
138 |
mMaxFrequency = mUiEngine->maxFrequency(); |
|
139 |
mFrequencyStepSize = mUiEngine->frequencyStepSize(); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
140 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
141 |
mLeftButton = uiLoader.findWidget<HbPushButton>( DOCML::MV_NAME_PREV_BUTTON ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
142 |
mRightButton = uiLoader.findWidget<HbPushButton>( DOCML::MV_NAME_NEXT_BUTTON ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
143 |
initButtons(); |
24 | 144 |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
145 |
mManualSeekTimer = new QTimer( this ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
146 |
mManualSeekTimer->setInterval( MANUALSEEK_START_TIMEOUT ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
147 |
mManualSeekTimer->setSingleShot( true ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
148 |
Radio::connect( mManualSeekTimer, SIGNAL(timeout()), |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
149 |
this, SLOT(toggleManualSeek()) ); |
24 | 150 |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
151 |
Radio::connect( mLeftButton, SIGNAL(clicked()), |
24 | 152 |
this, SLOT(handleLeftButton()) ); |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
153 |
Radio::connect( mRightButton, SIGNAL(clicked()), |
24 | 154 |
this, SLOT(handleRightButton()) ); |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
155 |
Radio::connect( mLeftButton, SIGNAL(longPress(QPointF)), |
24 | 156 |
this, SLOT(handleLongLeftButton()) ); |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
157 |
Radio::connect( mRightButton, SIGNAL(longPress(QPointF)), |
24 | 158 |
this, SLOT(handleLongRightButton()) ); |
159 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
160 |
Radio::connect( this, SIGNAL(scrollingEnded()), |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
161 |
this, SLOT(handleScrollingEnd()) ); |
24 | 162 |
|
163 |
grabGesture( Qt::SwipeGesture ); |
|
164 |
||
165 |
//TODO: Remove. Stepsize hardcoded to 100 Khz in europe region during demo |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
166 |
if ( mFrequencyStepSize < ONE_HUNDRED_KHZ ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
167 |
mFrequencyStepSize = ONE_HUNDRED_KHZ; |
24 | 168 |
} |
169 |
||
170 |
RadioStationModel* stationModel = &mUiEngine->stationModel(); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
171 |
Radio::connect( stationModel, SIGNAL(rowsInserted(QModelIndex,int,int)), |
24 | 172 |
this, SLOT(updateStation(QModelIndex,int,int)) ); |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
173 |
Radio::connect( stationModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
174 |
this, SLOT(removeStation(QModelIndex,int,int)) ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
175 |
Radio::connect( stationModel, SIGNAL(modelReset()), |
24 | 176 |
this, SLOT(initEmptyItems()) ); |
177 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
178 |
updateAllItems(); |
24 | 179 |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
180 |
showButtons(); |
24 | 181 |
} |
182 |
||
183 |
/*! |
|
184 |
* |
|
185 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
186 |
void RadioFrequencyStrip::setFrequency( const uint frequency, int reason, Scroll::Direction direction ) |
24 | 187 |
{ |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
188 |
Q_UNUSED( reason ); |
24 | 189 |
LOG_FORMAT( "RadioFrequencyStrip::setFrequency, frequency: %d, reason: %d", frequency, reason ); |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
190 |
if ( mFrequencies.contains( frequency ) ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
191 |
if ( frequency != mFrequency || reason == TuneReason::Skip ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
192 |
scrollToFrequency( frequency, direction, mAutoScrollTime, RadioUtil::tuneReason( reason ) ); |
24 | 193 |
} |
194 |
} |
|
195 |
} |
|
196 |
||
197 |
/*! |
|
198 |
* |
|
199 |
*/ |
|
200 |
uint RadioFrequencyStrip::frequency() const |
|
201 |
{ |
|
202 |
return mFrequency; |
|
203 |
} |
|
204 |
||
205 |
/*! |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
206 |
* |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
207 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
208 |
bool RadioFrequencyStrip::isInManualSeekMode() const |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
209 |
{ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
210 |
return mManualSeekMode; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
211 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
212 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
213 |
/*! |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
214 |
* |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
215 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
216 |
void RadioFrequencyStrip::cancelManualSeek() |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
217 |
{ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
218 |
mManualSeekTimer->stop(); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
219 |
if ( mManualSeekMode ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
220 |
toggleManualSeek(); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
221 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
222 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
223 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
224 |
/*! |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
225 |
* |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
226 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
227 |
void RadioFrequencyStrip::addScannedStation( const RadioStation& station ) |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
228 |
{ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
229 |
FrequencyPos pos = mFrequencies.value( station.frequency() ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
230 |
updateItem( pos.mItem, station.frequency() ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
231 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
232 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
233 |
/*! |
24 | 234 |
* |
235 |
*/ |
|
236 |
void RadioFrequencyStrip::updateFavorite( const RadioStation& station ) |
|
237 |
{ |
|
238 |
LOG_SLOT_CALLER; |
|
239 |
FrequencyPos pos = mFrequencies.value( station.frequency() ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
240 |
updateItem( pos.mItem ); |
24 | 241 |
} |
242 |
||
243 |
/*! |
|
244 |
* Public slot |
|
245 |
* |
|
246 |
*/ |
|
247 |
void RadioFrequencyStrip::setScanningMode( bool isScanning ) |
|
248 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
249 |
mManualSeekTimer->stop(); |
24 | 250 |
if ( isScanning ) { |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
251 |
initEmptyItems(); |
24 | 252 |
hideButtons(); |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
253 |
scrollToFrequency( mMinFrequency, Scroll::Shortest, mAutoScrollTime ); |
24 | 254 |
} else { |
255 |
showButtons(); |
|
256 |
} |
|
257 |
setEnabled( !isScanning ); |
|
258 |
} |
|
259 |
||
260 |
/*! |
|
261 |
* Private slot |
|
262 |
* |
|
263 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
264 |
void RadioFrequencyStrip::removeStation( const QModelIndex& parent, int first, int last ) |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
265 |
{ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
266 |
Q_UNUSED( parent ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
267 |
updateStationsInRange( first, last, true ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
268 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
269 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
270 |
/*! |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
271 |
* Private slot |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
272 |
* |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
273 |
*/ |
24 | 274 |
void RadioFrequencyStrip::updateStation( const QModelIndex& parent, int first, int last ) |
275 |
{ |
|
276 |
Q_UNUSED( parent ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
277 |
updateStationsInRange( first, last ); |
24 | 278 |
} |
279 |
||
280 |
/*! |
|
281 |
* Private slot |
|
282 |
* |
|
283 |
*/ |
|
284 |
void RadioFrequencyStrip::initEmptyItems() |
|
285 |
{ |
|
286 |
LOG_METHOD; |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
287 |
//TODO: Remove the weird hack of checking the sender |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
288 |
if ( !sender() || RadioUtil::scanStatus() != Scan::ScanningInMainView ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
289 |
QList<RadioStation> emptyList; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
290 |
foreach ( RadioFrequencyItem* item, mFrequencyItems ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
291 |
QPixmap pixmap = drawPixmap( item->frequency(), emptyList, item ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
292 |
item->setPixmap( pixmap ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
293 |
} |
24 | 294 |
} |
295 |
} |
|
296 |
||
297 |
/*! |
|
298 |
* Private slot |
|
299 |
*/ |
|
300 |
void RadioFrequencyStrip::handleLeftButton() |
|
301 |
{ |
|
302 |
emit skipRequested( StationSkip::PreviousFavorite ); |
|
303 |
} |
|
304 |
||
305 |
/*! |
|
306 |
* Private slot |
|
307 |
*/ |
|
308 |
void RadioFrequencyStrip::handleLongLeftButton() |
|
309 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
310 |
emit seekRequested( Seek::Down ); |
24 | 311 |
} |
312 |
||
313 |
/*! |
|
314 |
* Private slot |
|
315 |
*/ |
|
316 |
void RadioFrequencyStrip::handleRightButton() |
|
317 |
{ |
|
318 |
emit skipRequested( StationSkip::NextFavorite ); |
|
319 |
} |
|
320 |
||
321 |
/*! |
|
322 |
* Private slot |
|
323 |
*/ |
|
324 |
void RadioFrequencyStrip::handleLongRightButton() |
|
325 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
326 |
emit seekRequested( Seek::Up ); |
24 | 327 |
} |
328 |
||
329 |
/*! |
|
330 |
* Private slot |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
331 |
* |
24 | 332 |
*/ |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
333 |
void RadioFrequencyStrip::toggleManualSeek() |
24 | 334 |
{ |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
335 |
mManualSeekMode = !mManualSeekMode; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
336 |
emit manualSeekChanged( mManualSeekMode ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
337 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
338 |
if ( mManualSeekMode ) { |
32
189d20c34778
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
339 |
grabMouse(); |
24 | 340 |
hideButtons(); |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
341 |
mManualSeekTimerId = startTimer( MANUALSEEK_SIGNAL_DELAY ); |
24 | 342 |
} else { |
32
189d20c34778
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
343 |
ungrabMouse(); |
24 | 344 |
showButtons(); |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
345 |
killTimer( mManualSeekTimerId ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
346 |
mManualSeekTimerId = 0; |
24 | 347 |
} |
348 |
} |
|
349 |
||
350 |
/*! |
|
351 |
* Private slot |
|
352 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
353 |
void RadioFrequencyStrip::handleScrollingEnd() |
24 | 354 |
{ |
355 |
// Check if the selector is in the invalid area where the strip loops around |
|
356 |
const int selectorPosition = selectorPos(); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
357 |
if ( mManualSeekMode ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
358 |
if ( !mPositions.contains( selectorPosition ) ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
359 |
if ( selectorPosition < mMaxWidth - ITEM_WIDTH + mSeparatorPos ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
360 |
scrollToFrequency( mMaxFrequency, Scroll::Shortest, 500 ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
361 |
emit frequencyChanged( mMaxFrequency, TuneReason::ManualSeekUpdate, Scroll::Shortest ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
362 |
} else { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
363 |
scrollToFrequency( mMinFrequency, Scroll::Shortest, 500 ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
364 |
emit frequencyChanged( mMinFrequency, TuneReason::ManualSeekUpdate, Scroll::Shortest ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
365 |
} |
24 | 366 |
} |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
367 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
368 |
mManualSeekTimer->start( MANUALSEEK_END_TIMEOUT ); |
24 | 369 |
} |
370 |
} |
|
371 |
||
372 |
/*! |
|
373 |
* \reimp |
|
374 |
*/ |
|
375 |
void RadioFrequencyStrip::updateItemPrimitive( QGraphicsItem* itemToUpdate, int itemIndex ) |
|
376 |
{ |
|
377 |
QGraphicsPixmapItem* item = static_cast<QGraphicsPixmapItem*>( itemToUpdate ); |
|
378 |
if ( itemIndex < mFrequencyItems.count() ) { |
|
379 |
item->setPixmap( mFrequencyItems.at( itemIndex )->updatePrimitive( item ) ); |
|
380 |
} |
|
381 |
} |
|
382 |
||
383 |
/*! |
|
384 |
* \reimp |
|
385 |
*/ |
|
386 |
QGraphicsItem* RadioFrequencyStrip::createItemPrimitive( QGraphicsItem* parent ) |
|
387 |
{ |
|
388 |
return new QGraphicsPixmapItem( parent ); |
|
389 |
} |
|
390 |
||
391 |
/*! |
|
392 |
* \reimp |
|
393 |
*/ |
|
32
189d20c34778
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
394 |
void RadioFrequencyStrip::scrollPosChanged() |
24 | 395 |
{ |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
396 |
if ( mManualSeekMode ) { |
24 | 397 |
const int pos = selectorPos(); |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
398 |
const uint frequency = mPositions.value( pos ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
399 |
if ( frequency > 0 ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
400 |
mFrequency = mPositions.value( pos ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
401 |
emit frequencyChanged( mFrequency, TuneReason::ManualSeekUpdate, Scroll::Shortest ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
402 |
} |
24 | 403 |
} |
404 |
} |
|
405 |
||
406 |
/*! |
|
407 |
* \reimp |
|
408 |
*/ |
|
409 |
void RadioFrequencyStrip::resizeEvent ( QGraphicsSceneResizeEvent* event ) |
|
410 |
{ |
|
32
189d20c34778
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
411 |
LOG_METHOD; |
24 | 412 |
RadioStripBase::resizeEvent( event ); |
413 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
414 |
const qreal height = event->newSize().height(); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
415 |
const qreal width = event->newSize().width(); |
24 | 416 |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
417 |
mSelectorPos = width / 2; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
418 |
mSelectorImage->setOffset( mSelectorPos - (INDICATOR_WIDTH / 2), 0.0 ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
419 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
420 |
if ( mLeftButton && mRightButton ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
421 |
mLeftButton->resize( height, height ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
422 |
mRightButton->resize( height, height ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
423 |
mRightButton->setPos( QPointF( width - height, 0 ) ); |
24 | 424 |
} |
425 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
426 |
scrollToFrequency( mFrequency ); |
24 | 427 |
} |
428 |
||
429 |
/*! |
|
430 |
* \reimp |
|
431 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
432 |
//void RadioFrequencyStrip::showEvent( QShowEvent* event ) |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
433 |
//{ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
434 |
// RadioStripBase::showEvent( event ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
435 |
// scrollToFrequency( mFrequency ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
436 |
//} |
24 | 437 |
|
438 |
/*! |
|
439 |
* \reimp |
|
440 |
*/ |
|
441 |
void RadioFrequencyStrip::changeEvent( QEvent* event ) |
|
442 |
{ |
|
443 |
if ( event->type() == HbEvent::ThemeChanged ) { |
|
444 |
// Update the foreground color and redraw each item |
|
445 |
mForegroundColor = Qt::white;// HbColorScheme::color( TEXT_COLOR_ATTRIBUTE ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
446 |
updateAllItems(); |
24 | 447 |
} |
448 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
449 |
return RadioStripBase::changeEvent(event); |
24 | 450 |
} |
451 |
||
452 |
/*! |
|
453 |
* \reimp |
|
454 |
*/ |
|
455 |
void RadioFrequencyStrip::mousePressEvent( QGraphicsSceneMouseEvent* event ) |
|
456 |
{ |
|
457 |
RadioStripBase::mousePressEvent( event ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
458 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
459 |
mManualSeekTimer->stop(); |
32
189d20c34778
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
460 |
if ( mManualSeekMode ) { |
189d20c34778
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
461 |
const bool insideStrip = rect().contains( event->pos() ); |
189d20c34778
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
462 |
if ( !insideStrip ) { |
189d20c34778
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
463 |
toggleManualSeek(); |
189d20c34778
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
464 |
} |
189d20c34778
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
465 |
} else { |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
466 |
mManualSeekTimer->start( MANUALSEEK_START_TIMEOUT ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
467 |
} |
24 | 468 |
} |
469 |
||
470 |
/*! |
|
471 |
* \reimp |
|
472 |
*/ |
|
473 |
void RadioFrequencyStrip::mouseReleaseEvent( QGraphicsSceneMouseEvent* event ) |
|
474 |
{ |
|
475 |
RadioStripBase::mouseReleaseEvent( event ); |
|
476 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
477 |
mManualSeekTimer->stop(); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
478 |
if ( mManualSeekMode && !isScrolling() ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
479 |
mManualSeekTimer->start( MANUALSEEK_END_TIMEOUT ); |
24 | 480 |
} |
481 |
} |
|
482 |
||
483 |
/*! |
|
484 |
* \reimp |
|
485 |
*/ |
|
486 |
void RadioFrequencyStrip::gestureEvent( QGestureEvent* event ) |
|
487 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
488 |
HbSwipeGesture* swipeGesture = static_cast<HbSwipeGesture*>( event->gesture( Qt::SwipeGesture ) ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
489 |
if ( swipeGesture && !mManualSeekMode ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
490 |
if ( swipeGesture->state() == Qt::GestureFinished ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
491 |
if ( swipeGesture->horizontalDirection() == QSwipeGesture::Left ) { |
24 | 492 |
emit skipRequested( StationSkip::Next ); |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
493 |
} else if ( swipeGesture->horizontalDirection() == QSwipeGesture::Right ) { |
24 | 494 |
emit skipRequested( StationSkip::Previous ); |
495 |
} |
|
496 |
} |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
497 |
} else if ( mManualSeekMode ) { |
24 | 498 |
RadioStripBase::gestureEvent( event ); |
499 |
} |
|
500 |
} |
|
501 |
||
502 |
/*! |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
503 |
* \reimp |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
504 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
505 |
void RadioFrequencyStrip::timerEvent( QTimerEvent* event ) |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
506 |
{ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
507 |
Q_UNUSED( event ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
508 |
if ( mLastReportedFrequency != mFrequency ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
509 |
mLastReportedFrequency = mFrequency; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
510 |
emit frequencyChanged( mFrequency, TuneReason::ManualSeekTune, Scroll::Shortest ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
511 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
512 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
513 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
514 |
/*! |
24 | 515 |
* |
516 |
*/ |
|
517 |
void RadioFrequencyStrip::initModel() |
|
518 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
519 |
const uint minFreq = uint( qreal(mMinFrequency) / ONE_HERTZ + ROUNDER ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
520 |
const uint maxFreq = uint( qreal(mMaxFrequency) / ONE_HERTZ + 0.9 ); // always round up |
24 | 521 |
|
522 |
QStringList list; |
|
523 |
QString freqText; |
|
524 |
for ( uint i = minFreq; i <= maxFreq; ++i ) { |
|
525 |
freqText = QString::number( i ); |
|
526 |
list.append( freqText ); |
|
527 |
mFrequencyItems.append( new RadioFrequencyItem( freqText ) ); |
|
528 |
} |
|
529 |
mFrequencyItems.append( new RadioFrequencyItem( "" ) ); |
|
530 |
list.append( "" ); |
|
531 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
532 |
mMaxWidth = list.count() * ITEM_WIDTH; |
24 | 533 |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
534 |
mSeparatorPos = qreal(ITEM_WIDTH) / 2; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
535 |
const uint minDrawableFreq = minFreq * ONE_HERTZ - HALF_HERTZ;; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
536 |
const uint maxDrawableFreq = maxFreq * ONE_HERTZ + HALF_HERTZ; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
537 |
mSeparatorPos += qreal( ( mMinFrequency - minDrawableFreq ) / 2 ) / PIXEL_IN_HZ; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
538 |
mSeparatorPos -= qreal( ( maxDrawableFreq - mMaxFrequency ) / 2 ) / PIXEL_IN_HZ; |
24 | 539 |
|
540 |
setModel( new QStringListModel( list, this ) ); |
|
541 |
} |
|
542 |
||
543 |
/*! |
|
544 |
* |
|
545 |
*/ |
|
546 |
void RadioFrequencyStrip::initSelector() |
|
547 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
548 |
QPixmap selectorPixmap = QPixmap( QSize( SELECTOR_WIDTH, STRIP_HEIGHT ) ); |
24 | 549 |
selectorPixmap.fill( Qt::red ); |
550 |
mSelectorImage->setPixmap( selectorPixmap ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
551 |
mSelectorImage->setZValue( SELECTOR_Z_POS ); |
24 | 552 |
} |
553 |
||
554 |
/*! |
|
555 |
* |
|
556 |
*/ |
|
557 |
void RadioFrequencyStrip::initPositions() |
|
558 |
{ |
|
559 |
int prevPos = 0; |
|
560 |
int nextPos = 0; |
|
561 |
const int lastPos = mFrequencies.value( mMaxFrequency ).mPosition; |
|
562 |
for ( int i = mFrequencies.value( mMinFrequency ).mPosition; i < lastPos; ++i ) { |
|
563 |
if ( mPositions.contains( i ) ) { |
|
564 |
prevPos = i; |
|
565 |
const uint freq = mPositions.value( prevPos ) + mFrequencyStepSize; |
|
566 |
if ( mFrequencies.contains( freq ) ) { |
|
567 |
nextPos = mFrequencies.value( freq ).mPosition; |
|
568 |
} else { |
|
569 |
nextPos = prevPos; |
|
570 |
} |
|
571 |
} else { |
|
572 |
const int nearestHit = ( i - prevPos ) < ( nextPos - i ) ? prevPos : nextPos; |
|
573 |
mPositions.insert( i, mPositions.value( nearestHit ) ); |
|
574 |
} |
|
575 |
} |
|
576 |
} |
|
577 |
||
578 |
/*! |
|
579 |
* |
|
580 |
*/ |
|
581 |
void RadioFrequencyStrip::initButtons() |
|
582 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
583 |
mLeftButton->setZValue( SELECTOR_Z_POS ); |
24 | 584 |
mLeftButton->setObjectName( LEFT_BUTTON ); |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
585 |
mRightButton->setZValue( SELECTOR_Z_POS ); |
24 | 586 |
mRightButton->setObjectName( RIGHT_BUTTON ); |
587 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
588 |
const qreal height = size().height(); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
589 |
const qreal width = size().width(); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
590 |
mLeftButton->resize( height, height ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
591 |
mRightButton->resize( height, height ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
592 |
mRightButton->setPos( QPointF( width - height, 0 ) ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
593 |
|
24 | 594 |
QEffectList effectList; |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
595 |
effectList.append( EffectInfo( mLeftButton, ":/effects/slide_to_left.fxml", SLIDE_TO_LEFT ) ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
596 |
effectList.append( EffectInfo( mLeftButton, ":/effects/slide_from_left.fxml", SLIDE_FROM_LEFT ) ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
597 |
effectList.append( EffectInfo( mRightButton, ":/effects/slide_to_right.fxml", SLIDE_TO_RIGHT ) ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
598 |
effectList.append( EffectInfo( mRightButton, ":/effects/slide_from_right.fxml", SLIDE_FROM_RIGHT ) ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
599 |
RadioUtil::addEffects( effectList ); |
24 | 600 |
} |
601 |
||
602 |
/*! |
|
603 |
* |
|
604 |
*/ |
|
605 |
void RadioFrequencyStrip::addFrequencyPos( int pos, uint frequency, RadioFrequencyItem* item ) |
|
606 |
{ |
|
607 |
mFrequencies.insert( frequency, FrequencyPos( pos, item ) ); |
|
608 |
mPositions.insert( pos, frequency ); |
|
609 |
} |
|
610 |
||
611 |
/*! |
|
612 |
* |
|
613 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
614 |
void RadioFrequencyStrip::updateStationsInRange( int first, int last, bool stationRemoved ) |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
615 |
{ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
616 |
if ( RadioUtil::scanStatus() != Scan::ScanningInMainView ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
617 |
RadioStationModel& model = mUiEngine->stationModel(); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
618 |
uint frequency = 0; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
619 |
for ( int i = first; i <= last; ++i ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
620 |
frequency = model.data( model.index( i, 0, QModelIndex() ), |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
621 |
RadioRole::RadioStationRole ).value<RadioStation>().frequency(); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
622 |
if ( mFrequencies.contains( frequency ) ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
623 |
FrequencyPos pos = mFrequencies.value( frequency ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
624 |
updateItem( pos.mItem, 0, stationRemoved ? frequency : 0 ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
625 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
626 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
627 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
628 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
629 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
630 |
/*! |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
631 |
* |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
632 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
633 |
void RadioFrequencyStrip::updateItem( RadioFrequencyItem* item, uint upperRange, uint ignoredFrequency ) |
24 | 634 |
{ |
635 |
if ( item ) { |
|
636 |
uint frequency = item->frequency(); |
|
637 |
QList<RadioStation> stations; |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
638 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
639 |
if ( upperRange == 0 ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
640 |
upperRange = frequency + HALF_HERTZ; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
641 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
642 |
|
24 | 643 |
if ( mUiEngine ) { |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
644 |
stations = mUiEngine->stationsInRange( frequency - HALF_HERTZ, upperRange ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
645 |
for ( int i = stations.count() - 1; ignoredFrequency > 0 && i >= 0; --i ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
646 |
if ( stations[i].frequency() == ignoredFrequency ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
647 |
stations.removeAt( i ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
648 |
break; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
649 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
650 |
} |
24 | 651 |
} |
652 |
||
653 |
QPixmap pixmap = drawPixmap( frequency, stations, item ); |
|
654 |
item->setPixmap( pixmap ); |
|
655 |
||
656 |
foreach ( const RadioStation& station, stations ) { |
|
657 |
frequency = station.frequency(); |
|
658 |
FrequencyPos pos = mFrequencies.value( frequency ); |
|
659 |
mFrequencies.insert( frequency, pos ); |
|
660 |
} |
|
661 |
} |
|
662 |
} |
|
663 |
||
664 |
/*! |
|
665 |
* |
|
666 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
667 |
void RadioFrequencyStrip::updateAllItems() |
24 | 668 |
{ |
669 |
foreach ( RadioFrequencyItem* item, mFrequencyItems ) { |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
670 |
updateItem( item ); |
24 | 671 |
} |
672 |
} |
|
673 |
||
674 |
/*! |
|
675 |
* |
|
676 |
*/ |
|
677 |
QPixmap RadioFrequencyStrip::drawPixmap( uint frequency, QList<RadioStation> stations, RadioFrequencyItem* item ) |
|
678 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
679 |
QPixmap pixmap( PIXMAP_WIDTH, STRIP_HEIGHT ); |
24 | 680 |
pixmap.fill( Qt::transparent ); |
681 |
QPainter painter( &pixmap ); |
|
682 |
QPen normalPen = painter.pen(); |
|
683 |
QPen favoritePen = normalPen; |
|
684 |
normalPen.setColor( mForegroundColor ); |
|
685 |
painter.setPen( normalPen ); |
|
686 |
||
687 |
if ( frequency == 0 ) { |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
688 |
painter.drawLine( makeTab( mSeparatorPos - 1 + ROUNDER, STRIP_HEIGHT ) ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
689 |
painter.drawLine( makeTab( mSeparatorPos + ROUNDER, STRIP_HEIGHT ) ); |
24 | 690 |
return pixmap; |
691 |
} |
|
692 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
693 |
const QString itemText = QString::number( frequency / ONE_HERTZ ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
694 |
const uint startFrequency = frequency - HALF_HERTZ; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
695 |
const uint endFrequency = startFrequency + ONE_HERTZ; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
696 |
const uint roundedMin = int( qreal(mMinFrequency) / ONE_HERTZ + ROUNDER ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
697 |
const uint freq = frequency / ONE_HERTZ; |
24 | 698 |
const int diff = freq - roundedMin; |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
699 |
const qreal startPixel = diff * ITEM_WIDTH; |
24 | 700 |
qreal pixels = 0.0; |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
701 |
const qreal leftOverlap = PIXMAP_OVERLAP / 2; |
24 | 702 |
|
703 |
for ( uint frequency = startFrequency; frequency <= endFrequency; frequency += mFrequencyStepSize ) { |
|
704 |
||
705 |
if ( frequency < mMinFrequency || frequency > mMaxFrequency ) { |
|
706 |
continue; |
|
707 |
} |
|
708 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
709 |
pixels = qreal( frequency - startFrequency ) / PIXEL_IN_HZ; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
710 |
if ( frequency % ONE_HERTZ == 0 ) { |
24 | 711 |
|
712 |
// Draw the high frequency tab and the frequency text for the even number |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
713 |
painter.drawLine( makeTab( pixels + leftOverlap, TAB_HEIGHT_BIG ) ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
714 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
715 |
// Draw the frequency text and its 00 decimals |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
716 |
painter.setFont( DECIMAL_FONT ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
717 |
const int decimalWidth = painter.fontMetrics().width( DECIMAL_TEXT ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
718 |
const int decimalSpace = painter.fontMetrics().leftBearing( '.' ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
719 |
painter.setFont( FREQUENCY_FONT ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
720 |
const int frequencyWidth = painter.fontMetrics().width( itemText ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
721 |
const int textPosX = int( pixels + leftOverlap - ( frequencyWidth + decimalSpace + decimalWidth ) / 2 ); |
24 | 722 |
painter.drawText( QPoint( textPosX, 20 ), itemText ); |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
723 |
painter.setFont( DECIMAL_FONT ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
724 |
painter.drawText( QPoint( textPosX + frequencyWidth + decimalSpace, 20 ), DECIMAL_TEXT ); |
24 | 725 |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
726 |
} else if ( frequency % ONE_TAB_IN_HZ == 0 ) { |
24 | 727 |
|
728 |
// Draw the low frequency tab for the uneven number |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
729 |
painter.drawLine( makeTab( pixels + leftOverlap, TAB_HEIGHT_SMALL ) ); |
24 | 730 |
|
731 |
} |
|
732 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
733 |
addFrequencyPos( int( startPixel + pixels + ROUNDER ), frequency, item ); |
24 | 734 |
} |
735 |
||
736 |
// Draw favorites and local stations |
|
737 |
favoritePen.setColor( Qt::yellow ); |
|
738 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
739 |
const int markerYPos = STRIP_HEIGHT - 20; |
24 | 740 |
foreach ( const RadioStation& station, stations ) { |
741 |
const uint frequency = station.frequency(); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
742 |
pixels = qreal( frequency - startFrequency ) / PIXEL_IN_HZ; |
24 | 743 |
|
744 |
if ( station.isFavorite() ) { |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
745 |
favoritePen.setWidth( PEN_WIDTH_FAVORITE ); |
24 | 746 |
painter.setPen( favoritePen ); |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
747 |
painter.drawEllipse( int( pixels + leftOverlap - 3 ), markerYPos - 3, 6, 6 ); |
24 | 748 |
// painter.drawPixmap( pixels - 10, 20, 20, 20, mFavoriteIcon.pixmap() ); |
749 |
} else if ( station.isType( RadioStation::LocalStation ) ) { |
|
750 |
||
751 |
favoritePen.setWidth( 1 ); |
|
752 |
painter.setPen( favoritePen ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
753 |
painter.drawEllipse( int( pixels + leftOverlap - 4 ), markerYPos - 4, 8, 8 ); |
24 | 754 |
} |
755 |
} |
|
756 |
||
757 |
return pixmap; |
|
758 |
} |
|
759 |
||
760 |
/*! |
|
761 |
* |
|
762 |
*/ |
|
763 |
void RadioFrequencyStrip::emitFrequencyChanged( uint frequency ) |
|
764 |
{ |
|
765 |
if ( frequency > 0 && frequency != mFrequency ) { |
|
766 |
mFrequency = frequency; |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
767 |
//TOD: Get direction |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
768 |
emit frequencyChanged( frequency, TuneReason::FrequencyStrip, Scroll::Shortest ); |
24 | 769 |
} |
770 |
} |
|
771 |
||
772 |
/*! |
|
773 |
* |
|
774 |
*/ |
|
775 |
int RadioFrequencyStrip::selectorPos() const |
|
776 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
777 |
const int pos = int( -contentWidget()->x() + mSelectorPos + ROUNDER ); |
24 | 778 |
return pos % mMaxWidth; |
779 |
} |
|
780 |
||
781 |
/*! |
|
782 |
* |
|
783 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
784 |
void RadioFrequencyStrip::scrollToFrequency( uint frequency, Scroll::Direction direction, int time, TuneReason::Reason reason ) |
24 | 785 |
{ |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
786 |
int targetFreqPos = mFrequencies.value( frequency ).mPosition; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
787 |
const int currentFreqPos = mFrequencies.value( mFrequency ).mPosition; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
788 |
const int currentPos = int( -contentWidget()->x() + mSelectorPos + ROUNDER ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
789 |
const bool isInSecondHalf = currentPos >= mMaxWidth - ITEM_WIDTH + mSeparatorPos; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
790 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
791 |
// Special case: When there is only one favorite and the user presses skip |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
792 |
// the strip must scroll around to the same frequency. |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
793 |
if ( mFrequency == frequency && reason == TuneReason::Skip ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
794 |
if ( direction == Scroll::Left ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
795 |
targetFreqPos += mMaxWidth; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
796 |
} else { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
797 |
targetFreqPos -= mMaxWidth; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
798 |
} |
24 | 799 |
} |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
800 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
801 |
mFrequency = frequency; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
802 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
803 |
qreal newPos = targetFreqPos; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
804 |
if ( direction == Scroll::Left ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
805 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
806 |
if ( currentFreqPos > targetFreqPos ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
807 |
newPos += mMaxWidth; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
808 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
809 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
810 |
} else if ( direction == Scroll::Right ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
811 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
812 |
if ( currentFreqPos < targetFreqPos ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
813 |
newPos -= mMaxWidth; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
814 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
815 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
816 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
817 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
818 |
if ( isInSecondHalf ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
819 |
newPos += mMaxWidth; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
820 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
821 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
822 |
newPos -= mSelectorPos - ROUNDER; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
823 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
824 |
scrollContentsTo( QPointF( newPos, 0 ), time ); |
24 | 825 |
} |
826 |
||
827 |
/*! |
|
828 |
* |
|
829 |
*/ |
|
830 |
void RadioFrequencyStrip::hideButtons() |
|
831 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
832 |
HbEffect::start( mLeftButton, SLIDE_TO_LEFT ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
833 |
HbEffect::start( mRightButton, SLIDE_TO_RIGHT ); |
24 | 834 |
} |
835 |
||
836 |
/*! |
|
837 |
* |
|
838 |
*/ |
|
839 |
void RadioFrequencyStrip::showButtons() |
|
840 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
841 |
HbEffect::start( mLeftButton, SLIDE_FROM_LEFT ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
842 |
HbEffect::start( mRightButton, SLIDE_FROM_RIGHT ); |
24 | 843 |
} |