summaryrefslogtreecommitdiff
path: root/nephilim/common.py
diff options
context:
space:
mode:
authorAnton Khirnov <wyskas@gmail.com>2009-09-19 10:49:10 +0200
committerAnton Khirnov <wyskas@gmail.com>2009-09-19 10:49:10 +0200
commita5019465a52dbbe17c625c1c1045427c5059fe9e (patch)
tree661759b271577b66218ec96e263b63a95cc9ed57 /nephilim/common.py
parent6f1cf7b125325ec2d95986a60ee34ca127129fc8 (diff)
Playlist: support for moving songs with drag&drop
Diffstat (limited to 'nephilim/common.py')
-rw-r--r--nephilim/common.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/nephilim/common.py b/nephilim/common.py
index 7d6ba06..e3af3ef 100644
--- a/nephilim/common.py
+++ b/nephilim/common.py
@@ -146,3 +146,35 @@ class MetadataFetcher(QtCore.QObject):
pass
self.rep.abort()
self.rep = None
+
+class SongsMimeData(QtCore.QMimeData):
+ # private
+ __songs = None
+ __plistsongs = None
+
+ def set_songs(self, songs):
+ self.__songs = songs
+
+ def songs(self):
+ return self.__songs
+
+ def set_plistsongs(self, songs):
+ self.__plistsongs = songs
+
+ def plistsongs(self):
+ return self.__plistsongs
+
+ def formats(self):
+ types = QtCore.QMimeData.formats(self)
+ if self.__songs:
+ types += MIMETYPES['songs']
+ if self.__plistsongs:
+ types += MIMETYPES['plistsongs']
+ return types
+
+ def hasFormat(self, format):
+ if format == MIMETYPES['songs'] and self.__songs:
+ return True
+ elif format == MIMETYPES['plistsongs'] and self.__plistsongs:
+ return True
+ return QtCore.QMimeData.hasFormat(self, format)