1 | /* smplayer, GUI front-end for mplayer.
|
---|
2 | Copyright (C) 2006-2013 Ricardo Villalba <rvm@users.sourceforge.net>
|
---|
3 |
|
---|
4 | This program is free software; you can redistribute it and/or modify
|
---|
5 | it under the terms of the GNU General Public License as published by
|
---|
6 | the Free Software Foundation; either version 2 of the License, or
|
---|
7 | (at your option) any later version.
|
---|
8 |
|
---|
9 | This program is distributed in the hope that it will be useful,
|
---|
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
12 | GNU General Public License for more details.
|
---|
13 |
|
---|
14 | You should have received a copy of the GNU General Public License
|
---|
15 | along with this program; if not, write to the Free Software
|
---|
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
17 | */
|
---|
18 |
|
---|
19 | #include "about.h"
|
---|
20 | #include "images.h"
|
---|
21 | #include "version.h"
|
---|
22 | #include "global.h"
|
---|
23 | #include "preferences.h"
|
---|
24 | #include "paths.h"
|
---|
25 | #include "mplayerversion.h"
|
---|
26 |
|
---|
27 | #include <QFile>
|
---|
28 | #include <QDesktopServices>
|
---|
29 |
|
---|
30 | using namespace Global;
|
---|
31 |
|
---|
32 | About::About(QWidget * parent, Qt::WindowFlags f)
|
---|
33 | : QDialog(parent, f)
|
---|
34 | {
|
---|
35 | setupUi(this);
|
---|
36 | setWindowIcon( Images::icon("logo", 64) );
|
---|
37 |
|
---|
38 | logo->setPixmap( QPixmap(":/icons-png/logo.png").scaledToHeight(64, Qt::SmoothTransformation) );
|
---|
39 | contrib_icon->setPixmap( Images::icon("contributors" ) );
|
---|
40 | translators_icon->setPixmap( Images::icon("translators" ) );
|
---|
41 | license_icon->setPixmap( Images::icon("license" ) );
|
---|
42 |
|
---|
43 | QString mplayer_version;
|
---|
44 | if (pref->mplayer_detected_version > 0) {
|
---|
45 | if (pref->mplayer_is_mplayer2) {
|
---|
46 | mplayer_version = tr("Using MPlayer2 %1").arg(pref->mplayer2_detected_version);
|
---|
47 | } else {
|
---|
48 | mplayer_version = tr("Using MPlayer %1").arg(MplayerVersion::toString(pref->mplayer_detected_version));
|
---|
49 | }
|
---|
50 | mplayer_version += "<br><br>";
|
---|
51 | } else {
|
---|
52 | mplayer_version += "<br>";
|
---|
53 | }
|
---|
54 |
|
---|
55 | info->setText(
|
---|
56 | "<b>SMPlayer</b> © 2006-2013 Ricardo Villalba <rvm@users.sourceforge.net><br><br>"
|
---|
57 | "<b>" + tr("Version: %1").arg(Version::printable()) + "</b>" +
|
---|
58 | #if PORTABLE_APP
|
---|
59 | " (" + tr("Portable Edition") + ")" +
|
---|
60 | #endif
|
---|
61 | #ifdef EXPERIMENTAL
|
---|
62 | "<br>Experimental branch<br>"
|
---|
63 | #endif
|
---|
64 | "<br>" +
|
---|
65 | tr("Using Qt %1 (compiled with Qt %2)").arg(qVersion()).arg(QT_VERSION_STR) + "<br>" +
|
---|
66 | mplayer_version +
|
---|
67 | "<b>"+ tr("Links:") +"</b><br>"+
|
---|
68 | tr("Official website:") +" "+ link("http://smplayer.sourceforge.net") +"<br>"+
|
---|
69 | tr("Support forum:") +" "+ link("http://smplayer.sourceforge.net/forum/") +"<br>"+
|
---|
70 | "<br>" +
|
---|
71 | tr("SMPlayer uses the award-winning MPlayer as playback engine. See %1")
|
---|
72 | .arg("<a href=\"http://www.mplayerhq.hu/design7/info.html\">http://www.mplayerhq.hu</a>")
|
---|
73 | );
|
---|
74 |
|
---|
75 |
|
---|
76 | QString license_text =
|
---|
77 | "<i>"
|
---|
78 | "This program is free software; you can redistribute it and/or modify "
|
---|
79 | "it under the terms of the GNU General Public License as published by "
|
---|
80 | "the Free Software Foundation; either version 2 of the License, or "
|
---|
81 | "(at your option) any later version." "</i><br><br>";
|
---|
82 |
|
---|
83 | QString license_file = Paths::doc("gpl.html", "en");
|
---|
84 | if (QFile::exists(license_file)) {
|
---|
85 | license_file = QUrl::fromLocalFile(license_file).toString();
|
---|
86 | license_text += QString("<a href=\"%1\">%2</a>").arg(license_file).arg(tr("Read the entire license"));
|
---|
87 | }
|
---|
88 |
|
---|
89 | if ((pref->language != "en") && (pref->language != "en_US")) {
|
---|
90 | QString license_trans_file = Paths::doc("gpl.html", pref->language, false);
|
---|
91 | //qDebug("license_trans_file: %s", license_trans_file.toUtf8().constData());
|
---|
92 | if (QFile::exists(license_trans_file)) {
|
---|
93 | license_trans_file = QUrl::fromLocalFile(license_trans_file).toString();
|
---|
94 | license_text += QString("<br><a href=\"%1\">%2</a>").arg(license_trans_file).arg(tr("Read a translation"));
|
---|
95 | }
|
---|
96 | }
|
---|
97 | license->setText(license_text);
|
---|
98 | license->setOpenLinks(false);
|
---|
99 | license->setOpenExternalLinks(false);
|
---|
100 | connect(license, SIGNAL(anchorClicked(const QUrl &)), this, SLOT(openLink(const QUrl&)));
|
---|
101 |
|
---|
102 | translators->setHtml( getTranslators() );
|
---|
103 |
|
---|
104 | contributions->setText(
|
---|
105 | tr("SMPlayer logo by %1").arg("Charles Barcza <kbarcza@blackpanther.hu>") + "<br><br>" +
|
---|
106 | tr("Packages for Windows created by %1").arg("redxii <redxii@users.sourceforge.net>") + "<br><br>" +
|
---|
107 | tr("Many other people contributed with patches. See the Changelog for details.")
|
---|
108 | );
|
---|
109 |
|
---|
110 |
|
---|
111 | // Copy the background color ("window") of the tab widget to the "base" color of the qtextbrowsers
|
---|
112 | // Problem, it doesn't work with some styles, so first we change the "window" color of the tab widgets.
|
---|
113 | info_tab->setAutoFillBackground(true);
|
---|
114 | contributions_tab->setAutoFillBackground(true);
|
---|
115 | translations_tab->setAutoFillBackground(true);
|
---|
116 | license_tab->setAutoFillBackground(true);
|
---|
117 |
|
---|
118 | QPalette pal = info_tab->palette();
|
---|
119 | pal.setColor(QPalette::Window, palette().color(QPalette::Window) );
|
---|
120 |
|
---|
121 | info_tab->setPalette(pal);
|
---|
122 | contributions_tab->setPalette(pal);
|
---|
123 | translations_tab->setPalette(pal);
|
---|
124 | license_tab->setPalette(pal);
|
---|
125 |
|
---|
126 | QPalette p = info->palette();
|
---|
127 | //p.setBrush(QPalette::Base, info_tab->palette().window());
|
---|
128 | p.setColor(QPalette::Base, info_tab->palette().color(QPalette::Window));
|
---|
129 |
|
---|
130 | info->setPalette(p);
|
---|
131 | contributions->setPalette(p);
|
---|
132 | translators->setPalette(p);
|
---|
133 | license->setPalette(p);
|
---|
134 |
|
---|
135 | adjustSize();
|
---|
136 | }
|
---|
137 |
|
---|
138 | About::~About() {
|
---|
139 | }
|
---|
140 |
|
---|
141 | QString About::getTranslators() {
|
---|
142 | return QString(
|
---|
143 | tr("The following people have contributed with translations:") +
|
---|
144 | "<p>" +
|
---|
145 | trad(tr("Spanish"), "Ricardo Villalba <rvm@users.sourceforge.net>") +
|
---|
146 | trad(tr("German"), "Panagiotis Papadopoulos <pano_90@gmx.net>") +
|
---|
147 | trad(tr("Slovak"), "Sweto <peter.mendel@gmail.com>") +
|
---|
148 | trad(tr("Italian"), QStringList()
|
---|
149 | << "greengreat <gmeildeno@gmail.com>"
|
---|
150 | << "Giancarlo Scola <scola.giancarlo@libero.it>") +
|
---|
151 | trad(tr("French"), QStringList()
|
---|
152 | << "Olivier g <1got@caramail.com>"
|
---|
153 | << "Temet <goondy@free.fr>"
|
---|
154 | << "Erwann MEST <kud.gray@gmail.com>") +
|
---|
155 | trad(tr("Simplified-Chinese"), QStringList()
|
---|
156 | << "Tim Green <iamtimgreen@gmail.com>"
|
---|
157 | << "OpenBDH <opensource@bendihua.org>") +
|
---|
158 | trad(tr("Russian"), QString::fromUtf8("ÐелÑй ÐÐ»Ð°ÐŽÐžÐŒÐžÑ <wiselord1983@gmail.com>"))+
|
---|
159 | trad(tr("Hungarian"), QStringList()
|
---|
160 | << "Charles Barcza <kbarcza@blackpanther.hu>"
|
---|
161 | << "CyberDragon <cyberdragon777@gmail.com>") +
|
---|
162 | trad(tr("Polish"), QStringList()
|
---|
163 | << "qla <qla0@vp.pl>"
|
---|
164 | << "Jarek <ajep9691@wp.pl>"
|
---|
165 | << "sake12 <sake12@gmail.com>" ) +
|
---|
166 | trad(tr("Japanese"), "Nardog <alphisation@gmail.com>") +
|
---|
167 | trad(tr("Dutch"), QStringList()
|
---|
168 | << "profoX <wesley@ubuntu-nl.org>"
|
---|
169 | << "BalaamsMiracle"
|
---|
170 | << "Kristof Bal <kristof.bal@gmail.com>") +
|
---|
171 | trad(tr("Ukrainian"), QStringList()
|
---|
172 | << "Motsyo Gennadi <drool@altlinux.ru>"
|
---|
173 | << "Oleksandr Kovalenko <alx.kovalenko@gmail.com>" ) +
|
---|
174 | trad(tr("Portuguese - Brazil"), QStringList()
|
---|
175 | << "Ventura <ventura.barbeiro@terra.com.br>"
|
---|
176 | << QString::fromUtf8("Maico Sertório <maico.sertorio@gmail.com>")) +
|
---|
177 | trad(tr("Georgian"), "George Machitidze <giomac@gmail.com>") +
|
---|
178 | trad(tr("Czech"), QStringList()
|
---|
179 | << QString::fromUtf8("Martin DvoÅák <martin.dvorak@centrum.cz>")
|
---|
180 | << QString::fromUtf8("JaromÃr SmrÄek <jaromir.smrcek@zoner.com>") ) +
|
---|
181 | trad(tr("Bulgarian"), "<marzeliv@mail.bg>") +
|
---|
182 | trad(tr("Turkish"), "alper er <alperer@gmail.com>") +
|
---|
183 | trad(tr("Swedish"), "Leif Larsson <leif.larsson@gmail.com>") +
|
---|
184 | trad(tr("Serbian"), "Kunalagon Umuhanik <kunalagon@gmail.com>") +
|
---|
185 | trad(tr("Traditional Chinese"), "Hoopoe <dai715.tw@yahoo.com.tw>") +
|
---|
186 | trad(tr("Romanian"), "DoruH <DoruHushHush@gmail.com>") +
|
---|
187 | trad(tr("Portuguese - Portugal"), QStringList()
|
---|
188 | << "Waxman <waxman.pt@gmail.com>"
|
---|
189 | << QString::fromUtf8("Sérgio Marques <smarquespt@gmail.com>") ) +
|
---|
190 | trad(tr("Greek"), "my80s <wamy80s@gmail.com>") +
|
---|
191 | trad(tr("Finnish"), "peeaivo <peeaivo@gmail.com>") +
|
---|
192 | trad(tr("Korean"), "Heesu Yoon <imsu30@gmail.com>") +
|
---|
193 | trad(tr("Macedonian"), "Marko Doda <mark0d0da@gmail.com>") +
|
---|
194 | trad(tr("Basque"), QStringList()
|
---|
195 | << "Piarres Beobide <pi@beobide.net>"
|
---|
196 | << "Xabier Aramendi <azpidatziak@gmail.com>") +
|
---|
197 | trad(tr("Catalan"), QString::fromUtf8("Roger Calvó <rcalvoi@yahoo.com>")) +
|
---|
198 | trad(tr("Slovenian"), "Janez Troha <janez.troha@gmail.com>") +
|
---|
199 | trad(tr("Arabic"), "Muhammad Nour Hajj Omar <arabianheart@live.com>") +
|
---|
200 | trad(tr("Kurdish"), "Si_murg56 <simurg56@gmail.com>") +
|
---|
201 | trad(tr("Galician"), QStringList() << "Miguel Branco <mgl.branco@gmail.com>" << "Gallaecio") +
|
---|
202 | trad(tr("Vietnamese"), QString::fromUtf8("Lê Xuân Thảo <thaolx@gmail.com>")) +
|
---|
203 | trad(tr("Estonian"), QString::fromUtf8("Olav MÀgi <olav.magi@hotmail.com>")) +
|
---|
204 | trad(tr("Lithuanian"), QStringList()
|
---|
205 | << "Freemail <ricka_g@freemail.lt>"
|
---|
206 | << QString::fromUtf8("Algimantas MargeviÄius <margevicius.algimantas@gmail.com>") ) +
|
---|
207 | trad(tr("Danish"), "Martin Schlander <mschlander@opensuse.org>") +
|
---|
208 | trad(tr("Croatian"), QString::fromUtf8("Josip KujundÅŸija <marshsmello@gmail.com>")) +
|
---|
209 | trad(tr("Hebrew"), "Genghis Khan <genghiskhan@gmx.ca>") +
|
---|
210 | trad(tr("Thai"), QString::fromUtf8("àž¡àž²à¹àžàžàžà¹ àžªàž¡àžšàž±àžàžàžŽà¹ <xyteton@hotmail.com>")) +
|
---|
211 | trad(tr("Malay"), "abuyop (transifex)") +
|
---|
212 | "");
|
---|
213 | }
|
---|
214 |
|
---|
215 | QString About::trad(const QString & lang, const QString & author) {
|
---|
216 | return trad(lang, QStringList() << author);
|
---|
217 | }
|
---|
218 |
|
---|
219 | QString About::trad(const QString & lang, const QStringList & authors) {
|
---|
220 | QString s;
|
---|
221 | for (int n = 0; n < authors.count(); n++) {
|
---|
222 | QString author = authors[n];
|
---|
223 | s += author.replace("<", "<").replace(">", ">");
|
---|
224 | if (n < (authors.count()-1)) s += "<br>";
|
---|
225 | }
|
---|
226 | return QString("<h3>%1:</h3><h4>%2</h4><hr>").arg(lang).arg(s);
|
---|
227 | }
|
---|
228 |
|
---|
229 | QString About::link(const QString & url, QString name) {
|
---|
230 | if (name.isEmpty()) name = url;
|
---|
231 | return QString("<a href=\"" + url + "\">" + name +"</a>");
|
---|
232 | }
|
---|
233 |
|
---|
234 | QString About::contr(const QString & author, const QString & thing) {
|
---|
235 | return "<li>"+ tr("<b>%1</b> (%2)").arg(author).arg(thing) +"</li>";
|
---|
236 | }
|
---|
237 |
|
---|
238 | QSize About::sizeHint () const {
|
---|
239 | return QSize(518, 326);
|
---|
240 | }
|
---|
241 |
|
---|
242 | void About::openLink(const QUrl & link) {
|
---|
243 | qDebug("About::openLink: '%s'", link.toString().toUtf8().constData());
|
---|
244 | QDesktopServices::openUrl(link);
|
---|
245 | }
|
---|
246 |
|
---|
247 | #include "moc_about.cpp"
|
---|