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

Last change on this file since 125 was 124, checked in by Silvan Scherrer, 13 years ago

SMPlayer: 0.7.1 trunk update

  • Property svn:eol-style set to LF
File size: 10.2 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
30//#define TRANS_ORIG
31#define TRANS_LIST
32//#define TRANS_TABLE
33
34using namespace Global;
35
36About::About(QWidget * parent, Qt::WindowFlags f)
37 : QDialog(parent, f)
38{
39 setupUi(this);
40 setWindowIcon( Images::icon("logo", 64) );
41
42 logo->setPixmap( QPixmap(":/icons-png/logo.png").scaledToHeight(64, Qt::SmoothTransformation) );
43 contrib_icon->setPixmap( Images::icon("contributors" ) );
44 translators_icon->setPixmap( Images::icon("translators" ) );
45 license_icon->setPixmap( Images::icon("license" ) );
46
47 QString mplayer_version;
48 if (pref->mplayer_detected_version > 0) {
49 if (pref->mplayer_is_mplayer2) {
50 mplayer_version = tr("Using MPlayer2 %1").arg(pref->mplayer2_detected_version);
51 } else {
52 mplayer_version = tr("Using MPlayer %1").arg(MplayerVersion::toString(pref->mplayer_detected_version));
53 }
54 mplayer_version += "<br><br>";
55 }
56
57 info->setText(
58 "<b>SMPlayer</b> &copy; 2006-2012 Ricardo Villalba &lt;rvm@users.sourceforge.net&gt;<br><br>"
59 "<b>" + tr("Version: %1").arg(smplayerVersion()) + "</b>" +
60#if PORTABLE_APP
61 " (" + tr("Portable Edition") + ")" +
62#endif
63 "<br>" +
64 tr("Using Qt %1 (compiled with Qt %2)").arg(qVersion()).arg(QT_VERSION_STR) + "<br><br>" +
65 mplayer_version +
66 tr("Visit our web for updates:") +"<br>"+
67 link("http://smplayer.sf.net") +
68 "<br><br>" +
69 tr("Get help in our forum:") +"<br>" + link("http://smplayer.sf.net/forum") +
70 "<br><br>" +
71 tr("SMPlayer uses the award-winning MPlayer as playback engine. See %1")
72 .arg("<a href=\"http://www.mplayerhq.hu\">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 // Copy the background color ("window") of the tab widget to the "base" color of the qtextbrowsers
111 // Problem, it doesn't work with some styles, so first we change the "window" color of the tab widgets.
112 info_tab->setAutoFillBackground(true);
113 contributions_tab->setAutoFillBackground(true);
114 translations_tab->setAutoFillBackground(true);
115 license_tab->setAutoFillBackground(true);
116
117 QPalette pal = info_tab->palette();
118 pal.setColor(QPalette::Window, palette().color(QPalette::Window) );
119
120 info_tab->setPalette(pal);
121 contributions_tab->setPalette(pal);
122 translations_tab->setPalette(pal);
123 license_tab->setPalette(pal);
124
125 QPalette p = info->palette();
126 //p.setBrush(QPalette::Base, info_tab->palette().window());
127 p.setColor(QPalette::Base, info_tab->palette().color(QPalette::Window));
128
129 info->setPalette(p);
130 contributions->setPalette(p);
131 translators->setPalette(p);
132 license->setPalette(p);
133
134 adjustSize();
135}
136
137About::~About() {
138}
139
140QString About::getTranslators() {
141 return QString(
142 tr("The following people have contributed with translations:") +
143#ifndef TRANS_TABLE
144 "<ul>" +
145#else
146 "<table>" +
147#endif
148 trad(tr("German"), "Panagiotis Papadopoulos <pano_90@gmx.net>") +
149 trad(tr("Slovak"), "Sweto <peter.mendel@gmail.com>") +
150 trad(tr("Italian"), QStringList()
151 << "greengreat <gmeildeno@gmail.com>"
152 << "Giancarlo Scola <scola.giancarlo@libero.it>") +
153 trad(tr("French"), QStringList()
154 << "Olivier g <1got@caramail.com>"
155 << "Temet <goondy@free.fr>"
156 << "Erwann MEST <kud.gray@gmail.com>") +
157 trad(tr("Simplified-Chinese"), QStringList()
158 << "Tim Green <iamtimgreen@gmail.com>"
159 << "OpenBDH <opensource@bendihua.org>") +
160 trad(tr("Russian"), QString::fromUtf8("Белый ВлаЎОЌОр <wiselord1983@gmail.com>"))+
161 trad(tr("Hungarian"), QStringList()
162 << "Charles Barcza <kbarcza@blackpanther.hu>"
163 << "CyberDragon <cyberdragon777@gmail.com>") +
164 trad(tr("Polish"), QStringList()
165 << "qla <qla0@vp.pl>"
166 << "Jarek <ajep9691@wp.pl>"
167 << "sake12 <sake12@gmail.com>" ) +
168 trad(tr("Japanese"), "Nardog <alphisation@gmail.com>") +
169 trad(tr("Dutch"), QStringList()
170 << "profoX <wesley@ubuntu-nl.org>"
171 << "BalaamsMiracle"
172 << "Kristof Bal <kristof.bal@gmail.com>") +
173 trad(tr("Ukrainian"), QStringList()
174 << "Motsyo Gennadi <drool@altlinux.ru>"
175 << "Oleksandr Kovalenko <alx.kovalenko@gmail.com>" ) +
176 trad(tr("Portuguese - Brazil"), "Ventura <ventura.barbeiro@terra.com.br>") +
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"), "Piarres Beobide <pi@beobide.net>") +
195 trad(tr("Catalan"), QString::fromUtf8("Roger Calvó <rcalvoi@yahoo.com>")) +
196 trad(tr("Slovenian"), "Janez Troha <janez.troha@gmail.com>") +
197 trad(tr("Arabic"), "Muhammad Nour Hajj Omar <arabianheart@live.com>") +
198 trad(tr("Kurdish"), "Si_murg56 <simurg56@gmail.com>") +
199 trad(tr("Galician"), "Miguel Branco <mgl.branco@gmail.com>") +
200 trad(tr("Vietnamese"), QString::fromUtf8("Lê Xuân Thảo <thaolx@gmail.com>")) +
201 trad(tr("Estonian"), QString::fromUtf8("Olav MÀgi <olav.magi@hotmail.com>")) +
202 trad(tr("Lithuanian"), "Freemail <ricka_g@freemail.lt>") +
203 trad(tr("Danish"), "Martin Schlander <mschlander@opensuse.org>") +
204 trad(tr("Croatian"), QString::fromUtf8("Josip KujundÅŸija <marshsmello@gmail.com>")) +
205#ifndef TRANS_TABLE
206 "</ul>");
207#else
208 "</table>");
209#endif
210}
211
212QString About::trad(const QString & lang, const QString & author) {
213 return trad(lang, QStringList() << author);
214}
215
216QString About::trad(const QString & lang, const QStringList & authors) {
217#ifdef TRANS_ORIG
218 QString s;
219
220 switch (authors.count()) {
221 case 2: s = tr("%1 and %2"); break;
222 case 3: s = tr("%1, %2 and %3"); break;
223 case 4: s = tr("%1, %2, %3 and %4"); break;
224 case 5: s = tr("%1, %2, %3, %4 and %5"); break;
225 default: s = "%1";
226 }
227
228 for (int n = 0; n < authors.count(); n++) {
229 QString author = authors[n];
230 s = s.arg(author.replace("<", "&lt;").replace(">", "&gt;"));
231 }
232
233 return "<li>"+ tr("<b>%1</b>: %2").arg(lang).arg(s) + "</li>";
234#endif
235
236#ifdef TRANS_LIST
237 QString s = "<ul>";;
238 for (int n = 0; n < authors.count(); n++) {
239 QString author = authors[n];
240 s += "<li>"+ author.replace("<", "&lt;").replace(">", "&gt;") + "</li>";
241 }
242 s+= "</ul>";
243
244 return "<li>"+ tr("<b>%1</b>: %2").arg(lang).arg(s) + "</li>";
245#endif
246
247#ifdef TRANS_TABLE
248 QString s;
249 for (int n = 0; n < authors.count(); n++) {
250 QString author = authors[n];
251 s += author.replace("<", "&lt;").replace(">", "&gt;");
252 if (n < (authors.count()-1)) s += "<br>";
253 }
254
255 return QString("<tr><td align=right><b>%1</b></td><td>%2</td></tr>").arg(lang).arg(s);
256#endif
257}
258
259QString About::link(const QString & url, QString name) {
260 if (name.isEmpty()) name = url;
261 return QString("<a href=\"" + url + "\">" + name +"</a>");
262}
263
264QString About::contr(const QString & author, const QString & thing) {
265 return "<li>"+ tr("<b>%1</b> (%2)").arg(author).arg(thing) +"</li>";
266}
267
268QSize About::sizeHint () const {
269 return QSize(518, 326);
270}
271
272void About::openLink(const QUrl & link) {
273 qDebug("About::openLink: '%s'", link.toString().toUtf8().constData());
274 QDesktopServices::openUrl(link);
275}
276
277#include "moc_about.cpp"
Note: See TracBrowser for help on using the repository browser.