Updated FileAnalyzer_Task to extract cover artwork with latest MediaInfo version.
[LameXP.git] / src / Dialog_About.cpp
blob9b54379e5a88b57ad39ebc283878f93cf2d7751a
1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2018 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.videohelp.com/software/Nero-AAC-Codec"; //"http://www.nero.com/eng/company/about-nero/nero-aac-codec.php"
68 const char *AboutDialog::disqueUrl = "http://muldersoft.com/?player_url=n4bply6Ibqw"; //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 {"", L"Française", L"Sami Ghoul-Duclos", "samgd14@live.ca" },
86 {"hu", L"Magyarul", L"ZityiSoft Team", "zityisoft@gmail.com" },
87 {"it", L"Italiano", L"Roberto", "Gulliver_69@libero.it" },
88 {"", L"", L"Gianluca Papi", "johnnyb.goode68@gmail.com"},
89 {"kr", L"한국어", L"JaeHyung Lee", "Kolanp@gmail.com" },
90 {"pl", L"Polski", L"Sir Daniel K", "Sir.Daniel.K@gmail.com" },
91 {"ru", L"Русский", L"Neonailol", "Neonailol@gmail.com" },
92 {"", L"", L"Иван Митин", "bardak@inbox.ru" },
93 {"sv", L"Svenska", L"Åke Engelbrektson", "eson@svenskasprakfiler.se"},
94 {"tw", L"繁体中文", L"456Vv", "123@456vv.com" },
95 {"uk", L"Українська", L"Arestarh", "Arestarh@ukr.net" },
96 {"zh", L"简体中文", L"456Vv", "123@456vv.com" },
97 {"", L"", L"庄泓川", "kidneybean@pku.edu.cn" },
98 {NULL, NULL, NULL, NULL}
101 //Special Thanks
102 static const struct
104 char* pcName;
105 char *pcAddress;
107 g_lamexp_specialThanks[] =
109 { "Doom9's Forum", "http://forum.doom9.org/" },
110 { "Gleitz | German Doom9", "http://forum.gleitz.info/" },
111 { "Hydrogenaudio Forums", "http://www.hydrogenaudio.org/" },
112 { "RareWares", "http://www.rarewares.org/" },
113 { "GitHub", "http://github.com/" },
114 { "SourceForge", "http://sourceforge.net/" },
115 { "Qt Developer Network", "https://www.qt.io/developers/" },
116 { "CodePlex", "http://www.codeplex.com/" },
117 { "Marius Hudea", "http://savedonthe.net/" },
118 { "Codecs.com", "http://www.codecs.com/" },
119 { NULL, NULL }
122 //Mirrors
123 static const struct
125 char* pcName;
126 char *pcAddress;
128 g_lamexp_mirrors[] =
130 { "GitHub.com", "https://github.com/lordmulder/LameXP" },
131 { "SourceForge.net", "http://sourceforge.net/p/lamexp/code/" },
132 { "Bitbucket.org", "https://bitbucket.org/muldersoft/lamexp" },
133 { "GitLab.com" , "https://gitlab.com/lamexp/lamexp" },
134 { "Codeplex.com", "https://lamexp.codeplex.com/SourceControl/latest" },
135 { "Assembla.com", "https://www.assembla.com/spaces/lamexp/" },
136 { NULL, NULL }
139 ////////////////////////////////////////////////////////////
140 // Constructor
141 ////////////////////////////////////////////////////////////
143 AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstStart)
145 QDialog(parent),
146 ui(new Ui::AboutDialog),
147 m_settings(settings),
148 m_initFlags(new QMap<QWidget*,bool>),
149 m_disque(NULL),
150 m_disqueTimer(NULL),
151 m_rotateNext(false),
152 m_lastTab(0),
153 m_firstStart(firstStart)
155 //Init the dialog, from the .ui file
156 ui->setupUi(this);
157 setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
158 setMinimumSize(this->size());
160 //Adjust size to DPI settings and re-center
161 MUtils::GUI::scale_widget(this);
163 //Disable "X" button
164 if(firstStart)
166 MUtils::GUI::enable_close_button(this, false);
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 ui->acceptButton->hide();
186 ui->declineButton->hide();
187 ui->aboutQtButton->show();
188 ui->closeButton->show();
190 QPixmap disque(":/images/Disque.png");
191 m_disque.reset(new QLabel(this, Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint));
192 m_disque->resize(disque.size());
193 m_disque->setStyleSheet("background:transparent;");
194 m_disque->setAttribute(Qt::WA_TranslucentBackground);
195 m_disque->setPixmap(disque);
196 m_disque->setCursor(QCursor(Qt::PointingHandCursor));
197 m_disque->installEventFilter(this);
199 connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), this, SLOT(geometryUpdated()));
200 geometryUpdated();
202 m_discOpacity = 0.01;
203 m_disquePos.setX(static_cast<int>(MUtils::next_rand_u32() % static_cast<unsigned int>(m_disqueBound.right() - disque.width() - m_disqueBound.left())) + m_disqueBound.left());
204 m_disquePos.setY(static_cast<int>(MUtils::next_rand_u32() % static_cast<unsigned int>(m_disqueBound.bottom() - disque.height() - m_disqueBound.top())) + m_disqueBound.top());
205 m_disqueFlags[0] = (MUtils::next_rand_u32() > (UINT_MAX/2));
206 m_disqueFlags[1] = (MUtils::next_rand_u32() > (UINT_MAX/2));
207 m_disque->move(m_disquePos);
208 m_disque->setWindowOpacity(m_discOpacity);
210 m_disqueTimer.reset(new QTimer());
212 connect(m_disqueTimer.data(), SIGNAL(timeout()), this, SLOT(moveDisque()));
213 connect(ui->aboutQtButton, SIGNAL(clicked()), this, SLOT(showAboutQt()));
215 else
217 ui->acceptButton->show();
218 ui->declineButton->show();
219 ui->aboutQtButton->hide();
220 ui->closeButton->hide();
223 //Activate "show license" button
224 ui->showLicenseButton->show();
225 connect(ui->showLicenseButton, SIGNAL(clicked()), this, SLOT(gotoLicenseTab()));
228 AboutDialog::~AboutDialog(void)
230 if(m_disque)
232 m_disque->close();
234 if(m_disqueTimer)
236 m_disqueTimer->stop();
238 MUTILS_DELETE(ui);
241 ////////////////////////////////////////////////////////////
242 // Public Functions
243 ////////////////////////////////////////////////////////////
245 int AboutDialog::exec()
247 if(m_settings->soundsEnabled())
249 if(m_firstStart)
251 if(!MUtils::Sound::play_sound_file("imageres.dll", 5080, true))
253 MUtils::Sound::play_system_sound("SystemStart", true);
256 else
258 MUtils::Sound::play_sound("ghost", true);
262 switch(QDialog::exec())
264 case 1:
265 return 1;
266 break;
267 case 2:
268 return -1;
269 break;
270 default:
271 return 0;
272 break;
276 ////////////////////////////////////////////////////////////
277 // Slots
278 ////////////////////////////////////////////////////////////
280 #define TEMP_HIDE_DISQUE(CMD) do \
282 bool _tmp = (m_disque) ? m_disque->isVisible() : false; \
283 if(_tmp) m_disque->hide(); \
284 { CMD } \
285 if(_tmp) \
287 m_discOpacity = 0.01; \
288 m_disque->setWindowOpacity(m_discOpacity); \
289 m_disque->show(); \
292 while(0)
294 void AboutDialog::tabChanged(int index, const bool silent)
296 bool bInitialized = m_initFlags->value(ui->tabWidget->widget(index), false);
298 if(!bInitialized)
300 qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
302 if(QWidget *tab = ui->tabWidget->widget(index))
304 bool ok = false;
306 if(tab == ui->infoTab) { initInformationTab(); ok = true; }
307 if(tab == ui->contributorsTab) { initContributorsTab(); ok = true; }
308 if(tab == ui->softwareTab) { initSoftwareTab(); ok = true; }
309 if(tab == ui->licenseTab) { initLicenseTab(); ok = true; }
311 if(ok)
313 m_initFlags->insert(tab, true);
315 else
317 qWarning("Unknown tab %p encountered, cannot initialize !!!", tab);
322 ui->tabWidget->widget(index)->update();
323 qApp->processEvents();
324 qApp->restoreOverrideCursor();
327 //Play tick sound
328 if(m_settings->soundsEnabled() && (!silent))
330 MUtils::Sound::play_sound("tick", true);
333 //Scroll to the top
334 if(QWidget *tab = ui->tabWidget->widget(index))
336 if(tab == ui->infoTab) ui->infoScrollArea->verticalScrollBar()->setSliderPosition(0);
337 if(tab == ui->contributorsTab) ui->contributorsScrollArea->verticalScrollBar()->setSliderPosition(0);
338 if(tab == ui->softwareTab) ui->softwareScrollArea->verticalScrollBar()->setSliderPosition(0);
339 if(tab == ui->licenseTab) ui->licenseScrollArea->verticalScrollBar()->setSliderPosition(0);
342 //Update license button
343 ui->showLicenseButton->setChecked(ui->tabWidget->widget(index) == ui->licenseTab);
344 if(ui->tabWidget->widget(index) != ui->licenseTab) m_lastTab = index;
347 void AboutDialog::enableButtons(void)
349 ui->acceptButton->setEnabled(true);
350 ui->declineButton->setEnabled(true);
351 setCursor(QCursor(Qt::ArrowCursor));
354 void AboutDialog::openURL(const QString &url)
356 if(!QDesktopServices::openUrl(QUrl(url)))
358 MUtils::OS::shell_open(this, url);
362 void AboutDialog::showAboutQt(void)
364 TEMP_HIDE_DISQUE
366 QMessageBox::aboutQt(this);
370 void AboutDialog::gotoLicenseTab(void)
372 ui->tabWidget->setCurrentIndex(ui->tabWidget->indexOf(ui->showLicenseButton->isChecked() ? ui->licenseTab : ui->tabWidget->widget(m_lastTab)));
375 void AboutDialog::moveDisque(void)
377 int delta = 2;
378 QElapsedTimer elapsedTimer;
379 elapsedTimer.start();
381 if((!m_disqueDelay.isNull()) && m_disqueDelay->isValid())
383 const qint64 delay = m_disqueDelay->restart();
384 delta = qBound(1, static_cast<int>(ceil(static_cast<double>(delay) / 5.12)), 128);
386 else
388 m_disqueDelay.reset(new QElapsedTimer());
389 m_disqueDelay->start();
392 if(m_disque)
394 if(m_disquePos.x() <= m_disqueBound.left()) { m_disqueFlags[0] = true; m_rotateNext = true; }
395 if(m_disquePos.x() >= m_disqueBound.right()) { m_disqueFlags[0] = false; m_rotateNext = true; }
396 if(m_disquePos.y() <= m_disqueBound.top()) { m_disqueFlags[1] = true; m_rotateNext = true; }
397 if(m_disquePos.y() >= m_disqueBound.bottom()) { m_disqueFlags[1] = false; m_rotateNext = true; }
399 m_disquePos.setX(m_disqueFlags[0] ? (m_disquePos.x() + delta) : (m_disquePos.x() - delta));
400 m_disquePos.setY(m_disqueFlags[1] ? (m_disquePos.y() + delta) : (m_disquePos.y() - delta));
402 m_disque->move(m_disquePos);
404 if(m_rotateNext)
406 const QPixmap *const cartoon = m_cartoon[m_disqueFlags[0] ? (m_disqueFlags[1] ? 1 : 0): (m_disqueFlags[1] ? 2 : 3)].data();
407 if(cartoon)
409 m_disque->setPixmap(*cartoon);
410 if(m_disque->size() != cartoon->size())
412 m_disque->resize(cartoon->size());
413 geometryUpdated();
416 m_rotateNext = false;
419 if(m_discOpacity != 1.0)
421 m_discOpacity = m_discOpacity + 0.01;
422 if(qFuzzyCompare(m_discOpacity, 1.0) || (m_discOpacity > 1.0))
424 m_discOpacity = 1.0;
426 m_disque->setWindowOpacity(m_discOpacity);
427 m_disque->update();
432 void AboutDialog::geometryUpdated(void)
434 if(m_disque)
436 QRect screenGeometry = QApplication::desktop()->availableGeometry();
437 m_disqueBound.setLeft(screenGeometry.left());
438 m_disqueBound.setRight(screenGeometry.width() - m_disque->width() + screenGeometry.left());
439 m_disqueBound.setTop(screenGeometry.top());
440 m_disqueBound.setBottom(screenGeometry.height() - m_disque->height() + screenGeometry.top());
442 else
444 m_disqueBound = QApplication::desktop()->availableGeometry();
448 void AboutDialog::adjustSize(void)
450 const int maxH = QApplication::desktop()->availableGeometry().height();
451 const int maxW = QApplication::desktop()->availableGeometry().width();
453 const int deltaH = ui->infoScrollArea->widget()->height() - ui->infoScrollArea->viewport()->height();
454 const int deltaW = ui->infoScrollArea->widget()->width() - ui->infoScrollArea->viewport()->width();
456 if(deltaH > 0)
458 this->resize(this->width(), qMin(this->height() + deltaH, maxH));
459 this->move(this->x(), this->y() - (deltaH / 2));
460 this->setMinimumHeight(qMax(this->minimumHeight(), this->height()));
463 if(deltaW > 0)
465 this->resize(qMin(this->width() + deltaW, maxW), this->height());
466 this->move(this->x() - (deltaW / 2), this->y());
467 this->setMinimumWidth(qMax(this->minimumWidth(), this->width()));
471 ////////////////////////////////////////////////////////////
472 // Protected Functions
473 ////////////////////////////////////////////////////////////
475 void AboutDialog::showEvent(QShowEvent *e)
477 QDialog::showEvent(e);
479 ui->tabWidget->setCurrentIndex(ui->tabWidget->indexOf(ui->infoTab));
480 tabChanged(m_lastTab = ui->tabWidget->currentIndex(), true);
482 if(m_firstStart)
484 ui->acceptButton->setEnabled(false);
485 ui->declineButton->setEnabled(false);
486 QTimer::singleShot(5000, this, SLOT(enableButtons()));
487 setCursor(QCursor(Qt::WaitCursor));
490 if (!(m_disque.isNull() || m_disqueTimer.isNull()))
492 m_disque->show();
493 m_disqueTimer->start(10);
496 QTimer::singleShot(0, this, SLOT(adjustSize()));
499 void AboutDialog::closeEvent(QCloseEvent *e)
501 if (m_firstStart)
503 e->ignore();
507 bool AboutDialog::eventFilter(QObject *obj, QEvent *event)
509 if((!m_disque.isNull()) && (obj == m_disque.data()) && (event->type() == QEvent::MouseButtonPress))
511 MUtils::Sound::play_sound("chicken", true);
512 if (!m_cartoon[0])
514 QPixmap cartoon(":/images/Cartoon.png");
515 for(int i = 0; i < 4; i++)
517 m_cartoon[i].reset(new QPixmap(cartoon.transformed(QMatrix().rotate(static_cast<double>(i*90) + 45.0), Qt::SmoothTransformation)));
518 m_rotateNext = true;
521 QDesktopServices::openUrl(QUrl(disqueUrl));
524 return false;
527 ////////////////////////////////////////////////////////////
528 // Private Functions
529 ////////////////////////////////////////////////////////////
531 void AboutDialog::initInformationTab(void)
533 const QDate versionDate = MUtils::Version::app_build_date();
534 const QTime versionTime = MUtils::Version::app_build_time();
536 const QString versionStr = QString("Version %1 %2, Build %3 [%4] [%5]").arg
538 QString().sprintf("%u.%02u", lamexp_version_major(), lamexp_version_minor()),
539 QString::fromLatin1(lamexp_version_release()),
540 QString::number(lamexp_version_build()),
541 versionDate.toString(Qt::ISODate),
542 versionTime.toString(Qt::ISODate)
545 const QString platformStr = QString("%1 [%2], MUtilities %3 [%4] [%5], Qt Framework v%6 [%7]").arg
547 QString::fromLatin1(MUtils::Version::compiler_version()),
548 QString::fromLatin1(MUtils::Version::compiler_arch()),
549 QString().sprintf("%u.%02u", MUtils::Version::lib_version_major(), MUtils::Version::lib_version_minor()),
550 MUtils::Version::lib_build_date().toString(Qt::ISODate).toLatin1().constData(),
551 MUtils::Version::lib_build_time().toString(Qt::ISODate).toLatin1().constData(),
552 QString::fromLatin1(qVersion()),
553 QString::fromLatin1(QT_PACKAGEDATE_STR)
556 const QString copyrightStr = QString().sprintf
558 "Copyright (C) 2004-%04d LoRd_MuldeR &lt;MuldeR2@GMX.de&gt;. Some rights reserved.",
559 qMax(versionDate.year(), MUtils::OS::current_date().year())
562 QString aboutText;
564 aboutText += QString("<h2>%1</h2>").arg(tr("LameXP - Audio Encoder Front-end"));
565 aboutText += QString("<b>%1</b><br>").arg(copyrightStr);
566 aboutText += QString("<b>%1</b><br>").arg(versionStr);
567 aboutText += QString("<b>%1</b><br><br>").arg(platformStr);
568 aboutText += QString("%1<br>").arg(tr("Please visit %1 for news and updates!").arg(LINK(lamexp_website_url())));
570 #if QT_VERSION < QT_VERSION_CHECK(5,0,0)
571 const QDate currentDate = MUtils::OS::current_date();
572 if(MUTILS_DEBUG)
574 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0);
575 aboutText += QString("<hr><font color=\"crimson\">%1</font>").arg(QString("!!! --- DEBUG BUILD --- Expires at: %1 &middot; Days left: %2 --- DEBUG BUILD --- !!!").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(daysLeft)));
577 else if(lamexp_version_demo())
579 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0);
580 aboutText += QString("<hr><font color=\"crimson\">%1</font>").arg(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)));
582 #else
583 const QDate currentDate = lamexp_current_date_safe();
584 if(LAMEXP_DEBUG)
586 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0i64);
587 aboutText += QString("<hr><font color=\"crimson\">%1</font>").arg(QString("!!! --- DEBUG BUILD --- Expires at: %1 &middot; Days left: %2 --- DEBUG BUILD --- !!!").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(daysLeft)));
589 else if(lamexp_version_demo())
591 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0i64);
592 aboutText += QString("<hr><font color=\"crimson\">%1</font>").arg(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)));
594 #endif
596 aboutText += "<hr><br>";
598 aboutText += "<tt>This program is free software; you can redistribute it and/or modify<br>";
599 aboutText += "it under the terms of the GNU General Public License as published by<br>";
600 aboutText += "the Free Software Foundation; either version 2 of the License, or<br>";
601 aboutText += "(at your option) any later version, but always including the *additional*<br>";
602 aboutText += "restrictions defined in the \"License.txt\" file (see \"License\" tab).<br><br>";
603 aboutText += "This program is distributed in the hope that it will be useful,<br>";
604 aboutText += "but WITHOUT ANY WARRANTY; without even the implied warranty of<br>";
605 aboutText += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>";
606 aboutText += "GNU General Public License for more details.<br><br>";
607 aboutText += "You should have received a copy of the GNU General Public License<br>";
608 aboutText += "along with this program; if not, write to the Free Software<br>";
609 aboutText += "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110&minus;1301, USA.</tt><br>";
610 aboutText += "<hr><table style=\"margin-top:4px\"><tr>";
611 aboutText += "<td valign=\"middle\"><img src=\":/icons/error_big.png\"</td><td>&nbsp;</td>";
612 aboutText += QString("<td style='white-space:normal'><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 !!!"));
613 aboutText += "</tr></table>";
615 ui->infoLabel->setText(NOBREAK(aboutText));
616 ui->infoIcon->setPixmap(lamexp_app_icon().pixmap(QSize(72,72)));
617 connect(ui->infoLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
620 void AboutDialog::initContributorsTab(void)
622 const QString spaces("&nbsp;&nbsp;&nbsp;&nbsp;");
623 const QString extraVSpace("<font style=\"font-size:7px\"><br>&nbsp;</font>");
625 QString contributorsAboutText;
626 contributorsAboutText += QString("<h3>%1</h3>").arg(tr("The following people have contributed to LameXP:"));
627 contributorsAboutText += "<table style=\"margin-top:12px;white-space:nowrap\">";
629 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Programmers:"), extraVSpace);
630 QString icon = QString("<img src=\":/icons/%1.png\">").arg("user_gray");
631 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(icon, spaces);
632 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td>").arg(tr("Project Leader"), spaces);
633 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");
634 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>&nbsp;</b></td></tr>");
636 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Translators:"), extraVSpace);
637 for(int i = 0; g_lamexp_translators[i].pcName; i++)
639 QString flagIcon = (strlen(g_lamexp_translators[i].pcFlag) > 0) ? QString("<img src=\":/flags/%1.png\">").arg(g_lamexp_translators[i].pcFlag) : QString();
640 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(flagIcon, spaces);
641 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td>").arg(MUTILS_QSTR(g_lamexp_translators[i].pcLanguage), spaces);
642 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);
645 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>&nbsp;</b></td></tr>");
646 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Special thanks to:"), extraVSpace);
648 QString webIcon = QString("<img src=\":/icons/%1.png\">").arg("world");
649 for(int i = 0; g_lamexp_specialThanks[i].pcName; i++)
651 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(webIcon, spaces);
652 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));
655 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>&nbsp;</b></td></tr>");
656 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Official Mirrors:"), extraVSpace);
658 QString serverIcon = QString("<img src=\":/icons/%1.png\">").arg("server_database");
659 for(int i = 0; g_lamexp_mirrors[i].pcName; i++)
661 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(serverIcon, spaces);
662 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));
665 contributorsAboutText += "</table><br><br><br>";
666 contributorsAboutText += QString("<i>%1</i><br>").arg(tr("If you are willing to contribute a LameXP translation, feel free to contact us!"));
668 ui->contributorsLabel->setText(NOBREAK(contributorsAboutText));
669 ui->contributorsIcon->setPixmap(QIcon(":/images/Logo_Contributors.png").pixmap(QSize(72,84)));
670 connect(ui->contributorsLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
673 void AboutDialog::initSoftwareTab(void)
675 QString moreAboutText;
677 moreAboutText += QString("<h3>%1</h3>").arg(tr("The following third-party software is used in LameXP:"));
678 moreAboutText += "<ul style='margin-left:-25px'>"; //;font-size:7pt
680 moreAboutText += makeToolText
682 tr("LAME - OpenSource mp3 Encoder"),
683 "lame.exe", "v?.???, #-?",
684 tr("Released under the terms of the GNU Lesser General Public License."),
685 "http://lame.sourceforge.net/"
687 moreAboutText += makeToolText
689 tr("OggEnc - Vorbis Encoder"),
690 "oggenc2.exe", "v?.??, libvorbis v?.?? + aoTuV b?.??_#",
691 tr("Completely open and patent-free audio encoding technology."),
692 "http://www.rarewares.org/ogg-oggenc.php"
694 moreAboutText += makeToolText
696 tr("Nero AAC Reference MPEG-4 Encoder"),
697 "neroAacEnc.exe", "v?.?.?.?",
698 tr("Freeware state-of-the-art HE-AAC encoder with 2-Pass support."),
699 neroAacUrl,
700 tr("Available from vendor web-site as free download:")
702 moreAboutText += makeToolText
704 tr("Aften - A/52 audio encoder"),
705 "aften.exe", "v?.?.?",
706 tr("Released under the terms of the GNU Lesser General Public License."),
707 "http://aften.sourceforge.net/"
709 moreAboutText += makeToolText
711 tr("FLAC - Free Lossless Audio Codec"),
712 "flac.exe", "v?.?.?",
713 tr("Open and patent-free lossless audio compression technology."),
714 "http://flac.sourceforge.net/"
716 moreAboutText += makeToolText
718 tr("Opus Audio Codec"),
719 "opusenc.exe", "#, ????-??-??",
720 tr("Totally open, royalty-free, highly versatile audio codec."),
721 "http://www.opus-codec.org/"
723 moreAboutText += makeToolText
725 tr("mpg123 - Fast Console MPEG Audio Player/Decoder"),
726 "mpg123.exe", "v?.??.??",
727 tr("Released under the terms of the GNU Lesser General Public License."),
728 "http://www.mpg123.de/"
730 moreAboutText += makeToolText
732 tr("FAAD - OpenSource MPEG-4 and MPEG-2 AAC Decoder"),
733 "faad.exe", "v?.?.?",
734 tr("Released under the terms of the GNU General Public License."),
735 "https://sourceforge.net/projects/faac/" //"http://www.audiocoding.com/"
737 moreAboutText += makeToolText
739 tr("OggDec - Vorbis Decoder"),
740 "oggdec.exe", "v?.??.?",
741 tr("Command line Ogg Vorbis decoder created by John33."),
742 "http://www.rarewares.org/ogg-oggdec.php"
744 moreAboutText += makeToolText
746 tr("Valdec from AC3Filter Tools - AC3/DTS Decoder"),
747 "valdec.exe", "v?.??#",
748 tr("Released under the terms of the GNU Lesser General Public License."),
749 "http://www.ac3filter.net/projects/tools"
751 moreAboutText += makeToolText
753 tr("WavPack - Hybrid Lossless Compression"),
754 "wvunpack.exe", "v?.??.?",
755 tr("Completely open audio compression format."),
756 "http://www.wavpack.com/"
758 moreAboutText += makeToolText
760 tr("Musepack - Living Audio Compression"),
761 "mpcdec.exe", "r???",
762 tr("Released under the terms of the GNU Lesser General Public License."),
763 "http://www.musepack.net/"
765 moreAboutText += makeToolText
767 tr("Monkey's Audio - Lossless Audio Compressor"),
768 "mac.exe", "v?.??",
769 tr("Freely available source code, simple SDK and non-restrictive licensing."),
770 "http://www.monkeysaudio.com/"
772 moreAboutText += makeToolText
774 tr("Shorten - Lossless Audio Compressor"),
775 "shorten.exe", "v?.?.?",
776 tr("Released under the terms of the GNU Lesser General Public License."),
777 "http://etree.org/shnutils/shorten/"
779 moreAboutText += makeToolText
781 tr("Speex - Free Codec For Free Speech"),
782 "speexdec.exe", "v?.?",
783 tr("Open Source patent-free audio format designed for speech."),
784 "http://www.speex.org/"
786 moreAboutText += makeToolText
788 tr("The True Audio - Lossless Audio Codec"),
789 "tta.exe", "v?.?",
790 tr("Released under the terms of the GNU Lesser General Public License."),
791 "http://tta.sourceforge.net/"
793 moreAboutText += makeToolText
795 tr("refalac - Win32 command line ALAC encoder/decoder"),
796 "refalac.exe", "v?.??",
797 tr("The ALAC reference implementation by Apple is available under the Apache license."),
798 "http://alac.macosforge.org/"
800 moreAboutText += makeToolText
802 tr("wma2wav - Dump WMA files to Wave Audio"),
803 "wma2wav.exe", "????-??-??",
804 tr("Copyright (c) 2011 LoRd_MuldeR &lt;mulder2@gmx.de&gt;. Some rights reserved."),
805 "http://forum.doom9.org/showthread.php?t=140273"
807 moreAboutText += makeToolText
809 tr("avs2wav - Avisynth to Wave Audio converter"),
810 "avs2wav.exe", "v?.?",
811 tr("By Jory Stone &lt;jcsston@toughguy.net&gt; and LoRd_MuldeR &lt;mulder2@gmx.de&gt;."),
812 "http://forum.doom9.org/showthread.php?t=70882"
814 moreAboutText += makeToolText
816 tr("dcaenc"),
817 "dcaenc.exe", "????-??-??",
818 tr("Copyright (c) 2008-2011 Alexander E. Patrakov. Distributed under the LGPL."),
819 "https://gitlab.com/patrakov/dcaenc"
821 moreAboutText += makeToolText
823 tr("MediaInfo - Media File Analysis Tool"),
824 "mediainfo.exe", "v??.??.?",
825 tr("Released under the terms of the GNU Lesser General Public License."),
826 "http://mediainfo.sourceforge.net/"
828 moreAboutText += makeToolText
830 tr("SoX - Sound eXchange"),
831 "sox.exe", "v??.?.?",
832 tr("Released under the terms of the GNU Lesser General Public License."),
833 "http://sox.sourceforge.net/"
835 moreAboutText += makeToolText
837 tr("GnuPG - The GNU Privacy Guard"),
838 "gpgv.exe", "v?.?.??",
839 tr("Released under the terms of the GNU Lesser General Public License."),
840 "http://www.gnupg.org/"
842 moreAboutText += makeToolText
844 tr("GNU Wget - Software for retrieving files using HTTP"),
845 "wget.exe", "v?.??.?",
846 tr("Released under the terms of the GNU Lesser General Public License."),
847 "http://www.gnu.org/software/wget/"
849 moreAboutText += makeToolText
851 tr("UPX - The Ultimate Packer for eXecutables"),
852 QString(), "v3.09",
853 tr("Released under the terms of the GNU Lesser General Public License."),
854 "http://upx.sourceforge.net/"
856 moreAboutText += makeToolText
858 tr("Silk Icons - Over 700 icons in PNG format"),
859 QString(), "v1.3",
860 tr("By Mark James, released under the Creative Commons 'BY' License."),
861 "http://www.famfamfam.com/lab/icons/silk/"
863 moreAboutText += makeToolText
865 tr("Angry Chicken and Ghost Scream sound"),
866 QString(), "v1.0",
867 tr("By Alexander, released under the Creative Commons 'BY' License."),
868 "http://www.orangefreesounds.com/"
870 moreAboutText += QString("</ul><br><i>%1</i><br>").arg
872 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.")
875 ui->softwareLabel->setText(NOBREAK(moreAboutText));
876 ui->softwareIcon->setPixmap(QIcon(":/images/Logo_Software.png").pixmap(QSize(72,65)));
877 connect(ui->softwareLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
880 void AboutDialog::initLicenseTab(void)
882 bool bFoundHeader = false;
883 QRegExp header("^(\\s*)(GNU GENERAL PUBLIC LICENSE)(\\s*)$");
885 QString licenseText;
886 licenseText += ("<tt>");
888 QFile file(":/License.txt");
889 if(file.open(QIODevice::ReadOnly))
891 QTextStream stream(&file);
892 while((!stream.atEnd()) && (stream.status() == QTextStream::Ok))
894 QString line = stream.readLine();
895 line.replace('<', "&lt;").replace('>', "&gt;");
896 if((!bFoundHeader) && (header.indexIn(line) >= 0))
898 line.replace(header, "\\1<b>\\2</b>\\3");
899 bFoundHeader = true;
901 TRIM_RIGHT(line);
902 licenseText += QString("<nobr>%1</nobr><br>").arg(line.replace(' ', "&nbsp;"));
904 licenseText += QString("<br>");
905 stream.device()->close();
907 else
909 licenseText += QString("<font color=\"darkred\">Oups, failed to load license text. Please refer to:</font><br>");
910 licenseText += LINK("http://www.gnu.org/licenses/gpl-2.0.html");
913 licenseText += ("</tt>");
915 ui->licenseLabel->setText(licenseText);
916 ui->licenseIcon->setPixmap(QIcon(":/images/Logo_GNU.png").pixmap(QSize(72,65)));
917 connect(ui->licenseLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
920 QString AboutDialog::makeToolText(const QString &toolName, const QString &toolBin, const QString &toolVerFmt, const QString &toolLicense, const QString &toolWebsite, const QString &extraInfo)
922 QString toolText, toolTag, verStr(toolVerFmt);
924 if(!toolBin.isEmpty())
926 const unsigned int version = lamexp_tools_version(toolBin, &toolTag);
927 verStr = lamexp_version2string(toolVerFmt, version, tr("n/a"), toolTag);
930 toolText += QString("<li>%1<br>").arg(QString("<b>%1 (%2)</b>").arg(toolName, verStr));
931 toolText += QString("%1<br>").arg(toolLicense);
932 if(!extraInfo.isEmpty()) toolText += QString("<i>%1</i><br>").arg(extraInfo);
933 toolText += LINK(toolWebsite);
934 toolText += QString("<font style=\"font-size:9px\"><br>&nbsp;</font>");
936 return toolText;