Clicking an artist or tag in the song info tabs now does a global search instead of searching just last.fm
This commit is contained in:
parent
ccb1a745f6
commit
d74d4d65f0
@ -258,6 +258,15 @@ void GlobalSearchWidget::SwapModels() {
|
|||||||
RepositionPopup();
|
RepositionPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GlobalSearchWidget::StartSearch(const QString& query) {
|
||||||
|
ui_->search->setText(query);
|
||||||
|
TextEdited(query);
|
||||||
|
|
||||||
|
// Swap models immediately
|
||||||
|
swap_models_timer_->stop();
|
||||||
|
SwapModels();
|
||||||
|
}
|
||||||
|
|
||||||
void GlobalSearchWidget::AddResults(int id, const SearchProvider::ResultList& results) {
|
void GlobalSearchWidget::AddResults(int id, const SearchProvider::ResultList& results) {
|
||||||
if (id != last_id_)
|
if (id != last_id_)
|
||||||
return;
|
return;
|
||||||
|
@ -70,6 +70,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void ReloadSettings();
|
void ReloadSettings();
|
||||||
|
void StartSearch(const QString& query);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void AddToPlaylist(QMimeData* data);
|
void AddToPlaylist(QMimeData* data);
|
||||||
|
@ -221,7 +221,7 @@ void SongInfoBase::ConnectWidget(QWidget* widget) {
|
|||||||
connect(widget, SIGNAL(ShowSettingsDialog()), SIGNAL(ShowSettingsDialog()));
|
connect(widget, SIGNAL(ShowSettingsDialog()), SIGNAL(ShowSettingsDialog()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m->indexOfSignal("AddToPlaylist(QMimeData*)") != -1) {
|
if (m->indexOfSignal("DoGlobalSearch(QString)") != -1) {
|
||||||
connect(widget, SIGNAL(AddToPlaylist(QMimeData*)), SIGNAL(AddToPlaylist(QMimeData*)));
|
connect(widget, SIGNAL(DoGlobalSearch(QString)), SIGNAL(DoGlobalSearch(QString)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ public slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void ShowSettingsDialog();
|
void ShowSettingsDialog();
|
||||||
void AddToPlaylist(QMimeData* data);
|
void DoGlobalSearch(const QString& query);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent* e);
|
void showEvent(QShowEvent* e);
|
||||||
|
@ -113,8 +113,7 @@ void TagWidgetTag::contextMenuEvent(QContextMenuEvent*) {
|
|||||||
|
|
||||||
TagWidget::TagWidget(Type type, QWidget* parent)
|
TagWidget::TagWidget(Type type, QWidget* parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
type_(type),
|
type_(type)
|
||||||
menu_(NULL)
|
|
||||||
{
|
{
|
||||||
setLayout(new FlowLayout(4, 6, 4));
|
setLayout(new FlowLayout(4, 6, 4));
|
||||||
}
|
}
|
||||||
@ -130,70 +129,10 @@ void TagWidget::AddTag(const QString& tag) {
|
|||||||
tags_ << widget;
|
tags_ << widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TagWidget::EnsureMenuCreated() {
|
|
||||||
if (menu_)
|
|
||||||
return;
|
|
||||||
|
|
||||||
menu_ = new QMenu(this);
|
|
||||||
switch (type_) {
|
|
||||||
case Type_Tags:
|
|
||||||
menu_->addAction(QIcon(":/last.fm/as.png"), tr("Play last.fm tag radio"),
|
|
||||||
this, SLOT(PlayLastFmTagRadio()));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Type_Artists:
|
|
||||||
menu_->addAction(QIcon(":/last.fm/as.png"), tr("Play last.fm artist radio"),
|
|
||||||
this, SLOT(PlayLastFmArtistRadio()));
|
|
||||||
menu_->addAction(IconLoader::Load("folder-sound"), tr("Play from my Library"),
|
|
||||||
this, SLOT(PlayFromLibrary()));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TagWidget::TagClicked() {
|
void TagWidget::TagClicked() {
|
||||||
TagWidgetTag* tag = qobject_cast<TagWidgetTag*>(sender());
|
TagWidgetTag* tag = qobject_cast<TagWidgetTag*>(sender());
|
||||||
if (!tag)
|
if (!tag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EnsureMenuCreated();
|
emit DoGlobalSearch(tag->text());
|
||||||
|
|
||||||
context_item_ = tag->text();
|
|
||||||
menu_->popup(tag->mapToGlobal(tag->rect().bottomLeft()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void TagWidget::PlayLastFmArtistRadio() {
|
|
||||||
PlayLastFm("lastfm://artist/%1/similarartists");
|
|
||||||
}
|
|
||||||
|
|
||||||
void TagWidget::PlayLastFmTagRadio() {
|
|
||||||
PlayLastFm("lastfm://globaltags/%1");
|
|
||||||
}
|
|
||||||
|
|
||||||
void TagWidget::PlayFromLibrary() {
|
|
||||||
using smart_playlists::GeneratorMimeData;
|
|
||||||
using smart_playlists::GeneratorPtr;
|
|
||||||
using smart_playlists::QueryGenerator;
|
|
||||||
using smart_playlists::Search;
|
|
||||||
using smart_playlists::SearchTerm;
|
|
||||||
|
|
||||||
GeneratorPtr gen(new QueryGenerator(QString(), Search(
|
|
||||||
Search::Type_And, Search::TermList() <<
|
|
||||||
SearchTerm(SearchTerm::Field_Artist, SearchTerm::Op_Contains, context_item_),
|
|
||||||
Search::Sort_FieldAsc, SearchTerm::Field_Album, 100)));
|
|
||||||
emit AddToPlaylist(new GeneratorMimeData(gen));
|
|
||||||
}
|
|
||||||
|
|
||||||
void TagWidget::PlayLastFm(const QString& url_pattern) {
|
|
||||||
LastFMService* last_fm = InternetModel::Service<LastFMService>();
|
|
||||||
if (!last_fm->IsAuthenticated()) {
|
|
||||||
last_fm->ShowConfig();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QUrl url(url_pattern.arg(context_item_));
|
|
||||||
PlaylistItemPtr item(last_fm->PlaylistItemForUrl(url));
|
|
||||||
if (!item)
|
|
||||||
return;
|
|
||||||
|
|
||||||
emit AddToPlaylist(new PlaylistItemMimeData(item));
|
|
||||||
}
|
}
|
||||||
|
@ -83,25 +83,18 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void AddToPlaylist(QMimeData* data);
|
void AddToPlaylist(QMimeData* data);
|
||||||
|
void DoGlobalSearch(const QString& query);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void TagClicked();
|
void TagClicked();
|
||||||
|
|
||||||
void PlayLastFmTagRadio();
|
|
||||||
void PlayLastFmArtistRadio();
|
|
||||||
void PlayFromLibrary();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void EnsureMenuCreated();
|
|
||||||
void PlayLastFm(const QString& url_pattern);
|
void PlayLastFm(const QString& url_pattern);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Type type_;
|
Type type_;
|
||||||
QIcon icon_;
|
QIcon icon_;
|
||||||
QList<TagWidgetTag*> tags_;
|
QList<TagWidgetTag*> tags_;
|
||||||
|
|
||||||
QString context_item_;
|
|
||||||
QMenu* menu_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TAGWIDGET_H
|
#endif // TAGWIDGET_H
|
||||||
|
@ -111,17 +111,17 @@ msgid "%L1 total plays"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: transcoder/transcodedialog.cpp:198
|
#: transcoder/transcodedialog.cpp:198
|
||||||
#, c-format
|
#, c-format, qt-plural-format
|
||||||
msgid "%n failed"
|
msgid "%n failed"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: transcoder/transcodedialog.cpp:193
|
#: transcoder/transcodedialog.cpp:193
|
||||||
#, c-format
|
#, c-format, qt-plural-format
|
||||||
msgid "%n finished"
|
msgid "%n finished"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: transcoder/transcodedialog.cpp:188
|
#: transcoder/transcodedialog.cpp:188
|
||||||
#, c-format
|
#, c-format, qt-plural-format
|
||||||
msgid "%n remaining"
|
msgid "%n remaining"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -632,7 +632,7 @@ msgstr ""
|
|||||||
msgid "Are you sure you want to delete the \"%1\" preset?"
|
msgid "Are you sure you want to delete the \"%1\" preset?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: internet/groovesharkservice.cpp:905
|
#: internet/groovesharkservice.cpp:906
|
||||||
msgid "Are you sure you want to delete this playlist?"
|
msgid "Are you sure you want to delete this playlist?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -1044,7 +1044,7 @@ msgstr ""
|
|||||||
msgid "Convert any music that the device can't play"
|
msgid "Convert any music that the device can't play"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: internet/groovesharkservice.cpp:792
|
#: internet/groovesharkservice.cpp:793
|
||||||
msgid "Copy to clipboard"
|
msgid "Copy to clipboard"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -1124,7 +1124,7 @@ msgstr ""
|
|||||||
msgid "Covers from %1"
|
msgid "Covers from %1"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: internet/groovesharkservice.cpp:462 internet/groovesharkservice.cpp:857
|
#: internet/groovesharkservice.cpp:462 internet/groovesharkservice.cpp:858
|
||||||
msgid "Create a new Grooveshark playlist"
|
msgid "Create a new Grooveshark playlist"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -1264,7 +1264,7 @@ msgstr ""
|
|||||||
msgid "Delay between visualizations"
|
msgid "Delay between visualizations"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: internet/groovesharkservice.cpp:465 internet/groovesharkservice.cpp:904
|
#: internet/groovesharkservice.cpp:465 internet/groovesharkservice.cpp:905
|
||||||
msgid "Delete Grooveshark playlist"
|
msgid "Delete Grooveshark playlist"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -1593,7 +1593,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: internet/magnatunedownloaddialog.cpp:225 library/libraryview.cpp:453
|
#: internet/magnatunedownloaddialog.cpp:225 library/libraryview.cpp:453
|
||||||
#: ui/edittagdialog.cpp:719 ui/mainwindow.cpp:1802 ui/mainwindow.cpp:1907
|
#: ui/edittagdialog.cpp:719 ui/mainwindow.cpp:1802 ui/mainwindow.cpp:1907
|
||||||
#: ui/mainwindow.cpp:2125
|
#: ui/mainwindow.cpp:2126
|
||||||
msgid "Error"
|
msgid "Error"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -2597,7 +2597,7 @@ msgstr ""
|
|||||||
msgid "My Recommendations"
|
msgid "My Recommendations"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: internet/groovesharkservice.cpp:858 ui/equalizer.cpp:172
|
#: internet/groovesharkservice.cpp:859 ui/equalizer.cpp:172
|
||||||
#: ../bin/src/ui_deviceproperties.h:369
|
#: ../bin/src/ui_deviceproperties.h:369
|
||||||
#: ../bin/src/ui_magnatunedownloaddialog.h:135
|
#: ../bin/src/ui_magnatunedownloaddialog.h:135
|
||||||
#: ../bin/src/ui_wizardfinishpage.h:84
|
#: ../bin/src/ui_wizardfinishpage.h:84
|
||||||
@ -2921,10 +2921,6 @@ msgstr ""
|
|||||||
msgid "Play custom radio..."
|
msgid "Play custom radio..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: songinfo/tagwidget.cpp:147
|
|
||||||
msgid "Play from my Library"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: core/commandlineoptions.cpp:152
|
#: core/commandlineoptions.cpp:152
|
||||||
msgid "Play if stopped, pause if playing"
|
msgid "Play if stopped, pause if playing"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -2934,14 +2930,6 @@ msgstr ""
|
|||||||
msgid "Play if there is nothing already playing"
|
msgid "Play if there is nothing already playing"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: songinfo/tagwidget.cpp:145
|
|
||||||
msgid "Play last.fm artist radio"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: songinfo/tagwidget.cpp:140
|
|
||||||
msgid "Play last.fm tag radio"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: internet/lastfmservice.cpp:105
|
#: internet/lastfmservice.cpp:105
|
||||||
msgid "Play tag radio..."
|
msgid "Play tag radio..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -4469,7 +4457,7 @@ msgstr ""
|
|||||||
msgid "Your Magnatune credentials were incorrect"
|
msgid "Your Magnatune credentials were incorrect"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ui/edittagdialog.cpp:719 ui/mainwindow.cpp:2125
|
#: ui/edittagdialog.cpp:719 ui/mainwindow.cpp:2126
|
||||||
msgid ""
|
msgid ""
|
||||||
"Your gstreamer installation is missing the 'ofa' plugin. This is required "
|
"Your gstreamer installation is missing the 'ofa' plugin. This is required "
|
||||||
"for automatic tag fetching. Try installing the 'gstreamer-plugins-bad' "
|
"for automatic tag fetching. Try installing the 'gstreamer-plugins-bad' "
|
||||||
@ -4503,7 +4491,7 @@ msgid "Zero"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: playlist/playlistundocommands.cpp:37
|
#: playlist/playlistundocommands.cpp:37
|
||||||
#, c-format
|
#, c-format, qt-plural-format
|
||||||
msgid "add %n songs"
|
msgid "add %n songs"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -4558,7 +4546,7 @@ msgstr ""
|
|||||||
msgid "does not contain"
|
msgid "does not contain"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: globalsearch/globalsearchwidget.cpp:731
|
#: globalsearch/globalsearchwidget.cpp:740
|
||||||
msgid "e.g."
|
msgid "e.g."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -4627,7 +4615,7 @@ msgid "press enter"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: playlist/playlistundocommands.cpp:65 playlist/playlistundocommands.cpp:88
|
#: playlist/playlistundocommands.cpp:65 playlist/playlistundocommands.cpp:88
|
||||||
#, c-format
|
#, c-format, qt-plural-format
|
||||||
msgid "remove %n songs"
|
msgid "remove %n songs"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -2063,7 +2063,8 @@ void MainWindow::ConnectInfoView(SongInfoBase* view) {
|
|||||||
connect(player_, SIGNAL(Stopped()), view, SLOT(SongFinished()));
|
connect(player_, SIGNAL(Stopped()), view, SLOT(SongFinished()));
|
||||||
|
|
||||||
connect(view, SIGNAL(ShowSettingsDialog()), SLOT(ShowSongInfoConfig()));
|
connect(view, SIGNAL(ShowSettingsDialog()), SLOT(ShowSongInfoConfig()));
|
||||||
connect(view, SIGNAL(AddToPlaylist(QMimeData*)), SLOT(AddToPlaylist(QMimeData*)));
|
connect(view, SIGNAL(DoGlobalSearch(QString)),
|
||||||
|
ui_->global_search, SLOT(StartSearch(QString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::AddSongInfoGenerator(smart_playlists::GeneratorPtr gen) {
|
void MainWindow::AddSongInfoGenerator(smart_playlists::GeneratorPtr gen) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user