mirror of
https://github.com/clementine-player/Clementine
synced 2025-02-02 20:36:44 +01:00
Handle various artists properly in the global search tree, and make pressing Esc in the results list put the focus back on the search box
This commit is contained in:
parent
7b4ff1d2ee
commit
0b754b9b66
@ -73,7 +73,8 @@ void GlobalSearchModel::AddResults(const SearchProvider::ResultList& results) {
|
||||
}
|
||||
|
||||
// Create the item
|
||||
QStandardItem* item = new QStandardItem(result.metadata_.title());
|
||||
QStandardItem* item = new QStandardItem;
|
||||
item->setText(result.metadata_.TitleWithCompilationArtist());
|
||||
item->setData(QVariant::fromValue(result), Role_Result);
|
||||
item->setData(sort_index, Role_ProviderIndex);
|
||||
|
||||
@ -95,8 +96,13 @@ QStandardItem* GlobalSearchModel::BuildContainers(
|
||||
|
||||
switch (group_by_[level]) {
|
||||
case LibraryModel::GroupBy_Artist:
|
||||
display_text = LibraryModel::TextOrUnknown(s.artist());
|
||||
sort_text = LibraryModel::SortTextForArtist(s.artist());
|
||||
if (s.is_compilation()) {
|
||||
display_text = tr("Various artists");
|
||||
sort_text = "aaaaaa";
|
||||
} else {
|
||||
display_text = LibraryModel::TextOrUnknown(s.artist());
|
||||
sort_text = LibraryModel::SortTextForArtist(s.artist());
|
||||
}
|
||||
has_artist_icon = true;
|
||||
break;
|
||||
|
||||
|
@ -69,6 +69,7 @@ GlobalSearchView::GlobalSearchView(Application* app, QWidget* parent)
|
||||
|
||||
connect(ui_->search, SIGNAL(textChanged(QString)), SLOT(TextEdited(QString)));
|
||||
connect(ui_->results, SIGNAL(AddToPlaylistSignal(QMimeData*)), SIGNAL(AddToPlaylist(QMimeData*)));
|
||||
connect(ui_->results, SIGNAL(FocusOnFilterSignal(QKeyEvent*)), SLOT(FocusOnFilter(QKeyEvent*)));
|
||||
|
||||
// Set the appearance of the results list
|
||||
ui_->results->setItemDelegate(new GlobalSearchItemDelegate(this));
|
||||
@ -433,3 +434,8 @@ void GlobalSearchView::hideEvent(QHideEvent* e) {
|
||||
update_suggestions_timer_->stop();
|
||||
QWidget::hideEvent(e);
|
||||
}
|
||||
|
||||
void GlobalSearchView::FocusOnFilter(QKeyEvent* event) {
|
||||
ui_->search->set_focus();
|
||||
QApplication::sendEvent(ui_->search, event);
|
||||
}
|
||||
|
@ -72,6 +72,8 @@ private slots:
|
||||
void AddResults(int id, const SearchProvider::ResultList& results);
|
||||
void ArtLoaded(int id, const QPixmap& pixmap);
|
||||
|
||||
void FocusOnFilter(QKeyEvent* event);
|
||||
|
||||
void AddSelectedToPlaylist();
|
||||
void LoadSelected();
|
||||
void OpenSelectedInNewPlaylist();
|
||||
|
Loading…
x
Reference in New Issue
Block a user