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

Last change on this file since 119 was 119, checked in by Silvan Scherrer, 14 years ago

SMPlayer: latest svn update

  • Property svn:eol-style set to LF
File size: 9.7 KB
Line 
1/* smplayer, GUI front-end for mplayer.
2 Copyright (C) 2006-2011 Ricardo Villalba <rvm@escomposlinux.org>
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
29//#define TRANS_ORIG
30#define TRANS_LIST
31//#define TRANS_TABLE
32
33using namespace Global;
34
35About::About(QWidget * parent, Qt::WindowFlags f)
36 : QDialog(parent, f)
37{
38 setupUi(this);
39 setWindowIcon( Images::icon("logo", 64) );
40
41 logo->setPixmap( Images::icon("logo", 64) );
42 contrib_icon->setPixmap( Images::icon("contributors" ) );
43 translators_icon->setPixmap( Images::icon("translators" ) );
44 license_icon->setPixmap( Images::icon("license" ) );
45
46 QString mplayer_version;
47 if (pref->mplayer_detected_version > 0) {
48 mplayer_version = tr("Using MPlayer %1").arg(MplayerVersion::toString(pref->mplayer_detected_version)) + "<br><br>";
49 }
50
51 info->setText(
52 "<b>SMPlayer</b> &copy; 2006-2011 Ricardo Villalba &lt;rvm@escomposlinux.org&gt;<br><br>"
53 "<b>" + tr("Version: %1").arg(smplayerVersion()) + "</b>" +
54#if PORTABLE_APP
55 " (" + tr("Portable Edition") + ")" +
56#endif
57 "<br>" +
58 tr("Using Qt %1 (compiled with Qt %2)").arg(qVersion()).arg(QT_VERSION_STR) + "<br><br>" +
59 mplayer_version +
60 tr("Visit our web for updates:") +"<br>"+
61 link("http://smplayer.sf.net") +
62 "<br><br>" +
63 tr("Get help in our forum:") +"<br>" + link("http://smplayer.sf.net/forum")
64 );
65
66
67 QString license_file = Paths::doc("gpl.html", pref->language);
68 if (QFile::exists(license_file)) {
69 QFont fixed_font;
70 fixed_font.setStyleHint(QFont::TypeWriter);
71 fixed_font.setFamily("Courier");
72 license->setFont(fixed_font);
73
74 QFile f(license_file);
75 if (f.open(QIODevice::ReadOnly)) {
76 license->setText(QString::fromUtf8(f.readAll().constData()));
77 }
78 f.close();
79 } else {
80 license->setText(
81 "<i>" +
82 tr("This program is free software; you can redistribute it and/or modify "
83 "it under the terms of the GNU General Public License as published by "
84 "the Free Software Foundation; either version 2 of the License, or "
85 "(at your option) any later version.") + "</i>");
86 }
87
88 translators->setHtml( getTranslators() );
89
90 contributions->setText(
91 tr("SMPlayer logo by %1").arg("Charles Barcza &lt;kbarcza@blackpanther.hu&gt;") + "<br><br>" +
92 tr("The following people have contributed with patches "
93 "(see the changelog for details):") +
94 "<pre>" +
95 QString(
96 "corentin1234 <corentin1234@hotmail.com>\n"
97 "Florin Braghis <florin@libertv.ro>\n"
98 "Francesco Cosoleto <cosoleto@users.sourceforge.net>\n"
99 "Glaydus <glaydus@gmail.com>\n"
100 "Kamil Dziobek <turbos11@gmail.com>\n"
101 "LoRd_MuldeR (http://forum.doom9.org/member.php?u=78667)\n"
102 "Matthias Petri <matt@endboss.org>\n"
103 "profoX <wesley@ubuntu.com>\n"
104 "redxii <redxii1234@gmail.com>\n"
105 "Sikon <sikon@users.sourceforge.net>\n"
106 "Simon <hackykid@users.sourceforge.net>\n"
107 "Stanislav Maslovski <s_i_m@users.sourceforge.net>\n"
108 "Tanguy Krotoff <tkrotoff@gmail.com>\n"
109 "Stivo <helifan@users.sourceforge.net>\n"
110 ).replace("<", "&lt;").replace(">", "&gt;") +
111 "</pre>" +
112 tr("If there's any omission, please report.")
113 );
114
115 // Copy the background color ("window") of the tab widget to the "base" color of the qtextbrowsers
116 // Problem, it doesn't work with some styles, so first we change the "window" color of the tab widgets.
117 info_tab->setAutoFillBackground(true);
118 contributions_tab->setAutoFillBackground(true);
119 translations_tab->setAutoFillBackground(true);
120 license_tab->setAutoFillBackground(true);
121
122 QPalette pal = info_tab->palette();
123 pal.setColor(QPalette::Window, palette().color(QPalette::Window) );
124
125 info_tab->setPalette(pal);
126 contributions_tab->setPalette(pal);
127 translations_tab->setPalette(pal);
128 license_tab->setPalette(pal);
129
130 QPalette p = info->palette();
131 //p.setBrush(QPalette::Base, info_tab->palette().window());
132 p.setColor(QPalette::Base, info_tab->palette().color(QPalette::Window));
133
134 info->setPalette(p);
135 contributions->setPalette(p);
136 translators->setPalette(p);
137 //license->setPalette(p);
138
139 adjustSize();
140}
141
142About::~About() {
143}
144
145QString About::getTranslators() {
146 return QString(
147 tr("The following people have contributed with translations:") +
148#ifndef TRANS_TABLE
149 "<ul>" +
150#else
151 "<table>" +
152#endif
153 trad(tr("German"), "Panagiotis Papadopoulos <pano_90@gmx.net>") +
154 trad(tr("Slovak"), "Sweto <peter.mendel@gmail.com>") +
155 trad(tr("Italian"), QStringList()
156 << "greengreat <gmeildeno@gmail.com>"
157 << "Giancarlo Scola <scola.giancarlo@libero.it>") +
158 trad(tr("French"), QStringList()
159 << "Olivier g <1got@caramail.com>"
160 << "Temet <goondy@free.fr>"
161 << "Erwann MEST <kud.gray@gmail.com>") +
162 trad(tr("Simplified-Chinese"), "Tim Green <iamtimgreen@gmail.com>") +
163 trad(tr("Russian"), QString::fromUtf8("Белый ВлаЎОЌОр <wiselord1983@gmail.com>"))+
164 trad(tr("Hungarian"), QStringList()
165 << "Charles Barcza <kbarcza@blackpanther.hu>"
166 << "CyberDragon <cyberdragon777@gmail.com>") +
167 trad(tr("Polish"), QStringList()
168 << "qla <qla0@vp.pl>"
169 << "Jarek <ajep9691@wp.pl>"
170 << "sake12 <sake12@gmail.com>" ) +
171 trad(tr("Japanese"), "Nardog <nardog@e2umail.com>") +
172 trad(tr("Dutch"), QStringList()
173 << "profoX <wesley@ubuntu-nl.org>"
174 << "BalaamsMiracle"
175 << "Kristof Bal <kristof.bal@gmail.com>") +
176 trad(tr("Ukrainian"), QStringList()
177 << "Motsyo Gennadi <drool@altlinux.ru>"
178 << "Oleksandr Kovalenko <alx.kovalenko@gmail.com>" ) +
179 trad(tr("Portuguese - Brazil"), "Ventura <ventura.barbeiro@terra.com.br>") +
180 trad(tr("Georgian"), "George Machitidze <giomac@gmail.com>") +
181 trad(tr("Czech"), QStringList()
182 << QString::fromUtf8("Martin Dvořák <martin.dvorak@centrum.cz>")
183 << QString::fromUtf8("Jaromír Smrček <jaromir.smrcek@zoner.com>") ) +
184 trad(tr("Bulgarian"), "<marzeliv@mail.bg>") +
185 trad(tr("Turkish"), "alper er <alperer@gmail.com>") +
186 trad(tr("Swedish"), "Leif Larsson <leif.larsson@gmail.com>") +
187 trad(tr("Serbian"), "Kunalagon Umuhanik <kunalagon@gmail.com>") +
188 trad(tr("Traditional Chinese"), "Hoopoe <dai715.tw@yahoo.com.tw>") +
189 trad(tr("Romanian"), "DoruH <DoruHushHush@gmail.com>") +
190 trad(tr("Portuguese - Portugal"), QStringList()
191 << "Waxman <waxman.pt@gmail.com>"
192 << QString::fromUtf8("Sérgio Marques <smarquespt@gmail.com>") ) +
193 trad(tr("Greek"), "my80s <wamy80s@gmail.com>") +
194 trad(tr("Finnish"), "peeaivo <peeaivo@gmail.com>") +
195 trad(tr("Korean"), "Heesu Yoon <imsu30@gmail.com>") +
196 trad(tr("Macedonian"), "Marko Doda <mark0d0da@gmail.com>") +
197 trad(tr("Basque"), "Piarres Beobide <pi@beobide.net>") +
198 trad(tr("Catalan"), QString::fromUtf8("Roger Calvó <rcalvoi@yahoo.com>")) +
199 trad(tr("Slovenian"), "Janez Troha <janez.troha@gmail.com>") +
200 trad(tr("Arabic"), "Muhammad Nour Hajj Omar <arabianheart@live.com>") +
201 trad(tr("Kurdish"), "Si_murg56 <simurg56@gmail.com>") +
202 trad(tr("Galician"), "Miguel Branco <mgl.branco@gmail.com>") +
203 trad(tr("Vietnamese"), QString::fromUtf8("Lê Xuân Thảo <thaolx@gmail.com>")) +
204 trad(tr("Estonian"), QString::fromUtf8("Olav MÀgi <olav.magi@hotmail.com>")) +
205 trad(tr("Lithuanian"), "Freemail <ricka_g@freemail.lt>") +
206 trad(tr("Danish"), "Martin Schlander <mschlander@opensuse.org>") +
207#ifndef TRANS_TABLE
208 "</ul>");
209#else
210 "</table>");
211#endif
212}
213
214QString About::trad(const QString & lang, const QString & author) {
215 return trad(lang, QStringList() << author);
216}
217
218QString About::trad(const QString & lang, const QStringList & authors) {
219#ifdef TRANS_ORIG
220 QString s;
221
222 switch (authors.count()) {
223 case 2: s = tr("%1 and %2"); break;
224 case 3: s = tr("%1, %2 and %3"); break;
225 case 4: s = tr("%1, %2, %3 and %4"); break;
226 case 5: s = tr("%1, %2, %3, %4 and %5"); break;
227 default: s = "%1";
228 }
229
230 for (int n = 0; n < authors.count(); n++) {
231 QString author = authors[n];
232 s = s.arg(author.replace("<", "&lt;").replace(">", "&gt;"));
233 }
234
235 return "<li>"+ tr("<b>%1</b>: %2").arg(lang).arg(s) + "</li>";
236#endif
237
238#ifdef TRANS_LIST
239 QString s = "<ul>";;
240 for (int n = 0; n < authors.count(); n++) {
241 QString author = authors[n];
242 s += "<li>"+ author.replace("<", "&lt;").replace(">", "&gt;") + "</li>";
243 }
244 s+= "</ul>";
245
246 return "<li>"+ tr("<b>%1</b>: %2").arg(lang).arg(s) + "</li>";
247#endif
248
249#ifdef TRANS_TABLE
250 QString s;
251 for (int n = 0; n < authors.count(); n++) {
252 QString author = authors[n];
253 s += author.replace("<", "&lt;").replace(">", "&gt;");
254 if (n < (authors.count()-1)) s += "<br>";
255 }
256
257 return QString("<tr><td align=right><b>%1</b></td><td>%2</td></tr>").arg(lang).arg(s);
258#endif
259}
260
261QString About::link(const QString & url, QString name) {
262 if (name.isEmpty()) name = url;
263 return QString("<a href=\"" + url + "\">" + name +"</a>");
264}
265
266QString About::contr(const QString & author, const QString & thing) {
267 return "<li>"+ tr("<b>%1</b> (%2)").arg(author).arg(thing) +"</li>";
268}
269
270QSize About::sizeHint () const {
271 return QSize(518, 326);
272}
273
274#include "moc_about.cpp"
Note: See TracBrowser for help on using the repository browser.