35 #include "radiostationcarousel.h" |
35 #include "radiostationcarousel.h" |
36 #include "radiouiloader.h" |
36 #include "radiouiloader.h" |
37 #include "radioutil.h" |
37 #include "radioutil.h" |
38 #include "radiostationmodel.h" |
38 #include "radiostationmodel.h" |
39 #include "radiofrequencyscanner.h" |
39 #include "radiofrequencyscanner.h" |
|
40 #include "radioapplication.h" |
40 |
41 |
41 // Constants |
42 // Constants |
42 const QLatin1String RADIO_MAINVIEW_ACTIVITY_ID( "FMRadioMainView" ); |
43 const QLatin1String RADIO_MAINVIEW_ACTIVITY_ID( "FMRadioMainView" ); |
43 |
44 |
44 /*! |
45 /*! |
183 setNavigationAction( backAction ); |
184 setNavigationAction( backAction ); |
184 |
185 |
185 const bool firsTimeStart = mUiEngine->isFirstTimeStart(); |
186 const bool firsTimeStart = mUiEngine->isFirstTimeStart(); |
186 const int rowCount = mUiEngine->stationModel().rowCount(); |
187 const int rowCount = mUiEngine->stationModel().rowCount(); |
187 |
188 |
188 if ( firsTimeStart && rowCount == 0 ){ |
189 if ( firsTimeStart && rowCount == 0 ) { |
189 QTimer::singleShot( 4500, this, SLOT(startFirstTimeScanning()) ); |
190 QTimer::singleShot( 4500, this, SLOT(startFirstTimeScanning()) ); |
190 } |
191 } |
191 |
|
192 |
192 |
193 Radio::connect( static_cast<HbApplication*>( qApp ), SIGNAL(aboutToQuit()), |
193 Radio::connect( static_cast<HbApplication*>( qApp ), SIGNAL(aboutToQuit()), |
194 this, SLOT(saveActivity()) ); |
194 this, SLOT(saveActivity()) ); |
195 |
|
196 emit applicationReady(); |
|
197 |
195 |
198 QScopedPointer<AfActivityStorage> storage( new AfActivityStorage() ); |
196 QScopedPointer<AfActivityStorage> storage( new AfActivityStorage() ); |
199 bool ok = storage->removeActivity( RADIO_MAINVIEW_ACTIVITY_ID ); |
197 bool ok = storage->removeActivity( RADIO_MAINVIEW_ACTIVITY_ID ); |
200 LOG_ASSERT( ok, LOG( "Failed to remove old activity from Activity Storage!" ) ); |
198 LOG_ASSERT( ok, LOG( "Failed to remove old activity from Activity Storage!" ) ); |
|
199 |
|
200 // Send a signal to notify the automated tester that the application is ready |
|
201 QTimer::singleShot( 0, static_cast<RadioApplication*>( qApp ), SIGNAL(applicationReady()) ); |
201 } |
202 } |
202 |
203 |
203 /*! |
204 /*! |
204 * \reimp |
205 * \reimp |
205 * |
206 * |
268 mCarousel->clearInfoText(); |
269 mCarousel->clearInfoText(); |
269 updateFavoriteButton(); |
270 updateFavoriteButton(); |
270 if ( reason != TuneReason::FrequencyStrip && |
271 if ( reason != TuneReason::FrequencyStrip && |
271 reason != TuneReason::StationCarousel && |
272 reason != TuneReason::StationCarousel && |
272 reason != TuneReason::Skip && |
273 reason != TuneReason::Skip && |
273 reason != TuneReason::ManualSeekTune ) { |
274 reason != TuneReason::ManualSeekTune && |
|
275 reason != TuneReason::StationScanFinalize ) { |
274 mCarousel->setFrequency( frequency, reason, Scroll::Shortest ); |
276 mCarousel->setFrequency( frequency, reason, Scroll::Shortest ); |
275 mFrequencyStrip->setFrequency( frequency, reason, Scroll::Shortest ); |
277 mFrequencyStrip->setFrequency( frequency, reason, Scroll::Shortest ); |
276 } |
278 } |
277 } |
279 } |
278 } |
280 } |
430 QPixmap screenShot( screenShotSize ); |
432 QPixmap screenShot( screenShotSize ); |
431 QPainter painter( &screenShot ); |
433 QPainter painter( &screenShot ); |
432 |
434 |
433 // Draw the background and overlay |
435 // Draw the background and overlay |
434 // TODO: Uncomment when Orbit fixes the crash caused calling the pixmap() function. |
436 // TODO: Uncomment when Orbit fixes the crash caused calling the pixmap() function. |
435 // HbLabel* backgroundLabel = mUiLoader->findWidget<HbLabel>( DOCML::MV_NAME_CAROUSEL_BACKGROUND ); |
437 HbLabel* backgroundLabel = mUiLoader->findWidget<HbLabel>( DOCML::MV_NAME_CAROUSEL_BACKGROUND ); |
436 // painter.drawPixmap( 0, 0, backgroundLabel->icon().pixmap().scaled( screenShotSize ) ); |
438 painter.drawPixmap( 0, 0, backgroundLabel->icon().pixmap().scaled( screenShotSize ) ); |
437 // backgroundLabel = mUiLoader->findWidget<HbLabel>( DOCML::MV_NAME_CAROUSEL_OVERLAY ); |
439 backgroundLabel = mUiLoader->findWidget<HbLabel>( DOCML::MV_NAME_CAROUSEL_OVERLAY ); |
438 // painter.drawPixmap( 0, 0, backgroundLabel->icon().pixmap().scaled( screenShotSize ) ); |
440 painter.drawPixmap( 0, 0, backgroundLabel->icon().pixmap().scaled( screenShotSize ) ); |
439 |
441 |
440 mCarousel->drawOffScreen( painter ); |
442 mCarousel->drawOffScreen( painter ); |
441 |
443 |
442 QVariantHash metadata; |
444 QVariantHash metadata; |
443 metadata.insert( "screenshot", screenShot ); |
445 metadata.insert( "screenshot", screenShot ); |
444 |
446 screenShot.save( "radio.bmp" ); |
445 #ifdef __WINS__ |
|
446 screenShot.save( "c:\\radio.bmp" ); |
|
447 #elif defined BUILD_WIN32 |
|
448 screenShot.save( "radio.bmp" ); |
|
449 #endif |
|
450 |
447 |
451 // Update the activity to the activity manager |
448 // Update the activity to the activity manager |
452 QScopedPointer<AfActivityStorage> storage( new AfActivityStorage() ); |
449 QScopedPointer<AfActivityStorage> storage( new AfActivityStorage() ); |
453 bool ok = storage->saveActivity( RADIO_MAINVIEW_ACTIVITY_ID, QVariant(), metadata ); |
450 bool ok = storage->saveActivity( RADIO_MAINVIEW_ACTIVITY_ID, QVariant(), metadata ); |
454 LOG_ASSERT( ok, LOG( "Failed to update activity to Activity Storage!" ) ); |
451 LOG_ASSERT( ok, LOG( "Failed to update activity to Activity Storage!" ) ); |