25 #include "radiouiengine_p.h" |
25 #include "radiouiengine_p.h" |
26 #include "radioenginewrapper.h" |
26 #include "radioenginewrapper.h" |
27 #include "radiostationhandlerif.h" |
27 #include "radiostationhandlerif.h" |
28 #include "radiostationmodel.h" |
28 #include "radiostationmodel.h" |
29 #include "radiostation.h" |
29 #include "radiostation.h" |
|
30 #include "radiologger.h" |
30 |
31 |
31 /*! |
32 /*! |
32 * |
33 * |
33 */ |
34 */ |
34 RadioScannerEngine::RadioScannerEngine( RadioUiEnginePrivate& uiEngine ) : |
35 RadioScannerEngine::RadioScannerEngine( RadioUiEnginePrivate& uiEngine ) : |
41 * |
42 * |
42 */ |
43 */ |
43 RadioScannerEngine::~RadioScannerEngine() |
44 RadioScannerEngine::~RadioScannerEngine() |
44 { |
45 { |
45 cancel(); |
46 cancel(); |
46 delete d_ptr; |
|
47 } |
47 } |
48 |
48 |
49 /*! |
49 /*! |
50 * Starts the scanning from minimum frequency |
50 * Starts the scanning from minimum frequency |
51 */ |
51 */ |
52 void RadioScannerEngine::startScanning() |
52 void RadioScannerEngine::startScanning() |
53 { |
53 { |
54 Q_D( RadioScannerEngine ); |
54 Q_D( RadioScannerEngine ); |
55 d->mUiEngine.cancelSeeking(); |
55 d->mUiEngine.cancelSeeking(); |
56 |
56 |
|
57 // d->mUiEngine.wrapper().setRdsEnabled( false ); |
|
58 |
57 d->mIsScanning = true; |
59 d->mIsScanning = true; |
58 |
60 |
59 if ( !d->mUiEngine.api().isMuted() ) { |
61 if ( !d->mUiEngine.api().isMuted() ) { |
60 d->mUiEngine.api().setMute( true ); |
62 d->mUiEngine.api().setMute( true ); |
61 d->mMutedByScanner = true; |
63 d->mMutedByScanner = true; |
62 } |
64 } |
63 |
65 |
64 d->mUiEngine.api().emitSeekingStarted( Seeking::Up ); |
66 d->mUiEngine.api().emitSeekingStarted( Seek::Up ); |
65 |
67 |
66 d->mUiEngine.api().stationModel().removeAll( RadioStationModel::RemoveLocalStations ); |
68 d->mUiEngine.api().stationModel().removeAll( RadioStationModel::RemoveLocalStations ); |
67 d->mLastFoundFrequency = d->mUiEngine.api().minFrequency(); |
69 d->mLastFoundFrequency = d->mUiEngine.api().minFrequency(); |
68 |
70 |
69 if ( d->mUiEngine.wrapper().currentFrequency() == d->mLastFoundFrequency ) { |
71 if ( d->mUiEngine.wrapper().currentFrequency() == d->mLastFoundFrequency ) { |
70 // Engine was already at the minimun frequency so start scanning |
72 // Engine was already at the minimun frequency so start scanning |
71 d->mUiEngine.wrapper().startSeeking( Seeking::Up, TuneReason::StationScan ); |
73 d->mUiEngine.wrapper().startSeeking( Seek::Up, TuneReason::StationScan ); |
72 } else { |
74 } else { |
73 // Engine must be initialized to minimum frequency before scanning can start |
75 // Engine must be initialized to minimum frequency before scanning can start |
74 d->mUiEngine.wrapper().tuneFrequency( d->mLastFoundFrequency, TuneReason::StationScanInitialization ); |
76 d->mUiEngine.wrapper().setFrequency( d->mLastFoundFrequency, TuneReason::StationScanInitialization ); |
75 } |
77 } |
76 } |
78 } |
77 |
79 |
78 /*! |
80 /*! |
79 * Continues the scanning upwards from current frequency |
81 * Continues the scanning upwards from current frequency |
80 */ |
82 */ |
81 void RadioScannerEngine::continueScanning() |
83 void RadioScannerEngine::continueScanning() |
82 { |
84 { |
83 Q_D( RadioScannerEngine ); |
85 Q_D( RadioScannerEngine ); |
84 d->mUiEngine.wrapper().startSeeking( Seeking::Up, TuneReason::StationScan ); |
86 d->mUiEngine.wrapper().startSeeking( Seek::Up, TuneReason::StationScan ); |
85 } |
87 } |
86 |
88 |
87 /*! |
89 /*! |
88 * Checks if the scanning is ongoing |
90 * Checks if the scanning is ongoing |
89 */ |
91 */ |