diff --git a/src/cube/MetadataFilterController.cpp b/src/cube/MetadataFilterController.cpp index 6692dfff4..c5b796fb3 100644 --- a/src/cube/MetadataFilterController.cpp +++ b/src/cube/MetadataFilterController.cpp @@ -71,8 +71,18 @@ void MetadataFilterController::OnSelectionChanged(){ this->parent->selectionQuery.ClearMetadata(this->metadataKeyA.c_str()); - for(win32cpp::ListView::RowIndexList::iterator row=selectedRows.begin();row!=selectedRows.end();++row){ - this->parent->selectionQuery.SelectMetadata(this->metadataKeyA.c_str(),metadata[*row]->id); + bool firstRowSelected(false); + for(win32cpp::ListView::RowIndexList::iterator row=selectedRows.begin();row!=selectedRows.end() && !firstRowSelected;++row){ + if((*row)==0){ + firstRowSelected = true; + }else{ + this->parent->selectionQuery.SelectMetadata(this->metadataKeyA.c_str(),metadata[(*row)-1]->id); + } + } + + // Check if first row is selected, then clear the list + if(firstRowSelected){ + this->parent->selectionQuery.ClearMetadata(this->metadataKeyA.c_str()); } this->parent->SendQuery(); diff --git a/src/cube/MetadataFilterModel.cpp b/src/cube/MetadataFilterModel.cpp index 69c7fd190..fb8e98e63 100644 --- a/src/cube/MetadataFilterModel.cpp +++ b/src/cube/MetadataFilterModel.cpp @@ -62,8 +62,13 @@ using namespace musik::cube; uistring MetadataFilterModel::CellValueToString(int rowIndex, ListView::ColumnRef column) { typedef boost::basic_format format; + + if(rowIndex==0){ + return (format(_T("All (%1% %2%)")) % this->metadata.size() % this->controller->metadataKey).str(); + } + if(rowIndexmetadata.size()){ - return win32cpp::Escape(this->metadata[rowIndex]->value); + return win32cpp::Escape(this->metadata[rowIndex-1]->value); }else{ return uistring(); } @@ -77,4 +82,5 @@ void MetadataFilterModel::OnMetadata(musik::core::MetadataValueVector* me this->metadata.insert(this->metadata.end(),metadata->begin(),metadata->end()); } this->SetRowCount(this->metadata.size()); + this->InvalidateData(0); // Invalidate the "All" count }