Fixed NeroAAC download URL.
[LameXP.git] / src / Dialog_About.cpp
blobf47a4e834ec63af76514082ad0e65a019fe5cc89
1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2016 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=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@sohu.com" },
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/lord_mulder/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)
154 //Init the dialog, from the .ui file
155 ui->setupUi(this);
156 setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
157 resize(this->minimumSize());
159 //Disable "X" button
160 if(firstStart)
162 MUtils::GUI::enable_close_button(this, false);
165 //Init images
166 for(int i = 0; i < 4; i++)
168 m_cartoon[i] = NULL;
171 //Init tab widget
172 connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
174 //Make transparent
175 const type_info &styleType = typeid(*qApp->style());
176 if((typeid(QWindowsVistaStyle) == styleType) || (typeid(QWindowsXPStyle) == styleType))
178 MAKE_TRANSPARENT(ui->infoScrollArea);
179 MAKE_TRANSPARENT(ui->contributorsScrollArea);
180 MAKE_TRANSPARENT(ui->softwareScrollArea);
181 MAKE_TRANSPARENT(ui->licenseScrollArea);
184 //Show about dialog for the first time?
185 if(!firstStart)
187 MUtils::seed_rand();
189 ui->acceptButton->hide();
190 ui->declineButton->hide();
191 ui->aboutQtButton->show();
192 ui->closeButton->show();
194 QPixmap disque(":/images/Disque.png");
195 m_disque = new QLabel(this, Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
196 m_disque->resize(disque.size());
197 m_disque->setStyleSheet("background:transparent;");
198 m_disque->setAttribute(Qt::WA_TranslucentBackground);
199 m_disque->setPixmap(disque);
200 m_disque->installEventFilter(this);
202 connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), this, SLOT(geometryUpdated()));
203 geometryUpdated();
205 m_discOpacity = 0.01;
206 m_disquePos.setX(static_cast<int>(MUtils::next_rand32() % static_cast<unsigned int>(m_disqueBound.right() - disque.width() - m_disqueBound.left())) + m_disqueBound.left());
207 m_disquePos.setY(static_cast<int>(MUtils::next_rand32() % static_cast<unsigned int>(m_disqueBound.bottom() - disque.height() - m_disqueBound.top())) + m_disqueBound.top());
208 m_disqueFlags[0] = (MUtils::next_rand32() > (UINT_MAX/2));
209 m_disqueFlags[1] = (MUtils::next_rand32() > (UINT_MAX/2));
210 m_disque->move(m_disquePos);
211 m_disque->setWindowOpacity(m_discOpacity);
212 m_disque->show();
214 m_disqueTimer = new QTimer;
215 connect(m_disqueTimer, SIGNAL(timeout()), this, SLOT(moveDisque()));
216 m_disqueTimer->start(10);
218 connect(ui->aboutQtButton, SIGNAL(clicked()), this, SLOT(showAboutQt()));
220 else
222 ui->acceptButton->show();
223 ui->declineButton->show();
224 ui->aboutQtButton->hide();
225 ui->closeButton->hide();
228 //Activate "show license" button
229 ui->showLicenseButton->show();
230 connect(ui->showLicenseButton, SIGNAL(clicked()), this, SLOT(gotoLicenseTab()));
232 m_firstShow = firstStart;
235 AboutDialog::~AboutDialog(void)
237 if(m_disque)
239 m_disque->close();
240 MUTILS_DELETE(m_disque);
242 if(m_disqueTimer)
244 m_disqueTimer->stop();
245 MUTILS_DELETE(m_disqueTimer);
247 for(int i = 0; i < 4; i++)
249 MUTILS_DELETE(m_cartoon[i]);
251 MUTILS_DELETE(m_initFlags);
252 MUTILS_DELETE(ui);
255 ////////////////////////////////////////////////////////////
256 // Public Functions
257 ////////////////////////////////////////////////////////////
259 int AboutDialog::exec()
261 if(m_settings->soundsEnabled())
263 if(m_firstShow)
265 if(!MUtils::Sound::play_sound_file("imageres.dll", 5080, true))
267 MUtils::Sound::play_system_sound("SystemStart", true);
270 else
272 MUtils::Sound::play_sound("uuaarrgh", true);
276 switch(QDialog::exec())
278 case 1:
279 return 1;
280 break;
281 case 2:
282 return -1;
283 break;
284 default:
285 return 0;
286 break;
290 ////////////////////////////////////////////////////////////
291 // Slots
292 ////////////////////////////////////////////////////////////
294 #define TEMP_HIDE_DISQUE(CMD) do \
296 bool _tmp = (m_disque) ? m_disque->isVisible() : false; \
297 if(_tmp) m_disque->hide(); \
298 { CMD } \
299 if(_tmp) \
301 m_discOpacity = 0.01; \
302 m_disque->setWindowOpacity(m_discOpacity); \
303 m_disque->show(); \
306 while(0)
308 void AboutDialog::tabChanged(int index, const bool silent)
310 bool bInitialized = m_initFlags->value(ui->tabWidget->widget(index), false);
312 if(!bInitialized)
314 qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
316 if(QWidget *tab = ui->tabWidget->widget(index))
318 bool ok = false;
320 if(tab == ui->infoTab) { initInformationTab(); ok = true; }
321 if(tab == ui->contributorsTab) { initContributorsTab(); ok = true; }
322 if(tab == ui->softwareTab) { initSoftwareTab(); ok = true; }
323 if(tab == ui->licenseTab) { initLicenseTab(); ok = true; }
325 if(ok)
327 m_initFlags->insert(tab, true);
329 else
331 qWarning("Unknown tab %p encountered, cannot initialize !!!", tab);
336 ui->tabWidget->widget(index)->update();
337 qApp->processEvents();
338 qApp->restoreOverrideCursor();
341 //Play tick sound
342 if(m_settings->soundsEnabled() && (!silent))
344 MUtils::Sound::play_sound("tick", true);
347 //Scroll to the top
348 if(QWidget *tab = ui->tabWidget->widget(index))
350 if(tab == ui->infoTab) ui->infoScrollArea->verticalScrollBar()->setSliderPosition(0);
351 if(tab == ui->contributorsTab) ui->contributorsScrollArea->verticalScrollBar()->setSliderPosition(0);
352 if(tab == ui->softwareTab) ui->softwareScrollArea->verticalScrollBar()->setSliderPosition(0);
353 if(tab == ui->licenseTab) ui->licenseScrollArea->verticalScrollBar()->setSliderPosition(0);
356 //Update license button
357 ui->showLicenseButton->setChecked(ui->tabWidget->widget(index) == ui->licenseTab);
358 if(ui->tabWidget->widget(index) != ui->licenseTab) m_lastTab = index;
361 void AboutDialog::enableButtons(void)
363 ui->acceptButton->setEnabled(true);
364 ui->declineButton->setEnabled(true);
365 setCursor(QCursor(Qt::ArrowCursor));
368 void AboutDialog::openURL(const QString &url)
370 if(!QDesktopServices::openUrl(QUrl(url)))
372 MUtils::OS::shell_open(this, url);
376 void AboutDialog::showAboutQt(void)
378 TEMP_HIDE_DISQUE
380 QMessageBox::aboutQt(this);
384 void AboutDialog::gotoLicenseTab(void)
386 ui->tabWidget->setCurrentIndex(ui->tabWidget->indexOf(ui->showLicenseButton->isChecked() ? ui->licenseTab : ui->tabWidget->widget(m_lastTab)));
389 void AboutDialog::moveDisque(void)
391 int delta = 2;
392 QElapsedTimer elapsedTimer;
393 elapsedTimer.start();
395 if((!m_disqueDelay.isNull()) && m_disqueDelay->isValid())
397 const qint64 delay = m_disqueDelay->restart();
398 delta = qBound(1, static_cast<int>(ceil(static_cast<double>(delay) / 5.12)), 128);
400 else
402 m_disqueDelay.reset(new QElapsedTimer());
403 m_disqueDelay->start();
406 if(m_disque)
408 if(m_disquePos.x() <= m_disqueBound.left()) { m_disqueFlags[0] = true; m_rotateNext = true; }
409 if(m_disquePos.x() >= m_disqueBound.right()) { m_disqueFlags[0] = false; m_rotateNext = true; }
410 if(m_disquePos.y() <= m_disqueBound.top()) { m_disqueFlags[1] = true; m_rotateNext = true; }
411 if(m_disquePos.y() >= m_disqueBound.bottom()) { m_disqueFlags[1] = false; m_rotateNext = true; }
413 m_disquePos.setX(m_disqueFlags[0] ? (m_disquePos.x() + delta) : (m_disquePos.x() - delta));
414 m_disquePos.setY(m_disqueFlags[1] ? (m_disquePos.y() + delta) : (m_disquePos.y() - delta));
416 m_disque->move(m_disquePos);
418 if(m_rotateNext)
420 QPixmap *cartoon = NULL;
421 if(m_disqueFlags[0] == true && m_disqueFlags[1] != true) cartoon = m_cartoon[0];
422 if(m_disqueFlags[0] == true && m_disqueFlags[1] == true) cartoon = m_cartoon[1];
423 if(m_disqueFlags[0] != true && m_disqueFlags[1] == true) cartoon = m_cartoon[2];
424 if(m_disqueFlags[0] != true && m_disqueFlags[1] != true) cartoon = m_cartoon[3];
425 if(cartoon)
427 m_disque->setPixmap(*cartoon);
428 if(m_disque->size() != cartoon->size())
430 m_disque->resize(cartoon->size());
431 geometryUpdated();
434 m_rotateNext = false;
437 if(m_discOpacity != 1.0)
439 m_discOpacity = m_discOpacity + 0.01;
440 if(qFuzzyCompare(m_discOpacity, 1.0) || (m_discOpacity > 1.0))
442 m_discOpacity = 1.0;
444 m_disque->setWindowOpacity(m_discOpacity);
445 m_disque->update();
450 void AboutDialog::geometryUpdated(void)
452 if(m_disque)
454 QRect screenGeometry = QApplication::desktop()->availableGeometry();
455 m_disqueBound.setLeft(screenGeometry.left());
456 m_disqueBound.setRight(screenGeometry.width() - m_disque->width() + screenGeometry.left());
457 m_disqueBound.setTop(screenGeometry.top());
458 m_disqueBound.setBottom(screenGeometry.height() - m_disque->height() + screenGeometry.top());
460 else
462 m_disqueBound = QApplication::desktop()->availableGeometry();
466 void AboutDialog::adjustSize(void)
468 const int maxH = QApplication::desktop()->availableGeometry().height();
469 const int maxW = QApplication::desktop()->availableGeometry().width();
471 const int deltaH = ui->infoScrollArea->widget()->height() - ui->infoScrollArea->viewport()->height();
472 const int deltaW = ui->infoScrollArea->widget()->width() - ui->infoScrollArea->viewport()->width();
474 if(deltaH > 0)
476 this->resize(this->width(), qMin(this->height() + deltaH, maxH));
477 this->move(this->x(), this->y() - (deltaH / 2));
478 this->setMinimumHeight(qMax(this->minimumHeight(), this->height()));
481 if(deltaW > 0)
483 this->resize(qMin(this->width() + deltaW, maxW), this->height());
484 this->move(this->x() - (deltaW / 2), this->y());
485 this->setMinimumWidth(qMax(this->minimumWidth(), this->width()));
489 ////////////////////////////////////////////////////////////
490 // Protected Functions
491 ////////////////////////////////////////////////////////////
493 void AboutDialog::showEvent(QShowEvent *e)
495 QDialog::showEvent(e);
497 ui->tabWidget->setCurrentIndex(ui->tabWidget->indexOf(ui->infoTab));
498 tabChanged(m_lastTab = ui->tabWidget->currentIndex(), true);
500 if(m_firstShow)
502 ui->acceptButton->setEnabled(false);
503 ui->declineButton->setEnabled(false);
504 QTimer::singleShot(5000, this, SLOT(enableButtons()));
505 setCursor(QCursor(Qt::WaitCursor));
508 QTimer::singleShot(0, this, SLOT(adjustSize()));
511 void AboutDialog::closeEvent(QCloseEvent *e)
513 if(m_firstShow) e->ignore();
516 bool AboutDialog::eventFilter(QObject *obj, QEvent *event)
518 if((obj == m_disque) && (event->type() == QEvent::MouseButtonPress))
520 QPixmap cartoon(":/images/Cartoon.png");
521 for(int i = 0; i < 4; i++)
523 if(!m_cartoon[i])
525 m_cartoon[i] = new QPixmap(cartoon.transformed(QMatrix().rotate(static_cast<double>(i*90) + 45.0), Qt::SmoothTransformation));
526 m_rotateNext = true;
529 QDesktopServices::openUrl(QUrl(disqueUrl));
532 return false;
535 ////////////////////////////////////////////////////////////
536 // Private Functions
537 ////////////////////////////////////////////////////////////
539 void AboutDialog::initInformationTab(void)
541 const QDate versionDate = MUtils::Version::app_build_date();
543 const QString versionStr = QString().sprintf
545 "Version %d.%02d %s, Build %d [%s], %s %s, Qt v%s",
546 lamexp_version_major(),
547 lamexp_version_minor(),
548 lamexp_version_release(),
549 lamexp_version_build(),
550 versionDate.toString(Qt::ISODate).toLatin1().constData(),
551 MUtils::Version::compiler_version(),
552 MUtils::Version::compiler_arch(),
553 qVersion()
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(NOBR(tr("LameXP - Audio Encoder Front-end")));
565 aboutText += QString("<b>%1</b><br>").arg(NOBR(copyrightStr));
566 aboutText += QString("<b>%1</b><br><br>").arg(NOBR(versionStr));
567 aboutText += QString("%1<br>").arg(NOBR(tr("Please visit %1 for news and updates!").arg(LINK(lamexp_website_url()))));
569 #if QT_VERSION < QT_VERSION_CHECK(5,0,0)
570 const QDate currentDate = MUtils::OS::current_date();
571 if(MUTILS_DEBUG)
573 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0);
574 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))));
576 else if(lamexp_version_demo())
578 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0);
579 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))));
581 #else
582 const QDate currentDate = lamexp_current_date_safe();
583 if(LAMEXP_DEBUG)
585 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0i64);
586 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))));
588 else if(lamexp_version_demo())
590 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0i64);
591 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))));
593 #endif
595 aboutText += "<hr><br>";
597 aboutText += "<nobr><tt>This program is free software; you can redistribute it and/or modify<br>";
598 aboutText += "it under the terms of the GNU General Public License as published by<br>";
599 aboutText += "the Free Software Foundation; either version 2 of the License, or<br>";
600 aboutText += "(at your option) any later version, but always including the *additional*<br>";
601 aboutText += "restrictions defined in the \"License.txt\" file (see \"License\" tab).<br><br>";
602 aboutText += "This program is distributed in the hope that it will be useful,<br>";
603 aboutText += "but WITHOUT ANY WARRANTY; without even the implied warranty of<br>";
604 aboutText += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>";
605 aboutText += "GNU General Public License for more details.<br><br>";
606 aboutText += "You should have received a copy of the GNU General Public License<br>";
607 aboutText += "along with this program; if not, write to the Free Software<br>";
608 aboutText += "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110&minus;1301, USA.</tt></nobr><br>";
609 aboutText += "<hr><table style=\"margin-top:4px\"><tr>";
610 aboutText += "<td valign=\"middle\"><img src=\":/icons/error_big.png\"</td><td>&nbsp;</td>";
611 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 !!!"));
612 aboutText += "</tr></table>";
614 ui->infoLabel->setText(aboutText);
615 ui->infoIcon->setPixmap(lamexp_app_icon().pixmap(QSize(72,72)));
616 connect(ui->infoLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
619 void AboutDialog::initContributorsTab(void)
621 const QString spaces("&nbsp;&nbsp;&nbsp;&nbsp;");
622 const QString extraVSpace("<font style=\"font-size:7px\"><br>&nbsp;</font>");
624 QString contributorsAboutText;
625 contributorsAboutText += QString("<h3>%1</h3>").arg(NOBR(tr("The following people have contributed to LameXP:")));
626 contributorsAboutText += "<table style=\"margin-top:12px;white-space:nowrap\">";
628 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Programmers:"), extraVSpace);
629 QString icon = QString("<img src=\":/icons/%1.png\">").arg("user_gray");
630 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(icon, spaces);
631 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td>").arg(tr("Project Leader"), spaces);
632 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");
633 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>&nbsp;</b></td></tr>");
635 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Translators:"), extraVSpace);
636 for(int i = 0; g_lamexp_translators[i].pcName; i++)
638 QString flagIcon = (strlen(g_lamexp_translators[i].pcFlag) > 0) ? QString("<img src=\":/flags/%1.png\">").arg(g_lamexp_translators[i].pcFlag) : QString();
639 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(flagIcon, spaces);
640 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td>").arg(MUTILS_QSTR(g_lamexp_translators[i].pcLanguage), spaces);
641 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);
644 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>&nbsp;</b></td></tr>");
645 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Special thanks to:"), extraVSpace);
647 QString webIcon = QString("<img src=\":/icons/%1.png\">").arg("world");
648 for(int i = 0; g_lamexp_specialThanks[i].pcName; i++)
650 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(webIcon, spaces);
651 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));
654 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>&nbsp;</b></td></tr>");
655 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Official Mirrors:"), extraVSpace);
657 QString serverIcon = QString("<img src=\":/icons/%1.png\">").arg("server_database");
658 for(int i = 0; g_lamexp_mirrors[i].pcName; i++)
660 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(serverIcon, spaces);
661 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));
664 contributorsAboutText += "</table><br><br><br>";
665 contributorsAboutText += QString("<i>%1</i><br>").arg(NOBR(tr("If you are willing to contribute a LameXP translation, feel free to contact us!")));
667 ui->contributorsLabel->setText(contributorsAboutText);
668 ui->contributorsIcon->setPixmap(QIcon(":/images/Logo_Contributors.png").pixmap(QSize(72,84)));
669 connect(ui->contributorsLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
672 void AboutDialog::initSoftwareTab(void)
674 QString moreAboutText;
676 moreAboutText += QString("<h3>%1</h3>").arg(tr("The following third-party software is used in LameXP:"));
677 moreAboutText += "<div style=\"margin-left:-25px;white-space:nowrap\"><table><tr><td><ul>"; //;font-size:7pt
679 moreAboutText += makeToolText
681 tr("LAME - OpenSource mp3 Encoder"),
682 "lame.exe", "v?.???, #-?",
683 tr("Released under the terms of the GNU Lesser General Public License."),
684 "http://lame.sourceforge.net/"
686 moreAboutText += makeToolText
688 tr("OggEnc - Vorbis Encoder"),
689 "oggenc2.exe", "v?.??, libvorbis v?.?? + aoTuV b?.??_#",
690 tr("Completely open and patent-free audio encoding technology."),
691 "http://www.rarewares.org/ogg-oggenc.php"
693 moreAboutText += makeToolText
695 tr("Nero AAC Reference MPEG-4 Encoder"),
696 "neroAacEnc.exe", "v?.?.?.?",
697 tr("Freeware state-of-the-art HE-AAC encoder with 2-Pass support."),
698 neroAacUrl,
699 tr("Available from vendor web-site as free download:")
701 moreAboutText += makeToolText
703 tr("Aften - A/52 audio encoder"),
704 "aften.exe", "v?.?.?",
705 tr("Released under the terms of the GNU Lesser General Public License."),
706 "http://aften.sourceforge.net/"
708 moreAboutText += makeToolText
710 tr("FLAC - Free Lossless Audio Codec"),
711 "flac.exe", "v?.?.?",
712 tr("Open and patent-free lossless audio compression technology."),
713 "http://flac.sourceforge.net/"
715 moreAboutText += makeToolText
717 tr("Opus Audio Codec"),
718 "opusenc.exe", "#, ????-??-??",
719 tr("Totally open, royalty-free, highly versatile audio codec."),
720 "http://www.opus-codec.org/"
722 moreAboutText += makeToolText
724 tr("mpg123 - Fast Console MPEG Audio Player/Decoder"),
725 "mpg123.exe", "v?.??.?",
726 tr("Released under the terms of the GNU Lesser General Public License."),
727 "http://www.mpg123.de/"
729 moreAboutText += makeToolText
731 tr("FAAD - OpenSource MPEG-4 and MPEG-2 AAC Decoder"),
732 "faad.exe", "v?.?",
733 tr("Released under the terms of the GNU General Public License."),
734 "http://www.audiocoding.com/"
736 moreAboutText += makeToolText
738 tr("OggDec - Vorbis Decoder"),
739 "oggdec.exe", "v?.??.?",
740 tr("Command line Ogg Vorbis decoder created by John33."),
741 "http://www.rarewares.org/ogg-oggdec.php"
743 moreAboutText += makeToolText
745 tr("Valdec from AC3Filter Tools - AC3/DTS Decoder"),
746 "valdec.exe", "v?.??#",
747 tr("Released under the terms of the GNU Lesser General Public License."),
748 "http://www.ac3filter.net/projects/tools"
750 moreAboutText += makeToolText
752 tr("WavPack - Hybrid Lossless Compression"),
753 "wvunpack.exe", "v?.??.?",
754 tr("Completely open audio compression format."),
755 "http://www.wavpack.com/"
757 moreAboutText += makeToolText
759 tr("Musepack - Living Audio Compression"),
760 "mpcdec.exe", "r???",
761 tr("Released under the terms of the GNU Lesser General Public License."),
762 "http://www.musepack.net/"
764 moreAboutText += makeToolText
766 tr("Monkey's Audio - Lossless Audio Compressor"),
767 "mac.exe", "v?.??",
768 tr("Freely available source code, simple SDK and non-restrictive licensing."),
769 "http://www.monkeysaudio.com/"
771 moreAboutText += makeToolText
773 tr("Shorten - Lossless Audio Compressor"),
774 "shorten.exe", "v?.?.?",
775 tr("Released under the terms of the GNU Lesser General Public License."),
776 "http://etree.org/shnutils/shorten/"
778 moreAboutText += makeToolText
780 tr("Speex - Free Codec For Free Speech"),
781 "speexdec.exe", "v?.?",
782 tr("Open Source patent-free audio format designed for speech."),
783 "http://www.speex.org/"
785 moreAboutText += makeToolText
787 tr("The True Audio - Lossless Audio Codec"),
788 "tta.exe", "v?.?",
789 tr("Released under the terms of the GNU Lesser General Public License."),
790 "http://tta.sourceforge.net/"
792 moreAboutText += makeToolText
794 tr("refalac - Win32 command line ALAC encoder/decoder"),
795 "refalac.exe", "v?.??",
796 tr("The ALAC reference implementation by Apple is available under the Apache license."),
797 "http://alac.macosforge.org/"
799 moreAboutText += makeToolText
801 tr("wma2wav - Dump WMA files to Wave Audio"),
802 "wma2wav.exe", "????-??-??",
803 tr("Copyright (c) 2011 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved."),
804 "http://forum.doom9.org/showthread.php?t=140273"
806 moreAboutText += makeToolText
808 tr("avs2wav - Avisynth to Wave Audio converter"),
809 "avs2wav.exe", "v?.?",
810 tr("By Jory Stone <jcsston@toughguy.net> and LoRd_MuldeR <mulder2@gmx.de>."),
811 "http://forum.doom9.org/showthread.php?t=70882"
813 moreAboutText += makeToolText
815 tr("dcaenc"),
816 "dcaenc.exe", "????-??-??",
817 tr("Copyright (c) 2008-2011 Alexander E. Patrakov. Distributed under the LGPL."),
818 "https://gitlab.com/patrakov/dcaenc"
820 moreAboutText += makeToolText
822 tr("MediaInfo - Media File Analysis Tool"),
823 "mediainfo.exe", "v?.?.??",
824 tr("Released under the terms of the GNU Lesser General Public License."),
825 "http://mediainfo.sourceforge.net/"
827 moreAboutText += makeToolText
829 tr("SoX - Sound eXchange"),
830 "sox.exe", "v??.?.?",
831 tr("Released under the terms of the GNU Lesser General Public License."),
832 "http://sox.sourceforge.net/"
834 moreAboutText += makeToolText
836 tr("GnuPG - The GNU Privacy Guard"),
837 "gpgv.exe", "v?.?.??",
838 tr("Released under the terms of the GNU Lesser General Public License."),
839 "http://www.gnupg.org/"
841 moreAboutText += makeToolText
843 tr("GNU Wget - Software for retrieving files using HTTP"),
844 "wget.exe", "v?.??.?",
845 tr("Released under the terms of the GNU Lesser General Public License."),
846 "http://www.gnu.org/software/wget/"
848 moreAboutText += makeToolText
850 tr("Netcat for NT - TCP/IP Swiss Army Knife"),
851 "nc.exe", "v?.??",
852 tr("Released under the terms of the GNU Lesser General Public License."),
853 "https://eternallybored.org/misc/netcat/"
855 moreAboutText += makeToolText
857 tr("UPX - The Ultimate Packer for eXecutables"),
858 QString(), "v3.09",
859 tr("Released under the terms of the GNU Lesser General Public License."),
860 "http://upx.sourceforge.net/"
862 moreAboutText += makeToolText
864 tr("Silk Icons - Over 700 icons in PNG format"),
865 QString(), "v1.3",
866 tr("By Mark James, released under the Creative Commons 'by' License."),
867 "http://www.famfamfam.com/lab/icons/silk/"
869 moreAboutText += QString("</ul></td><td>&nbsp;</td></tr></table></div><br><i>%1</i><br>").arg
871 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.")
874 ui->softwareLabel->setText(moreAboutText);
875 ui->softwareIcon->setPixmap(QIcon(":/images/Logo_Software.png").pixmap(QSize(72,65)));
876 connect(ui->softwareLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
879 void AboutDialog::initLicenseTab(void)
881 bool bFoundHeader = false;
882 QRegExp header("^(\\s*)(GNU GENERAL PUBLIC LICENSE)(\\s*)$");
884 QString licenseText;
885 licenseText += ("<tt>");
887 QFile file(":/License.txt");
888 if(file.open(QIODevice::ReadOnly))
890 QTextStream stream(&file);
891 while((!stream.atEnd()) && (stream.status() == QTextStream::Ok))
893 QString line = stream.readLine();
894 line.replace('<', "&lt;").replace('>', "&gt;");
895 if((!bFoundHeader) && (header.indexIn(line) >= 0))
897 line.replace(header, "\\1<b>\\2</b>\\3");
898 bFoundHeader = true;
900 TRIM_RIGHT(line);
901 licenseText += QString("<nobr>%1</nobr><br>").arg(line.replace(' ', "&nbsp;"));
903 licenseText += QString("<br>");
904 stream.device()->close();
906 else
908 licenseText += QString("<font color=\"darkred\">Oups, failed to load license text. Please refer to:</font><br>");
909 licenseText += LINK("http://www.gnu.org/licenses/gpl-2.0.html");
912 licenseText += ("</tt>");
914 ui->licenseLabel->setText(licenseText);
915 ui->licenseIcon->setPixmap(QIcon(":/images/Logo_GNU.png").pixmap(QSize(72,65)));
916 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(NOBR(QString("<b>%1 (%2)</b>").arg(toolName, verStr)));
931 toolText += QString("%1<br>").arg(NOBR(toolLicense));
932 if(!extraInfo.isEmpty()) toolText += QString("<i>%1</i><br>").arg(NOBR(extraInfo));
933 toolText += QString("<nobr>%1</nobr>").arg(LINK(toolWebsite));
934 toolText += QString("<font style=\"font-size:9px\"><br>&nbsp;</font>");
936 return toolText;