1# -*- coding: utf-8 -*- 2# 3# Picard, the next-generation MusicBrainz tagger 4# 5# Copyright (C) 2006-2014 Lukáš Lalinský 6# Copyright (C) 2008, 2013, 2018-2020 Philipp Wolfer 7# Copyright (C) 2011 Pavan Chander 8# Copyright (C) 2011, 2013 Wieland Hoffmann 9# Copyright (C) 2013 Michael Wiencek 10# Copyright (C) 2013-2015, 2018 Laurent Monin 11# Copyright (C) 2014 Ismael Olea 12# Copyright (C) 2017 Sambhav Kothari 13# 14# This program is free software; you can redistribute it and/or 15# modify it under the terms of the GNU General Public License 16# as published by the Free Software Foundation; either version 2 17# of the License, or (at your option) any later version. 18# 19# This program is distributed in the hope that it will be useful, 20# but WITHOUT ANY WARRANTY; without even the implied warranty of 21# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22# GNU General Public License for more details. 23# 24# You should have received a copy of the GNU General Public License 25# along with this program; if not, write to the Free Software 26# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 27 28from PyQt5 import QtCore 29 30from picard.const import PICARD_URLS 31from picard.formats import supported_extensions 32from picard.util import versions 33 34from picard.ui import ( 35 PicardDialog, 36 SingletonDialog, 37) 38from picard.ui.ui_aboutdialog import Ui_AboutDialog 39 40 41class AboutDialog(PicardDialog, SingletonDialog): 42 43 autorestore = False 44 45 def __init__(self, parent=None): 46 super().__init__(parent) 47 self.setAttribute(QtCore.Qt.WA_DeleteOnClose) 48 self.ui = Ui_AboutDialog() 49 self.ui.setupUi(self) 50 self._update_content() 51 52 def _update_content(self): 53 args = versions.as_dict(i18n=True) 54 55 args['third_parties_versions'] = ', '.join([ 56 ("%s %s" % (versions.version_name(name), value)) 57 .replace(' ', ' ') 58 .replace('-', '‑') # non-breaking hyphen 59 for name, value 60 in versions.as_dict(i18n=True).items() 61 if name != 'version']) 62 63 args['formats'] = ", ".join(map(lambda x: x[1:], supported_extensions())) 64 args['copyright_years'] = '2004-2021' 65 args['authors_credits'] = ", ".join([ 66 'Robert Kaye', 67 'Lukáš Lalinský', 68 'Laurent Monin', 69 'Sambhav Kothari', 70 'Philipp Wolfer', 71 ]) 72 73 # TR: Replace this with your name to have it appear in the "About" dialog. 74 args["translator_credits"] = _("translator-credits") 75 if args["translator_credits"] != "translator-credits": 76 # TR: Replace LANG with language you are translating to. 77 args["translator_credits"] = _("<br/>Translated to LANG by %s") % args["translator_credits"].replace("\n", "<br/>") 78 else: 79 args["translator_credits"] = "" 80 args['icons_credits'] = _( 81 'Icons made by Sambhav Kothari <sambhavs.email@gmail.com> ' 82 'and <a href="http://www.flaticon.com/authors/madebyoliver">Madebyoliver</a>, ' 83 '<a href="http://www.flaticon.com/authors/pixel-buddha">Pixel Buddha</a>, ' 84 '<a href="http://www.flaticon.com/authors/nikita-golubev">Nikita Golubev</a>, ' 85 '<a href="http://www.flaticon.com/authors/maxim-basinski">Maxim Basinski</a>, ' 86 '<a href="https://www.flaticon.com/authors/smashicons">Smashicons</a> ' 87 'from <a href="https://www.flaticon.com">www.flaticon.com</a>') 88 89 def strong(s): 90 return '<strong>' + s + '</strong>' 91 92 def small(s): 93 return '<small>' + s + '</small>' 94 95 def url(url, s=None): 96 if s is None: 97 s = url 98 return '<a href="%s">%s</a>' % (url, s) 99 100 text_paragraphs = [ 101 strong(_("Version %(version)s")), 102 small('%(third_parties_versions)s'), 103 strong(_("Supported formats")), 104 '%(formats)s', 105 strong(_("Please donate")), 106 _("Thank you for using Picard. Picard relies on the MusicBrainz database, which is operated by the " 107 "MetaBrainz Foundation with the help of thousands of volunteers. If you like this application please " 108 "consider donating to the MetaBrainz Foundation to keep the service running."), 109 url(PICARD_URLS['donate'], _("Donate now!")), 110 strong(_("Credits")), 111 small(_("Copyright © %(copyright_years)s %(authors_credits)s and others") + "%(translator_credits)s"), 112 small('%(icons_credits)s'), 113 strong(_("Official website")), 114 url(PICARD_URLS['home']) 115 ] 116 self.ui.label.setOpenExternalLinks(True) 117 self.ui.label.setText("".join(['<p align="center">' + p + "</p>" for p in text_paragraphs]) % args) 118