[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdeextragear-1/amarok/src
From:       Ladislav Strojil <Ladislav () Strojil ! cz>
Date:       2005-05-01 7:06:42
Message-ID: 20050501070642.877D9635 () office ! kde ! org
[Download RAW message or body]

CVS commit by strojil: 

Don't show duplicate entries in MusicBrainz results dialog.


  M +24 -1     ktrm.cpp   1.12
  M +6 -1      ktrm.h   1.7


--- kdeextragear-1/amarok/src/ktrm.cpp  #1.11:1.12
@@ -286,6 +286,20 @@ public:
     int year;
     double relevance;
+
+    bool operator== (const KTRMResultPrivate &r) const;
 };
 
+bool KTRMResult::KTRMResultPrivate::operator==(const KTRMResultPrivate &r) const
+{
+        return (
+                        title == r.title &&
+                        artist == r.artist &&
+                        album == r.album &&
+                        track == r.track &&
+                        year == r.year &&
+                        relevance == r.relevance
+               );
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // KTRMResult public methods
@@ -384,4 +398,12 @@ KTRMResult &KTRMResult::operator= (const
 }
 
+bool KTRMResult::operator== (const KTRMResult &r) const
+{
+#if HAVE_TUNEPIMP
+    return *d == *(r.d);
+#endif
+    return false;
+}
+
 
 bool KTRMResult::isEmpty() const
@@ -544,5 +566,5 @@ void KTRMLookup::collision()
                     1 * stringSimilarity(strList,result.d->album);
 
-                d->results.append(result);
+                if(!d->results.contains(result)) d->results.append(result);
             }
             break;
@@ -558,4 +580,5 @@ void KTRMLookup::collision()
     tr_Unlock(track);
     qHeapSort(d->results);
+    
     finished();
 #endif

--- kdeextragear-1/amarok/src/ktrm.h  #1.6:1.7
@@ -91,8 +91,13 @@ public:
 
     /**
-     * Basic assignment opperator; required for the QTL
+     * Basic assignment operator; required for the QTL
      */
     KTRMResult &operator= (const KTRMResult &r);
 
+    /**
+     * Basic comparison operator; required for the QTL
+     */
+    bool operator== (const KTRMResult &r) const;
+
 private:
     class KTRMResultPrivate;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic