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

Last change on this file since 170 was 170, checked in by Silvan Scherrer, 11 years ago

SMPlayer: updated trunk to 14.9.0

  • Property svn:eol-style set to LF
File size: 10.7 KB
Line 
1/* smplayer, GUI front-end for mplayer.
2 Copyright (C) 2006-2014 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-2014 Ricardo Villalba &lt;rvm@users.sourceforge.net&gt;<br><br>"
57 "<b>" + tr("Version: %1").arg(Version::printable()) + "</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
111 // Copy the background color ("window") of the tab widget to the "base" color of the qtextbrowsers
112 // Problem, it doesn't work with some styles, so first we change the "window" color of the tab widgets.
113 info_tab->setAutoFillBackground(true);
114 contributions_tab->setAutoFillBackground(true);
115 translations_tab->setAutoFillBackground(true);
116 license_tab->setAutoFillBackground(true);
117
118 QPalette pal = info_tab->palette();
119 pal.setColor(QPalette::Window, palette().color(QPalette::Window) );
120
121 info_tab->setPalette(pal);
122 contributions_tab->setPalette(pal);
123 translations_tab->setPalette(pal);
124 license_tab->setPalette(pal);
125
126 QPalette p = info->palette();
127 //p.setBrush(QPalette::Base, info_tab->palette().window());
128 p.setColor(QPalette::Base, info_tab->palette().color(QPalette::Window));
129
130 info->setPalette(p);
131 contributions->setPalette(p);
132 translators->setPalette(p);
133 license->setPalette(p);
134
135 tab_widget->removeTab(0);
136
137 adjustSize();
138}
139
140About::~About() {
141}
142
143QString About::getTranslators() {
144 return QString(
145 tr("Many people contributed with translations.") +" "+
146 tr("You can also help to translate SMPlayer into your own language.") +"<p>"+
147 tr("Visit %1 and join a translation team.").arg("<a href=\"http://www.transifex.com/projects/p/smplayer/\">http://www.transifex.com/projects/p/smplayer/</a>") +
148 "<p>" +
149 tr("Current translators from the transifex teams:") +
150 "<p>" +
151 trad(tr("Spanish"), "Ricardo Villalba") +
152 trad(tr("Basque"), "Xabier Aramendi") +
153 trad(tr("Croatian"), "Gogo") +
154 trad(tr("Czech"), QStringList() << QString::fromUtf8("Petr Šimáček") << QString::fromUtf8("Jakub Koşíšek")) +
155 trad(tr("Japanese"), QStringList() << "Ever_green" << "Nardog") +
156 trad(tr("Korean"), QStringList() << "ParkJS" << "Potato") +
157 trad(tr("Portuguese"), QStringList() << QString::fromUtf8("Sérgio Marques") << "Hugo Carvalho") +
158 trad(tr("Serbian"), QStringList() << QString::fromUtf8("Mladen Pejaković") << "Miroslav" << "Rancher") +
159 trad(tr("Ukrainian"), QStringList() << "Zubr139" << "evmir2" << "vitrolov") +
160 trad(tr("Galician"), QStringList() << QString::fromUtf8("Adrián Chaves Fernández") << "Miguel Branco" << "antiparvos") +
161 trad(tr("Lithuanian"), QString::fromUtf8("Algimantas Margevičius")) +
162 trad(tr("Malay"), QStringList() << "Abuyop" << "inashdeen") +
163 trad(tr("Portuguese - Brazil"), QStringList() << QString::fromUtf8("Maico Sertório") << "Vinicius" << "Ronnie Dilli" << QString::fromUtf8("Lucas Simões") << "Conservador Ressurge") +
164 trad(tr("Hebrew"), "GenghisKhan") +
165 trad(tr("Simplified Chinese"), QStringList() << "OpenBDH" << "Zhangzheliuli" << "Zhangmin" << "wwj402" << "775405984" << "DefineFC") +
166 trad(tr("Vietnamese"), QStringList() << "Anh Phan" << "Biz Over" << "Thu Thao Nguyen Ngoc" << "Duy Truong Nguyen") +
167 trad(tr("Polish"), QStringList() <<"Filux" << QString::fromUtf8("Łukasz Hryniuk") << QString::fromUtf8("Piotr Strębski") << QString::fromUtf8("Michał Trzebiatowski") << "Grzegorz Pruchniakowski") +
168 trad(tr("Russian"), QStringList() << "WiseLord" << "Viktor" << "DmitryKX" << "Gleb Mekhrenin" << "ElFrio" << "Semen V. Dubina" << "Denis" << "angry_snake" << "Andrei Stepanov") +
169 trad(tr("French"), QStringList() << "Olivier Devineau" << "Ybsar" << "Janmaro" << "Guillaume 'zzd10h' Boesel" << "tneskovic" << "Calinou" << "Cajetan Bouchard") +
170 trad(tr("Indonesian"), QStringList() << "Mohamad Hasan Al Banna" << "Aulia Firdaus Simbolon" << "Muhammad Fikri Hariri") +
171 trad(tr("Danish"), "Michael Larsen") +
172 trad(tr("Hungarian"), QStringList() << "Gojko" << QString::fromUtf8("Zsolt Péter Basák") << "chris020891") +
173 trad(tr("Turkish"), QStringList() << "Emre Firat" << QString::fromUtf8("Hasan Akgöz") << QString::fromUtf8("якуп")) +
174 trad(tr("Finnish"), QString::fromUtf8("Jiri Grönroos")) +
175 trad(tr("German"), QStringList() << "Shaggy" << QString::fromUtf8("Michał Trzebiatowski") << "Eclipse" << "j5lx" << "Tobias Bannert") +
176 trad(tr("Traditional Chinese"), QStringList() << "Taijuin Lee" << "Wpliao" << "Jeff Huang" << "cges30901") +
177 trad(tr("Bulgarian"), QStringList() << "Ivailo Monev" << QString::fromUtf8("РаЎПслав") << "Elusiv_man" << "Kiril Kirilov") +
178 trad(tr("Norwegian Nynorsk"), QStringList() << "Bjorni" << "F_Sauce") +
179 trad(tr("Swedish"), QStringList() << "XC" << "Andreas Gustafsson" << "Patrik Nilsson") +
180 trad(tr("Arabic"), QStringList() << "Riyadh" << "Muhammad Fawwaz Orabi" << "Mohamed Sakhri" << QString::fromUtf8("طاهر")) +
181 trad(tr("Georgian"), "George Machitidze") +
182 trad(tr("Arabic - Saudi Arabia"), "Mohamed") +
183 trad(tr("Sinhala"), QStringList() << "Rathnayake" << "anupeiris" << "sahan777") +
184 trad(tr("Greek"), QString::fromUtf8("ΓιάΜΜης ΑΜΞυ
185ΌίΎης")) +
186 trad(tr("Estonian"), QString::fromUtf8("Olav MÀgi")) +
187 trad(tr("N'ko"), QStringList() << QString::fromUtf8("Kairaba Cissé") << "Youssouf Diaby" << "Lasnei Kante" << "Kante Soufiane") +
188 trad(tr("Italian"), QStringList() << "Damtux" << "Samir Hawamdeh" << "Fabio Mazza") +
189 trad(tr("Uzbek"), "Umid Almasov") +
190 trad(tr("Catalan"), QStringList() << "Anna Fenoy" << "Jmontane") +
191 trad(tr("Slovak"), QString::fromUtf8("Ján ĎanovskÜ")) +
192 trad(tr("British English"), "F_Sauce") +
193 trad(tr("Albanian"), "rigels.gordani") +
194 trad(tr("Dutch"), QStringList() << "CecilWesterhof" << "meijdam" << "Heimen Stoffels") +
195 trad(tr("Romanian"), "msalajan") +
196 trad(tr("Khmer"), "Sovichet Tep") +
197 trad(tr("Telugu"), "Praveen_Illa") +
198 trad(tr("Tamil"), "vithushanth123") +
199 trad(tr("Malayalam"), "Akhilan") +
200 "");
201}
202
203QString About::trad(const QString & lang, const QString & author) {
204 return trad(lang, QStringList() << author);
205}
206
207QString About::trad(const QString & lang, const QStringList & authors) {
208 QString s;
209 for (int n = 0; n < authors.count(); n++) {
210 QString author = authors[n];
211 s += author.replace("<", "&lt;").replace(">", "&gt;");
212 if (n < (authors.count()-1)) s += ", ";
213 }
214 //return QString("<h3>%1:</h3><h4>%2</h4><hr>").arg(lang).arg(s);
215 return QString("<p><b>%1</b>: %2</p>").arg(lang).arg(s);
216}
217
218QString About::link(const QString & url, QString name) {
219 if (name.isEmpty()) name = url;
220 return QString("<a href=\"" + url + "\">" + name +"</a>");
221}
222
223QString About::contr(const QString & author, const QString & thing) {
224 return "<li>"+ tr("<b>%1</b> (%2)").arg(author).arg(thing) +"</li>";
225}
226
227QSize About::sizeHint () const {
228 return QSize(518, 326);
229}
230
231void About::openLink(const QUrl & link) {
232 qDebug("About::openLink: '%s'", link.toString().toUtf8().constData());
233 QDesktopServices::openUrl(link);
234}
235
236#include "moc_about.cpp"
Note: See TracBrowser for help on using the repository browser.