Added "All (count metakey)" to MetadataFilter.

This commit is contained in:
Daniel Önnerby 2008-04-20 21:14:56 +00:00
parent 448ad89fc4
commit 45bb01e3b5
2 changed files with 19 additions and 3 deletions

View File

@ -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();

View File

@ -62,8 +62,13 @@ using namespace musik::cube;
uistring MetadataFilterModel::CellValueToString(int rowIndex, ListView::ColumnRef column)
{
typedef boost::basic_format<uichar> format;
if(rowIndex==0){
return (format(_T("All (%1% %2%)")) % this->metadata.size() % this->controller->metadataKey).str();
}
if(rowIndex<this->metadata.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
}