picard/0001-Introduce-new-cover-art-thumbnail-class.patch
Olaf Hering b6d44fd48e Accepting request 457107 from home:alarrosa:branches:multimedia:apps
- Update to version 1.4.0
  * Bugfix: AcoustID submission fails with code 299 (PICARD-82)
  * Bugfix: Ignoring "hip hop rap" folksonomy tags also ignores "rap", "hip hop", etc. (PICARD-335)
  * Bugfix: Picard downloads multiple 'front' images instead of just first one. (PICARD-350)
  * Bugfix: Saving hidden file with only an extension drops the extension (PICARD-357)
  * Bugfix: Add directory opens in "wrong" dir (PICARD-366)
  * Bugfix: Picard should de-duplicate work lists (PICARD-375)
  * Bugfix: Tree selector in Options window is partially obscured, pane too narrow (PICARD-408)
  * Bugfix: tag acoustid_id can not be removed or deleted in script, renaming or plugin (PICARD-419)
  * Bugfix: Can't remove value from field (PICARD-546)
  * Bugfix: Can't open Options (PICARD-592)
  * Bugfix: "Tags from filenames" action stays enabled even if it is unavailable. (PICARD-688)
  * Bugfix: Using the first image type as filename changes the name of front images (PICARD-701)
  * Bugfix: Fingerprint Submission Failes if AcoustID tags are present and/or invalid (PICARD-706)
  * Bugfix: Picard moves into the selected folder (PICARD-726)
  * Bugfix: Picard does not support (recording) relationship credits (PICARD-730)
  * Bugfix: Picard repeats/duplicates field data (PICARD-748)
  * Bugfix: Number of pending web requests is not decremented on exceptions in the handler (PICARD-751)
  * Bugfix: Divide by zero error in _convert_folksonomy_tags_to_genre when no tag at the release/release group level (  PICARD-753)
  * Bugfix: Directory tree (file browser) not sorted for non-system drives under Windows (PICARD-754)
  * Bugfix: Crash when loading release with only zero count tags (PICARD-759)
  * Bugfix: No name and no window grouping in gnome-shell Alt-Tab app switcher (PICARD-761)
  * Bugfix: Lookup in Browser does not and can not load HTTPS version of musicbrainz.org (PICARD-764)
  * Bugfix: Unable to login using oauth via Picard options with Server Port set to 443 (PICARD-766)
  * Bugfix: "AttributeError: 'MetadataBox' object has no attribute 'resize_columns'" when enabling the cover art box (  PICARD-775)
  * Bugfix: Pre-gap tracks are not counted in absolutetracknumber (PICARD-778)
  * Bugfix: CAA cover art provider runs even if cover art has already been loaded (PICARD-780)
  * Bugfix: Toggling Embed Cover Art in Tags and restarting doesn't have the expected behavior (PICARD-782)
  * Bugfix: XMLWS redirects incorrectly (PICARD-788)
  * Bugfix: Handle empty collection-list in web server response (PICARD-798)

OBS-URL: https://build.opensuse.org/request/show/457107
OBS-URL: https://build.opensuse.org/package/show/multimedia:apps/picard?expand=0&rev=47
2017-02-14 14:37:35 +00:00

88 lines
3.0 KiB
Diff

From b56a1ac307c2183052334926114cb71da41f3956 Mon Sep 17 00:00:00 2001
From: Sambhav Kothari <sambhavs.email@gmail.com>
Date: Sun, 22 Jan 2017 18:49:00 +0530
Subject: [PATCH 1/9] Introduce new cover-art thumbnail class
---
picard/ui/coverartbox.py | 64 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/picard/ui/coverartbox.py b/picard/ui/coverartbox.py
index fc515877..a2ca057f 100644
--- a/picard/ui/coverartbox.py
+++ b/picard/ui/coverartbox.py
@@ -67,6 +67,70 @@ class ActiveLabel(QtGui.QLabel):
if accepted:
event.acceptProposedAction()
+class CoverArtThumbnail(ActiveLabel):
+
+ def __init__(self, active=False, drops=False, *args, **kwargs):
+ super(CoverArtThumbnail, self).__init__(active, drops, *args, **kwargs)
+ self.data = None
+ self.shadow = QtGui.QPixmap(":/images/CoverArtShadow.png")
+ self.release = None
+ self.setPixmap(self.shadow)
+ self.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignHCenter)
+ self.clicked.connect(self.open_release_page)
+ self.imageDropped.connect(self.fetch_remote_image)
+
+ def show(self):
+ self.set_data(self.data, True)
+
+ def set_data(self, data, force=False, pixmap=None):
+ if not force and self.data == data:
+ return
+
+ self.data = data
+ if not force and self.parent().isHidden():
+ return
+
+ cover = self.shadow
+ if self.data:
+ if pixmap is None:
+ pixmap = QtGui.QPixmap()
+ pixmap.loadFromData(self.data.data)
+ if not pixmap.isNull():
+ offx, offy, w, h = (1, 1, 121, 121)
+ cover = QtGui.QPixmap(self.shadow)
+ pixmap = pixmap.scaled(w, h, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
+ painter = QtGui.QPainter(cover)
+ bgcolor = QtGui.QColor.fromRgb(0, 0, 0, 128)
+ painter.fillRect(QtCore.QRectF(offx, offy, w, h), bgcolor)
+ x = offx + (w - pixmap.width()) / 2
+ y = offy + (h - pixmap.height()) / 2
+ painter.drawPixmap(x, y, pixmap)
+ painter.end()
+ self.setPixmap(cover)
+
+ def set_metadata(self, metadata):
+ data = None
+ if metadata and metadata.images:
+ for image in metadata.images:
+ if image.is_front_image():
+ data = image
+ break
+ else:
+ # There's no front image, choose the first one available
+ data = metadata.images[0]
+ self.set_data(data)
+ release = None
+ if metadata:
+ release = metadata.get("musicbrainz_albumid", None)
+ if release:
+ self.setActive(True)
+ self.setToolTip(_(u"View release on MusicBrainz"))
+ else:
+ self.setActive(False)
+ self.setToolTip("")
+ self.release = release
+
+
class CoverArtBox(QtGui.QGroupBox):
--
2.11.0