1 /*
2 * Strawberry Music Player
3 * This file was part of Clementine.
4 * Copyright 2010, David Sansome <me@davidsansome.com>
5 * Copyright 2013-2021, Jonas Kvinge <jonas@jkvinge.net>
6 *
7 * Strawberry is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * Strawberry is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22 #include "config.h"
23
24 #include <QCoreApplication>
25 #include <QWidget>
26 #include <QDialog>
27 #include <QDialogButtonBox>
28 #include <QString>
29 #include <QStringBuilder>
30 #include <QFlags>
31 #include <QFont>
32 #include <QLabel>
33 #include <QPushButton>
34 #include <QKeySequence>
35 #include <QTextBrowser>
36
37 #include "about.h"
38 #include "ui_about.h"
39
About(QWidget * parent)40 About::About(QWidget *parent) : QDialog(parent) {
41
42 ui_.setupUi(this);
43 setWindowFlags(windowFlags()|Qt::WindowStaysOnTopHint);
44 setWindowTitle(tr("About Strawberry"));
45
46 strawberry_authors_ \
47 << Person("Jonas Kvinge", "jonas@jkvinge.net");
48
49 strawberry_contributors_ \
50 << Person("Gavin D. Howard", "yzena.tech@gmail.com")
51 << Person("Martin Delille", "martin@delille.org");
52
53 clementine_authors_
54 << Person("David Sansome", "me@davidsansome.com")
55 << Person("John Maguire", "john.maguire@gmail.com")
56 << Person(QString::fromUtf8("Paweł Bara"), "keirangtp@gmail.com")
57 << Person("Arnaud Bienner", "arnaud.bienner@gmail.com");
58
59 clementine_contributors_ \
60 << Person("Jakub Stachowski", "qbast@go2.pl")
61 << Person("Paul Cifarelli", "paul@cifarelli.net")
62 << Person("Felipe Rivera", "liebremx@users.sourceforge.net")
63 << Person("Alexander Peitz")
64 << Person("Andreas Muttscheller", "asfa194@gmail.com")
65 << Person("Mark Furneaux", "mark@furneaux.ca")
66 << Person("Florian Bigard", "florian.bigard@gmail.com")
67 << Person("Alex Bikadorov", "wegwerf@abwesend.de")
68 << Person("Mattias Andersson", "mandersson444@gmail.com")
69 << Person("Alan Briolat", "alan.briolat@gmail.com")
70 << Person("Arun Narayanankutty", "n.arun.lifescience@gmail.com")
71 << Person(QString::fromUtf8("Bartłomiej Burdukiewicz"), "dev.strikeu@gmail.com")
72 << Person("Andre Siviero", "altsiviero@gmail.com")
73 << Person("Santiago Gil")
74 << Person("Tyler Rhodes", "tyler.s.rhodes@gmail.com")
75 << Person("Vikram Ambrose", "ambroseworks@gmail.com")
76 << Person("David Guillen", "david@davidgf.net")
77 << Person("Krzysztof Sobiecki", "sobkas@gmail.com")
78 << Person("Valeriy Malov", "jazzvoid@gmail.com")
79 << Person("Nick Lanham", "nick@afternight.org");
80
81 strawberry_thanks_ \
82 << Person("Mark Kretschmann", "kretschmann@kde.org")
83 << Person("Max Howell", "max.howell@methylblue.com")
84 << Person("Artur Rona", "artur.rona@gmail.com")
85 << Person("Robert-André Mauchin", "eclipseo@fedoraproject.org")
86 << Person("Thomas Pierson", "contact@thomaspierson.fr")
87 << Person("Fabio Loli", "fabio.lolix@gmail.com");
88
89 QFont title_font;
90 title_font.setBold(true);
91 title_font.setPointSize(title_font.pointSize() + 4);
92
93 ui_.label_title->setFont(title_font);
94 ui_.label_title->setText(windowTitle());
95 ui_.label_text->setText(MainHtml());
96 ui_.text_contributors->document()->setDefaultStyleSheet(QString("a {color: %1; }").arg(palette().text().color().name()));
97 ui_.text_contributors->setText(ContributorsHtml());
98
99 ui_.buttonBox->button(QDialogButtonBox::Close)->setShortcut(QKeySequence::Close);
100
101 }
102
MainHtml() const103 QString About::MainHtml() const {
104
105 QString ret;
106
107 ret += QString("<p>");
108 ret += tr("Version %1").arg(QCoreApplication::applicationVersion());
109 ret += QString("</p>");
110
111 ret += QString("<p>");
112 ret += tr("Strawberry is a music player and music collection organizer.");
113 ret += QString("<br />");
114 ret += tr("It is a fork of Clementine released in 2018 aimed at music collectors and audiophiles.");
115 ret += QString("</p>");
116
117 ret += QString("<p>");
118 ret += tr("Strawberry is free software released under GPL. The source code is available on %1").arg(QString("<a style=\"color:%1;\" href=\"https://github.com/strawberrymusicplayer/strawberry\">GitHub</a>.").arg(palette().text().color().name()));
119 ret += QString("<br />");
120 ret += tr("You should have received a copy of the GNU General Public License along with this program. If not, see %1").arg(QString("<a style=\"color:%1;\" href=\"http://www.gnu.org/licenses/\">http://www.gnu.org/licenses/</a>").arg(palette().text().color().name()));
121 ret += QString("</p>");
122
123 ret += QString("<p>");
124 ret += tr("If you like Strawberry and can make use of it, consider sponsoring or donating.");
125 ret += QString("<br />");
126 ret += tr("You can sponsor the author on %1. You can also make a one-time payment through %2.").arg(
127 QString("<a style=\"color:%1;\" href=\"https://github.com/sponsors/jonaski\">GitHub sponsors</a>").arg(palette().text().color().name()),
128 QString("<a style=\"color:%1;\" href=\"https://paypal.me/jonaskvinge\">paypal.me/jonaskvinge</a>").arg(palette().text().color().name())
129 );
130
131 ret += QString("</p>");
132
133 return ret;
134
135 }
136
ContributorsHtml() const137 QString About::ContributorsHtml() const {
138
139 QString ret;
140
141 ret += QString("<p>");
142 ret += "<b>";
143 ret += tr("Author and maintainer");
144 ret += "</b>";
145 for (const Person &person : strawberry_authors_) {
146 ret += "<br />" + PersonToHtml(person);
147 }
148 ret += QString("</p>");
149
150 ret += QString("<p>");
151 ret += "<b>";
152 ret += tr("Contributors");
153 ret += "</b>";
154 for (const Person &person : strawberry_contributors_) {
155 ret += "<br />" + PersonToHtml(person);
156 }
157 ret += QString("</p>");
158
159 ret += QString("<p>");
160 ret += "<b>";
161 ret += tr("Clementine authors");
162 ret += "</b>";
163 for (const Person &person : clementine_authors_) {
164 ret += "<br />" + PersonToHtml(person);
165 }
166 ret += QString("</p>");
167
168 ret += QString("<p>");
169 ret += "<b>";
170 ret += tr("Clementine contributors");
171 ret += "</b>";
172 for (const Person &person : clementine_contributors_) {
173 ret += "<br />" + PersonToHtml(person);
174 }
175 ret += QString("</p>");
176
177 ret += QString("<p>");
178 ret += "<b>";
179 ret += tr("Thanks to");
180 ret += "</b>";
181 for (const Person &person : strawberry_thanks_) {
182 ret += "<br />" + PersonToHtml(person);
183 }
184 ret += QString("</p>");
185
186 ret += QString("<p>");
187 ret += tr("Thanks to all the other Amarok and Clementine contributors.");
188 ret += QString("</p>");
189 return ret;
190
191 }
192
PersonToHtml(const Person & person)193 QString About::PersonToHtml(const Person &person) {
194
195 if (person.email.isEmpty()) {
196 return person.name;
197 }
198 else {
199 return QString("%1 <<a href=\"mailto:%2\">%3</a>>").arg(person.name, person.email, person.email);
200 }
201 }
202