55 void displayLyrics(SmfTrackInfo currTrack); |
55 void displayLyrics(SmfTrackInfo currTrack); |
56 void showLyrics(SmfLyricsList* list); |
56 void showLyrics(SmfLyricsList* list); |
57 |
57 |
58 private: |
58 private: |
59 MyAppView* m_view; |
59 MyAppView* m_view; |
|
60 SmfClient client; |
60 SmfGallery* m_smfgl; |
61 SmfGallery* m_smfgl; |
61 SmfContactFetcher* m_smfcf; |
62 SmfContactFetcher* m_smfcf; |
62 SmfMusicService* m_smfms; |
63 SmfMusicService* m_smfms; |
63 QList<SmfContact> m_myfrndz; |
64 QList<SmfContact> m_myfrndz; |
64 }; |
65 }; |
65 /** 1. Display a gallery on the screen for some remote service. |
66 /** 1. Display a gallery on the screen for some remote service. |
66 * assume m_view is some gallery view object in the application.*/ |
67 * assume m_view is some gallery view object in the application.*/ |
67 void MyApplication::displayGallery() |
68 void MyApplication::displayGallery() |
68 { |
69 { |
69 // Some common interface for finding implementations. |
70 // Some common interface for finding implementations. |
70 QList<SmfProvider>* galleries = SmfClient::GetServices("org.symbian.smf.gallery\0.2"); |
71 QList<SmfProvider>* galleries = client.GetServices("org.symbian.smf.gallery\0.2"); |
71 |
72 |
72 // We will use the first one now |
73 // We will use the first one now |
73 SmfProvider smfp = galleries->value(0); |
74 SmfProvider smfp = galleries->value(0); |
74 SmfGallery* myGallery = new SmfGallery(&smfp); |
75 SmfGallery* myGallery = new SmfGallery(&smfp); |
75 |
76 |
136 * e.g. last.fm music service where users maintain profiles and friends. |
137 * e.g. last.fm music service where users maintain profiles and friends. |
137 */ |
138 */ |
138 void MyApplication::displayFriends() |
139 void MyApplication::displayFriends() |
139 { |
140 { |
140 // Some common interface for finding implementations. |
141 // Some common interface for finding implementations. |
141 QList<SmfProvider>* contactFetcherList = SmfClient::GetServices("org.symbian.smf.contact.fetcher\0.2"); |
142 QList<SmfProvider>* contactFetcherList = client.GetServices("org.symbian.smf.contact.fetcher\0.2"); |
142 SmfProvider smfp = contactFetcherList->value(0); |
143 SmfProvider smfp = contactFetcherList->value(0); |
143 SmfContactFetcher* smfcf = new SmfContactFetcher(&smfp); |
144 SmfContactFetcher* smfcf = new SmfContactFetcher(&smfp); |
144 |
145 |
145 //Request friend list, the friendsListAvailable() signal |
146 //Request friend list, the friendsListAvailable() signal |
146 //is emitted with SmfContactList once data is arrived. |
147 //is emitted with SmfContactList once data is arrived. |
173 * 4. This is an example of posting and reading user updates to social netowrking sites |
174 * 4. This is an example of posting and reading user updates to social netowrking sites |
174 */ |
175 */ |
175 void MyApplication::postUpdate() |
176 void MyApplication::postUpdate() |
176 { |
177 { |
177 // Some common interface for finding implementations. |
178 // Some common interface for finding implementations. |
178 QList<SmfProvider>* postServices = SmfClient::GetServices("org.symbian.smf.contact.posts\0.2"); |
179 QList<SmfProvider>* postServices = client.GetServices("org.symbian.smf.contact.posts\0.2"); |
179 |
180 |
180 //let us use the first one |
181 //let us use the first one |
181 QString servName = postServices->value(0).serviceName(); |
182 QString servName = postServices->value(0).serviceName(); |
182 if(!servName.compare("Facebook.com")) return; |
183 if(!servName.compare("Facebook.com")) return; |
183 SmfProvider smfp = postServices->value(0); |
184 SmfProvider smfp = postServices->value(0); |
213 * 5. This is an example of getting song recommendations from a social netowrking sites |
214 * 5. This is an example of getting song recommendations from a social netowrking sites |
214 */ |
215 */ |
215 void MyApplication::getMusic(SmfTrackInfo currTrack) |
216 void MyApplication::getMusic(SmfTrackInfo currTrack) |
216 { |
217 { |
217 // Some common interface for finding implementations. |
218 // Some common interface for finding implementations. |
218 QList<SmfProvider>* smfProList = SmfClient::GetServices("org.symbian.smf.music\0.2"); |
219 QList<SmfProvider>* smfProList = client.GetServices("org.symbian.smf.music\0.2"); |
219 SmfProvider smfp = smfProList->value(0); |
220 SmfProvider smfp = smfProList->value(0); |
220 SmfMusicSearch* mServer = new SmfMusicSearch(&smfp); |
221 SmfMusicSearch* mServer = new SmfMusicSearch(&smfp); |
221 |
222 |
222 QObject::connect(mServer,SIGNAL(trackSearchAvailable(SmfTrackInfoList*, QString,SmfResultPage )),this,SLOT(showTrackSearch(SmfTrackInfoList*))); |
223 QObject::connect(mServer,SIGNAL(trackSearchAvailable(SmfTrackInfoList*, QString,SmfResultPage )),this,SLOT(showTrackSearch(SmfTrackInfoList*))); |
223 QObject::connect(mServer,SIGNAL(storeSearchAvailable(SmfProviderList*, QString,SmfResultPage )),this,SLOT(showStoreSearch(SmfProviderList*))); |
224 QObject::connect(mServer,SIGNAL(storeSearchAvailable(SmfProviderList*, QString,SmfResultPage )),this,SLOT(showStoreSearch(SmfProviderList*))); |
235 void MyApplication::showTrackSearch(SmfTrackInfoList* songs) |
236 void MyApplication::showTrackSearch(SmfTrackInfoList* songs) |
236 { |
237 { |
237 foreach(SmfTrackInfo track, *songs){ |
238 foreach(SmfTrackInfo track, *songs){ |
238 m_view->add(track); |
239 m_view->add(track); |
239 } |
240 } |
240 QList<SmfProvider>* smfProList = SmfClient::GetServices("org.symbian.smf.client.music.search\0.2"); |
241 QList<SmfProvider>* smfProList = client.GetServices("org.symbian.smf.client.music.search\0.2"); |
241 SmfProvider smfp = smfProList->value(0); |
242 SmfProvider smfp = smfProList->value(0); |
242 SmfMusicSearch* mServer = new SmfMusicSearch(&smfp); |
243 SmfMusicSearch* mServer = new SmfMusicSearch(&smfp); |
243 //allow user to select a track and get purchase links |
244 //allow user to select a track and get purchase links |
244 //connect to showStoreSearch signal to display the stores for that track |
245 //connect to showStoreSearch signal to display the stores for that track |
245 mServer->stores(songs->value(0)); |
246 mServer->stores(songs->value(0)); |
261 |
262 |
262 void MyApplication::displayLyrics(SmfTrackInfo currTrack) |
263 void MyApplication::displayLyrics(SmfTrackInfo currTrack) |
263 { |
264 { |
264 |
265 |
265 // Some common interface for finding implementations. |
266 // Some common interface for finding implementations. |
266 QList<SmfProvider>* smfProList = SmfClient::GetServices("org.symbian.smf.music.lyrics\0.2","lyricsfly.com"); |
267 QList<SmfProvider>* smfProList = client.GetServices("org.symbian.smf.music.lyrics\0.2","lyricsfly.com"); |
267 SmfProvider smfp = smfProList->value(0); |
268 SmfProvider smfp = smfProList->value(0); |
268 SmfLyricsService* lyricsService = new SmfLyricsService(&smfp); |
269 SmfLyricsService* lyricsService = new SmfLyricsService(&smfp); |
269 QObject::connect(lyricsService,SIGNAL(lyricsAvailable(SmfLyricsList*, QString, SmfResultPage )),this,SLOT(showLyrics(SmfLyricsList*))); |
270 QObject::connect(lyricsService,SIGNAL(lyricsAvailable(SmfLyricsList*, QString, SmfResultPage )),this,SLOT(showLyrics(SmfLyricsList*))); |
270 |
271 |
271 //Request to get the lyrics |
272 //Request to get the lyrics |