Catched a few more cases where MUtils::Sound::play_sound() was called directly instea...
[LameXP.git] / src / Dialog_About.cpp
blobe3379483fe5613ad48ccfdb3503b3ed09cd69f1b
1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2019 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 <QLibraryInfo>
56 #include <QWindowsVistaStyle>
57 #include <QWindowsXPStyle>
59 //CRT
60 #include <math.h>
62 //Helper macros
63 #define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(QString(URL).replace("-", "&minus;"))
64 #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)
65 #define PLAY_SOUND_OPTIONAL(NAME, ASYNC) do { if(m_settings->soundsEnabled()) MUtils::Sound::play_sound((NAME), (ASYNC)); } while(0)
66 #define MAKE_TRANSPARENT(WIDGET) do { QPalette _p = (WIDGET)->palette(); _p.setColor(QPalette::Background, Qt::transparent); (WIDGET)->setPalette(_p); } while(0)
68 //Constants
69 const char *AboutDialog::neroAacUrl = "http://www.videohelp.com/software/Nero-AAC-Codec"; //"http://www.nero.com/eng/company/about-nero/nero-aac-codec.php"
70 const char *AboutDialog::disqueUrl = "http://muldersoft.com/?player_url=n4bply6Ibqw"; //38X-MXOB014
72 //Contributors
73 static const struct
75 char *pcFlag;
76 wchar_t *pcLanguage;
77 wchar_t *pcName;
78 char *pcContactAddr;
80 g_lamexp_translators[] =
82 {"en", L"Englisch", L"LoRd_MuldeR", "MuldeR2@GMX.de" },
83 {"de", L"Deutsch", L"LoRd_MuldeR", "MuldeR2@GMX.de" },
84 {"", L"", L"Bodo Thevissen", "Bodo@thevissen.de" },
85 {"es", L"Español", L"Rub3nCT", "Rub3nCT@gmail.com" },
86 {"fr", L"Française", L"Dodich Informatique", "Dodich@live.fr" },
87 {"", L"Française", L"Sami Ghoul-Duclos", "samgd14@live.ca" },
88 {"hu", L"Magyarul", L"ZityiSoft Team", "zityisoft@gmail.com" },
89 {"it", L"Italiano", L"Roberto", "Gulliver_69@libero.it" },
90 {"", L"", L"Gianluca Papi", "johnnyb.goode68@gmail.com"},
91 {"ja", L"日本語", L"Maboroshin", "pc.genkaku.in" },
92 {"kr", L"한국어", L"JaeHyung Lee", "Kolanp@gmail.com" },
93 {"pl", L"Polski", L"Sir Daniel K", "Sir.Daniel.K@gmail.com" },
94 {"ru", L"Русский", L"Neonailol", "Neonailol@gmail.com" },
95 {"", L"", L"Иван Митин", "bardak@inbox.ru" },
96 {"sv", L"Svenska", L"Åke Engelbrektson", "eson@svenskasprakfiler.se"},
97 {"tw", L"繁体中文", L"456Vv", "123@456vv.com" },
98 {"uk", L"Українська", L"Arestarh", "Arestarh@ukr.net" },
99 {"zh", L"简体中文", L"456Vv", "123@456vv.com" },
100 {"", L"", L"庄泓川", "kidneybean@pku.edu.cn" },
101 {NULL, NULL, NULL, NULL}
104 //Special Thanks
105 static const struct
107 char* pcName;
108 char *pcAddress;
110 g_lamexp_specialThanks[] =
112 { "Doom9's Forum", "http://forum.doom9.org/" },
113 { "Gleitz | German Doom9", "http://forum.gleitz.info/" },
114 { "Portable Freeware", "http://www.portablefreeware.com/" },
115 { "Hydrogenaudio Forums", "http://www.hydrogenaudio.org/" },
116 { "RareWares", "http://www.rarewares.org/" },
117 { "GitHub", "http://github.com/" },
118 { "SourceForge", "http://sourceforge.net/" },
119 { "OSDN.net", "http://osdn.net/" },
120 { "Marius Hudea", "http://savedonthe.net/" },
121 { "Qt Developer Network", "http://www.qt.io/developers/" },
122 { "Codecs.com", "http://www.codecs.com/" },
123 { "VideoHelp", "http://www.videohelp.com/" },
124 { NULL, NULL }
127 //Mirrors
128 static const struct
130 char* pcName;
131 char *pcAddress;
133 g_lamexp_mirrors[] =
135 { "GitHub.com", "https://github.com/lordmulder/LameXP" },
136 { "SourceForge.net", "http://sourceforge.net/p/lamexp/code/" },
137 { "OSDN.net", "https://osdn.net/projects/lamexp/scm/git/LameXP/" },
138 { "Bitbucket.org", "https://bitbucket.org/muldersoft/lamexp" },
139 { "GitLab.com" , "https://gitlab.com/lamexp/lamexp" },
140 { "Assembla.com", "https://www.assembla.com/spaces/lamexp/" },
141 { "repo.or.cz", "https://repo.or.cz/w/LameXP.git" },
142 { NULL, NULL }
145 ////////////////////////////////////////////////////////////
146 // Constructor
147 ////////////////////////////////////////////////////////////
149 AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstStart)
151 QDialog(parent),
152 ui(new Ui::AboutDialog),
153 m_settings(settings),
154 m_initFlags(new QMap<QWidget*,bool>),
155 m_disque(NULL),
156 m_disqueTimer(NULL),
157 m_rotateNext(false),
158 m_lastTab(0),
159 m_firstStart(firstStart)
161 //Init the dialog, from the .ui file
162 ui->setupUi(this);
163 setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
164 setMinimumSize(this->size());
166 //Adjust size to DPI settings and re-center
167 MUtils::GUI::scale_widget(this);
169 //Disable "X" button
170 if(firstStart)
172 MUtils::GUI::enable_close_button(this, false);
175 //Init tab widget
176 connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
178 //Make transparent
179 const type_info &styleType = typeid(*qApp->style());
180 if((typeid(QWindowsVistaStyle) == styleType) || (typeid(QWindowsXPStyle) == styleType))
182 MAKE_TRANSPARENT(ui->infoScrollArea);
183 MAKE_TRANSPARENT(ui->contributorsScrollArea);
184 MAKE_TRANSPARENT(ui->softwareScrollArea);
185 MAKE_TRANSPARENT(ui->licenseScrollArea);
188 //Show about dialog for the first time?
189 if(!firstStart)
191 ui->acceptButton->hide();
192 ui->declineButton->hide();
193 ui->aboutQtButton->show();
194 ui->closeButton->show();
196 QPixmap disque(":/images/Disque.png");
197 m_disque.reset(new QLabel(this, Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint));
198 m_disque->resize(disque.size());
199 m_disque->setStyleSheet("background:transparent;");
200 m_disque->setAttribute(Qt::WA_TranslucentBackground);
201 m_disque->setPixmap(disque);
202 m_disque->setCursor(QCursor(Qt::PointingHandCursor));
203 m_disque->installEventFilter(this);
205 connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), this, SLOT(geometryUpdated()));
206 geometryUpdated();
208 m_discOpacity = 0.01;
209 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());
210 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());
211 m_disqueFlags[0] = (MUtils::next_rand_u32() > (UINT_MAX/2));
212 m_disqueFlags[1] = (MUtils::next_rand_u32() > (UINT_MAX/2));
213 m_disque->move(m_disquePos);
214 m_disque->setWindowOpacity(m_discOpacity);
216 m_disqueTimer.reset(new QTimer());
218 connect(m_disqueTimer.data(), SIGNAL(timeout()), this, SLOT(moveDisque()));
219 connect(ui->aboutQtButton, SIGNAL(clicked()), this, SLOT(showAboutQt()));
221 else
223 ui->acceptButton->show();
224 ui->declineButton->show();
225 ui->aboutQtButton->hide();
226 ui->closeButton->hide();
229 //Activate "show license" button
230 ui->showLicenseButton->show();
231 connect(ui->showLicenseButton, SIGNAL(clicked()), this, SLOT(gotoLicenseTab()));
234 AboutDialog::~AboutDialog(void)
236 if(m_disque)
238 m_disque->close();
240 if(m_disqueTimer)
242 m_disqueTimer->stop();
244 MUTILS_DELETE(ui);
247 ////////////////////////////////////////////////////////////
248 // Public Functions
249 ////////////////////////////////////////////////////////////
251 int AboutDialog::exec()
253 if(m_settings->soundsEnabled())
255 if(m_firstStart)
257 if(!MUtils::Sound::play_sound_file("imageres.dll", 5080, true))
259 MUtils::Sound::play_system_sound("SystemStart", true);
262 else
264 PLAY_SOUND_OPTIONAL("ghost", true);
268 switch(QDialog::exec())
270 case 1:
271 return 1;
272 break;
273 case 2:
274 return -1;
275 break;
276 default:
277 return 0;
278 break;
282 ////////////////////////////////////////////////////////////
283 // Slots
284 ////////////////////////////////////////////////////////////
286 #define TEMP_HIDE_DISQUE(CMD) do \
288 bool _tmp = (m_disque) ? m_disque->isVisible() : false; \
289 if(_tmp) m_disque->hide(); \
290 { CMD } \
291 if(_tmp) \
293 m_discOpacity = 0.01; \
294 m_disque->setWindowOpacity(m_discOpacity); \
295 m_disque->show(); \
298 while(0)
300 void AboutDialog::tabChanged(int index, const bool silent)
302 bool bInitialized = m_initFlags->value(ui->tabWidget->widget(index), false);
304 if(!bInitialized)
306 qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
308 if(QWidget *tab = ui->tabWidget->widget(index))
310 bool ok = false;
312 if(tab == ui->infoTab) { initInformationTab(); ok = true; }
313 if(tab == ui->contributorsTab) { initContributorsTab(); ok = true; }
314 if(tab == ui->softwareTab) { initSoftwareTab(); ok = true; }
315 if(tab == ui->licenseTab) { initLicenseTab(); ok = true; }
317 if(ok)
319 m_initFlags->insert(tab, true);
321 else
323 qWarning("Unknown tab %p encountered, cannot initialize !!!", tab);
328 ui->tabWidget->widget(index)->update();
329 qApp->processEvents();
330 qApp->restoreOverrideCursor();
333 //Play tick sound
334 if(m_settings->soundsEnabled() && (!silent))
336 PLAY_SOUND_OPTIONAL("tick", true);
339 //Scroll to the top
340 if(QWidget *tab = ui->tabWidget->widget(index))
342 if(tab == ui->infoTab) ui->infoScrollArea->verticalScrollBar()->setSliderPosition(0);
343 if(tab == ui->contributorsTab) ui->contributorsScrollArea->verticalScrollBar()->setSliderPosition(0);
344 if(tab == ui->softwareTab) ui->softwareScrollArea->verticalScrollBar()->setSliderPosition(0);
345 if(tab == ui->licenseTab) ui->licenseScrollArea->verticalScrollBar()->setSliderPosition(0);
348 //Update license button
349 ui->showLicenseButton->setChecked(ui->tabWidget->widget(index) == ui->licenseTab);
350 if(ui->tabWidget->widget(index) != ui->licenseTab) m_lastTab = index;
353 void AboutDialog::enableButtons(void)
355 ui->acceptButton->setEnabled(true);
356 ui->declineButton->setEnabled(true);
357 setCursor(QCursor(Qt::ArrowCursor));
360 void AboutDialog::openURL(const QString &url)
362 if(!QDesktopServices::openUrl(QUrl(url)))
364 MUtils::OS::shell_open(this, url);
368 void AboutDialog::showAboutQt(void)
370 TEMP_HIDE_DISQUE
372 QMessageBox::aboutQt(this);
376 void AboutDialog::gotoLicenseTab(void)
378 ui->tabWidget->setCurrentIndex(ui->tabWidget->indexOf(ui->showLicenseButton->isChecked() ? ui->licenseTab : ui->tabWidget->widget(m_lastTab)));
381 void AboutDialog::moveDisque(void)
383 int delta = 2;
384 QElapsedTimer elapsedTimer;
385 elapsedTimer.start();
387 if((!m_disqueDelay.isNull()) && m_disqueDelay->isValid())
389 const qint64 delay = m_disqueDelay->restart();
390 delta = qBound(1, static_cast<int>(ceil(static_cast<double>(delay) / 5.12)), 128);
392 else
394 m_disqueDelay.reset(new QElapsedTimer());
395 m_disqueDelay->start();
398 if(m_disque)
400 if(m_disquePos.x() <= m_disqueBound.left()) { m_disqueFlags[0] = true; m_rotateNext = true; }
401 if(m_disquePos.x() >= m_disqueBound.right()) { m_disqueFlags[0] = false; m_rotateNext = true; }
402 if(m_disquePos.y() <= m_disqueBound.top()) { m_disqueFlags[1] = true; m_rotateNext = true; }
403 if(m_disquePos.y() >= m_disqueBound.bottom()) { m_disqueFlags[1] = false; m_rotateNext = true; }
405 m_disquePos.setX(m_disqueFlags[0] ? (m_disquePos.x() + delta) : (m_disquePos.x() - delta));
406 m_disquePos.setY(m_disqueFlags[1] ? (m_disquePos.y() + delta) : (m_disquePos.y() - delta));
408 m_disque->move(m_disquePos);
410 if(m_rotateNext)
412 const QPixmap *const cartoon = m_cartoon[m_disqueFlags[0] ? (m_disqueFlags[1] ? 1 : 0): (m_disqueFlags[1] ? 2 : 3)].data();
413 if(cartoon)
415 m_disque->setPixmap(*cartoon);
416 if(m_disque->size() != cartoon->size())
418 m_disque->resize(cartoon->size());
419 geometryUpdated();
422 m_rotateNext = false;
425 if(m_discOpacity != 1.0)
427 m_discOpacity = m_discOpacity + 0.01;
428 if(qFuzzyCompare(m_discOpacity, 1.0) || (m_discOpacity > 1.0))
430 m_discOpacity = 1.0;
432 m_disque->setWindowOpacity(m_discOpacity);
433 m_disque->update();
438 void AboutDialog::geometryUpdated(void)
440 if(m_disque)
442 QRect screenGeometry = QApplication::desktop()->availableGeometry();
443 m_disqueBound.setLeft(screenGeometry.left());
444 m_disqueBound.setRight(screenGeometry.width() - m_disque->width() + screenGeometry.left());
445 m_disqueBound.setTop(screenGeometry.top());
446 m_disqueBound.setBottom(screenGeometry.height() - m_disque->height() + screenGeometry.top());
448 else
450 m_disqueBound = QApplication::desktop()->availableGeometry();
454 void AboutDialog::adjustSize(void)
456 const int maxH = QApplication::desktop()->availableGeometry().height();
457 const int maxW = QApplication::desktop()->availableGeometry().width();
459 const int deltaH = ui->infoScrollArea->widget()->height() - ui->infoScrollArea->viewport()->height();
460 const int deltaW = ui->infoScrollArea->widget()->width() - ui->infoScrollArea->viewport()->width();
462 if(deltaH > 0)
464 this->resize(this->width(), qMin(this->height() + deltaH, maxH));
465 this->move(this->x(), this->y() - (deltaH / 2));
466 this->setMinimumHeight(qMax(this->minimumHeight(), this->height()));
469 if(deltaW > 0)
471 this->resize(qMin(this->width() + deltaW, maxW), this->height());
472 this->move(this->x() - (deltaW / 2), this->y());
473 this->setMinimumWidth(qMax(this->minimumWidth(), this->width()));
477 ////////////////////////////////////////////////////////////
478 // Protected Functions
479 ////////////////////////////////////////////////////////////
481 void AboutDialog::showEvent(QShowEvent *e)
483 QDialog::showEvent(e);
485 ui->tabWidget->setCurrentIndex(ui->tabWidget->indexOf(ui->infoTab));
486 tabChanged(m_lastTab = ui->tabWidget->currentIndex(), true);
488 if(m_firstStart)
490 ui->acceptButton->setEnabled(false);
491 ui->declineButton->setEnabled(false);
492 QTimer::singleShot(5000, this, SLOT(enableButtons()));
493 setCursor(QCursor(Qt::WaitCursor));
496 if (!(m_disque.isNull() || m_disqueTimer.isNull()))
498 m_disque->show();
499 m_disqueTimer->start(10);
502 QTimer::singleShot(0, this, SLOT(adjustSize()));
505 void AboutDialog::closeEvent(QCloseEvent *e)
507 if (m_firstStart)
509 e->ignore();
513 bool AboutDialog::eventFilter(QObject *obj, QEvent *event)
515 if((!m_disque.isNull()) && (obj == m_disque.data()) && (event->type() == QEvent::MouseButtonPress))
517 PLAY_SOUND_OPTIONAL("chicken", true);
518 if (!m_cartoon[0])
520 QPixmap cartoon(":/images/Cartoon.png");
521 for(int i = 0; i < 4; i++)
523 m_cartoon[i].reset(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();
540 const QTime versionTime = MUtils::Version::app_build_time();
542 const QString versionStr = QString("Version %1 %2, Build %3 [%4] [%5]").arg
544 QString().sprintf("%u.%02u", lamexp_version_major(), lamexp_version_minor()),
545 QString::fromLatin1(lamexp_version_release()),
546 QString::number(lamexp_version_build()),
547 versionDate.toString(Qt::ISODate),
548 versionTime.toString(Qt::ISODate)
551 const QString platformStr = QString("%1 [%2], MUtilities %3 [%4] [%5], Qt Framework v%6 [%7]").arg
553 QString::fromLatin1(MUtils::Version::compiler_version()),
554 QString::fromLatin1(MUtils::Version::compiler_arch()),
555 QString().sprintf("%u.%02u", MUtils::Version::lib_version_major(), MUtils::Version::lib_version_minor()),
556 MUtils::Version::lib_build_date().toString(Qt::ISODate).toLatin1().constData(),
557 MUtils::Version::lib_build_time().toString(Qt::ISODate).toLatin1().constData(),
558 QString::fromLatin1(qVersion()),
559 QLibraryInfo::buildDate().toString(Qt::ISODate)
562 const QString copyrightStr = QString().sprintf
564 "Copyright (C) 2004-%04d LoRd_MuldeR &lt;MuldeR2@GMX.de&gt;. Some rights reserved.",
565 qMax(versionDate.year(), MUtils::OS::current_date().year())
568 QString aboutText;
570 aboutText += QString("<h2>%1</h2>").arg(tr("LameXP - Audio Encoder Front-end"));
571 aboutText += QString("<b>%1</b><br>").arg(copyrightStr);
572 aboutText += QString("<b>%1</b><br>").arg(versionStr);
573 aboutText += QString("<b>%1</b><br><br>").arg(platformStr);
574 aboutText += QString("%1<br>").arg(tr("Please visit %1 for news and updates!").arg(LINK(lamexp_website_url())));
576 #if QT_VERSION < QT_VERSION_CHECK(5,0,0)
577 const QDate currentDate = MUtils::OS::current_date();
578 if(MUTILS_DEBUG)
580 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0);
581 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)));
583 else if(lamexp_version_demo())
585 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0);
586 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)));
588 #else
589 const QDate currentDate = lamexp_current_date_safe();
590 if(LAMEXP_DEBUG)
592 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0i64);
593 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)));
595 else if(lamexp_version_demo())
597 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0i64);
598 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)));
600 #endif
602 aboutText += "<hr><br>";
604 aboutText += "<tt>This program is free software; you can redistribute it and/or modify<br>";
605 aboutText += "it under the terms of the GNU General Public License as published by<br>";
606 aboutText += "the Free Software Foundation; either version 2 of the License, or<br>";
607 aboutText += "(at your option) any later version, but always including the *additional*<br>";
608 aboutText += "restrictions defined in the \"License.txt\" file (see \"License\" tab).<br><br>";
609 aboutText += "This program is distributed in the hope that it will be useful,<br>";
610 aboutText += "but WITHOUT ANY WARRANTY; without even the implied warranty of<br>";
611 aboutText += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>";
612 aboutText += "GNU General Public License for more details.<br><br>";
613 aboutText += "You should have received a copy of the GNU General Public License<br>";
614 aboutText += "along with this program; if not, write to the Free Software<br>";
615 aboutText += "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110&minus;1301, USA.</tt><br>";
616 aboutText += "<hr><table style=\"margin-top:4px\"><tr>";
617 aboutText += "<td valign=\"middle\"><img src=\":/icons/error_big.png\"</td><td>&nbsp;</td>";
618 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 !!!"));
619 aboutText += "</tr></table>";
621 ui->infoLabel->setText(NOBREAK(aboutText));
622 ui->infoIcon->setPixmap(lamexp_app_icon().pixmap(QSize(72,72)));
623 connect(ui->infoLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
626 void AboutDialog::initContributorsTab(void)
628 const QString spaces("&nbsp;&nbsp;&nbsp;&nbsp;");
629 const QString extraVSpace("<font style=\"font-size:7px\"><br>&nbsp;</font>");
631 QString contributorsAboutText;
632 contributorsAboutText += QString("<h3>%1</h3>").arg(tr("The following people have contributed to LameXP:"));
633 contributorsAboutText += "<table style=\"margin-top:12px;white-space:nowrap\">";
635 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Programmers:"), extraVSpace);
636 QString icon = QString("<img src=\":/icons/%1.png\">").arg("user_gray");
637 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(icon, spaces);
638 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td>").arg(tr("Project Leader"), spaces);
639 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td><td><a href=\"mailto:%3?subject=LameXP\">&lt;%3&gt;</a></td></tr>").arg(L1S("LoRd_MuldeR"), spaces, L1S("MuldeR2@GMX.de"));
640 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>&nbsp;</b></td></tr>");
642 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Translators:"), extraVSpace);
643 for(int i = 0; g_lamexp_translators[i].pcName; i++)
645 const QString flagIcon = (strlen(g_lamexp_translators[i].pcFlag) > 0) ? QString("<img src=\":/flags/%1.png\">").arg(QString::fromLatin1(g_lamexp_translators[i].pcFlag)) : QString();
646 const QString contactAddr = QString::fromLatin1(g_lamexp_translators[i].pcContactAddr);
647 const QString linkUrl = QString(contactAddr.contains('@') ? "mailto:%1?subject=LameXP" : "http://%1").arg(contactAddr);
648 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(flagIcon, spaces);
649 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td>").arg(MUTILS_QSTR(g_lamexp_translators[i].pcLanguage), spaces);
650 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td><td><a href=\"%3\">&lt;%4&gt;</a></td></tr>").arg(MUTILS_QSTR(g_lamexp_translators[i].pcName), spaces, linkUrl, contactAddr);
653 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>&nbsp;</b></td></tr>");
654 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Special thanks to:"), extraVSpace);
656 QString webIcon = QString("<img src=\":/icons/%1.png\">").arg("world");
657 for(int i = 0; g_lamexp_specialThanks[i].pcName; i++)
659 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(webIcon, spaces);
660 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));
663 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>&nbsp;</b></td></tr>");
664 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Official Mirrors:"), extraVSpace);
666 QString serverIcon = QString("<img src=\":/icons/%1.png\">").arg("server_database");
667 for(int i = 0; g_lamexp_mirrors[i].pcName; i++)
669 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(serverIcon, spaces);
670 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));
673 contributorsAboutText += "</table><br><br><br>";
674 contributorsAboutText += QString("<i>%1</i><br>").arg(tr("If you are willing to contribute a LameXP translation, feel free to contact us!"));
676 ui->contributorsLabel->setText(NOBREAK(contributorsAboutText));
677 ui->contributorsIcon->setPixmap(QIcon(":/images/Logo_Contributors.png").pixmap(QSize(72,84)));
678 connect(ui->contributorsLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
681 void AboutDialog::initSoftwareTab(void)
683 QString moreAboutText;
685 moreAboutText += QString("<h3>%1</h3>").arg(tr("The following third-party software is used in LameXP:"));
686 moreAboutText += "<ul style='margin-left:-25px'>"; //;font-size:7pt
688 moreAboutText += makeToolText
690 tr("LAME - OpenSource mp3 Encoder"),
691 "lame.exe", "v?.???, #-?",
692 tr("Released under the terms of the GNU Lesser General Public License."),
693 "http://lame.sourceforge.net/"
695 moreAboutText += makeToolText
697 tr("OggEnc - Vorbis Encoder"),
698 "oggenc2.exe", "v?.??, libvorbis v?.?? + aoTuV b?.??_#",
699 tr("Completely open and patent-free audio encoding technology."),
700 "http://www.rarewares.org/ogg-oggenc.php"
702 moreAboutText += makeToolText
704 tr("Nero AAC Reference MPEG-4 Encoder"),
705 "neroAacEnc.exe", "v?.?.?.?",
706 tr("Freeware state-of-the-art HE-AAC encoder with 2-Pass support."),
707 neroAacUrl,
708 tr("Available from vendor web-site as free download:")
710 moreAboutText += makeToolText
712 tr("Aften - A/52 audio encoder"),
713 "aften.exe", "v?.?.?",
714 tr("Released under the terms of the GNU Lesser General Public License."),
715 "http://aften.sourceforge.net/"
717 moreAboutText += makeToolText
719 tr("FLAC - Free Lossless Audio Codec"),
720 "flac.exe", "v?.?.?",
721 tr("Open and patent-free lossless audio compression technology."),
722 "http://flac.sourceforge.net/"
724 moreAboutText += makeToolText
726 tr("Opus Audio Codec"),
727 "opusenc.exe", "#, ????-??-??",
728 tr("Totally open, royalty-free, highly versatile audio codec."),
729 "http://www.opus-codec.org/"
731 moreAboutText += makeToolText
733 tr("mpg123 - Fast Console MPEG Audio Player/Decoder"),
734 "mpg123.exe", "v?.??.??",
735 tr("Released under the terms of the GNU Lesser General Public License."),
736 "http://www.mpg123.de/"
738 moreAboutText += makeToolText
740 tr("FAAD - OpenSource MPEG-4 and MPEG-2 AAC Decoder"),
741 "faad.exe", "v?.?.?",
742 tr("Released under the terms of the GNU General Public License."),
743 "https://sourceforge.net/projects/faac/" //"http://www.audiocoding.com/"
745 moreAboutText += makeToolText
747 tr("OggDec - Vorbis Decoder"),
748 "oggdec.exe", "v?.??.?",
749 tr("Command line Ogg Vorbis decoder created by John33."),
750 "http://www.rarewares.org/ogg-oggdec.php"
752 moreAboutText += makeToolText
754 tr("Valdec from AC3Filter Tools - AC3/DTS Decoder"),
755 "valdec.exe", "v?.??#",
756 tr("Released under the terms of the GNU Lesser General Public License."),
757 "http://www.ac3filter.net/projects/tools"
759 moreAboutText += makeToolText
761 tr("WavPack - Hybrid Lossless Compression"),
762 "wvunpack.exe", "v?.??.?",
763 tr("Completely open audio compression format."),
764 "http://www.wavpack.com/"
766 moreAboutText += makeToolText
768 tr("Musepack - Living Audio Compression"),
769 "mpcdec.exe", "r???",
770 tr("Released under the terms of the GNU Lesser General Public License."),
771 "http://www.musepack.net/"
773 moreAboutText += makeToolText
775 tr("Monkey's Audio - Lossless Audio Compressor"),
776 "mac.exe", "v?.??",
777 tr("Freely available source code, simple SDK and non-restrictive licensing."),
778 "http://www.monkeysaudio.com/"
780 moreAboutText += makeToolText
782 tr("Shorten - Lossless Audio Compressor"),
783 "shorten.exe", "v?.?.?",
784 tr("Released under the terms of the GNU Lesser General Public License."),
785 "http://etree.org/shnutils/shorten/"
787 moreAboutText += makeToolText
789 tr("Speex - Free Codec For Free Speech"),
790 "speexdec.exe", "v?.?",
791 tr("Open Source patent-free audio format designed for speech."),
792 "http://www.speex.org/"
794 moreAboutText += makeToolText
796 tr("The True Audio - Lossless Audio Codec"),
797 "tta.exe", "v?.?",
798 tr("Released under the terms of the GNU Lesser General Public License."),
799 "http://tta.sourceforge.net/"
801 moreAboutText += makeToolText
803 tr("refalac - Win32 command line ALAC encoder/decoder"),
804 "refalac.exe", "v?.??",
805 tr("The ALAC reference implementation by Apple is available under the Apache license."),
806 "http://alac.macosforge.org/"
808 moreAboutText += makeToolText
810 tr("wma2wav - Dump WMA files to Wave Audio"),
811 "wma2wav.exe", "????-??-??",
812 tr("Copyright (c) 2011 LoRd_MuldeR &lt;mulder2@gmx.de&gt;. Some rights reserved."),
813 "http://forum.doom9.org/showthread.php?t=140273"
815 moreAboutText += makeToolText
817 tr("avs2wav - Avisynth to Wave Audio converter"),
818 "avs2wav.exe", "v?.?",
819 tr("By Jory Stone &lt;jcsston@toughguy.net&gt; and LoRd_MuldeR &lt;mulder2@gmx.de&gt;."),
820 "http://forum.doom9.org/showthread.php?t=70882"
822 moreAboutText += makeToolText
824 tr("dcaenc"),
825 "dcaenc.exe", "????-??-??",
826 tr("Copyright (c) 2008-2011 Alexander E. Patrakov. Distributed under the LGPL."),
827 "https://gitlab.com/patrakov/dcaenc"
829 moreAboutText += makeToolText
831 tr("MediaInfo - Media File Analysis Tool"),
832 "mediainfo.exe", "v??.??.?",
833 tr("Released under the terms of the GNU Lesser General Public License."),
834 "http://mediainfo.sourceforge.net/"
836 moreAboutText += makeToolText
838 tr("SoX - Sound eXchange"),
839 "sox.exe", "v??.?.?",
840 tr("Released under the terms of the GNU Lesser General Public License."),
841 "http://sox.sourceforge.net/"
843 moreAboutText += makeToolText
845 tr("GnuPG - The GNU Privacy Guard"),
846 "gpgv.exe", "v?.?.??",
847 tr("Released under the terms of the GNU Lesser General Public License."),
848 "http://www.gnupg.org/"
850 moreAboutText += makeToolText
852 tr("cURL - Curl URL Request Library"),
853 "curl.exe", "v?.??.?",
854 tr("By Daniel Stenberg, released under the terms of the MIT/X Derivate License."),
855 "https://curl.haxx.se/"
857 moreAboutText += makeToolText
859 tr("UPX - The Ultimate Packer for eXecutables"),
860 QString(), "v3.09",
861 tr("Released under the terms of the GNU Lesser General Public License."),
862 "http://upx.sourceforge.net/"
864 moreAboutText += makeToolText
866 tr("Silk Icons - Over 700 icons in PNG format"),
867 QString(), "v1.3",
868 tr("By Mark James, released under the Creative Commons 'BY' License."),
869 "http://www.famfamfam.com/lab/icons/silk/"
871 moreAboutText += makeToolText
873 tr("Angry Chicken and Ghost Scream sound"),
874 QString(), "v1.0",
875 tr("By Alexander, released under the Creative Commons 'BY' License."),
876 "http://www.orangefreesounds.com/"
878 moreAboutText += QString("</ul><br><i>%1</i><br>").arg
880 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.")
883 ui->softwareLabel->setText(NOBREAK(moreAboutText));
884 ui->softwareIcon->setPixmap(QIcon(":/images/Logo_Software.png").pixmap(QSize(72,65)));
885 connect(ui->softwareLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
888 void AboutDialog::initLicenseTab(void)
890 bool bFoundHeader = false;
891 QRegExp header("^(\\s*)(GNU GENERAL PUBLIC LICENSE)(\\s*)$");
893 QString licenseText;
894 licenseText += ("<tt>");
896 QFile file(":/License.txt");
897 if(file.open(QIODevice::ReadOnly))
899 QTextStream stream(&file);
900 while((!stream.atEnd()) && (stream.status() == QTextStream::Ok))
902 QString line = stream.readLine();
903 line.replace('<', "&lt;").replace('>', "&gt;");
904 if((!bFoundHeader) && (header.indexIn(line) >= 0))
906 line.replace(header, "\\1<b>\\2</b>\\3");
907 bFoundHeader = true;
909 TRIM_RIGHT(line);
910 licenseText += QString("<nobr>%1</nobr><br>").arg(line.replace(' ', "&nbsp;"));
912 licenseText += QString("<br>");
913 stream.device()->close();
915 else
917 licenseText += QString("<font color=\"darkred\">Oups, failed to load license text. Please refer to:</font><br>");
918 licenseText += LINK("http://www.gnu.org/licenses/gpl-2.0.html");
921 licenseText += ("</tt>");
923 ui->licenseLabel->setText(licenseText);
924 ui->licenseIcon->setPixmap(QIcon(":/images/Logo_GNU.png").pixmap(QSize(72,65)));
925 connect(ui->licenseLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
928 QString AboutDialog::makeToolText(const QString &toolName, const QString &toolBin, const QString &toolVerFmt, const QString &toolLicense, const QString &toolWebsite, const QString &extraInfo)
930 QString toolText, toolTag, verStr(toolVerFmt);
932 if(!toolBin.isEmpty())
934 const unsigned int version = lamexp_tools_version(toolBin, &toolTag);
935 verStr = lamexp_version2string(toolVerFmt, version, tr("n/a"), toolTag);
938 toolText += QString("<li>%1<br>").arg(QString("<b>%1 (%2)</b>").arg(toolName, verStr));
939 toolText += QString("%1<br>").arg(toolLicense);
940 if(!extraInfo.isEmpty()) toolText += QString("<i>%1</i><br>").arg(extraInfo);
941 toolText += LINK(toolWebsite);
942 toolText += QString("<font style=\"font-size:9px\"><br>&nbsp;</font>");
944 return toolText;