Bump version.
[LameXP.git] / src / Dialog_About.cpp
blob149bc6de48e640ec6b77aa2abd00a498415c0b48
1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version, but always including the *additional*
9 // restrictions defined in the "License.txt" file.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this program; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 // http://www.gnu.org/licenses/gpl-2.0.txt
21 ///////////////////////////////////////////////////////////////////////////////
23 #include "Dialog_About.h"
25 #include "UIC_AboutDialog.h"
27 //Internal
28 #include "Global.h"
29 #include "Model_Settings.h"
31 //MUtils
32 #include <MUtils/Global.h>
33 #include <MUtils/OSSupport.h>
34 #include <MUtils/Sound.h>
35 #include <MUtils/GUI.h>
36 #include <MUtils/Version.h>
38 //Qt
39 #include <QDate>
40 #include <QApplication>
41 #include <QIcon>
42 #include <QPushButton>
43 #include <QDesktopServices>
44 #include <QUrl>
45 #include <QTimer>
46 #include <QFileInfo>
47 #include <QDir>
48 #include <QDesktopWidget>
49 #include <QLabel>
50 #include <QMessageBox>
51 #include <QTextStream>
52 #include <QScrollBar>
53 #include <QCloseEvent>
54 #include <QElapsedTimer>
55 #include <QWindowsVistaStyle>
56 #include <QWindowsXPStyle>
58 //CRT
59 #include <math.h>
61 //Helper macros
62 #define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(QString(URL).replace("-", "&minus;"))
63 #define TRIM_RIGHT(STR) do { while(STR.endsWith(QChar(' ')) || STR.endsWith(QChar('\t')) || STR.endsWith(QChar('\r')) || STR.endsWith(QChar('\n'))) STR.chop(1); } while(0)
64 #define MAKE_TRANSPARENT(WIDGET) do { QPalette _p = (WIDGET)->palette(); _p.setColor(QPalette::Background, Qt::transparent); (WIDGET)->setPalette(_p); } while(0)
66 //Constants
67 const char *AboutDialog::neroAacUrl = "http://www.nero.com/eng/company/about-nero/nero-aac-codec.php"; //"http://www.videohelp.com/tools/Nero-AAC-Codec";
68 const char *AboutDialog::disqueUrl = "http://muldersoft.com/?player_url=38X-MXOB014";
70 //Contributors
71 static const struct
73 char *pcFlag;
74 wchar_t *pcLanguage;
75 wchar_t *pcName;
76 char *pcMail;
78 g_lamexp_translators[] =
80 {"en", L"Englisch", L"LoRd_MuldeR", "MuldeR2@GMX.de" },
81 {"de", L"Deutsch", L"LoRd_MuldeR", "MuldeR2@GMX.de" },
82 {"", L"", L"Bodo Thevissen", "Bodo@thevissen.de" },
83 {"es", L"Español", L"Rub3nCT", "Rub3nCT@gmail.com" },
84 {"fr", L"Française", L"Dodich Informatique", "Dodich@live.fr" },
85 {"hu", L"Magyarul", L"ZityiSoft Team", "zityisoft@gmail.com" },
86 {"it", L"Italiano", L"Roberto", "Gulliver_69@libero.it" },
87 {"kr", L"한국어", L"JaeHyung Lee", "Kolanp@gmail.com" },
88 {"pl", L"Polski", L"Sir Daniel K", "Sir.Daniel.K@gmail.com" },
89 {"ru", L"Русский", L"Neonailol", "Neonailol@gmail.com" },
90 {"", L"", L"Иван Митин", "bardak@inbox.ru" },
91 {"sv", L"Svenska", L"Åke Engelbrektson", "eson@svenskasprakfiler.se"},
92 {"tw", L"繁体中文", L"456Vv", "123@456vv.com" },
93 {"uk", L"Українська", L"Arestarh", "Arestarh@ukr.net" },
94 {"zh", L"简体中文", L"456Vv", "123@456vv.com" },
95 {"", L"", L"庄泓川", "kidneybean@sohu.com" },
96 {NULL, NULL, NULL, NULL}
99 //Special Thanks
100 static const struct
102 char* pcName;
103 char *pcAddress;
105 g_lamexp_specialThanks[] =
107 { "Doom9's Forum", "http://forum.doom9.org/" },
108 { "Gleitz | German Doom9", "http://forum.gleitz.info/" },
109 { "Hydrogenaudio Forums", "http://www.hydrogenaudio.org/" },
110 { "RareWares", "http://www.rarewares.org/" },
111 { "GitHub", "http://github.com/" },
112 { "SourceForge", "http://sourceforge.net/" },
113 { "Qt Developer Network", "http://qt-project.org/" },
114 { "CodePlex", "http://www.codeplex.com/" },
115 { "Marius Hudea", "http://savedonthe.net/" },
116 { "Codecs.com", "http://www.codecs.com/" },
117 { NULL, NULL }
120 //Mirrors
121 static const struct
123 char* pcName;
124 char *pcAddress;
126 g_lamexp_mirrors[] =
128 { "GitHub.com", "https://github.com/lordmulder/LameXP" },
129 { "SourceForge.net", "http://sourceforge.net/p/lamexp/code/" },
130 { "Bitbucket.org", "https://bitbucket.org/lord_mulder/lamexp" },
131 { "GitLab.com" , "https://gitlab.com/lamexp/lamexp" },
132 { "Codeplex.com", "https://lamexp.codeplex.com/SourceControl/latest" },
133 { "Assembla.com", "https://www.assembla.com/spaces/lamexp/" },
134 { NULL, NULL }
137 ////////////////////////////////////////////////////////////
138 // Constructor
139 ////////////////////////////////////////////////////////////
141 AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstStart)
143 QDialog(parent),
144 ui(new Ui::AboutDialog),
145 m_settings(settings),
146 m_initFlags(new QMap<QWidget*,bool>),
147 m_disque(NULL),
148 m_disqueTimer(NULL),
149 m_rotateNext(false),
150 m_lastTab(0)
152 //Init the dialog, from the .ui file
153 ui->setupUi(this);
154 setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
155 resize(this->minimumSize());
157 //Disable "X" button
158 if(firstStart)
160 MUtils::GUI::enable_close_button(this, false);
163 //Init images
164 for(int i = 0; i < 4; i++)
166 m_cartoon[i] = NULL;
169 //Init tab widget
170 connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
172 //Make transparent
173 const type_info &styleType = typeid(*qApp->style());
174 if((typeid(QWindowsVistaStyle) == styleType) || (typeid(QWindowsXPStyle) == styleType))
176 MAKE_TRANSPARENT(ui->infoScrollArea);
177 MAKE_TRANSPARENT(ui->contributorsScrollArea);
178 MAKE_TRANSPARENT(ui->softwareScrollArea);
179 MAKE_TRANSPARENT(ui->licenseScrollArea);
182 //Show about dialog for the first time?
183 if(!firstStart)
185 MUtils::seed_rand();
187 ui->acceptButton->hide();
188 ui->declineButton->hide();
189 ui->aboutQtButton->show();
190 ui->closeButton->show();
192 QPixmap disque(":/images/Disque.png");
193 m_disque = new QLabel(this, Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
194 m_disque->resize(disque.size());
195 m_disque->setStyleSheet("background:transparent;");
196 m_disque->setAttribute(Qt::WA_TranslucentBackground);
197 m_disque->setPixmap(disque);
198 m_disque->installEventFilter(this);
200 connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), this, SLOT(geometryUpdated()));
201 geometryUpdated();
203 m_discOpacity = 0.01;
204 m_disquePos.setX(static_cast<int>(MUtils::next_rand32() % static_cast<unsigned int>(m_disqueBound.right() - disque.width() - m_disqueBound.left())) + m_disqueBound.left());
205 m_disquePos.setY(static_cast<int>(MUtils::next_rand32() % static_cast<unsigned int>(m_disqueBound.bottom() - disque.height() - m_disqueBound.top())) + m_disqueBound.top());
206 m_disqueFlags[0] = (MUtils::next_rand32() > (UINT_MAX/2));
207 m_disqueFlags[1] = (MUtils::next_rand32() > (UINT_MAX/2));
208 m_disque->move(m_disquePos);
209 m_disque->setWindowOpacity(m_discOpacity);
210 m_disque->show();
212 m_disqueTimer = new QTimer;
213 connect(m_disqueTimer, SIGNAL(timeout()), this, SLOT(moveDisque()));
214 m_disqueTimer->start(10);
216 connect(ui->aboutQtButton, SIGNAL(clicked()), this, SLOT(showAboutQt()));
218 else
220 ui->acceptButton->show();
221 ui->declineButton->show();
222 ui->aboutQtButton->hide();
223 ui->closeButton->hide();
226 //Activate "show license" button
227 ui->showLicenseButton->show();
228 connect(ui->showLicenseButton, SIGNAL(clicked()), this, SLOT(gotoLicenseTab()));
230 m_firstShow = firstStart;
233 AboutDialog::~AboutDialog(void)
235 if(m_disque)
237 m_disque->close();
238 MUTILS_DELETE(m_disque);
240 if(m_disqueTimer)
242 m_disqueTimer->stop();
243 MUTILS_DELETE(m_disqueTimer);
245 for(int i = 0; i < 4; i++)
247 MUTILS_DELETE(m_cartoon[i]);
249 MUTILS_DELETE(m_initFlags);
250 MUTILS_DELETE(ui);
253 ////////////////////////////////////////////////////////////
254 // Public Functions
255 ////////////////////////////////////////////////////////////
257 int AboutDialog::exec()
259 if(m_settings->soundsEnabled())
261 if(m_firstShow)
263 if(!MUtils::Sound::play_sound_file("imageres.dll", 5080, true))
265 MUtils::Sound::play_system_sound("SystemStart", true);
268 else
270 MUtils::Sound::play_sound("uuaarrgh", true);
274 switch(QDialog::exec())
276 case 1:
277 return 1;
278 break;
279 case 2:
280 return -1;
281 break;
282 default:
283 return 0;
284 break;
288 ////////////////////////////////////////////////////////////
289 // Slots
290 ////////////////////////////////////////////////////////////
292 #define TEMP_HIDE_DISQUE(CMD) do \
294 bool _tmp = (m_disque) ? m_disque->isVisible() : false; \
295 if(_tmp) m_disque->hide(); \
296 { CMD } \
297 if(_tmp) \
299 m_discOpacity = 0.01; \
300 m_disque->setWindowOpacity(m_discOpacity); \
301 m_disque->show(); \
304 while(0)
306 void AboutDialog::tabChanged(int index, const bool silent)
308 bool bInitialized = m_initFlags->value(ui->tabWidget->widget(index), false);
310 if(!bInitialized)
312 qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
314 if(QWidget *tab = ui->tabWidget->widget(index))
316 bool ok = false;
318 if(tab == ui->infoTab) { initInformationTab(); ok = true; }
319 if(tab == ui->contributorsTab) { initContributorsTab(); ok = true; }
320 if(tab == ui->softwareTab) { initSoftwareTab(); ok = true; }
321 if(tab == ui->licenseTab) { initLicenseTab(); ok = true; }
323 if(ok)
325 m_initFlags->insert(tab, true);
327 else
329 qWarning("Unknown tab %p encountered, cannot initialize !!!", tab);
334 ui->tabWidget->widget(index)->update();
335 qApp->processEvents();
336 qApp->restoreOverrideCursor();
339 //Play tick sound
340 if(m_settings->soundsEnabled() && (!silent))
342 MUtils::Sound::play_sound("tick", true);
345 //Scroll to the top
346 if(QWidget *tab = ui->tabWidget->widget(index))
348 if(tab == ui->infoTab) ui->infoScrollArea->verticalScrollBar()->setSliderPosition(0);
349 if(tab == ui->contributorsTab) ui->contributorsScrollArea->verticalScrollBar()->setSliderPosition(0);
350 if(tab == ui->softwareTab) ui->softwareScrollArea->verticalScrollBar()->setSliderPosition(0);
351 if(tab == ui->licenseTab) ui->licenseScrollArea->verticalScrollBar()->setSliderPosition(0);
354 //Update license button
355 ui->showLicenseButton->setChecked(ui->tabWidget->widget(index) == ui->licenseTab);
356 if(ui->tabWidget->widget(index) != ui->licenseTab) m_lastTab = index;
359 void AboutDialog::enableButtons(void)
361 ui->acceptButton->setEnabled(true);
362 ui->declineButton->setEnabled(true);
363 setCursor(QCursor(Qt::ArrowCursor));
366 void AboutDialog::openURL(const QString &url)
368 if(!QDesktopServices::openUrl(QUrl(url)))
370 MUtils::OS::shell_open(this, url);
374 void AboutDialog::showAboutQt(void)
376 TEMP_HIDE_DISQUE
378 QMessageBox::aboutQt(this);
382 void AboutDialog::gotoLicenseTab(void)
384 ui->tabWidget->setCurrentIndex(ui->tabWidget->indexOf(ui->showLicenseButton->isChecked() ? ui->licenseTab : ui->tabWidget->widget(m_lastTab)));
387 void AboutDialog::moveDisque(void)
389 int delta = 2;
390 QElapsedTimer elapsedTimer;
391 elapsedTimer.start();
393 if((!m_disqueDelay.isNull()) && m_disqueDelay->isValid())
395 const qint64 delay = m_disqueDelay->restart();
396 delta = qBound(1, static_cast<int>(ceil(static_cast<double>(delay) / 5.12)), 128);
398 else
400 m_disqueDelay.reset(new QElapsedTimer());
401 m_disqueDelay->start();
404 if(m_disque)
406 if(m_disquePos.x() <= m_disqueBound.left()) { m_disqueFlags[0] = true; m_rotateNext = true; }
407 if(m_disquePos.x() >= m_disqueBound.right()) { m_disqueFlags[0] = false; m_rotateNext = true; }
408 if(m_disquePos.y() <= m_disqueBound.top()) { m_disqueFlags[1] = true; m_rotateNext = true; }
409 if(m_disquePos.y() >= m_disqueBound.bottom()) { m_disqueFlags[1] = false; m_rotateNext = true; }
411 m_disquePos.setX(m_disqueFlags[0] ? (m_disquePos.x() + delta) : (m_disquePos.x() - delta));
412 m_disquePos.setY(m_disqueFlags[1] ? (m_disquePos.y() + delta) : (m_disquePos.y() - delta));
414 m_disque->move(m_disquePos);
416 if(m_rotateNext)
418 QPixmap *cartoon = NULL;
419 if(m_disqueFlags[0] == true && m_disqueFlags[1] != true) cartoon = m_cartoon[0];
420 if(m_disqueFlags[0] == true && m_disqueFlags[1] == true) cartoon = m_cartoon[1];
421 if(m_disqueFlags[0] != true && m_disqueFlags[1] == true) cartoon = m_cartoon[2];
422 if(m_disqueFlags[0] != true && m_disqueFlags[1] != true) cartoon = m_cartoon[3];
423 if(cartoon)
425 m_disque->setPixmap(*cartoon);
426 if(m_disque->size() != cartoon->size())
428 m_disque->resize(cartoon->size());
429 geometryUpdated();
432 m_rotateNext = false;
435 if(m_discOpacity != 1.0)
437 m_discOpacity = m_discOpacity + 0.01;
438 if(qFuzzyCompare(m_discOpacity, 1.0) || (m_discOpacity > 1.0))
440 m_discOpacity = 1.0;
442 m_disque->setWindowOpacity(m_discOpacity);
443 m_disque->update();
448 void AboutDialog::geometryUpdated(void)
450 if(m_disque)
452 QRect screenGeometry = QApplication::desktop()->availableGeometry();
453 m_disqueBound.setLeft(screenGeometry.left());
454 m_disqueBound.setRight(screenGeometry.width() - m_disque->width() + screenGeometry.left());
455 m_disqueBound.setTop(screenGeometry.top());
456 m_disqueBound.setBottom(screenGeometry.height() - m_disque->height() + screenGeometry.top());
458 else
460 m_disqueBound = QApplication::desktop()->availableGeometry();
464 void AboutDialog::adjustSize(void)
466 const int maxH = QApplication::desktop()->availableGeometry().height();
467 const int maxW = QApplication::desktop()->availableGeometry().width();
469 const int deltaH = ui->infoScrollArea->widget()->height() - ui->infoScrollArea->viewport()->height();
470 const int deltaW = ui->infoScrollArea->widget()->width() - ui->infoScrollArea->viewport()->width();
472 if(deltaH > 0)
474 this->resize(this->width(), qMin(this->height() + deltaH, maxH));
475 this->move(this->x(), this->y() - (deltaH / 2));
476 this->setMinimumHeight(qMax(this->minimumHeight(), this->height()));
479 if(deltaW > 0)
481 this->resize(qMin(this->width() + deltaW, maxW), this->height());
482 this->move(this->x() - (deltaW / 2), this->y());
483 this->setMinimumWidth(qMax(this->minimumWidth(), this->width()));
487 ////////////////////////////////////////////////////////////
488 // Protected Functions
489 ////////////////////////////////////////////////////////////
491 void AboutDialog::showEvent(QShowEvent *e)
493 QDialog::showEvent(e);
495 ui->tabWidget->setCurrentIndex(ui->tabWidget->indexOf(ui->infoTab));
496 tabChanged(m_lastTab = ui->tabWidget->currentIndex(), true);
498 if(m_firstShow)
500 ui->acceptButton->setEnabled(false);
501 ui->declineButton->setEnabled(false);
502 QTimer::singleShot(5000, this, SLOT(enableButtons()));
503 setCursor(QCursor(Qt::WaitCursor));
506 QTimer::singleShot(0, this, SLOT(adjustSize()));
509 void AboutDialog::closeEvent(QCloseEvent *e)
511 if(m_firstShow) e->ignore();
514 bool AboutDialog::eventFilter(QObject *obj, QEvent *event)
516 if((obj == m_disque) && (event->type() == QEvent::MouseButtonPress))
518 QPixmap cartoon(":/images/Cartoon.png");
519 for(int i = 0; i < 4; i++)
521 if(!m_cartoon[i])
523 m_cartoon[i] = new QPixmap(cartoon.transformed(QMatrix().rotate(static_cast<double>(i*90) + 45.0), Qt::SmoothTransformation));
524 m_rotateNext = true;
527 QDesktopServices::openUrl(QUrl(disqueUrl));
530 return false;
533 ////////////////////////////////////////////////////////////
534 // Private Functions
535 ////////////////////////////////////////////////////////////
537 void AboutDialog::initInformationTab(void)
539 const QDate versionDate = MUtils::Version::app_build_date();
541 const QString versionStr = QString().sprintf
543 "Version %d.%02d %s, Build %d [%s], %s %s, Qt v%s",
544 lamexp_version_major(),
545 lamexp_version_minor(),
546 lamexp_version_release(),
547 lamexp_version_build(),
548 versionDate.toString(Qt::ISODate).toLatin1().constData(),
549 MUtils::Version::compiler_version(),
550 MUtils::Version::compiler_arch(),
551 qVersion()
554 const QString copyrightStr = QString().sprintf
556 "Copyright (C) 2004-%04d LoRd_MuldeR &lt;MuldeR2@GMX.de&gt;. Some rights reserved.",
557 qMax(versionDate.year(), MUtils::OS::current_date().year())
560 QString aboutText;
562 aboutText += QString("<h2>%1</h2>").arg(NOBR(tr("LameXP - Audio Encoder Front-end")));
563 aboutText += QString("<b>%1</b><br>").arg(NOBR(copyrightStr));
564 aboutText += QString("<b>%1</b><br><br>").arg(NOBR(versionStr));
565 aboutText += QString("%1<br>").arg(NOBR(tr("Please visit %1 for news and updates!").arg(LINK(lamexp_website_url()))));
567 #if QT_VERSION < QT_VERSION_CHECK(5,0,0)
568 const QDate currentDate = MUtils::OS::current_date();
569 if(MUTILS_DEBUG)
571 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0);
572 aboutText += QString("<hr><font color=\"crimson\">%1</font>").arg(NOBR(QString("!!! --- DEBUG BUILD --- Expires at: %1 &middot; Days left: %2 --- DEBUG BUILD --- !!!").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(daysLeft))));
574 else if(lamexp_version_demo())
576 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0);
577 aboutText += QString("<hr><font color=\"crimson\">%1</font>").arg(NOBR(tr("Note: This demo (pre-release) version of LameXP will expire at %1. Still %2 days left.").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(daysLeft))));
579 #else
580 const QDate currentDate = lamexp_current_date_safe();
581 if(LAMEXP_DEBUG)
583 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0i64);
584 aboutText += QString("<hr><font color=\"crimson\">%1</font>").arg(NOBR(QString("!!! --- DEBUG BUILD --- Expires at: %1 &middot; Days left: %2 --- DEBUG BUILD --- !!!").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(daysLeft))));
586 else if(lamexp_version_demo())
588 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0i64);
589 aboutText += QString("<hr><font color=\"crimson\">%1</font>").arg(NOBR(tr("Note: This demo (pre-release) version of LameXP will expire at %1. Still %2 days left.").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(daysLeft))));
591 #endif
593 aboutText += "<hr><br>";
595 aboutText += "<nobr><tt>This program is free software; you can redistribute it and/or modify<br>";
596 aboutText += "it under the terms of the GNU General Public License as published by<br>";
597 aboutText += "the Free Software Foundation; either version 2 of the License, or<br>";
598 aboutText += "(at your option) any later version, but always including the *additional*<br>";
599 aboutText += "restrictions defined in the \"License.txt\" file (see \"License\" tab).<br><br>";
600 aboutText += "This program is distributed in the hope that it will be useful,<br>";
601 aboutText += "but WITHOUT ANY WARRANTY; without even the implied warranty of<br>";
602 aboutText += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>";
603 aboutText += "GNU General Public License for more details.<br><br>";
604 aboutText += "You should have received a copy of the GNU General Public License<br>";
605 aboutText += "along with this program; if not, write to the Free Software<br>";
606 aboutText += "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110&minus;1301, USA.</tt></nobr><br>";
607 aboutText += "<hr><table style=\"margin-top:4px\"><tr>";
608 aboutText += "<td valign=\"middle\"><img src=\":/icons/error_big.png\"</td><td>&nbsp;</td>";
609 aboutText += QString("<td><font color=\"darkred\">%1</font></td>").arg(tr("Note: LameXP is free software. Do <b>not</b> pay money to obtain or use LameXP! If some third-party website tries to make you pay for downloading LameXP, you should <b>not</b> respond to the offer !!!"));
610 aboutText += "</tr></table>";
612 ui->infoLabel->setText(aboutText);
613 ui->infoIcon->setPixmap(lamexp_app_icon().pixmap(QSize(72,72)));
614 connect(ui->infoLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
617 void AboutDialog::initContributorsTab(void)
619 const QString spaces("&nbsp;&nbsp;&nbsp;&nbsp;");
620 const QString extraVSpace("<font style=\"font-size:7px\"><br>&nbsp;</font>");
622 QString contributorsAboutText;
623 contributorsAboutText += QString("<h3>%1</h3>").arg(NOBR(tr("The following people have contributed to LameXP:")));
624 contributorsAboutText += "<table style=\"margin-top:12px;white-space:nowrap\">";
626 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Programmers:"), extraVSpace);
627 QString icon = QString("<img src=\":/icons/%1.png\">").arg("user_gray");
628 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(icon, spaces);
629 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td>").arg(tr("Project Leader"), spaces);
630 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td><td><a href=\"mailto:%3\">&lt;%3&gt;</a></td></tr>").arg("LoRd_MuldeR", spaces, "MuldeR2@GMX.de");
631 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>&nbsp;</b></td></tr>");
633 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Translators:"), extraVSpace);
634 for(int i = 0; g_lamexp_translators[i].pcName; i++)
636 QString flagIcon = (strlen(g_lamexp_translators[i].pcFlag) > 0) ? QString("<img src=\":/flags/%1.png\">").arg(g_lamexp_translators[i].pcFlag) : QString();
637 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(flagIcon, spaces);
638 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td>").arg(MUTILS_QSTR(g_lamexp_translators[i].pcLanguage), spaces);
639 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td><td><a href=\"mailto:%3\">&lt;%3&gt;</a></td></tr>").arg(MUTILS_QSTR(g_lamexp_translators[i].pcName), spaces, g_lamexp_translators[i].pcMail);
642 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>&nbsp;</b></td></tr>");
643 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Special thanks to:"), extraVSpace);
645 QString webIcon = QString("<img src=\":/icons/%1.png\">").arg("world");
646 for(int i = 0; g_lamexp_specialThanks[i].pcName; i++)
648 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(webIcon, spaces);
649 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td><td valign=\"middle\" colspan=\"3\"><a href=\"%3\">%3</td></tr>").arg(QString::fromLatin1(g_lamexp_specialThanks[i].pcName), spaces, QString::fromLatin1(g_lamexp_specialThanks[i].pcAddress));
652 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>&nbsp;</b></td></tr>");
653 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Official Mirrors:"), extraVSpace);
655 QString serverIcon = QString("<img src=\":/icons/%1.png\">").arg("server_database");
656 for(int i = 0; g_lamexp_mirrors[i].pcName; i++)
658 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(serverIcon, spaces);
659 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td><td valign=\"middle\" colspan=\"3\"><a href=\"%3\">%3</td></tr>").arg(QString::fromLatin1(g_lamexp_mirrors[i].pcName), spaces, QString::fromLatin1(g_lamexp_mirrors[i].pcAddress));
662 contributorsAboutText += "</table><br><br><br>";
663 contributorsAboutText += QString("<i>%1</i><br>").arg(NOBR(tr("If you are willing to contribute a LameXP translation, feel free to contact us!")));
665 ui->contributorsLabel->setText(contributorsAboutText);
666 ui->contributorsIcon->setPixmap(QIcon(":/images/Logo_Contributors.png").pixmap(QSize(72,84)));
667 connect(ui->contributorsLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
670 void AboutDialog::initSoftwareTab(void)
672 QString moreAboutText;
674 moreAboutText += QString("<h3>%1</h3>").arg(tr("The following third-party software is used in LameXP:"));
675 moreAboutText += "<div style=\"margin-left:-25px;white-space:nowrap\"><table><tr><td><ul>"; //;font-size:7pt
677 moreAboutText += makeToolText
679 tr("LAME - OpenSource mp3 Encoder"),
680 "lame.exe", "v?.??, #-?",
681 tr("Released under the terms of the GNU Lesser General Public License."),
682 "http://lame.sourceforge.net/"
684 moreAboutText += makeToolText
686 tr("OggEnc - Vorbis Encoder"),
687 "oggenc2.exe", "v?.??, libvorbis v?.?? + aoTuV b?.??_#",
688 tr("Completely open and patent-free audio encoding technology."),
689 "http://www.rarewares.org/ogg-oggenc.php"
691 moreAboutText += makeToolText
693 tr("Nero AAC Reference MPEG-4 Encoder"),
694 "neroAacEnc.exe", "v?.?.?.?",
695 tr("Freeware state-of-the-art HE-AAC encoder with 2-Pass support."),
696 neroAacUrl,
697 tr("Available from vendor web-site as free download:")
699 moreAboutText += makeToolText
701 tr("Aften - A/52 audio encoder"),
702 "aften.exe", "v?.?.?",
703 tr("Released under the terms of the GNU Lesser General Public License."),
704 "http://aften.sourceforge.net/"
706 moreAboutText += makeToolText
708 tr("FLAC - Free Lossless Audio Codec"),
709 "flac.exe", "v?.?.?",
710 tr("Open and patent-free lossless audio compression technology."),
711 "http://flac.sourceforge.net/"
713 moreAboutText += makeToolText
715 tr("Opus Audio Codec"),
716 "opusenc.exe", "#, ????-??-??",
717 tr("Totally open, royalty-free, highly versatile audio codec."),
718 "http://www.opus-codec.org/"
720 moreAboutText += makeToolText
722 tr("mpg123 - Fast Console MPEG Audio Player/Decoder"),
723 "mpg123.exe", "v?.??.?",
724 tr("Released under the terms of the GNU Lesser General Public License."),
725 "http://www.mpg123.de/"
727 moreAboutText += makeToolText
729 tr("FAAD - OpenSource MPEG-4 and MPEG-2 AAC Decoder"),
730 "faad.exe", "v?.?",
731 tr("Released under the terms of the GNU General Public License."),
732 "http://www.audiocoding.com/"
734 moreAboutText += makeToolText
736 tr("OggDec - Vorbis Decoder"),
737 "oggdec.exe", "v?.??.?",
738 tr("Command line Ogg Vorbis decoder created by John33."),
739 "http://www.rarewares.org/ogg-oggdec.php"
741 moreAboutText += makeToolText
743 tr("Valdec from AC3Filter Tools - AC3/DTS Decoder"),
744 "valdec.exe", "v?.??#",
745 tr("Released under the terms of the GNU Lesser General Public License."),
746 "http://www.ac3filter.net/projects/tools"
748 moreAboutText += makeToolText
750 tr("WavPack - Hybrid Lossless Compression"),
751 "wvunpack.exe", "v?.??.?",
752 tr("Completely open audio compression format."),
753 "http://www.wavpack.com/"
755 moreAboutText += makeToolText
757 tr("Musepack - Living Audio Compression"),
758 "mpcdec.exe", "r???",
759 tr("Released under the terms of the GNU Lesser General Public License."),
760 "http://www.musepack.net/"
762 moreAboutText += makeToolText
764 tr("Monkey's Audio - Lossless Audio Compressor"),
765 "mac.exe", "v?.??",
766 tr("Freely available source code, simple SDK and non-restrictive licensing."),
767 "http://www.monkeysaudio.com/"
769 moreAboutText += makeToolText
771 tr("Shorten - Lossless Audio Compressor"),
772 "shorten.exe", "v?.?.?",
773 tr("Released under the terms of the GNU Lesser General Public License."),
774 "http://etree.org/shnutils/shorten/"
776 moreAboutText += makeToolText
778 tr("Speex - Free Codec For Free Speech"),
779 "speexdec.exe", "v?.?",
780 tr("Open Source patent-free audio format designed for speech."),
781 "http://www.speex.org/"
783 moreAboutText += makeToolText
785 tr("The True Audio - Lossless Audio Codec"),
786 "tta.exe", "v?.?",
787 tr("Released under the terms of the GNU Lesser General Public License."),
788 "http://tta.sourceforge.net/"
790 moreAboutText += makeToolText
792 tr("refalac - Win32 command line ALAC encoder/decoder"),
793 "refalac.exe", "v?.??",
794 tr("The ALAC reference implementation by Apple is available under the Apache license."),
795 "http://alac.macosforge.org/"
797 moreAboutText += makeToolText
799 tr("wma2wav - Dump WMA files to Wave Audio"),
800 "wma2wav.exe", "????-??-??",
801 tr("Copyright (c) 2011 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved."),
802 "http://forum.doom9.org/showthread.php?t=140273"
804 moreAboutText += makeToolText
806 tr("avs2wav - Avisynth to Wave Audio converter"),
807 "avs2wav.exe", "v?.?",
808 tr("By Jory Stone <jcsston@toughguy.net> and LoRd_MuldeR <mulder2@gmx.de>."),
809 "http://forum.doom9.org/showthread.php?t=70882"
811 moreAboutText += makeToolText
813 tr("dcaenc"),
814 "dcaenc.exe", "????-??-??",
815 tr("Copyright (c) 2008-2011 Alexander E. Patrakov. Distributed under the LGPL."),
816 "https://gitlab.com/patrakov/dcaenc"
818 moreAboutText += makeToolText
820 tr("MediaInfo - Media File Analysis Tool"),
821 "mediainfo.exe", "v?.?.??",
822 tr("Released under the terms of the GNU Lesser General Public License."),
823 "http://mediainfo.sourceforge.net/"
825 moreAboutText += makeToolText
827 tr("SoX - Sound eXchange"),
828 "sox.exe", "v??.?.?",
829 tr("Released under the terms of the GNU Lesser General Public License."),
830 "http://sox.sourceforge.net/"
832 moreAboutText += makeToolText
834 tr("GnuPG - The GNU Privacy Guard"),
835 "gpgv.exe", "v?.?.??",
836 tr("Released under the terms of the GNU Lesser General Public License."),
837 "http://www.gnupg.org/"
839 moreAboutText += makeToolText
841 tr("GNU Wget - Software for retrieving files using HTTP"),
842 "wget.exe", "v?.??.?",
843 tr("Released under the terms of the GNU Lesser General Public License."),
844 "http://www.gnu.org/software/wget/"
846 moreAboutText += makeToolText
848 tr("UPX - The Ultimate Packer for eXecutables"),
849 QString(), "v3.09",
850 tr("Released under the terms of the GNU Lesser General Public License."),
851 "http://upx.sourceforge.net/"
853 moreAboutText += makeToolText
855 tr("Silk Icons - Over 700 icons in PNG format"),
856 QString(), "v1.3",
857 tr("By Mark James, released under the Creative Commons 'by' License."),
858 "http://www.famfamfam.com/lab/icons/silk/"
860 moreAboutText += QString("</ul></td><td>&nbsp;</td></tr></table></div><br><i>%1</i><br>").arg
862 tr("The copyright of LameXP as a whole belongs to LoRd_MuldeR. The copyright of third-party software used in LameXP belongs to the individual authors.")
865 ui->softwareLabel->setText(moreAboutText);
866 ui->softwareIcon->setPixmap(QIcon(":/images/Logo_Software.png").pixmap(QSize(72,65)));
867 connect(ui->softwareLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
870 void AboutDialog::initLicenseTab(void)
872 bool bFoundHeader = false;
873 QRegExp header("^(\\s*)(GNU GENERAL PUBLIC LICENSE)(\\s*)$");
875 QString licenseText;
876 licenseText += ("<tt>");
878 QFile file(":/License.txt");
879 if(file.open(QIODevice::ReadOnly))
881 QTextStream stream(&file);
882 while((!stream.atEnd()) && (stream.status() == QTextStream::Ok))
884 QString line = stream.readLine();
885 line.replace('<', "&lt;").replace('>', "&gt;");
886 if((!bFoundHeader) && (header.indexIn(line) >= 0))
888 line.replace(header, "\\1<b>\\2</b>\\3");
889 bFoundHeader = true;
891 TRIM_RIGHT(line);
892 licenseText += QString("<nobr>%1</nobr><br>").arg(line.replace(' ', "&nbsp;"));
894 licenseText += QString("<br>");
895 stream.device()->close();
897 else
899 licenseText += QString("<font color=\"darkred\">Oups, failed to load license text. Please refer to:</font><br>");
900 licenseText += LINK("http://www.gnu.org/licenses/gpl-2.0.html");
903 licenseText += ("</tt>");
905 ui->licenseLabel->setText(licenseText);
906 ui->licenseIcon->setPixmap(QIcon(":/images/Logo_GNU.png").pixmap(QSize(72,65)));
907 connect(ui->licenseLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
911 QString AboutDialog::makeToolText(const QString &toolName, const QString &toolBin, const QString &toolVerFmt, const QString &toolLicense, const QString &toolWebsite, const QString &extraInfo)
913 QString toolText, toolTag, verStr(toolVerFmt);
915 if(!toolBin.isEmpty())
917 const unsigned int version = lamexp_tools_version(toolBin, &toolTag);
918 verStr = lamexp_version2string(toolVerFmt, version, tr("n/a"), toolTag);
921 toolText += QString("<li>%1<br>").arg(NOBR(QString("<b>%1 (%2)</b>").arg(toolName, verStr)));
922 toolText += QString("%1<br>").arg(NOBR(toolLicense));
923 if(!extraInfo.isEmpty()) toolText += QString("<i>%1</i><br>").arg(NOBR(extraInfo));
924 toolText += QString("<nobr>%1</nobr>").arg(LINK(toolWebsite));
925 toolText += QString("<font style=\"font-size:9px\"><br>&nbsp;</font>");
927 return toolText;