[Amarok] a971b2f Renamed "Random" sort order to "Shuffle" in the so

Teo Mrnjavac teo at kde.org
Sat Aug 7 12:56:05 CEST 2010


commit a971b2ffce2fed718c83f9a453b2dfb943a28048
Author: Teo Mrnjavac <teo at kde.org>
Date:   Sat Aug 7 14:50:45 2010 +0200

    Renamed "Random" sort order to "Shuffle" in the sorting widget, and also in the bookmark manager. Old AmarokURLs with "Random" in them are still supported but new ones are created with the label "Shuffle".
    RFC on the usability of this new string and on the way the change is handled with bookmarks.
    CCMAIL:amarok-devel at kde.org
    CCMAIL:admin at leinir.dk

diff --git a/src/playlist/PlaylistBreadcrumbItem.cpp b/src/playlist/PlaylistBreadcrumbItem.cpp
index 97b7f48..7e0a9cd 100644
--- a/src/playlist/PlaylistBreadcrumbItem.cpp
+++ b/src/playlist/PlaylistBreadcrumbItem.cpp
@@ -54,7 +54,7 @@ BreadcrumbItem::BreadcrumbItem( BreadcrumbLevel *level, QWidget *parent )
 
     //And then the main breadcrumb button...
     bool noArrow = false;
-    if( m_name == "Random" )
+    if( m_name == "Shuffle" )
         noArrow = true;
     m_mainButton = new BreadcrumbItemSortButton( level->icon(), level->prettyName(), noArrow, this );
 
@@ -119,8 +119,8 @@ BreadcrumbAddMenuButton::BreadcrumbAddMenuButton( QWidget *parent )
         //FIXME: this menu should have the same margins as other Playlist::Breadcrumb and
         //       BrowserBreadcrumb menus.
     }
-    QAction *action = m_menu->addAction( KIcon( "media-playlist-shuffle" ), QString( i18n( "Random" ) ) );
-    action->setData( "Random" );
+    QAction *action = m_menu->addAction( KIcon( "media-playlist-shuffle" ), QString( i18n( "Shuffle" ) ) );
+    action->setData( "Shuffle" );
 
     connect( m_menu, SIGNAL( triggered( QAction* ) ), this, SLOT( siblingTriggered( QAction* ) ) );
 
