source: smplayer/vendor/current/src/about.cpp@ 140

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

SMPlayer: update vendor to 0.8.5'

File size: 10.9 KB
Line 
1/* smplayer, GUI front-end for mplayer.
2 Copyright (C) 2006-2013 Ricardo Villalba <[email protected]>
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-2013 Ricardo Villalba &lt;[email protected]&gt;<br><br>"
57 "<b>" + tr("Version: %1").arg(smplayerVersion()) + "</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;[email protected]&gt;") + "<br><br>" +
106 tr("Packages for Windows created by %1").arg("redxii &lt;[email protected]&gt;") + "<br><br>" +
107 tr("Many other people contributed with patches. See the Changelog for details.")
108 );
109
110#ifdef YOUTUBE_SUPPORT
111 youtube->setHtml(
112 tr("Founded in February 2005, YouTube&trade; is the world's most popular online "
113 "video community, allowing millions of people to discover, watch and share "
114 "originally-created videos. YouTube&trade; provides a forum for people to "
115 "connect, inform, and inspire others across the globe and acts as a "
116 "distribution platform for original content creators and advertisers large and small.") +
117 "<br><br>" +
118 tr("By using this application you hereby agree to be bound by Google Terms of Services located "
119 "at %1.").arg(link("http://www.google.com/accounts/TOS", "http://www.google.com/accounts/TOS"))
120 );
121 youtube->setOpenExternalLinks(true);
122#else
123 tab_widget->removeTab(4);
124#endif
125
126 // Copy the background color ("window") of the tab widget to the "base" color of the qtextbrowsers
127 // Problem, it doesn't work with some styles, so first we change the "window" color of the tab widgets.
128 info_tab->setAutoFillBackground(true);
129 contributions_tab->setAutoFillBackground(true);
130 translations_tab->setAutoFillBackground(true);
131 license_tab->setAutoFillBackground(true);
132 youtube_tab->setAutoFillBackground(true);
133
134 QPalette pal = info_tab->palette();
135 pal.setColor(QPalette::Window, palette().color(QPalette::Window) );
136
137 info_tab->setPalette(pal);
138 contributions_tab->setPalette(pal);
139 translations_tab->setPalette(pal);
140 license_tab->setPalette(pal);
141 youtube_tab->setPalette(pal);
142
143 QPalette p = info->palette();
144 //p.setBrush(QPalette::Base, info_tab->palette().window());
145 p.setColor(QPalette::Base, info_tab->palette().color(QPalette::Window));
146
147 info->setPalette(p);
148 contributions->setPalette(p);
149 translators->setPalette(p);
150 license->setPalette(p);
151 youtube->setPalette(p);
152
153 adjustSize();
154}
155
156About::~About() {
157}
158
159QString About::getTranslators() {
160 return QString(
161 tr("The following people have contributed with translations:") +
162 "<p>" +
163 trad(tr("Spanish"), "Ricardo Villalba <[email protected]>") +
164 trad(tr("German"), "Panagiotis Papadopoulos <[email protected]>") +
165 trad(tr("Slovak"), "Sweto <[email protected]>") +
166 trad(tr("Italian"), QStringList()
167 << "greengreat <[email protected]>"
168 << "Giancarlo Scola <[email protected]>") +
169 trad(tr("French"), QStringList()
170 << "Olivier g <[email protected]>"
171 << "Temet <[email protected]>"
172 << "Erwann MEST <[email protected]>") +
173 trad(tr("Simplified-Chinese"), QStringList()
174 << "Tim Green <[email protected]>"
175 << "OpenBDH <[email protected]>") +
176 trad(tr("Russian"), QString::fromUtf8("Белый ВлаЎОЌОр <[email protected]>"))+
177 trad(tr("Hungarian"), QStringList()
178 << "Charles Barcza <[email protected]>"
179 << "CyberDragon <[email protected]>") +
180 trad(tr("Polish"), QStringList()
181 << "qla <[email protected]>"
182 << "Jarek <[email protected]>"
183 << "sake12 <[email protected]>" ) +
184 trad(tr("Japanese"), "Nardog <[email protected]>") +
185 trad(tr("Dutch"), QStringList()
186 << "profoX <[email protected]>"
187 << "BalaamsMiracle"
188 << "Kristof Bal <[email protected]>") +
189 trad(tr("Ukrainian"), QStringList()
190 << "Motsyo Gennadi <[email protected]>"
191 << "Oleksandr Kovalenko <[email protected]>" ) +
192 trad(tr("Portuguese - Brazil"), QStringList()
193 << "Ventura <[email protected]>"
194 << QString::fromUtf8("Maico Sertório <[email protected]>")) +
195 trad(tr("Georgian"), "George Machitidze <[email protected]>") +
196 trad(tr("Czech"), QStringList()
197 << QString::fromUtf8("Martin Dvořák <[email protected]>")
198 << QString::fromUtf8("Jaromír Smrček <[email protected]>") ) +
199 trad(tr("Bulgarian"), "<[email protected]>") +
200 trad(tr("Turkish"), "alper er <[email protected]>") +
201 trad(tr("Swedish"), "Leif Larsson <[email protected]>") +
202 trad(tr("Serbian"), "Kunalagon Umuhanik <[email protected]>") +
203 trad(tr("Traditional Chinese"), "Hoopoe <[email protected]>") +
204 trad(tr("Romanian"), "DoruH <[email protected]>") +
205 trad(tr("Portuguese - Portugal"), QStringList()
206 << "Waxman <[email protected]>"
207 << QString::fromUtf8("Sérgio Marques <[email protected]>") ) +
208 trad(tr("Greek"), "my80s <[email protected]>") +
209 trad(tr("Finnish"), "peeaivo <[email protected]>") +
210 trad(tr("Korean"), "Heesu Yoon <[email protected]>") +
211 trad(tr("Macedonian"), "Marko Doda <[email protected]>") +
212 trad(tr("Basque"), QStringList()
213 << "Piarres Beobide <[email protected]>"
214 << "Xabier Aramendi <[email protected]>") +
215 trad(tr("Catalan"), QString::fromUtf8("Roger Calvó <[email protected]>")) +
216 trad(tr("Slovenian"), "Janez Troha <[email protected]>") +
217 trad(tr("Arabic"), "Muhammad Nour Hajj Omar <[email protected]>") +
218 trad(tr("Kurdish"), "Si_murg56 <[email protected]>") +
219 trad(tr("Galician"), QStringList() << "Miguel Branco <[email protected]>" << "Gallaecio") +
220 trad(tr("Vietnamese"), QString::fromUtf8("Lê Xuân Thảo <[email protected]>")) +
221 trad(tr("Estonian"), QString::fromUtf8("Olav MÀgi <[email protected]>")) +
222 trad(tr("Lithuanian"), QStringList()
223 << "Freemail <[email protected]>"
224 << QString::fromUtf8("Algimantas Margevičius <[email protected]>") ) +
225 trad(tr("Danish"), "Martin Schlander <[email protected]>") +
226 trad(tr("Croatian"), QString::fromUtf8("Josip KujundÅŸija <[email protected]>")) +
227 trad(tr("Hebrew"), "Genghis Khan <[email protected]>") +
228 trad(tr("Thai"), QString::fromUtf8("àž¡àž²à¹‚àž™àžŠàžà¹Œ àžªàž¡àžšàž±àžàž”àžŽà¹Œ <[email protected]>")) +
229 trad(tr("Malay"), "abuyop (transifex)") +
230 "");
231}
232
233QString About::trad(const QString & lang, const QString & author) {
234 return trad(lang, QStringList() << author);
235}
236
237QString About::trad(const QString & lang, const QStringList & authors) {
238 QString s;
239 for (int n = 0; n < authors.count(); n++) {
240 QString author = authors[n];
241 s += author.replace("<", "&lt;").replace(">", "&gt;");
242 if (n < (authors.count()-1)) s += "<br>";
243 }
244 return QString("<h3>%1:</h3><h4>%2</h4><hr>").arg(lang).arg(s);
245}
246
247QString About::link(const QString & url, QString name) {
248 if (name.isEmpty()) name = url;
249 return QString("<a href=\"" + url + "\">" + name +"</a>");
250}
251
252QString About::contr(const QString & author, const QString & thing) {
253 return "<li>"+ tr("<b>%1</b> (%2)").arg(author).arg(thing) +"</li>";
254}
255
256QSize About::sizeHint () const {
257 return QSize(518, 326);
258}
259
260void About::openLink(const QUrl & link) {
261 qDebug("About::openLink: '%s'", link.toString().toUtf8().constData());
262 QDesktopServices::openUrl(link);
263}
264
265#include "moc_about.cpp"
Note: See TracBrowser for help on using the repository browser.