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

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

SMPlayer: trunk update to latest svn

  • Property svn:eol-style set to LF
File size: 9.6 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 // Copy the background color ("window") of the tab widget to the "base" color of the qtextbrowsers
110 // Problem, it doesn't work with some styles, so first we change the "window" color of the tab widgets.
111 info_tab->setAutoFillBackground(true);
112 contributions_tab->setAutoFillBackground(true);
113 translations_tab->setAutoFillBackground(true);
114 license_tab->setAutoFillBackground(true);
115
116 QPalette pal = info_tab->palette();
117 pal.setColor(QPalette::Window, palette().color(QPalette::Window) );
118
119 info_tab->setPalette(pal);
120 contributions_tab->setPalette(pal);
121 translations_tab->setPalette(pal);
122 license_tab->setPalette(pal);
123
124 QPalette p = info->palette();
125 //p.setBrush(QPalette::Base, info_tab->palette().window());
126 p.setColor(QPalette::Base, info_tab->palette().color(QPalette::Window));
127
128 info->setPalette(p);
129 contributions->setPalette(p);
130 translators->setPalette(p);
131 license->setPalette(p);
132
133 adjustSize();
134}
135
136About::~About() {
137}
138
139QString About::getTranslators() {
140 return QString(
141 tr("The following people have contributed with translations:") +
142 "<p>" +
143 trad(tr("Spanish"), "Ricardo Villalba <rvm@users.sourceforge.net>") +
144 trad(tr("German"), "Panagiotis Papadopoulos <pano_90@gmx.net>") +
145 trad(tr("Slovak"), "Sweto <peter.mendel@gmail.com>") +
146 trad(tr("Italian"), QStringList()
147 << "greengreat <gmeildeno@gmail.com>"
148 << "Giancarlo Scola <scola.giancarlo@libero.it>") +
149 trad(tr("French"), QStringList()
150 << "Olivier g <1got@caramail.com>"
151 << "Temet <goondy@free.fr>"
152 << "Erwann MEST <kud.gray@gmail.com>") +
153 trad(tr("Simplified-Chinese"), QStringList()
154 << "Tim Green <iamtimgreen@gmail.com>"
155 << "OpenBDH <opensource@bendihua.org>") +
156 trad(tr("Russian"), QString::fromUtf8("Белый ВлаЎОЌОр <wiselord1983@gmail.com>"))+
157 trad(tr("Hungarian"), QStringList()
158 << "Charles Barcza <kbarcza@blackpanther.hu>"
159 << "CyberDragon <cyberdragon777@gmail.com>") +
160 trad(tr("Polish"), QStringList()
161 << "qla <qla0@vp.pl>"
162 << "Jarek <ajep9691@wp.pl>"
163 << "sake12 <sake12@gmail.com>" ) +
164 trad(tr("Japanese"), "Nardog <alphisation@gmail.com>") +
165 trad(tr("Dutch"), QStringList()
166 << "profoX <wesley@ubuntu-nl.org>"
167 << "BalaamsMiracle"
168 << "Kristof Bal <kristof.bal@gmail.com>") +
169 trad(tr("Ukrainian"), QStringList()
170 << "Motsyo Gennadi <drool@altlinux.ru>"
171 << "Oleksandr Kovalenko <alx.kovalenko@gmail.com>" ) +
172 trad(tr("Portuguese - Brazil"), "Ventura <ventura.barbeiro@terra.com.br>") +
173 trad(tr("Georgian"), "George Machitidze <giomac@gmail.com>") +
174 trad(tr("Czech"), QStringList()
175 << QString::fromUtf8("Martin Dvořák <martin.dvorak@centrum.cz>")
176 << QString::fromUtf8("Jaromír Smrček <jaromir.smrcek@zoner.com>") ) +
177 trad(tr("Bulgarian"), "<marzeliv@mail.bg>") +
178 trad(tr("Turkish"), "alper er <alperer@gmail.com>") +
179 trad(tr("Swedish"), "Leif Larsson <leif.larsson@gmail.com>") +
180 trad(tr("Serbian"), "Kunalagon Umuhanik <kunalagon@gmail.com>") +
181 trad(tr("Traditional Chinese"), "Hoopoe <dai715.tw@yahoo.com.tw>") +
182 trad(tr("Romanian"), "DoruH <DoruHushHush@gmail.com>") +
183 trad(tr("Portuguese - Portugal"), QStringList()
184 << "Waxman <waxman.pt@gmail.com>"
185 << QString::fromUtf8("Sérgio Marques <smarquespt@gmail.com>") ) +
186 trad(tr("Greek"), "my80s <wamy80s@gmail.com>") +
187 trad(tr("Finnish"), "peeaivo <peeaivo@gmail.com>") +
188 trad(tr("Korean"), "Heesu Yoon <imsu30@gmail.com>") +
189 trad(tr("Macedonian"), "Marko Doda <mark0d0da@gmail.com>") +
190 trad(tr("Basque"), QStringList()
191 << "Piarres Beobide <pi@beobide.net>"
192 << "Xabier Aramendi <azpidatziak@gmail.com>") +
193 trad(tr("Catalan"), QString::fromUtf8("Roger Calvó <rcalvoi@yahoo.com>")) +
194 trad(tr("Slovenian"), "Janez Troha <janez.troha@gmail.com>") +
195 trad(tr("Arabic"), "Muhammad Nour Hajj Omar <arabianheart@live.com>") +
196 trad(tr("Kurdish"), "Si_murg56 <simurg56@gmail.com>") +
197 trad(tr("Galician"), "Miguel Branco <mgl.branco@gmail.com>") +
198 trad(tr("Vietnamese"), QString::fromUtf8("Lê Xuân Thảo <thaolx@gmail.com>")) +
199 trad(tr("Estonian"), QString::fromUtf8("Olav MÀgi <olav.magi@hotmail.com>")) +
200 trad(tr("Lithuanian"), QStringList()
201 << "Freemail <ricka_g@freemail.lt>"
202 << QString::fromUtf8("Algimantas Margevičius <margevicius.algimantas@gmail.com>") ) +
203 trad(tr("Danish"), "Martin Schlander <mschlander@opensuse.org>") +
204 trad(tr("Croatian"), QString::fromUtf8("Josip KujundÅŸija <marshsmello@gmail.com>")) +
205 "");
206}
207
208QString About::trad(const QString & lang, const QString & author) {
209 return trad(lang, QStringList() << author);
210}
211
212QString About::trad(const QString & lang, const QStringList & authors) {
213 QString s;
214 for (int n = 0; n < authors.count(); n++) {
215 QString author = authors[n];
216 s += author.replace("<", "&lt;").replace(">", "&gt;");
217 if (n < (authors.count()-1)) s += "<br>";
218 }
219 return QString("<h3>%1:</h3><h4>%2</h4><hr>").arg(lang).arg(s);
220}
221
222QString About::link(const QString & url, QString name) {
223 if (name.isEmpty()) name = url;
224 return QString("<a href=\"" + url + "\">" + name +"</a>");
225}
226
227QString About::contr(const QString & author, const QString & thing) {
228 return "<li>"+ tr("<b>%1</b> (%2)").arg(author).arg(thing) +"</li>";
229}
230
231QSize About::sizeHint () const {
232 return QSize(518, 326);
233}
234
235void About::openLink(const QUrl & link) {
236 qDebug("About::openLink: '%s'", link.toString().toUtf8().constData());
237 QDesktopServices::openUrl(link);
238}
239
240#include "moc_about.cpp"
Note: See TracBrowser for help on using the repository browser.