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

Last change on this file since 115 was 112, checked in by Silvan Scherrer, 15 years ago

Smplayer: eol-style

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