| 1 | /* smplayer, GUI front-end for mplayer.
|
|---|
| 2 | Copyright (C) 2006-2016 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 "inforeader.h"
|
|---|
| 26 | #include "links.h"
|
|---|
| 27 |
|
|---|
| 28 | #include <QFile>
|
|---|
| 29 | #include <QDesktopServices>
|
|---|
| 30 |
|
|---|
| 31 | using namespace Global;
|
|---|
| 32 |
|
|---|
| 33 | About::About(QWidget * parent, Qt::WindowFlags f)
|
|---|
| 34 | : QDialog(parent, f)
|
|---|
| 35 | {
|
|---|
| 36 | setupUi(this);
|
|---|
| 37 | setWindowIcon( Images::icon("logo", 64) );
|
|---|
| 38 |
|
|---|
| 39 | logo->setPixmap( QPixmap(":/default-theme/logo.png").scaledToHeight(64, Qt::SmoothTransformation) );
|
|---|
| 40 | contrib_icon->setPixmap( Images::icon("contributors" ) );
|
|---|
| 41 | translators_icon->setPixmap( Images::icon("translators" ) );
|
|---|
| 42 | license_icon->setPixmap( Images::icon("license" ) );
|
|---|
| 43 |
|
|---|
| 44 | InfoReader * i = InfoReader::obj(pref->mplayer_bin);
|
|---|
| 45 | i->getInfo();
|
|---|
| 46 | QString mplayer_version = tr("Using %1").arg(i->playerVersion());
|
|---|
| 47 |
|
|---|
| 48 | info->setText(
|
|---|
| 49 | "<b>SMPlayer</b> © 2006-2016 Ricardo Villalba <rvm@users.sourceforge.net><br><br>"
|
|---|
| 50 | "<b>" + tr("Version: %1").arg(Version::printable()) + "</b>" +
|
|---|
| 51 | #if PORTABLE_APP
|
|---|
| 52 | " (" + tr("Portable Edition") + ")" +
|
|---|
| 53 | #endif
|
|---|
| 54 | #ifdef EXPERIMENTAL
|
|---|
| 55 | "<br>Experimental branch<br>"
|
|---|
| 56 | #endif
|
|---|
| 57 | "<br>" +
|
|---|
| 58 | tr("Using Qt %1 (compiled with Qt %2)").arg(qVersion()).arg(QT_VERSION_STR) + "<br>" +
|
|---|
| 59 | mplayer_version + "<br><br>" +
|
|---|
| 60 | "<b>"+ tr("Links:") +"</b><br>"+
|
|---|
| 61 | tr("Official website:") +" "+ link(URL_HOMEPAGE) +"<br>"+
|
|---|
| 62 | tr("Support forum:") +" "+ link(URL_FORUM) +"<br>"+
|
|---|
| 63 | "<br>" +
|
|---|
| 64 | /*
|
|---|
| 65 | tr("SMPlayer uses the award-winning MPlayer as playback engine. See %1")
|
|---|
| 66 | .arg("<a href=\"http://www.mplayerhq.hu/design7/info.html\">http://www.mplayerhq.hu</a>") +
|
|---|
| 67 | */
|
|---|
| 68 | #if defined(MPV_SUPPORT) && defined(MPLAYER_SUPPORT)
|
|---|
| 69 | tr("SMPlayer is a graphical interface for %1 and %2.")
|
|---|
| 70 | .arg("<a href=\"http://www.mplayerhq.hu/design7/info.html\">MPlayer</a>")
|
|---|
| 71 | .arg("<a href=\"http://www.mpv.io\">mpv</a>") +
|
|---|
| 72 | #else
|
|---|
| 73 | tr("SMPlayer is a graphical interface for %1.")
|
|---|
| 74 | #ifdef MPV_SUPPORT
|
|---|
| 75 | .arg("<a href=\"http://www.mpv.io\">mpv</a>") +
|
|---|
| 76 | #endif
|
|---|
| 77 | #ifdef MPLAYER_SUPPORT
|
|---|
| 78 | .arg("<a href=\"http://www.mplayerhq.hu/design7/info.html\">MPlayer</a>") +
|
|---|
| 79 | #endif
|
|---|
| 80 | #endif
|
|---|
| 81 | "<br><br>" +
|
|---|
| 82 | tr("Subtitles service powered by %1").arg("<a href=\"http://www.opensubtitles.org\">www.OpenSubtitles.org</a>")
|
|---|
| 83 | /* + "<br><a href=\"http://www.opensubtitles.org\"><img src=\":default-theme/opensubtitles-logo.png\"></a>" */
|
|---|
| 84 | );
|
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 | QString license_text =
|
|---|
| 88 | "<i>"
|
|---|
| 89 | "This program is free software; you can redistribute it and/or modify "
|
|---|
| 90 | "it under the terms of the GNU General Public License as published by "
|
|---|
| 91 | "the Free Software Foundation; either version 2 of the License, or "
|
|---|
| 92 | "(at your option) any later version." "</i><br><br>";
|
|---|
| 93 |
|
|---|
| 94 | QString license_file = Paths::doc("gpl.html", "en");
|
|---|
| 95 | if (QFile::exists(license_file)) {
|
|---|
| 96 | license_file = QUrl::fromLocalFile(license_file).toString();
|
|---|
| 97 | license_text += QString("<a href=\"%1\">%2</a>").arg(license_file).arg(tr("Read the entire license"));
|
|---|
| 98 | }
|
|---|
| 99 |
|
|---|
| 100 | if ((pref->language != "en") && (pref->language != "en_US")) {
|
|---|
| 101 | QString license_trans_file = Paths::doc("gpl.html", pref->language, false);
|
|---|
| 102 | //qDebug("license_trans_file: %s", license_trans_file.toUtf8().constData());
|
|---|
| 103 | if (QFile::exists(license_trans_file)) {
|
|---|
| 104 | license_trans_file = QUrl::fromLocalFile(license_trans_file).toString();
|
|---|
| 105 | license_text += QString("<br><a href=\"%1\">%2</a>").arg(license_trans_file).arg(tr("Read a translation"));
|
|---|
| 106 | }
|
|---|
| 107 | }
|
|---|
| 108 | license->setText(license_text);
|
|---|
| 109 | license->setOpenLinks(false);
|
|---|
| 110 | license->setOpenExternalLinks(false);
|
|---|
| 111 | connect(license, SIGNAL(anchorClicked(const QUrl &)), this, SLOT(openLink(const QUrl&)));
|
|---|
| 112 |
|
|---|
| 113 | translators->setHtml( getTranslators() );
|
|---|
| 114 |
|
|---|
| 115 | contributions->setText(
|
|---|
| 116 | tr("SMPlayer logo by %1").arg("Charles Barcza <kbarcza@blackpanther.hu>") + "<br><br>" +
|
|---|
| 117 | tr("Packages for Windows created by %1").arg("redxii <redxii@users.sourceforge.net>") + "<br><br>" +
|
|---|
| 118 | tr("Many other people contributed with patches. See the Changelog for details.")
|
|---|
| 119 | );
|
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 | // Copy the background color ("window") of the tab widget to the "base" color of the qtextbrowsers
|
|---|
| 123 | // Problem, it doesn't work with some styles, so first we change the "window" color of the tab widgets.
|
|---|
| 124 | info_tab->setAutoFillBackground(true);
|
|---|
| 125 | contributions_tab->setAutoFillBackground(true);
|
|---|
| 126 | translations_tab->setAutoFillBackground(true);
|
|---|
| 127 | license_tab->setAutoFillBackground(true);
|
|---|
| 128 |
|
|---|
| 129 | QPalette pal = info_tab->palette();
|
|---|
| 130 | pal.setColor(QPalette::Window, palette().color(QPalette::Window) );
|
|---|
| 131 |
|
|---|
| 132 | info_tab->setPalette(pal);
|
|---|
| 133 | contributions_tab->setPalette(pal);
|
|---|
| 134 | translations_tab->setPalette(pal);
|
|---|
| 135 | license_tab->setPalette(pal);
|
|---|
| 136 |
|
|---|
| 137 | QPalette p = info->palette();
|
|---|
| 138 | //p.setBrush(QPalette::Base, info_tab->palette().window());
|
|---|
| 139 | p.setColor(QPalette::Base, info_tab->palette().color(QPalette::Window));
|
|---|
| 140 |
|
|---|
| 141 | info->setPalette(p);
|
|---|
| 142 | contributions->setPalette(p);
|
|---|
| 143 | translators->setPalette(p);
|
|---|
| 144 | license->setPalette(p);
|
|---|
| 145 |
|
|---|
| 146 | tab_widget->removeTab(0);
|
|---|
| 147 |
|
|---|
| 148 | adjustSize();
|
|---|
| 149 | }
|
|---|
| 150 |
|
|---|
| 151 | About::~About() {
|
|---|
| 152 | }
|
|---|
| 153 |
|
|---|
| 154 | QString About::getTranslators() {
|
|---|
| 155 | return QString(
|
|---|
| 156 | tr("Many people contributed with translations.") +" "+
|
|---|
| 157 | tr("You can also help to translate SMPlayer into your own language.") +"<p>"+
|
|---|
| 158 | 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>") +
|
|---|
| 159 | "<p><a href=\"" URL_TRANSLATORS "\">" +
|
|---|
| 160 | tr("Click here to know the translators from the transifex teams") +
|
|---|
| 161 | "</a>");
|
|---|
| 162 | }
|
|---|
| 163 |
|
|---|
| 164 | QString About::trad(const QString & lang, const QString & author) {
|
|---|
| 165 | return trad(lang, QStringList() << author);
|
|---|
| 166 | }
|
|---|
| 167 |
|
|---|
| 168 | QString About::trad(const QString & lang, const QStringList & authors) {
|
|---|
| 169 | QString s;
|
|---|
| 170 | for (int n = 0; n < authors.count(); n++) {
|
|---|
| 171 | QString author = authors[n];
|
|---|
| 172 | s += author.replace("<", "<").replace(">", ">");
|
|---|
| 173 | if (n < (authors.count()-1)) s += ", ";
|
|---|
| 174 | }
|
|---|
| 175 | //return QString("<h3>%1:</h3><h4>%2</h4><hr>").arg(lang).arg(s);
|
|---|
| 176 | return QString("<p><b>%1</b>: %2</p>").arg(lang).arg(s);
|
|---|
| 177 | }
|
|---|
| 178 |
|
|---|
| 179 | QString About::link(const QString & url, QString name) {
|
|---|
| 180 | if (name.isEmpty()) name = url;
|
|---|
| 181 | return QString("<a href=\"" + url + "\">" + name +"</a>");
|
|---|
| 182 | }
|
|---|
| 183 |
|
|---|
| 184 | QString About::contr(const QString & author, const QString & thing) {
|
|---|
| 185 | return "<li>"+ tr("<b>%1</b> (%2)").arg(author).arg(thing) +"</li>";
|
|---|
| 186 | }
|
|---|
| 187 |
|
|---|
| 188 | QSize About::sizeHint () const {
|
|---|
| 189 | return QSize(518, 326);
|
|---|
| 190 | }
|
|---|
| 191 |
|
|---|
| 192 | void About::openLink(const QUrl & link) {
|
|---|
| 193 | qDebug("About::openLink: '%s'", link.toString().toUtf8().constData());
|
|---|
| 194 | QDesktopServices::openUrl(link);
|
|---|
| 195 | }
|
|---|
| 196 |
|
|---|
| 197 | #include "moc_about.cpp"
|
|---|