Bug 122858 - Change "The Artist" to "Artist, The" in the Cover Manager
Summary: Change "The Artist" to "Artist, The" in the Cover Manager
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-28 21:35 UTC by Gleb Litvjak
Modified: 2006-06-11 12:32 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gleb Litvjak 2006-02-28 21:35:55 UTC
Version:           1.4 SVN (using KDE KDE 3.5.1)
Installed from:    Gentoo Packages
OS:                Linux

Long ago, by popular demand amaroK developers implemented a feature to convert "The Artist" to "Artist, The" in the Collection Browser. However, the Cover Manager still displays "The Artist". I think tis is inconsistent and even frustrating. Wouldn't it be good if Cover Manager followed the same policy as the Collection Browser?
Comment 1 Seb Ruiz 2006-03-07 03:11:09 UTC
SVN commit 516411 by seb:

Change "The Artist" to "Artist, The" in the Cover Manager, like the collection browser
BUG:122858


 M  +2 -0      ChangeLog  
 M  +30 -8     src/covermanager.cpp  


--- trunk/extragear/multimedia/amarok/ChangeLog #516410:516411
@@ -4,6 +4,8 @@
 
 VERSION 1.4-beta3:
   FEATURES:
+    * Ignore 'The ' in artist names when sorting in the cover manager, as per
+      the collection browser. (BR 122858)
     * Add autocompletion to the composer field in the tag dialog. (BR 123026)
 
   CHANGES:
--- trunk/extragear/multimedia/amarok/src/covermanager.cpp #516410:516411
@@ -7,6 +7,7 @@
 #include "browserToolBar.h"
 #include "clicklineedit.h"
 #include "debug.h"
+#include "collectionbrowser.h" //manipulateThe()
 #include "collectiondb.h"
 #include "config.h"
 #include "coverfetcher.h"
@@ -84,23 +85,34 @@
     m_artistView = new KListView( this );
     m_artistView->addColumn(i18n( "Albums By" ));
     m_artistView->setFullWidth( true );
-    m_artistView->setSorting( -1 );    //no sort
+    m_artistView->setSorting( 0 );
     m_artistView->setMinimumWidth( 180 );
-    KListViewItem *item = new KListViewItem( m_artistView, i18n( "All Albums" ) );
-    item->setPixmap( 0, SmallIcon("cdrom_unmount") );
+    KListViewItem *item = 0;
 
     //load artists from the collection db
     const QStringList artists = CollectionDB::instance()->artistList( false, false );
-    foreach( artists )  {
-        item = new KListViewItem( m_artistView, item, *it );
+    foreach( artists )
+    {
+        QString artist = *it;
+        if( artist.startsWith( "The " ) )
+            CollectionView::instance()->manipulateThe( artist, true );
+
+        item = new KListViewItem( m_artistView, item, artist );
         item->setPixmap( 0, SmallIcon("personal") );
     }
+    m_artistView->sort();
+
+    m_artistView->setSorting( -1 );
+    KListViewItem *last = item;
+    item = new KListViewItem( m_artistView, 0, i18n( "All Albums" ) );
+    item->setPixmap( 0, SmallIcon("cdrom_unmount") );
+
     QueryBuilder qb;
     qb.addReturnValue( QueryBuilder::tabAlbum, QueryBuilder::valName );
     qb.setOptions( QueryBuilder::optOnlyCompilations | QueryBuilder::optRemoveDuplicates );
     qb.setLimit( 0, 1 );
     if ( qb.run().count() ) {
-        item = new KListViewItem( m_artistView, item, i18n( "Various Artists" ) );
+        item = new KListViewItem( m_artistView, last, i18n( "Various Artists" ) );
         item->setPixmap( 0, SmallIcon("personal") );
     }
 
@@ -347,6 +359,11 @@
     if( item->depth() ) //album item
         return;
 
+    QString artist = item->text(0);
+
+    if( artist.endsWith( ", The" ) )
+        CollectionView::instance()->manipulateThe( artist, false );
+
     m_coverView->clear();
     m_coverItems.clear();
 
@@ -383,7 +400,7 @@
     qb.setOptions( QueryBuilder::optNoCompilations );
 
     if ( item != m_artistView->firstChild() )
-        qb.addMatches( QueryBuilder::tabArtist, item->text( 0 ) );
+        qb.addMatches( QueryBuilder::tabArtist, artist );
 
     albums = qb.run();
 
@@ -808,7 +825,12 @@
         else if( m_artistView->selectedItem() ) {
             text = i18n( "1 album", "%n albums", totalCounter );
             if( m_artistView->selectedItem() != m_artistView->firstChild() ) //showing albums by an artist
-                text += i18n( " by " ) + m_artistView->selectedItem()->text(0);
+            {
+                QString artist = m_artistView->selectedItem()->text(0);
+                if( artist.endsWith( ", The" ) )
+                    CollectionView::instance()->manipulateThe( artist, false );
+                text += i18n( " by " ) + artist;
+            }
         }
 
         if( missingCounter )