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 |
|
---|
30 | using namespace Global;
|
---|
31 |
|
---|
32 | About::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> © 2006-2014 Ricardo Villalba <rvm@users.sourceforge.net><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 <kbarcza@blackpanther.hu>") + "<br><br>" +
|
---|
106 | tr("Packages for Windows created by %1").arg("redxii <redxii@users.sourceforge.net>") + "<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 |
|
---|
140 | About::~About() {
|
---|
141 | }
|
---|
142 |
|
---|
143 | QString 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") +
|
---|
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"), "Abuyop") +
|
---|
163 | trad(tr("Portuguese - Brazil"), QStringList() << QString::fromUtf8("Maico Sertório") << "Vinicius" << "Ronnie Dilli" << QString::fromUtf8("Lucas Simões")) +
|
---|
164 | trad(tr("Hebrew"), "GenghisKhan") +
|
---|
165 | trad(tr("Simplified Chinese"), QStringList() << "OpenBDH" << "Zhangzheliuli" << "Zhnagmin" << "wwj402" << "775405984") +
|
---|
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") +
|
---|
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" << QString::fromUtf8("å¥çæè¥¿éæ¯")) +
|
---|
177 | trad(tr("Bulgarian"), QStringList() << "Ivailo Monev" << QString::fromUtf8("РаЎПÑлав") << "Elusiv_man") +
|
---|
178 | trad(tr("Norwegian Nynorsk"), QStringList() << "Bjorni" << "F_Sauce") +
|
---|
179 | trad(tr("Swedish"), QStringList() << "XC" << "Andreas Gustafsson") +
|
---|
180 | trad(tr("Arabic"), QStringList() << "Riyadh" << "Muhammad Fawwaz Orabi" << "Mohamed Sakhri") +
|
---|
181 | trad(tr("Georgian"), "George Machitidze") +
|
---|
182 | trad(tr("Arabic - Saudi Arabia"), "Mohamed") +
|
---|
183 | trad(tr("Sinhala"), "Rathnayake") +
|
---|
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 | "");
|
---|
195 | }
|
---|
196 |
|
---|
197 | QString About::trad(const QString & lang, const QString & author) {
|
---|
198 | return trad(lang, QStringList() << author);
|
---|
199 | }
|
---|
200 |
|
---|
201 | QString About::trad(const QString & lang, const QStringList & authors) {
|
---|
202 | QString s;
|
---|
203 | for (int n = 0; n < authors.count(); n++) {
|
---|
204 | QString author = authors[n];
|
---|
205 | s += author.replace("<", "<").replace(">", ">");
|
---|
206 | if (n < (authors.count()-1)) s += ", ";
|
---|
207 | }
|
---|
208 | //return QString("<h3>%1:</h3><h4>%2</h4><hr>").arg(lang).arg(s);
|
---|
209 | return QString("<p><b>%1</b>: %2</p>").arg(lang).arg(s);
|
---|
210 | }
|
---|
211 |
|
---|
212 | QString About::link(const QString & url, QString name) {
|
---|
213 | if (name.isEmpty()) name = url;
|
---|
214 | return QString("<a href=\"" + url + "\">" + name +"</a>");
|
---|
215 | }
|
---|
216 |
|
---|
217 | QString About::contr(const QString & author, const QString & thing) {
|
---|
218 | return "<li>"+ tr("<b>%1</b> (%2)").arg(author).arg(thing) +"</li>";
|
---|
219 | }
|
---|
220 |
|
---|
221 | QSize About::sizeHint () const {
|
---|
222 | return QSize(518, 326);
|
---|
223 | }
|
---|
224 |
|
---|
225 | void About::openLink(const QUrl & link) {
|
---|
226 | qDebug("About::openLink: '%s'", link.toString().toUtf8().constData());
|
---|
227 | QDesktopServices::openUrl(link);
|
---|
228 | }
|
---|
229 |
|
---|
230 | #include "moc_about.cpp"
|
---|