Summary: | collection browser sorts numerical columns incorrectly | ||
---|---|---|---|
Product: | [Applications] amarok | Reporter: | Aaron VonderHaar <gruen0aermel> |
Component: | general | Assignee: | Amarok Developers <amarok-bugs-dist> |
Status: | RESOLVED FIXED | ||
Severity: | minor | CC: | a1th0, ahlgren, Stefan.Borggraefe |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Aaron VonderHaar
2006-07-12 03:44:34 UTC
Confirming with Amarok 1.4.1 final. *** Bug 132646 has been marked as a duplicate of this bug. *** SVN commit 575764 by aumuell: numeric sort for numeric columns in flat collection view BUG: 130667 M +1 -0 ChangeLog M +38 -9 src/collectionbrowser.cpp --- trunk/extragear/multimedia/amarok/ChangeLog #575763:575764 @@ -10,6 +10,7 @@ CHANGES: BUGFIXES: + * Sort numeric columns in flat collection numerically. (BR 130667) VERSION 1.4.2: FEATURES: --- trunk/extragear/multimedia/amarok/src/collectionbrowser.cpp #575763:575764 @@ -3781,9 +3781,9 @@ w += correct; correct = 0; setColumnWidth( c, w ); - if( m_viewMode == modeFlatView ) - m_flatColumnWidths.push_back( w ); } + if( m_viewMode == modeFlatView ) + m_flatColumnWidths.push_back( w ); } } @@ -3806,7 +3806,6 @@ setColumnWidth( 0, width - col1width ); } - // Needed for correct redraw of bubble help triggerUpdate(); } @@ -3911,13 +3910,43 @@ // Sampler is the first one in iPod view CollectionView* view = static_cast<CollectionView*>( listView() ); if( view->viewMode() == CollectionView::modeIpodView ) - { - if ( m_isSampler ) - return -1; - if ( dynamic_cast<CollectionItem*>( i ) && static_cast<CollectionItem*>( i )->m_isSampler ) - return 1; - } + { + if ( m_isSampler ) + return -1; + if ( dynamic_cast<CollectionItem*>( i ) && static_cast<CollectionItem*>( i )->m_isSampler ) + return 1; + } + else if( view->viewMode() == CollectionView::modeFlatView ) + { + ia = ib = 0; + // correctly treat numeric values + switch( col ) + { + case CollectionView::Track: + case CollectionView::DiscNumber: + case CollectionView::Bitrate: + case CollectionView::Score: + case CollectionView::Rating: + case CollectionView::Playcount: + case CollectionView::BPM: + ia = a.toInt(); + ib = b.toInt(); + break; + case CollectionView::Length: + ia = a.section( ':', 0, 0 ).toInt() * 60 + a.section( ':', 1, 1 ).toInt(); + ib = b.section( ':', 0, 0 ).toInt() * 60 + b.section( ':', 1, 1 ).toInt(); + break; + } + if( ia || ib ) + { + if( ia < ib ) + return 1; + if( ia > ib ) + return -1; + return 0; + } + } // Unknown is always the first one unless we're doing iPod view, but if the two items to be compared are Unknown, // then compare the normal way *** Bug 132948 has been marked as a duplicate of this bug. *** |