source: smplayer/trunk/src/about.cpp@ 142

Last change on this file since 142 was 142, checked in by Silvan Scherrer, 12 years ago

SMPlayer: update trunk to 0.8.5

  • Property svn:eol-style set to LF
File size: 10.9 KB
Line 
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
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 } else {
52 mplayer_version += "<br>";
53 }
54
55 info->setText(
56 "<b>SMPlayer</b> &copy; 2006-2013 Ricardo Villalba &lt;rvm@users.sourceforge.net&gt;<br><br>"
57 "<b>" + tr("Version: %1").arg(smplayerVersion()) + "</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 &lt;kbarcza@blackpanther.hu&gt;") + "<br><br>" +
106 tr("Packages for Windows created by %1").arg("redxii &lt;redxii@users.sourceforge.net&gt;") + "<br><br>" +
107 tr("Many other people contributed with patches. See the Changelog for details.")
108 );
109
110#ifdef YOUTUBE_SUPPORT
111 youtube->setHtml(
112 tr("Founded in February 2005, YouTube&trade; is the world's most popular online "
113 "video community, allowing millions of people to discover, watch and share "
114 "originally-created videos. YouTube&trade; provides a forum for people to "
115 "connect, inform, and inspire others across the globe and acts as a "
116 "distribution platform for original content creators and advertisers large and small.") +
117 "<br><br>" +
118 tr("By using this application you hereby agree to be bound by Google Terms of Services located "
119 "at %1.").arg(link("http://www.google.com/accounts/TOS", "http://www.google.com/accounts/TOS"))
120 );
121 youtube->setOpenExternalLinks(true);
122#else
123 tab_widget->removeTab(4);
124#endif
125
126 // Copy the background color ("window") of the tab widget to the "base" color of the qtextbrowsers
127 // Problem, it doesn't work with some styles, so first we change the "window" color of the tab widgets.
128 info_tab->setAutoFillBackground(true);
129 contributions_tab->setAutoFillBackground(true);
130 translations_tab->setAutoFillBackground(true);
131 license_tab->setAutoFillBackground(true);
132 youtube_tab->setAutoFillBackground(true);
133
134 QPalette pal = info_tab->palette();
135 pal.setColor(QPalette::Window, palette().color(QPalette::Window) );
136
137 info_tab->setPalette(pal);
138 contributions_tab->setPalette(pal);
139 translations_tab->setPalette(pal);
140 license_tab->setPalette(pal);
141 youtube_tab->setPalette(pal);
142
143 QPalette p = info->palette();
144 //p.setBrush(QPalette::Base, info_tab->palette().window());
145 p.setColor(QPalette::Base, info_tab->palette().color(QPalette::Window));
146
147 info->setPalette(p);
148 contributions->setPalette(p);
149 translators->setPalette(p);
150 license->setPalette(p);
151 youtube->setPalette(p);
152
153 adjustSize();
154}
155
156About::~About() {
157}
158
159QString About::getTranslators() {
160 return QString(
161 tr("The following people have contributed with translations:") +
162 "<p>" +
163 trad(tr("Spanish"), "Ricardo Villalba <rvm@users.sourceforge.net>") +
164 trad(tr("German"), "Panagiotis Papadopoulos <pano_90@gmx.net>") +
165 trad(tr("Slovak"), "Sweto <peter.mendel@gmail.com>") +
166 trad(tr("Italian"), QStringList()
167 << "greengreat <gmeildeno@gmail.com>"
168 << "Giancarlo Scola <scola.giancarlo@libero.it>") +
169 trad(tr("French"), QStringList()
170 << "Olivier g <1got@caramail.com>"
171 << "Temet <goondy@free.fr>"
172 << "Erwann MEST <kud.gray@gmail.com>") +
173 trad(tr("Simplified-Chinese"), QStringList()
174 << "Tim Green <iamtimgreen@gmail.com>"
175 << "OpenBDH <opensource@bendihua.org>") +
176 trad(tr("Russian"), QString::fromUtf8("Белый ВлаЎОЌОр <wiselord1983@gmail.com>"))+
177 trad(tr("Hungarian"), QStringList()
178 << "Charles Barcza <kbarcza@blackpanther.hu>"
179 << "CyberDragon <cyberdragon777@gmail.com>") +
180 trad(tr("Polish"), QStringList()
181 << "qla <qla0@vp.pl>"
182 << "Jarek <ajep9691@wp.pl>"
183 << "sake12 <sake12@gmail.com>" ) +
184 trad(tr("Japanese"), "Nardog <alphisation@gmail.com>") +
185 trad(tr("Dutch"), QStringList()
186 << "profoX <wesley@ubuntu-nl.org>"
187 << "BalaamsMiracle"
188 << "Kristof Bal <kristof.bal@gmail.com>") +
189 trad(tr("Ukrainian"), QStringList()
190 << "Motsyo Gennadi <drool@altlinux.ru>"
191 << "Oleksandr Kovalenko <alx.kovalenko@gmail.com>" ) +
192 trad(tr("Portuguese - Brazil"), QStringList()
193 << "Ventura <ventura.barbeiro@terra.com.br>"
194 << QString::fromUtf8("Maico Sertório <maico.sertorio@gmail.com>")) +
195 trad(tr("Georgian"), "George Machitidze <giomac@gmail.com>") +
196 trad(tr("Czech"), QStringList()
197 << QString::fromUtf8("Martin Dvořák <martin.dvorak@centrum.cz>")
198 << QString::fromUtf8("Jaromír Smrček <jaromir.smrcek@zoner.com>") ) +
199 trad(tr("Bulgarian"), "<marzeliv@mail.bg>") +
200 trad(tr("Turkish"), "alper er <alperer@gmail.com>") +
201 trad(tr("Swedish"), "Leif Larsson <leif.larsson@gmail.com>") +
202 trad(tr("Serbian"), "Kunalagon Umuhanik <kunalagon@gmail.com>") +
203 trad(tr("Traditional Chinese"), "Hoopoe <dai715.tw@yahoo.com.tw>") +
204 trad(tr("Romanian"), "DoruH <DoruHushHush@gmail.com>") +
205 trad(tr("Portuguese - Portugal"), QStringList()
206 << "Waxman <waxman.pt@gmail.com>"
207 << QString::fromUtf8("Sérgio Marques <smarquespt@gmail.com>") ) +
208 trad(tr("Greek"), "my80s <wamy80s@gmail.com>") +
209 trad(tr("Finnish"), "peeaivo <peeaivo@gmail.com>") +
210 trad(tr("Korean"), "Heesu Yoon <imsu30@gmail.com>") +
211 trad(tr("Macedonian"), "Marko Doda <mark0d0da@gmail.com>") +
212 trad(tr("Basque"), QStringList()
213 << "Piarres Beobide <pi@beobide.net>"
214 << "Xabier Aramendi <azpidatziak@gmail.com>") +
215 trad(tr("Catalan"), QString::fromUtf8("Roger Calvó <rcalvoi@yahoo.com>")) +
216 trad(tr("Slovenian"), "Janez Troha <janez.troha@gmail.com>") +
217 trad(tr("Arabic"), "Muhammad Nour Hajj Omar <arabianheart@live.com>") +
218 trad(tr("Kurdish"), "Si_murg56 <simurg56@gmail.com>") +
219 trad(tr("Galician"), QStringList() << "Miguel Branco <mgl.branco@gmail.com>" << "Gallaecio") +
220 trad(tr("Vietnamese"), QString::fromUtf8("Lê Xuân Thảo <thaolx@gmail.com>")) +
221 trad(tr("Estonian"), QString::fromUtf8("Olav MÀgi <olav.magi@hotmail.com>")) +
222 trad(tr("Lithuanian"), QStringList()
223 << "Freemail <ricka_g@freemail.lt>"
224 << QString::fromUtf8("Algimantas Margevičius <margevicius.algimantas@gmail.com>") ) +
225 trad(tr("Danish"), "Martin Schlander <mschlander@opensuse.org>") +
226 trad(tr("Croatian"), QString::fromUtf8("Josip KujundÅŸija <marshsmello@gmail.com>")) +
227 trad(tr("Hebrew"), "Genghis Khan <genghiskhan@gmx.ca>") +
228 trad(tr("Thai"), QString::fromUtf8("àž¡àž²à¹‚àž™àžŠàžà¹Œ àžªàž¡àžšàž±àžàž”àžŽà¹Œ <xyteton@hotmail.com>")) +
229 trad(tr("Malay"), "abuyop (transifex)") +
230 "");
231}
232
233QString About::trad(const QString & lang, const QString & author) {
234 return trad(lang, QStringList() << author);
235}
236
237QString About::trad(const QString & lang, const QStringList & authors) {
238 QString s;
239 for (int n = 0; n < authors.count(); n++) {
240 QString author = authors[n];
241 s += author.replace("<", "&lt;").replace(">", "&gt;");
242 if (n < (authors.count()-1)) s += "<br>";
243 }
244 return QString("<h3>%1:</h3><h4>%2</h4><hr>").arg(lang).arg(s);
245}
246
247QString About::link(const QString & url, QString name) {
248 if (name.isEmpty()) name = url;
249 return QString("<a href=\"" + url + "\">" + name +"</a>");
250}
251
252QString About::contr(const QString & author, const QString & thing) {
253 return "<li>"+ tr("<b>%1</b> (%2)").arg(author).arg(thing) +"</li>";
254}
255
256QSize About::sizeHint () const {
257 return QSize(518, 326);
258}
259
260void About::openLink(const QUrl & link) {
261 qDebug("About::openLink: '%s'", link.toString().toUtf8().constData());
262 QDesktopServices::openUrl(link);
263}
264
265#include "moc_about.cpp"
Note: See TracBrowser for help on using the repository browser.