[PATCH] When editing the Tracks of Multiple Files show the Directory of the Files in the TagDialog where the Files reside when all Files are local Files & are in the same Directory

Stefan Derkits stefan at derkits.net
Wed Sep 15 22:21:50 CEST 2010


---
 src/dialogs/TagDialog.cpp |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/dialogs/TagDialog.cpp b/src/dialogs/TagDialog.cpp
index 68fc5e3..26d4eb8 100644
--- a/src/dialogs/TagDialog.cpp
+++ b/src/dialogs/TagDialog.cpp
@@ -1193,9 +1193,10 @@ TagDialog::readMultipleTracks()
     m_currentData = QVariantMap();
 
     QVariantMap first = dataForTrack( it.peekNext() );
+    QString firstDirectory = it.peekNext()->playableUrl().directory();
 
     bool artist=true, album=true, genre=true, comment=true, year=true,
-         score=true, rating=true, composer=true, discNumber=true;
+         score=true, rating=true, composer=true, discNumber=true, directory = true;
     int songCount=0, ratingCount=0, ratingSum=0, scoreCount=0;
     double scoreSum = 0.f;
     while( it.hasNext() )
@@ -1210,6 +1211,7 @@ TagDialog::readMultipleTracks()
         }
 
         QVariantMap data = dataForTrack( next );
+        QString currDirectory = next->playableUrl().directory();
         songCount++;
         if ( data.value( Meta::Field::RATING ).toInt() )
         {
@@ -1221,11 +1223,10 @@ TagDialog::readMultipleTracks()
             scoreCount++;
             scoreSum += data.value( Meta::Field::SCORE ).toDouble();
         }
-
         if( !it.peekPrevious()->playableUrl().isLocalFile() )
         {
             // If we have a non local file, don't even lose more time comparing
-            artist = album = genre = comment = year = false;
+            artist = album = genre = comment = year = directory = false;
             score  = rating = composer = discNumber = false;
             continue;
         }
@@ -1243,6 +1244,8 @@ TagDialog::readMultipleTracks()
             composer = false;
         if ( discNumber && data.value( Meta::Field::DISCNUMBER ).toInt() != first.value( Meta::Field::DISCNUMBER ).toInt() )
             discNumber = false;
+        if ( directory && firstDirectory != currDirectory)
+            directory = false;
         //score is double internally, but we only show ints in the tab
         if ( score && data.value( Meta::Field::SCORE ).toInt() != first.value( Meta::Field::SCORE ).toInt() )
             score = false;
@@ -1289,6 +1292,15 @@ TagDialog::readMultipleTracks()
         m_currentData.insert( Meta::Field::DISCNUMBER, first.value( Meta::Field::DISCNUMBER ) );
         ui->qSpinBox_discNumber->setValue( first.value( Meta::Field::DISCNUMBER ).toInt() );
     }
+    if (directory)
+    {
+        //all files are local & have the same Directory
+        m_path = firstDirectory;
+        ui->locationLabel->show();
+        ui->kLineEdit_location->show();
+        ui->pushButton_open->show();
+        ui->kLineEdit_location->setText( firstDirectory );
+    }
     if( score )
     {
         m_currentData.insert( Meta::Field::SCORE, first.value( Meta::Field::SCORE ) );
-- 
1.7.1


--------------030809080604070709040602
Content-Type: application/octet-stream;
 name="0001-When-editing-the-Tracks-of-Multiple-Files-show-the-D.patch.sig"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename*0="0001-When-editing-the-Tracks-of-Multiple-Files-show-the-D.pa";
 filename*1="tch.sig"

iEYEABECAAYFAkyRLewACgkQlZvAMV/NgGLy9QCgxQh7k59OKw4ZL+6YAPd1TmgbCPIAn3cV
F0nAl4L8D25ilAZno+4yaIoe
--------------030809080604070709040602--


More information about the Amarok-devel mailing list