118 if (button) |
123 if (button) |
119 { |
124 { |
120 connect(button, SIGNAL(clicked()), SLOT(fetchSong())); |
125 connect(button, SIGNAL(clicked()), SLOT(fetchSong())); |
121 bottomLayout->addItem(button); |
126 bottomLayout->addItem(button); |
122 } |
127 } |
|
128 |
|
129 QGraphicsLinearLayout *playLayout = new QGraphicsLinearLayout(Qt::Horizontal); |
123 HbPushButton* playButton = new HbPushButton("Play song"); |
130 HbPushButton* playButton = new HbPushButton("Play song"); |
124 if (playButton) |
131 if (playButton) |
125 { |
132 { |
126 connect(playButton, SIGNAL(clicked()), SLOT(viewSong())); |
133 connect(playButton, SIGNAL(clicked()), SLOT(viewSong())); |
127 bottomLayout->addItem(playButton); |
134 playLayout->addItem(playButton); |
128 } |
135 } |
129 HbPushButton* viewButton = new HbPushButton("Play song caged"); |
136 HbPushButton* viewButton = new HbPushButton("Play song caged"); |
130 if (viewButton) |
137 if (viewButton) |
131 { |
138 { |
132 connect(viewButton, SIGNAL(clicked()), SLOT(viewSongCaged())); |
139 connect(viewButton, SIGNAL(clicked()), SLOT(viewSongCaged())); |
133 bottomLayout->addItem(viewButton); |
140 playLayout->addItem(viewButton); |
134 } |
141 } |
135 |
142 bottomLayout->addItem(playLayout); |
|
143 |
|
144 QGraphicsLinearLayout *hsLayout = new QGraphicsLinearLayout(Qt::Horizontal); |
136 HbPushButton* homeScreenButton = new HbPushButton("HS Widget MainView"); |
145 HbPushButton* homeScreenButton = new HbPushButton("HS Widget MainView"); |
137 if (homeScreenButton) |
146 if (homeScreenButton) |
138 { |
147 { |
139 connect(homeScreenButton, SIGNAL(clicked()), SLOT(launchHomeScreen())); |
148 connect(homeScreenButton, SIGNAL(clicked()), SLOT(launchHomeScreen())); |
140 bottomLayout->addItem(homeScreenButton); |
149 hsLayout->addItem(homeScreenButton); |
141 } |
150 } |
142 |
151 |
143 HbPushButton* homeScreenButtonNPV = new HbPushButton("HS Widget NowPlayingView"); |
152 HbPushButton* homeScreenButtonNPV = new HbPushButton("HS Widget NowPlayingView"); |
144 if (homeScreenButtonNPV) |
153 if (homeScreenButtonNPV) |
145 { |
154 { |
146 connect(homeScreenButtonNPV, SIGNAL(clicked()), SLOT(launchHomeScreenNowPlaying())); |
155 connect(homeScreenButtonNPV, SIGNAL(clicked()), SLOT(launchHomeScreenNowPlaying())); |
147 bottomLayout->addItem(homeScreenButtonNPV); |
156 hsLayout->addItem(homeScreenButtonNPV); |
148 } |
157 } |
149 |
158 |
150 HbPushButton* homeScreenButtonNPVS = new HbPushButton("HS Widget NPV Shuffle"); |
159 HbPushButton* homeScreenButtonNPVS = new HbPushButton("HS Widget NPV Shuffle"); |
151 if (homeScreenButtonNPVS) |
160 if (homeScreenButtonNPVS) |
152 { |
161 { |
153 connect(homeScreenButtonNPVS, SIGNAL(clicked()), SLOT(launchHomeScreenNPShuffle())); |
162 connect(homeScreenButtonNPVS, SIGNAL(clicked()), SLOT(launchHomeScreenNPShuffle())); |
154 bottomLayout->addItem(homeScreenButtonNPVS); |
163 hsLayout->addItem(homeScreenButtonNPVS); |
155 } |
164 } |
|
165 bottomLayout->addItem(hsLayout); |
|
166 |
|
167 HbPushButton* NowPlayingButton = new HbPushButton("NPV File Activity"); |
|
168 if (NowPlayingButton) |
|
169 { |
|
170 connect(NowPlayingButton, SIGNAL(clicked()), SLOT(playNPVSong())); |
|
171 bottomLayout->addItem(NowPlayingButton); |
|
172 } |
|
173 QGraphicsLinearLayout *goomLayout = new QGraphicsLinearLayout(Qt::Horizontal); |
|
174 HbPushButton* endButton = new HbPushButton("End MP"); |
|
175 if (endButton) |
|
176 { |
|
177 connect(endButton, SIGNAL(clicked()), SLOT(endMP())); |
|
178 goomLayout->addItem(endButton); |
|
179 } |
|
180 |
|
181 HbPushButton* killButton = new HbPushButton("Kill MP"); |
|
182 if (killButton) |
|
183 { |
|
184 connect(killButton, SIGNAL(clicked()), SLOT(killMP())); |
|
185 goomLayout->addItem(killButton); |
|
186 } |
|
187 |
|
188 bottomLayout->addItem(goomLayout); |
|
189 |
156 layout->addItem(bottomLayout); |
190 layout->addItem(bottomLayout); |
157 } |
191 } |
158 |
192 |
159 setLayout(layout); // Takes ownership of layout |
193 setLayout(layout); // Takes ownership of layout |
160 } |
194 } |
435 |
469 |
436 // Handle error |
470 // Handle error |
437 } |
471 } |
438 |
472 |
439 } |
473 } |
|
474 |
|
475 void MpFetcherTestAppView::playNPVSong() |
|
476 { |
|
477 QUrl url; |
|
478 |
|
479 url.setUrl("appto://10207C62?activityname=MusicNowPlayingView&launchtype=standalone&uri=" + mResultEdit->text() ); |
|
480 if(mReq){ |
|
481 delete mReq; |
|
482 mReq = 0; |
|
483 } |
|
484 mReq = mAppMgr.create(url); |
|
485 if (mReq == NULL) |
|
486 { |
|
487 // No handlers for the URI |
|
488 return; |
|
489 } |
|
490 |
|
491 mReq->setBackground(false); |
|
492 |
|
493 // Send the request |
|
494 bool res = mReq->send(); |
|
495 if (!res) |
|
496 { |
|
497 // Request failed. |
|
498 int error = mReq->lastError(); |
|
499 |
|
500 // Handle error |
|
501 } |
|
502 |
|
503 } |
|
504 |
|
505 void MpFetcherTestAppView::endMP() |
|
506 { |
|
507 TApaTaskList taskList(CEikonEnv::Static()->WsSession()); |
|
508 TApaTask task = taskList.FindApp(TUid::Uid(270564450)); |
|
509 if (task.Exists()) { |
|
510 task.EndTask(); |
|
511 } else { |
|
512 qCritical("Cannot bring to forward task %08x", 270564450); |
|
513 } |
|
514 |
|
515 } |
|
516 void MpFetcherTestAppView::killMP() |
|
517 { |
|
518 TApaTaskList taskList(CEikonEnv::Static()->WsSession()); |
|
519 TApaTask task = taskList.FindApp(TUid::Uid(270564450)); |
|
520 if (task.Exists()) { |
|
521 task.KillTask(); |
|
522 } else { |
|
523 qCritical("Cannot bring to forward task %08x", 270564450); |
|
524 } |
|
525 } |