source: smplayer/vendor/0.8.2/src/about.cpp

Last change on this file was 137, checked in by Silvan Scherrer, 13 years ago

SMPlayer: updated vendor to 0.8.2

File size: 10.5 KB
Line 
1/* smplayer, GUI front-end for mplayer.
2 Copyright (C) 2006-2012 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
30using namespace Global;
31
32About::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 }
52
53 info->setText(
54 "<b>SMPlayer</b> &copy; 2006-2012 Ricardo Villalba &lt;rvm@users.sourceforge.net&gt;<br><br>"
55 "<b>" + tr("Version: %1").arg(smplayerVersion()) + "</b>" +
56#if PORTABLE_APP
57 " (" + tr("Portable Edition") + ")" +
58#endif
59#ifdef EXPERIMENTAL
60 "<br>Experimental branch<br>"
61#endif
62 "<br>" +
63 tr("Using Qt %1 (compiled with Qt %2)").arg(qVersion()).arg(QT_VERSION_STR) + "<br><br>" +
64 mplayer_version +
65 tr("Visit our web for updates:") +"<br>"+
66 link("http://smplayer.sf.net") +
67 "<br><br>" +
68 tr("Get help in our forum:") +"<br>" + link("http://smplayer.sf.net/forum") +
69 "<br><br>" +
70 tr("SMPlayer uses the award-winning MPlayer as playback engine. See %1")
71 .arg("<a href=\"http://www.mplayerhq.hu\">http://www.mplayerhq.hu</a>")
72 );
73
74
75 QString license_text =
76 "<i>"
77 "This program is free software; you can redistribute it and/or modify "
78 "it under the terms of the GNU General Public License as published by "
79 "the Free Software Foundation; either version 2 of the License, or "
80 "(at your option) any later version." "</i><br><br>";
81
82 QString license_file = Paths::doc("gpl.html", "en");
83 if (QFile::exists(license_file)) {
84 license_file = QUrl::fromLocalFile(license_file).toString();
85 license_text += QString("<a href=\"%1\">%2</a>").arg(license_file).arg(tr("Read the entire license"));
86 }
87
88 if ((pref->language != "en") && (pref->language != "en_US")) {
89 QString license_trans_file = Paths::doc("gpl.html", pref->language, false);
90 //qDebug("license_trans_file: %s", license_trans_file.toUtf8().constData());
91 if (QFile::exists(license_trans_file)) {
92 license_trans_file = QUrl::fromLocalFile(license_trans_file).toString();
93 license_text += QString("<br><a href=\"%1\">%2</a>").arg(license_trans_file).arg(tr("Read a translation"));
94 }
95 }
96 license->setText(license_text);
97 license->setOpenLinks(false);
98 license->setOpenExternalLinks(false);
99 connect(license, SIGNAL(anchorClicked(const QUrl &)), this, SLOT(openLink(const QUrl&)));
100
101 translators->setHtml( getTranslators() );
102
103 contributions->setText(
104 tr("SMPlayer logo by %1").arg("Charles Barcza &lt;kbarcza@blackpanther.hu&gt;") + "<br><br>" +
105 tr("Packages for Windows created by %1").arg("redxii &lt;redxii@users.sourceforge.net&gt;") + "<br><br>" +
106 tr("Many other people contributed with patches. See the Changelog for details.")
107 );
108
109#ifdef YOUTUBE_SUPPORT
110 youtube->setHtml(
111 tr("Founded in February 2005, YouTube&trade; is the world's most popular online "
112 "video community, allowing millions of people to discover, watch and share "
113 "originally-created videos. YouTube&trade; provides a forum for people to "
114 "connect, inform, and inspire others across the globe and acts as a "
115 "distribution platform for original content creators and advertisers large and small.") +
116 "<br><br>" +
117 tr("By using this application you hereby agree to be bound by Google Terms of Services located "
118 "at %1.").arg(link("http://www.google.com/accounts/TOS", "http://www.google.com/accounts/TOS"))
119 );
120 youtube->setOpenExternalLinks(true);
121#else
122 tab_widget->removeTab(4);
123#endif
124
125 // Copy the background color ("window") of the tab widget to the "base" color of the qtextbrowsers
126 // Problem, it doesn't work with some styles, so first we change the "window" color of the tab widgets.
127 info_tab->setAutoFillBackground(true);
128 contributions_tab->setAutoFillBackground(true);
129 translations_tab->setAutoFillBackground(true);
130 license_tab->setAutoFillBackground(true);
131 youtube_tab->setAutoFillBackground(true);
132
133 QPalette pal = info_tab->palette();
134 pal.setColor(QPalette::Window, palette().color(QPalette::Window) );
135
136 info_tab->setPalette(pal);
137 contributions_tab->setPalette(pal);
138 translations_tab->setPalette(pal);
139 license_tab->setPalette(pal);
140 youtube_tab->setPalette(pal);
141
142 QPalette p = info->palette();
143 //p.setBrush(QPalette::Base, info_tab->palette().window());
144 p.setColor(QPalette::Base, info_tab->palette().color(QPalette::Window));
145
146 info->setPalette(p);
147 contributions->setPalette(p);
148 translators->setPalette(p);
149 license->setPalette(p);
150 youtube->setPalette(p);
151
152 adjustSize();
153}
154
155About::~About() {
156}
157
158QString About::getTranslators() {
159 return QString(
160 tr("The following people have contributed with translations:") +
161 "<p>" +
162 trad(tr("Spanish"), "Ricardo Villalba <rvm@users.sourceforge.net>") +
163 trad(tr("German"), "Panagiotis Papadopoulos <pano_90@gmx.net>") +
164 trad(tr("Slovak"), "Sweto <peter.mendel@gmail.com>") +
165 trad(tr("Italian"), QStringList()
166 << "greengreat <gmeildeno@gmail.com>"
167 << "Giancarlo Scola <scola.giancarlo@libero.it>") +
168 trad(tr("French"), QStringList()
169 << "Olivier g <1got@caramail.com>"
170 << "Temet <goondy@free.fr>"
171 << "Erwann MEST <kud.gray@gmail.com>") +
172 trad(tr("Simplified-Chinese"), QStringList()
173 << "Tim Green <iamtimgreen@gmail.com>"
174 << "OpenBDH <opensource@bendihua.org>") +
175 trad(tr("Russian"), QString::fromUtf8("Белый ВлаЎОЌОр <wiselord1983@gmail.com>"))+
176 trad(tr("Hungarian"), QStringList()
177 << "Charles Barcza <kbarcza@blackpanther.hu>"
178 << "CyberDragon <cyberdragon777@gmail.com>") +
179 trad(tr("Polish"), QStringList()
180 << "qla <qla0@vp.pl>"
181 << "Jarek <ajep9691@wp.pl>"
182 << "sake12 <sake12@gmail.com>" ) +
183 trad(tr("Japanese"), "Nardog <alphisation@gmail.com>") +
184 trad(tr("Dutch"), QStringList()
185 << "profoX <wesley@ubuntu-nl.org>"
186 << "BalaamsMiracle"
187 << "Kristof Bal <kristof.bal@gmail.com>") +
188 trad(tr("Ukrainian"), QStringList()
189 << "Motsyo Gennadi <drool@altlinux.ru>"
190 << "Oleksandr Kovalenko <alx.kovalenko@gmail.com>" ) +
191 trad(tr("Portuguese - Brazil"), "Ventura <ventura.barbeiro@terra.com.br>") +
192 trad(tr("Georgian"), "George Machitidze <giomac@gmail.com>") +
193 trad(tr("Czech"), QStringList()
194 << QString::fromUtf8("Martin Dvořák <martin.dvorak@centrum.cz>")
195 << QString::fromUtf8("Jaromír Smrček <jaromir.smrcek@zoner.com>") ) +
196 trad(tr("Bulgarian"), "<marzeliv@mail.bg>") +
197 trad(tr("Turkish"), "alper er <alperer@gmail.com>") +
198 trad(tr("Swedish"), "Leif Larsson <leif.larsson@gmail.com>") +
199 trad(tr("Serbian"), "Kunalagon Umuhanik <kunalagon@gmail.com>") +
200 trad(tr("Traditional Chinese"), "Hoopoe <dai715.tw@yahoo.com.tw>") +
201 trad(tr("Romanian"), "DoruH <DoruHushHush@gmail.com>") +
202 trad(tr("Portuguese - Portugal"), QStringList()
203 << "Waxman <waxman.pt@gmail.com>"
204 << QString::fromUtf8("Sérgio Marques <smarquespt@gmail.com>") ) +
205 trad(tr("Greek"), "my80s <wamy80s@gmail.com>") +
206 trad(tr("Finnish"), "peeaivo <peeaivo@gmail.com>") +
207 trad(tr("Korean"), "Heesu Yoon <imsu30@gmail.com>") +
208 trad(tr("Macedonian"), "Marko Doda <mark0d0da@gmail.com>") +
209 trad(tr("Basque"), QStringList()
210 << "Piarres Beobide <pi@beobide.net>"
211 << "Xabier Aramendi <azpidatziak@gmail.com>") +
212 trad(tr("Catalan"), QString::fromUtf8("Roger Calvó <rcalvoi@yahoo.com>")) +
213 trad(tr("Slovenian"), "Janez Troha <janez.troha@gmail.com>") +
214 trad(tr("Arabic"), "Muhammad Nour Hajj Omar <arabianheart@live.com>") +
215 trad(tr("Kurdish"), "Si_murg56 <simurg56@gmail.com>") +
216 trad(tr("Galician"), QStringList() << "Miguel Branco <mgl.branco@gmail.com>" << "Gallaecio") +
217 trad(tr("Vietnamese"), QString::fromUtf8("Lê Xuân Thảo <thaolx@gmail.com>")) +
218 trad(tr("Estonian"), QString::fromUtf8("Olav MÀgi <olav.magi@hotmail.com>")) +
219 trad(tr("Lithuanian"), QStringList()
220 << "Freemail <ricka_g@freemail.lt>"
221 << QString::fromUtf8("Algimantas Margevičius <margevicius.algimantas@gmail.com>") ) +
222 trad(tr("Danish"), "Martin Schlander <mschlander@opensuse.org>") +
223 trad(tr("Croatian"), QString::fromUtf8("Josip KujundÅŸija <marshsmello@gmail.com>")) +
224 "");
225}
226
227QString About::trad(const QString & lang, const QString & author) {
228 return trad(lang, QStringList() << author);
229}
230
231QString About::trad(const QString & lang, const QStringList & authors) {
232 QString s;
233 for (int n = 0; n < authors.count(); n++) {
234 QString author = authors[n];
235 s += author.replace("<", "&lt;").replace(">", "&gt;");
236 if (n < (authors.count()-1)) s += "<br>";
237 }
238 return QString("<h3>%1:</h3><h4>%2</h4><hr>").arg(lang).arg(s);
239}
240
241QString About::link(const QString & url, QString name) {
242 if (name.isEmpty()) name = url;
243 return QString("<a href=\"" + url + "\">" + name +"</a>");
244}
245
246QString About::contr(const QString & author, const QString & thing) {
247 return "<li>"+ tr("<b>%1</b> (%2)").arg(author).arg(thing) +"</li>";
248}
249
250QSize About::sizeHint () const {
251 return QSize(518, 326);
252}
253
254void About::openLink(const QUrl & link) {
255 qDebug("About::openLink: '%s'", link.toString().toUtf8().constData());
256 QDesktopServices::openUrl(link);
257}
258
259#include "moc_about.cpp"
Note: See TracBrowser for help on using the repository browser.