Initialise the item lists for simple search providers on startup so they can be used to populate the global search suggestions.

This commit is contained in:
David Sansome 2011-11-08 18:35:33 +00:00
parent 7c5aaf36aa
commit 5dcd1d4890
8 changed files with 92 additions and 67 deletions

View File

@ -31,6 +31,11 @@ DigitallyImportedSearchProvider::DigitallyImportedSearchProvider(
<< "digitallyimported");
connect(service_, SIGNAL(StreamsChanged()), SLOT(MaybeRecreateItems()));
// Load the channel list on startup only if it doesn't involve going to update
// info from the server.
if (!service_->IsChannelListStale())
RecreateItems();
}
void DigitallyImportedSearchProvider::RecreateItems() {

View File

@ -30,6 +30,11 @@ LastFMSearchProvider::LastFMSearchProvider(LastFMService* service, QObject* pare
set_safe_words(QStringList() << "lastfm" << "last.fm");
connect(service, SIGNAL(SavedItemsChanged()), SLOT(MaybeRecreateItems()));
// Load the friends list on startup only if it doesn't involve going to update
// info from the server.
if (!service_->IsFriendsListStale())
RecreateItems();
}
void LastFMSearchProvider::LoadArtAsync(int id, const Result& result) {

View File

@ -27,6 +27,8 @@ SavedRadioSearchProvider::SavedRadioSearchProvider(SavedRadio* service, QObject*
Init(tr("Your radio streams"), "savedradio", IconLoader::Load("document-open-remote"));
connect(service_, SIGNAL(StreamsChanged()), SLOT(MaybeRecreateItems()));
RecreateItems();
}
void SavedRadioSearchProvider::RecreateItems() {

View File

@ -27,6 +27,11 @@ SomaFMSearchProvider::SomaFMSearchProvider(SomaFMService* service, QObject* pare
icon_ = ScaleAndPad(QImage(":/providers/somafm.png"));
connect(service, SIGNAL(StreamsChanged()), SLOT(MaybeRecreateItems()));
// Load the stream list on startup only if it doesn't involve going to update
// info from the server.
if (!service_->IsStreamListStale())
RecreateItems();
}
void SomaFMSearchProvider::LoadArtAsync(int id, const Result& result) {

View File

@ -59,6 +59,8 @@ DigitallyImportedServiceBase::DigitallyImportedServiceBase(
saved_channels_(kSettingsGroup, api_service_name, kStreamsCacheDurationSecs),
api_client_(new DigitallyImportedClient(api_service_name, this))
{
ReloadSettings();
model->player()->RegisterUrlHandler(url_handler_);
model->global_search()->AddProvider(new DigitallyImportedSearchProvider(this, this));

View File

@ -90,6 +90,8 @@ LastFMService::LastFMService(InternetModel* parent)
friend_names_(kSettingsGroup, "friend_names", kFriendsCacheDurationSecs),
connection_problems_(false)
{
ReloadSettings();
//we emit the signal the first time to be sure the buttons are in the right state
emit ScrobblingEnabledChanged(scrobbling_enabled_);

View File

@ -50,10 +50,10 @@ SomaFMService::SomaFMService(InternetModel* parent)
network_(new NetworkAccessManager(this)),
streams_(kSettingsGroup, "streams", kStreamsCacheDurationSecs)
{
ReloadSettings();
model()->player()->RegisterUrlHandler(url_handler_);
model()->global_search()->AddProvider(new SomaFMSearchProvider(this, this));
ReloadSettings();
}
SomaFMService::~SomaFMService() {

View File

@ -427,11 +427,11 @@ msgstr ""
msgid "Add stream..."
msgstr ""
#: internet/groovesharkservice.cpp:725
#: internet/groovesharkservice.cpp:732
msgid "Add to Grooveshark favorites"
msgstr ""
#: internet/groovesharkservice.cpp:731
#: internet/groovesharkservice.cpp:738
msgid "Add to Grooveshark playlists"
msgstr ""
@ -597,7 +597,7 @@ msgstr ""
msgid "An error occurred writing metadata to '%1'"
msgstr ""
#: internet/lastfmservice.cpp:900
#: internet/lastfmservice.cpp:902
#, qt-format
msgid "An unknown last.fm error occurred: %1"
msgstr ""
@ -632,7 +632,7 @@ msgstr ""
msgid "Are you sure you want to delete the \"%1\" preset?"
msgstr ""
#: internet/groovesharkservice.cpp:852
#: internet/groovesharkservice.cpp:859
msgid "Are you sure you want to delete this playlist?"
msgstr ""
@ -654,7 +654,7 @@ msgstr ""
msgid "Artist info"
msgstr ""
#: internet/lastfmservice.cpp:189
#: internet/lastfmservice.cpp:191
msgid "Artist radio"
msgstr ""
@ -675,7 +675,7 @@ msgid "Authenticating..."
msgstr ""
#: internet/digitallyimportedsettingspage.cpp:82
#: internet/magnatunesettingspage.cpp:113 internet/lastfmservice.cpp:430
#: internet/magnatunesettingspage.cpp:113 internet/lastfmservice.cpp:432
#: internet/lastfmsettingspage.cpp:79 remote/remotesettingspage.cpp:113
msgid "Authentication failed"
msgstr ""
@ -991,11 +991,11 @@ msgstr ""
msgid "Composer"
msgstr ""
#: internet/groovesharkservice.cpp:466
#: internet/groovesharkservice.cpp:469
msgid "Configure Grooveshark..."
msgstr ""
#: internet/lastfmservice.cpp:109
#: internet/lastfmservice.cpp:111
msgid "Configure Last.fm..."
msgstr ""
@ -1015,7 +1015,7 @@ msgstr ""
msgid "Configure library..."
msgstr ""
#: internet/digitallyimportedservicebase.cpp:180
#: internet/digitallyimportedservicebase.cpp:182
#: ../bin/src/ui_globalsearchsettingspage.h:167
msgid "Configure..."
msgstr ""
@ -1079,7 +1079,7 @@ msgid ""
"plugins installed"
msgstr ""
#: internet/lastfmservice.cpp:897
#: internet/lastfmservice.cpp:899
msgid "Couldn't load the last.fm radio station"
msgstr ""
@ -1120,7 +1120,7 @@ msgstr ""
msgid "Covers from %1"
msgstr ""
#: internet/groovesharkservice.cpp:451 internet/groovesharkservice.cpp:804
#: internet/groovesharkservice.cpp:454 internet/groovesharkservice.cpp:811
msgid "Create a new Grooveshark playlist"
msgstr ""
@ -1212,7 +1212,7 @@ msgstr ""
msgid "Custom message settings"
msgstr ""
#: internet/lastfmservice.cpp:197
#: internet/lastfmservice.cpp:199
msgid "Custom radio"
msgstr ""
@ -1260,7 +1260,7 @@ msgstr ""
msgid "Delay between visualizations"
msgstr ""
#: internet/groovesharkservice.cpp:454 internet/groovesharkservice.cpp:851
#: internet/groovesharkservice.cpp:457 internet/groovesharkservice.cpp:858
msgid "Delete Grooveshark playlist"
msgstr ""
@ -1614,7 +1614,7 @@ msgstr ""
msgid "Error loading %1"
msgstr ""
#: internet/digitallyimportedservicebase.cpp:202
#: internet/digitallyimportedservicebase.cpp:204
#: internet/digitallyimportedurlhandler.cpp:73
msgid "Error loading di.fm playlist"
msgstr ""
@ -1688,7 +1688,7 @@ msgstr ""
msgid "Fast"
msgstr ""
#: internet/groovesharkservice.cpp:592
#: internet/groovesharkservice.cpp:595
msgid "Favorites"
msgstr ""
@ -1837,7 +1837,7 @@ msgstr ""
msgid "Frames per buffer"
msgstr ""
#: internet/lastfmservice.cpp:205
#: internet/lastfmservice.cpp:207
msgid "Friends"
msgstr ""
@ -1875,7 +1875,7 @@ msgstr ""
msgid "Getting channels"
msgstr ""
#: internet/digitallyimportedservicebase.cpp:104
#: internet/digitallyimportedservicebase.cpp:106
msgid "Getting streams"
msgstr ""
@ -2080,31 +2080,31 @@ msgstr ""
msgid "Internet providers"
msgstr ""
#: internet/lastfmservice.cpp:436
#: internet/lastfmservice.cpp:438
msgid "Invalid API key"
msgstr ""
#: internet/lastfmservice.cpp:431
#: internet/lastfmservice.cpp:433
msgid "Invalid format"
msgstr ""
#: internet/lastfmservice.cpp:429
#: internet/lastfmservice.cpp:431
msgid "Invalid method"
msgstr ""
#: internet/lastfmservice.cpp:432
#: internet/lastfmservice.cpp:434
msgid "Invalid parameters"
msgstr ""
#: internet/lastfmservice.cpp:433
#: internet/lastfmservice.cpp:435
msgid "Invalid resource specified"
msgstr ""
#: internet/lastfmservice.cpp:428
#: internet/lastfmservice.cpp:430
msgid "Invalid service"
msgstr ""
#: internet/lastfmservice.cpp:435
#: internet/lastfmservice.cpp:437
msgid "Invalid session key"
msgstr ""
@ -2198,25 +2198,25 @@ msgstr ""
msgid "Last.fm Custom Radio: %1"
msgstr ""
#: internet/lastfmservice.cpp:236 internet/lastfmservice.cpp:691
#: internet/lastfmservice.cpp:726
#: internet/lastfmservice.cpp:238 internet/lastfmservice.cpp:693
#: internet/lastfmservice.cpp:728
#, qt-format
msgid "Last.fm Library - %1"
msgstr ""
#: globalsearch/lastfmsearchprovider.cpp:70 internet/lastfmservice.cpp:238
#: internet/lastfmservice.cpp:241
#: globalsearch/lastfmsearchprovider.cpp:75 internet/lastfmservice.cpp:240
#: internet/lastfmservice.cpp:243
#, qt-format
msgid "Last.fm Mix Radio - %1"
msgstr ""
#: globalsearch/lastfmsearchprovider.cpp:72 internet/lastfmservice.cpp:243
#: internet/lastfmservice.cpp:246
#: globalsearch/lastfmsearchprovider.cpp:77 internet/lastfmservice.cpp:245
#: internet/lastfmservice.cpp:248
#, qt-format
msgid "Last.fm Neighbor Radio - %1"
msgstr ""
#: globalsearch/lastfmsearchprovider.cpp:68 internet/lastfmservice.cpp:233
#: globalsearch/lastfmsearchprovider.cpp:73 internet/lastfmservice.cpp:235
#, qt-format
msgid "Last.fm Radio Station - %1"
msgstr ""
@ -2231,7 +2231,7 @@ msgstr ""
msgid "Last.fm Tag Radio: %1"
msgstr ""
#: internet/lastfmservice.cpp:440
#: internet/lastfmservice.cpp:442
msgid "Last.fm is currently busy, please try again in a few minutes"
msgstr ""
@ -2320,7 +2320,7 @@ msgstr ""
msgid "Load playlist..."
msgstr ""
#: internet/lastfmservice.cpp:910
#: internet/lastfmservice.cpp:912
msgid "Loading Last.fm radio"
msgstr ""
@ -2449,7 +2449,7 @@ msgstr ""
msgid "Make playlist available offline"
msgstr ""
#: internet/lastfmservice.cpp:447
#: internet/lastfmservice.cpp:449
msgid "Malformed response"
msgstr ""
@ -2549,39 +2549,39 @@ msgstr ""
msgid "Mute"
msgstr ""
#: globalsearch/lastfmsearchprovider.cpp:46 internet/lastfmservice.cpp:176
#: globalsearch/lastfmsearchprovider.cpp:51 internet/lastfmservice.cpp:178
msgid "My Last.fm Library"
msgstr ""
#: globalsearch/lastfmsearchprovider.cpp:48 internet/lastfmservice.cpp:181
#: globalsearch/lastfmsearchprovider.cpp:53 internet/lastfmservice.cpp:183
msgid "My Last.fm Mix Radio"
msgstr ""
#: globalsearch/lastfmsearchprovider.cpp:50 internet/lastfmservice.cpp:186
#: globalsearch/lastfmsearchprovider.cpp:55 internet/lastfmservice.cpp:188
msgid "My Last.fm Neighborhood"
msgstr ""
#: globalsearch/lastfmsearchprovider.cpp:44 internet/lastfmservice.cpp:171
#: globalsearch/lastfmsearchprovider.cpp:49 internet/lastfmservice.cpp:173
msgid "My Last.fm Recommended Radio"
msgstr ""
#: internet/lastfmservice.cpp:178
#: internet/lastfmservice.cpp:180
msgid "My Mix Radio"
msgstr ""
#: internet/lastfmservice.cpp:183
#: internet/lastfmservice.cpp:185
msgid "My Neighborhood"
msgstr ""
#: internet/lastfmservice.cpp:173
#: internet/lastfmservice.cpp:175
msgid "My Radio Station"
msgstr ""
#: internet/lastfmservice.cpp:168
#: internet/lastfmservice.cpp:170
msgid "My Recommendations"
msgstr ""
#: internet/groovesharkservice.cpp:805 ui/equalizer.cpp:172
#: internet/groovesharkservice.cpp:812 ui/equalizer.cpp:172
#: ../bin/src/ui_deviceproperties.h:369
#: ../bin/src/ui_magnatunedownloaddialog.h:135
#: ../bin/src/ui_wizardfinishpage.h:84
@ -2597,7 +2597,7 @@ msgstr ""
msgid "Narrow band (NB)"
msgstr ""
#: internet/lastfmservice.cpp:210
#: internet/lastfmservice.cpp:212
msgid "Neighbors"
msgstr ""
@ -2689,19 +2689,19 @@ msgstr ""
msgid "Not connected"
msgstr ""
#: internet/lastfmservice.cpp:442
#: internet/lastfmservice.cpp:444
msgid "Not enough content"
msgstr ""
#: internet/lastfmservice.cpp:444
#: internet/lastfmservice.cpp:446
msgid "Not enough fans"
msgstr ""
#: internet/lastfmservice.cpp:443
#: internet/lastfmservice.cpp:445
msgid "Not enough members"
msgstr ""
#: internet/lastfmservice.cpp:445
#: internet/lastfmservice.cpp:447
msgid "Not enough neighbors"
msgstr ""
@ -2750,7 +2750,7 @@ msgstr ""
msgid "Only show the first"
msgstr ""
#: internet/digitallyimportedservicebase.cpp:173
#: internet/digitallyimportedservicebase.cpp:175
#, qt-format
msgid "Open %1 in browser"
msgstr ""
@ -2794,7 +2794,7 @@ msgstr ""
msgid "Open..."
msgstr ""
#: internet/lastfmservice.cpp:434
#: internet/lastfmservice.cpp:436
msgid "Operation failed"
msgstr ""
@ -2893,7 +2893,7 @@ msgstr ""
msgid "Play Artist or Tag"
msgstr ""
#: internet/lastfmservice.cpp:101
#: internet/lastfmservice.cpp:103
msgid "Play artist radio..."
msgstr ""
@ -2901,7 +2901,7 @@ msgstr ""
msgid "Play count"
msgstr ""
#: internet/lastfmservice.cpp:105
#: internet/lastfmservice.cpp:107
msgid "Play custom radio..."
msgstr ""
@ -2926,7 +2926,7 @@ msgstr ""
msgid "Play last.fm tag radio"
msgstr ""
#: internet/lastfmservice.cpp:103
#: internet/lastfmservice.cpp:105
msgid "Play tag radio..."
msgstr ""
@ -3152,7 +3152,7 @@ msgstr ""
msgid "Refresh channels"
msgstr ""
#: internet/lastfmservice.cpp:107
#: internet/lastfmservice.cpp:109
msgid "Refresh friends list"
msgstr ""
@ -3160,7 +3160,7 @@ msgstr ""
msgid "Refresh station list"
msgstr ""
#: internet/digitallyimportedservicebase.cpp:176
#: internet/digitallyimportedservicebase.cpp:178
msgid "Refresh streams"
msgstr ""
@ -3180,7 +3180,7 @@ msgstr ""
msgid "Remote Control"
msgstr ""
#: internet/savedradio.cpp:100 internet/lastfmservice.cpp:98
#: internet/savedradio.cpp:100 internet/lastfmservice.cpp:100
#: ../bin/src/ui_queuemanager.h:135 ../bin/src/ui_searchtermwidget.h:282
#: ../bin/src/ui_transcodedialog.h:207
msgid "Remove"
@ -3194,11 +3194,11 @@ msgstr ""
msgid "Remove folder"
msgstr ""
#: internet/groovesharkservice.cpp:461
#: internet/groovesharkservice.cpp:464
msgid "Remove from favorites"
msgstr ""
#: internet/groovesharkservice.cpp:458 ../bin/src/ui_mainwindow.h:674
#: internet/groovesharkservice.cpp:461 ../bin/src/ui_mainwindow.h:674
msgid "Remove from playlist"
msgstr ""
@ -3354,11 +3354,11 @@ msgid "Search"
msgstr ""
#: internet/groovesharksearchplaylisttype.cpp:32
#: internet/groovesharkservice.cpp:663
#: internet/groovesharkservice.cpp:667
msgid "Search Grooveshark"
msgstr ""
#: internet/groovesharkservice.cpp:464 internet/groovesharkservice.cpp:473
#: internet/groovesharkservice.cpp:467 internet/groovesharkservice.cpp:476
msgid "Search Grooveshark (opens a new tab)"
msgstr ""
@ -3386,7 +3386,11 @@ msgstr ""
msgid "Search Spotify (opens a new tab)..."
msgstr ""
#: ../bin/src/ui_globalsearchwidget.h:60
#: ../bin/src/ui_globalsearchwidget.h:61
msgid "Search around all your sources (library, internet services, ...)"
msgstr ""
#: ../bin/src/ui_globalsearchwidget.h:63
msgid "Search everywhere"
msgstr ""
@ -3450,7 +3454,7 @@ msgstr ""
msgid "Serial number"
msgstr ""
#: internet/lastfmservice.cpp:437
#: internet/lastfmservice.cpp:439
msgid "Service offline"
msgstr ""
@ -3833,7 +3837,7 @@ msgstr ""
msgid "Tag fetcher"
msgstr ""
#: internet/lastfmservice.cpp:193
#: internet/lastfmservice.cpp:195
msgid "Tag radio"
msgstr ""
@ -3972,7 +3976,7 @@ msgid ""
"want to continue?"
msgstr ""
#: internet/lastfmservice.cpp:438
#: internet/lastfmservice.cpp:440
msgid "This stream is for paid subscribers only"
msgstr ""
@ -4090,7 +4094,7 @@ msgstr ""
msgid "Unknown"
msgstr ""
#: internet/digitallyimportedclient.cpp:68 internet/lastfmservice.cpp:451
#: internet/digitallyimportedclient.cpp:68 internet/lastfmservice.cpp:453
msgid "Unknown error"
msgstr ""