135 */ |
158 */ |
136 void RadioViewBase::initBackAction() |
159 void RadioViewBase::initBackAction() |
137 { |
160 { |
138 // The default back button activates the tuning view |
161 // The default back button activates the tuning view |
139 HbAction* backAction = new HbAction( Hb::BackNaviAction, this ); |
162 HbAction* backAction = new HbAction( Hb::BackNaviAction, this ); |
140 connectAndTest( backAction, SIGNAL(triggered()), |
163 Radio::connect( backAction, SIGNAL(triggered()), |
141 mMainWindow, SLOT(activateMainView()) ); |
164 mMainWindow, SLOT(activateMainView()) ); |
142 setNavigationAction( backAction ); |
165 setNavigationAction( backAction ); |
143 } |
166 } |
144 |
167 |
145 /*! |
168 /*! |
146 * |
169 * |
147 */ |
170 */ |
148 void RadioViewBase::connectCommonMenuItem( int menuItem ) |
171 void RadioViewBase::connectCommonMenuItem( int menuItem ) |
149 { |
172 { |
150 RadioUiEngine* engine = &mMainWindow->uiEngine(); |
|
151 switch ( menuItem ) { |
173 switch ( menuItem ) { |
152 case MenuItem::UseLoudspeaker: |
174 case MenuItem::UseLoudspeaker: |
153 mUseLoudspeakerAction = mUiLoader->findObject<HbAction>( DOCML::NAME_LOUDSPEAKER_ACTION ); |
175 mUseLoudspeakerAction = mUiLoader->findObject<HbAction>( DOCML::NAME_LOUDSPEAKER_ACTION ); |
154 if ( mUseLoudspeakerAction ) { |
176 if ( mUseLoudspeakerAction ) { |
155 connectAndTest( mUseLoudspeakerAction, SIGNAL(triggered()), engine, SLOT(toggleAudioRoute()) ); |
177 Radio::connect( mUseLoudspeakerAction, SIGNAL(triggered()), mUiEngine.data(), SLOT(toggleAudioRoute()) ); |
156 updateAudioRouting( engine->isUsingLoudspeaker() ); |
178 updateAudioRouting( mUiEngine->isUsingLoudspeaker() ); |
157 connectAndTest( engine, SIGNAL(audioRouteChanged(bool)), this, SLOT(updateAudioRouting(bool)) ); |
179 Radio::connect( mUiEngine.data(), SIGNAL(audioRouteChanged(bool)), this, SLOT(updateAudioRouting(bool)) ); |
158 } |
180 } |
159 break; |
181 break; |
160 |
182 |
|
183 case MenuItem::Exit: |
|
184 if ( HbAction* exitAction = mUiLoader->findObject<HbAction>( DOCML::NAME_EXIT_ACTION ) ) { |
|
185 Radio::connect( exitAction, SIGNAL(triggered()), this, SLOT(quit()) ); |
|
186 } |
|
187 break; |
|
188 |
161 default: |
189 default: |
162 break; |
190 break; |
163 } |
191 } |
164 } |
192 } |
165 |
193 |
166 /*! |
194 /*! |
167 * |
195 * |
168 */ |
196 */ |
169 void RadioViewBase::connectXmlElement( const char* name, const char* signal, QObject* receiver, const char* slot ) |
197 void RadioViewBase::connectXmlElement( const QString& name, const char* signal, QObject* receiver, const char* slot ) |
170 { |
198 { |
171 if ( QObject* action = mUiLoader->findObject<QObject>( name ) ) { |
199 if ( QObject* action = mUiLoader->findObject<QObject>( name ) ) { |
172 connectAndTest( action, signal, receiver, slot ); |
200 Radio::connect( action, signal, receiver, slot ); |
173 } |
201 } |
174 } |
202 } |
175 |
203 |
176 /*! |
204 /*! |
177 * |
205 * |
178 */ |
206 */ |
179 void RadioViewBase::connectViewChangeMenuItem( QString name, const char* slot ) |
207 void RadioViewBase::connectViewChangeMenuItem( QString name, const char* slot ) |
180 { |
208 { |
181 if ( QObject* action = mUiLoader->findObject<QObject>( name ) ) { |
209 if ( QObject* action = mUiLoader->findObject<QObject>( name ) ) { |
182 connectAndTest( action, SIGNAL(triggered()), mMainWindow, slot ); |
210 Radio::connect( action, SIGNAL(triggered()), mMainWindow, slot ); |
183 } |
211 } |
184 } |
212 } |
185 |
213 |
186 /*! |
214 /*! |
187 * |
215 * |
188 */ |
216 */ |
189 void RadioViewBase::loadSection( const QString& docml, const QString& section ) |
217 void RadioViewBase::loadSection( const QString& docml, const QString& section ) |
190 { |
218 { |
191 LOG_FORMAT( "RadioViewBase::loadSection: Docml: %s, section: %s", GETSTRING( docml ), GETSTRING( section ) ); |
219 LOG_FORMAT( "RadioViewBase::loadSection: Docml: %s, section: %s", GETSTRING( docml ), GETSTRING( section ) ); |
192 bool ok = false; |
220 bool ok = false; |
193 mUiLoader->load( docml, section, &ok ); |
221 mUiLoader->load( docml, section, &ok ); |
194 LOG_ASSERT( ok, LOG_FORMAT( "Loading of section %s failed!", GETSTRING( section ) ) ); |
222 LOG_ASSERT( ok, LOG_FORMAT( "Loading of section %s failed!", GETSTRING( section ) ) ); |
195 } |
223 } |
196 |
224 |
197 /*! |
225 /*! |