@@ -139,7 +139,7 @@ BreadcrumbAddMenuButton::siblingTriggered( QAction *action )
 void
 BreadcrumbAddMenuButton::updateMenu( const QStringList &usedBreadcrumbLevels )
 {
-    if( usedBreadcrumbLevels.contains( "Random" ) )
+    if( usedBreadcrumbLevels.contains( "Shuffle" ) )
         hide();
     else
         show();
diff --git a/src/playlist/PlaylistBreadcrumbLevel.cpp b/src/playlist/PlaylistBreadcrumbLevel.cpp
index f2d4e7a..e86d455 100644
--- a/src/playlist/PlaylistBreadcrumbLevel.cpp
+++ b/src/playlist/PlaylistBreadcrumbLevel.cpp
@@ -24,17 +24,17 @@ namespace Playlist
 BreadcrumbLevel::BreadcrumbLevel( QString internalColumnName )
     : m_name( internalColumnName )
 {
-    if( m_name == "Random" )
+    if( m_name == "Shuffle" )
     {
         m_icon = KIcon( "media-playlist-shuffle" );
-        m_prettyName = i18n( "Random" );
+        m_prettyName = i18n( "Shuffle" );
     }
     else
     {
         m_icon = KIcon( iconNames.at( internalColumnNames.indexOf( internalColumnName ) ) );
         m_prettyName = columnNames.at( internalColumnNames.indexOf( internalColumnName ) );
     }
-    
+
     for( int i = 0; i < NUM_COLUMNS; ++i )  //might be faster if it used a const_iterator
     {
         QString currentInternalColumnName = internalColumnNames.at( i );
@@ -44,8 +44,8 @@ BreadcrumbLevel::BreadcrumbLevel( QString internalColumnName )
         m_siblings.insert( currentInternalColumnName,
                            QPair< KIcon, QString>( KIcon( iconNames.at( i ) ), columnNames.at( i ) ) );
     }
-    if( m_name != "Random" )
-        m_siblings.insert( "Random", QPair< KIcon, QString>( KIcon( "media-playlist-shuffle" ), i18n("Random" ) ) );
+    if( m_name != "Shuffle" )
+        m_siblings.insert( "Shuffle", QPair< KIcon, QString>( KIcon( "media-playlist-shuffle" ), i18n("Shuffle" ) ) );
 }
 
 BreadcrumbLevel::~BreadcrumbLevel()
diff --git a/src/playlist/PlaylistSortWidget.cpp b/src/playlist/PlaylistSortWidget.cpp
index 0afec0c..a11c4b3 100644
--- a/src/playlist/PlaylistSortWidget.cpp
+++ b/src/playlist/PlaylistSortWidget.cpp
@@ -66,9 +66,9 @@ SortWidget::SortWidget( QWidget *parent )
         QStringList levels = sortPath.split( '-' );
         foreach( const QString &level, levels )
         {
-            if( level == QString( "Random" ) )
+            if( level == QString( "Shuffle" ) || level == QString( "Random" ) ) //we keep "Random" for compatibility
             {
-                addLevel( level );
+                addLevel( QString( "Shuffle" ) );
                 break;
             }
             QStringList levelParts = level.split( '_' );
@@ -147,7 +147,7 @@ SortWidget::updateSortScheme()
     for( int i = 0; i < m_ribbon->count(); ++i )    //could be faster if done with iterator
     {
         QString name( qobject_cast< BreadcrumbItem * >( m_ribbon->itemAt( i )->widget() )->name() );
-        int category = ( name == "Random" ) ? -1 : internalColumnNames.indexOf( name );
+        int category = ( name == "Shuffle" ) ? -1 : internalColumnNames.indexOf( name );
         Qt::SortOrder sortOrder = qobject_cast< BreadcrumbItem * >( m_ribbon->itemAt( i )->widget() )->sortOrder();
         scheme.addLevel( SortLevel( category, sortOrder ) );
     }
@@ -165,7 +165,7 @@ SortWidget::sortPath() const
     {
         QString name( qobject_cast< BreadcrumbItem * >( m_ribbon->itemAt( i )->widget() )->name() );
         Qt::SortOrder sortOrder = qobject_cast< BreadcrumbItem * >( m_ribbon->itemAt( i )->widget() )->sortOrder();
-        QString level = ( name == "Random" ) ? name : ( name + "_" + ( sortOrder ? "des" : "asc" ) );
+        QString level = ( name == "Shuffle" ) ? name : ( name + "_" + ( sortOrder ? "des" : "asc" ) );
         path.append( ( i == m_ribbon->count() - 1 ) ? level : ( level + '-' ) );
     }
     return path;
@@ -180,7 +180,7 @@ SortWidget::prettySortPath() const
         QString name( qobject_cast< BreadcrumbItem * >( m_ribbon->itemAt( i )->widget() )->name() );
         QString prettyName( qobject_cast< BreadcrumbItem * >( m_ribbon->itemAt( i )->widget() )->prettyName() );
         Qt::SortOrder sortOrder = qobject_cast< BreadcrumbItem * >( m_ribbon->itemAt( i )->widget() )->sortOrder();
-        QString prettyLevel = ( name == "Random" ) ? prettyName : ( prettyName + ( sortOrder ? "↓" : "↑" ) );
+        QString prettyLevel = ( name == "Shuffle" ) ? prettyName : ( prettyName + ( sortOrder ? "↓" : "↑" ) );
         prettyPath.append( ( i == m_ribbon->count() - 1 ) ? prettyLevel : ( prettyLevel + " > " ) );
         //TODO: see how this behaves on RTL systems
     }
diff --git a/src/playlist/PlaylistViewUrlRunner.cpp b/src/playlist/PlaylistViewUrlRunner.cpp
index b62e940..749233e 100644
--- a/src/playlist/PlaylistViewUrlRunner.cpp
+++ b/src/playlist/PlaylistViewUrlRunner.cpp
@@ -69,9 +69,9 @@ ViewUrlRunner::run( AmarokUrl url )
         QStringList levels = sortPath.split( '-' );
         foreach( const QString &level, levels )
         {
-            if( level == QString( "Random" ) )
+            if( level == QString( "Random" ) || level == QString( "Shuffle" ) ) //we keep "Random" for compatibility
             {
-                playlistDock->sortWidget()->addLevel( level );
+                playlistDock->sortWidget()->addLevel( QString( "Shuffle" ) );
                 break;
             }
             QStringList levelParts = level.split( '_' );
diff --git a/src/playlist/proxymodels/SortScheme.cpp b/src/playlist/proxymodels/SortScheme.cpp
index 9e74ba5..0746559 100644
--- a/src/playlist/proxymodels/SortScheme.cpp
+++ b/src/playlist/proxymodels/SortScheme.cpp
@@ -88,7 +88,7 @@ QString
 SortLevel::prettyName() const
 {
     if( m_category == -1 )
-        return i18n( "Random" );
+        return i18n( "Shuffle" );
     return columnNames.at( m_category );
 }
 


More information about the Amarok-devel mailing list