mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-30 06:32:36 +00:00
Added "All (count metakey)" to MetadataFilter.
This commit is contained in:
parent
448ad89fc4
commit
45bb01e3b5
@ -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();
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user