Rescale dialog size according to DPI scaling level.
[LameXP.git] / src / Dialog_About.cpp
blob3249678ef9ee9f9095e0c3e2d0868edee4c11aab
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=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@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 setMinimumSize(this->size());
159 //Adjust size to DPI settings and re-center
160 MUtils::GUI::scale_widget(this);
162 //Disable "X" button
163 if(firstStart)
165 MUtils::GUI::enable_close_button(this, false);
168 //Init images
169 for(int i = 0; i < 4; i++)
171 m_cartoon[i] = NULL;
174 //Init tab widget
175 connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
177 //Make transparent
178 const type_info &styleType = typeid(*qApp->style());
179 if((typeid(QWindowsVistaStyle) == styleType) || (typeid(QWindowsXPStyle) == styleType))
181 MAKE_TRANSPARENT(ui->infoScrollArea);
182 MAKE_TRANSPARENT(ui->contributorsScrollArea);
183 MAKE_TRANSPARENT(ui->softwareScrollArea);
184 MAKE_TRANSPARENT(ui->licenseScrollArea);
187 //Show about dialog for the first time?
188 if(!firstStart)
190 ui->acceptButton->hide();
191 ui->declineButton->hide();
192 ui->aboutQtButton->show();
193 ui->closeButton->show();
195 QPixmap disque(":/images/Disque.png");
196 m_disque = new QLabel(this, Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
197 m_disque->resize(disque.size());
198 m_disque->setStyleSheet("background:transparent;");
199 m_disque->setAttribute(Qt::WA_TranslucentBackground);
200 m_disque->setPixmap(disque);
201 m_disque->setCursor(QCursor(Qt::PointingHandCursor));
202 m_disque->installEventFilter(this);
204 connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), this, SLOT(geometryUpdated()));
205 geometryUpdated();
207 m_discOpacity = 0.01;
208 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());
209 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());
210 m_disqueFlags[0] = (MUtils::next_rand_u32() > (UINT_MAX/2));
211 m_disqueFlags[1] = (MUtils::next_rand_u32() > (UINT_MAX/2));
212 m_disque->move(m_disquePos);
213 m_disque->setWindowOpacity(m_discOpacity);
214 m_disque->show();
216 m_disqueTimer = new QTimer;
217 connect(m_disqueTimer, SIGNAL(timeout()), this, SLOT(moveDisque()));
218 m_disqueTimer->start(10);
220 connect(ui->aboutQtButton, SIGNAL(clicked()), this, SLOT(showAboutQt()));
222 else
224 ui->acceptButton->show();
225 ui->declineButton->show();
226 ui->aboutQtButton->hide();
227 ui->closeButton->hide();
230 //Activate "show license" button
231 ui->showLicenseButton->show();
232 connect(ui->showLicenseButton, SIGNAL(clicked()), this, SLOT(gotoLicenseTab()));
234 m_firstShow = firstStart;
237 AboutDialog::~AboutDialog(void)
239 if(m_disque)
241 m_disque->close();
242 MUTILS_DELETE(m_disque);
244 if(m_disqueTimer)
246 m_disqueTimer->stop();
247 MUTILS_DELETE(m_disqueTimer);
249 for(int i = 0; i < 4; i++)
251 MUTILS_DELETE(m_cartoon[i]);
253 MUTILS_DELETE(m_initFlags);
254 MUTILS_DELETE(ui);
257 ////////////////////////////////////////////////////////////
258 // Public Functions
259 ////////////////////////////////////////////////////////////
261 int AboutDialog::exec()
263 if(m_settings->soundsEnabled())
265 if(m_firstShow)
267 if(!MUtils::Sound::play_sound_file("imageres.dll", 5080, true))
269 MUtils::Sound::play_system_sound("SystemStart", true);
272 else
274 MUtils::Sound::play_sound("ghost", true);
278 switch(QDialog::exec())
280 case 1:
281 return 1;
282 break;
283 case 2:
284 return -1;
285 break;
286 default:
287 return 0;
288 break;
292 ////////////////////////////////////////////////////////////
293 // Slots
294 ////////////////////////////////////////////////////////////
296 #define TEMP_HIDE_DISQUE(CMD) do \
298 bool _tmp = (m_disque) ? m_disque->isVisible() : false; \
299 if(_tmp) m_disque->hide(); \
300 { CMD } \
301 if(_tmp) \
303 m_discOpacity = 0.01; \
304 m_disque->setWindowOpacity(m_discOpacity); \
305 m_disque->show(); \
308 while(0)
310 void AboutDialog::tabChanged(int index, const bool silent)
312 bool bInitialized = m_initFlags->value(ui->tabWidget->widget(index), false);
314 if(!bInitialized)
316 qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
318 if(QWidget *tab = ui->tabWidget->widget(index))
320 bool ok = false;
322 if(tab == ui->infoTab) { initInformationTab(); ok = true; }
323 if(tab == ui->contributorsTab) { initContributorsTab(); ok = true; }
324 if(tab == ui->softwareTab) { initSoftwareTab(); ok = true; }
325 if(tab == ui->licenseTab) { initLicenseTab(); ok = true; }
327 if(ok)
329 m_initFlags->insert(tab, true);
331 else
333 qWarning("Unknown tab %p encountered, cannot initialize !!!", tab);
338 ui->tabWidget->widget(index)->update();
339 qApp->processEvents();
340 qApp->restoreOverrideCursor();
343 //Play tick sound
344 if(m_settings->soundsEnabled() && (!silent))
346 MUtils::Sound::play_sound("tick", true);
349 //Scroll to the top
350 if(QWidget *tab = ui->tabWidget->widget(index))
352 if(tab == ui->infoTab) ui->infoScrollArea->verticalScrollBar()->setSliderPosition(0);
353 if(tab == ui->contributorsTab) ui->contributorsScrollArea->verticalScrollBar()->setSliderPosition(0);
354 if(tab == ui->softwareTab) ui->softwareScrollArea->verticalScrollBar()->setSliderPosition(0);
355 if(tab == ui->licenseTab) ui->licenseScrollArea->verticalScrollBar()->setSliderPosition(0);
358 //Update license button
359 ui->showLicenseButton->setChecked(ui->tabWidget->widget(index) == ui->licenseTab);
360 if(ui->tabWidget->widget(index) != ui->licenseTab) m_lastTab = index;
363 void AboutDialog::enableButtons(void)
365 ui->acceptButton->setEnabled(true);
366 ui->declineButton->setEnabled(true);
367 setCursor(QCursor(Qt::ArrowCursor));
370 void AboutDialog::openURL(const QString &url)
372 if(!QDesktopServices::openUrl(QUrl(url)))
374 MUtils::OS::shell_open(this, url);
378 void AboutDialog::showAboutQt(void)
380 TEMP_HIDE_DISQUE
382 QMessageBox::aboutQt(this);
386 void AboutDialog::gotoLicenseTab(void)
388 ui->tabWidget->setCurrentIndex(ui->tabWidget->indexOf(ui->showLicenseButton->isChecked() ? ui->licenseTab : ui->tabWidget->widget(m_lastTab)));
391 void AboutDialog::moveDisque(void)
393 int delta = 2;
394 QElapsedTimer elapsedTimer;
395 elapsedTimer.start();
397 if((!m_disqueDelay.isNull()) && m_disqueDelay->isValid())
399 const qint64 delay = m_disqueDelay->restart();
400 delta = qBound(1, static_cast<int>(ceil(static_cast<double>(delay) / 5.12)), 128);
402 else
404 m_disqueDelay.reset(new QElapsedTimer());
405 m_disqueDelay->start();
408 if(m_disque)
410 if(m_disquePos.x() <= m_disqueBound.left()) { m_disqueFlags[0] = true; m_rotateNext = true; }
411 if(m_disquePos.x() >= m_disqueBound.right()) { m_disqueFlags[0] = false; m_rotateNext = true; }
412 if(m_disquePos.y() <= m_disqueBound.top()) { m_disqueFlags[1] = true; m_rotateNext = true; }
413 if(m_disquePos.y() >= m_disqueBound.bottom()) { m_disqueFlags[1] = false; m_rotateNext = true; }
415 m_disquePos.setX(m_disqueFlags[0] ? (m_disquePos.x() + delta) : (m_disquePos.x() - delta));
416 m_disquePos.setY(m_disqueFlags[1] ? (m_disquePos.y() + delta) : (m_disquePos.y() - delta));
418 m_disque->move(m_disquePos);
420 if(m_rotateNext)
422 QPixmap *cartoon = NULL;
423 if(m_disqueFlags[0] == true && m_disqueFlags[1] != true) cartoon = m_cartoon[0];
424 if(m_disqueFlags[0] == true && m_disqueFlags[1] == true) cartoon = m_cartoon[1];
425 if(m_disqueFlags[0] != true && m_disqueFlags[1] == true) cartoon = m_cartoon[2];
426 if(m_disqueFlags[0] != true && m_disqueFlags[1] != true) cartoon = m_cartoon[3];
427 if(cartoon)
429 m_disque->setPixmap(*cartoon);
430 if(m_disque->size() != cartoon->size())
432 m_disque->resize(cartoon->size());
433 geometryUpdated();
436 m_rotateNext = false;
439 if(m_discOpacity != 1.0)
441 m_discOpacity = m_discOpacity + 0.01;
442 if(qFuzzyCompare(m_discOpacity, 1.0) || (m_discOpacity > 1.0))
444 m_discOpacity = 1.0;
446 m_disque->setWindowOpacity(m_discOpacity);
447 m_disque->update();
452 void AboutDialog::geometryUpdated(void)
454 if(m_disque)
456 QRect screenGeometry = QApplication::desktop()->availableGeometry();
457 m_disqueBound.setLeft(screenGeometry.left());
458 m_disqueBound.setRight(screenGeometry.width() - m_disque->width() + screenGeometry.left());
459 m_disqueBound.setTop(screenGeometry.top());
460 m_disqueBound.setBottom(screenGeometry.height() - m_disque->height() + screenGeometry.top());
462 else
464 m_disqueBound = QApplication::desktop()->availableGeometry();
468 void AboutDialog::adjustSize(void)
470 const int maxH = QApplication::desktop()->availableGeometry().height();
471 const int maxW = QApplication::desktop()->availableGeometry().width();
473 const int deltaH = ui->infoScrollArea->widget()->height() - ui->infoScrollArea->viewport()->height();
474 const int deltaW = ui->infoScrollArea->widget()->width() - ui->infoScrollArea->viewport()->width();
476 if(deltaH > 0)
478 this->resize(this->width(), qMin(this->height() + deltaH, maxH));
479 this->move(this->x(), this->y() - (deltaH / 2));
480 this->setMinimumHeight(qMax(this->minimumHeight(), this->height()));
483 if(deltaW > 0)
485 this->resize(qMin(this->width() + deltaW, maxW), this->height());
486 this->move(this->x() - (deltaW / 2), this->y());
487 this->setMinimumWidth(qMax(this->minimumWidth(), this->width()));
491 ////////////////////////////////////////////////////////////
492 // Protected Functions
493 ////////////////////////////////////////////////////////////
495 void AboutDialog::showEvent(QShowEvent *e)
497 QDialog::showEvent(e);
499 ui->tabWidget->setCurrentIndex(ui->tabWidget->indexOf(ui->infoTab));
500 tabChanged(m_lastTab = ui->tabWidget->currentIndex(), true);
502 if(m_firstShow)
504 ui->acceptButton->setEnabled(false);
505 ui->declineButton->setEnabled(false);
506 QTimer::singleShot(5000, this, SLOT(enableButtons()));
507 setCursor(QCursor(Qt::WaitCursor));
510 QTimer::singleShot(0, this, SLOT(adjustSize()));
513 void AboutDialog::closeEvent(QCloseEvent *e)
515 if(m_firstShow) e->ignore();
518 bool AboutDialog::eventFilter(QObject *obj, QEvent *event)
520 if((obj == m_disque) && (event->type() == QEvent::MouseButtonPress))
522 MUtils::Sound::play_sound("chicken", true);
523 if (!m_cartoon[0])
525 QPixmap cartoon(":/images/Cartoon.png");
526 for(int i = 0; i < 4; i++)
528 m_cartoon[i] = new QPixmap(cartoon.transformed(QMatrix().rotate(static_cast<double>(i*90) + 45.0), Qt::SmoothTransformation));
529 m_rotateNext = true;
532 QDesktopServices::openUrl(QUrl(disqueUrl));
535 return false;
538 ////////////////////////////////////////////////////////////
539 // Private Functions
540 ////////////////////////////////////////////////////////////
542 void AboutDialog::initInformationTab(void)
544 const QDate versionDate = MUtils::Version::app_build_date();
546 const QString versionStr = QString().sprintf
548 "Version %d.%02d %s, Build %d [%s], %s %s, Qt v%s",
549 lamexp_version_major(),
550 lamexp_version_minor(),
551 lamexp_version_release(),
552 lamexp_version_build(),
553 versionDate.toString(Qt::ISODate).toLatin1().constData(),
554 MUtils::Version::compiler_version(),
555 MUtils::Version::compiler_arch(),
556 qVersion()
559 const QString copyrightStr = QString().sprintf
561 "Copyright (C) 2004-%04d LoRd_MuldeR &lt;MuldeR2@GMX.de&gt;. Some rights reserved.",
562 qMax(versionDate.year(), MUtils::OS::current_date().year())
565 QString aboutText;
567 aboutText += QString("<h2>%1</h2>").arg(NOBR(tr("LameXP - Audio Encoder Front-end")));
568 aboutText += QString("<b>%1</b><br>").arg(NOBR(copyrightStr));
569 aboutText += QString("<b>%1</b><br><br>").arg(NOBR(versionStr));
570 aboutText += QString("%1<br>").arg(NOBR(tr("Please visit %1 for news and updates!").arg(LINK(lamexp_website_url()))));
572 #if QT_VERSION < QT_VERSION_CHECK(5,0,0)
573 const QDate currentDate = MUtils::OS::current_date();
574 if(MUTILS_DEBUG)
576 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0);
577 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))));
579 else if(lamexp_version_demo())
581 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0);
582 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))));
584 #else
585 const QDate currentDate = lamexp_current_date_safe();
586 if(LAMEXP_DEBUG)
588 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0i64);
589 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))));
591 else if(lamexp_version_demo())
593 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0i64);
594 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))));
596 #endif
598 aboutText += "<hr><br>";
600 aboutText += "<nobr><tt>This program is free software; you can redistribute it and/or modify<br>";
601 aboutText += "it under the terms of the GNU General Public License as published by<br>";
602 aboutText += "the Free Software Foundation; either version 2 of the License, or<br>";
603 aboutText += "(at your option) any later version, but always including the *additional*<br>";
604 aboutText += "restrictions defined in the \"License.txt\" file (see \"License\" tab).<br><br>";
605 aboutText += "This program is distributed in the hope that it will be useful,<br>";
606 aboutText += "but WITHOUT ANY WARRANTY; without even the implied warranty of<br>";
607 aboutText += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>";
608 aboutText += "GNU General Public License for more details.<br><br>";
609 aboutText += "You should have received a copy of the GNU General Public License<br>";
610 aboutText += "along with this program; if not, write to the Free Software<br>";
611 aboutText += "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110&minus;1301, USA.</tt></nobr><br>";
612 aboutText += "<hr><table style=\"margin-top:4px\"><tr>";
613 aboutText += "<td valign=\"middle\"><img src=\":/icons/error_big.png\"</td><td>&nbsp;</td>";
614 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 !!!"));
615 aboutText += "</tr></table>";
617 ui->infoLabel->setText(aboutText);
618 ui->infoIcon->setPixmap(lamexp_app_icon().pixmap(QSize(72,72)));
619 connect(ui->infoLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
622 void AboutDialog::initContributorsTab(void)
624 const QString spaces("&nbsp;&nbsp;&nbsp;&nbsp;");
625 const QString extraVSpace("<font style=\"font-size:7px\"><br>&nbsp;</font>");
627 QString contributorsAboutText;
628 contributorsAboutText += QString("<h3>%1</h3>").arg(NOBR(tr("The following people have contributed to LameXP:")));
629 contributorsAboutText += "<table style=\"margin-top:12px;white-space:nowrap\">";
631 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Programmers:"), extraVSpace);
632 QString icon = QString("<img src=\":/icons/%1.png\">").arg("user_gray");
633 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(icon, spaces);
634 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td>").arg(tr("Project Leader"), spaces);
635 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");
636 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>&nbsp;</b></td></tr>");
638 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Translators:"), extraVSpace);
639 for(int i = 0; g_lamexp_translators[i].pcName; i++)
641 QString flagIcon = (strlen(g_lamexp_translators[i].pcFlag) > 0) ? QString("<img src=\":/flags/%1.png\">").arg(g_lamexp_translators[i].pcFlag) : QString();
642 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(flagIcon, spaces);
643 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td>").arg(MUTILS_QSTR(g_lamexp_translators[i].pcLanguage), spaces);
644 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);
647 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>&nbsp;</b></td></tr>");
648 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Special thanks to:"), extraVSpace);
650 QString webIcon = QString("<img src=\":/icons/%1.png\">").arg("world");
651 for(int i = 0; g_lamexp_specialThanks[i].pcName; i++)
653 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(webIcon, spaces);
654 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));
657 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>&nbsp;</b></td></tr>");
658 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Official Mirrors:"), extraVSpace);
660 QString serverIcon = QString("<img src=\":/icons/%1.png\">").arg("server_database");
661 for(int i = 0; g_lamexp_mirrors[i].pcName; i++)
663 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(serverIcon, spaces);
664 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));
667 contributorsAboutText += "</table><br><br><br>";
668 contributorsAboutText += QString("<i>%1</i><br>").arg(NOBR(tr("If you are willing to contribute a LameXP translation, feel free to contact us!")));
670 ui->contributorsLabel->setText(contributorsAboutText);
671 ui->contributorsIcon->setPixmap(QIcon(":/images/Logo_Contributors.png").pixmap(QSize(72,84)));
672 connect(ui->contributorsLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
675 void AboutDialog::initSoftwareTab(void)
677 QString moreAboutText;
679 moreAboutText += QString("<h3>%1</h3>").arg(tr("The following third-party software is used in LameXP:"));
680 moreAboutText += "<div style=\"margin-left:-25px;white-space:nowrap\"><table><tr><td><ul>"; //;font-size:7pt
682 moreAboutText += makeToolText
684 tr("LAME - OpenSource mp3 Encoder"),
685 "lame.exe", "v?.???, #-?",
686 tr("Released under the terms of the GNU Lesser General Public License."),
687 "http://lame.sourceforge.net/"
689 moreAboutText += makeToolText
691 tr("OggEnc - Vorbis Encoder"),
692 "oggenc2.exe", "v?.??, libvorbis v?.?? + aoTuV b?.??_#",
693 tr("Completely open and patent-free audio encoding technology."),
694 "http://www.rarewares.org/ogg-oggenc.php"
696 moreAboutText += makeToolText
698 tr("Nero AAC Reference MPEG-4 Encoder"),
699 "neroAacEnc.exe", "v?.?.?.?",
700 tr("Freeware state-of-the-art HE-AAC encoder with 2-Pass support."),
701 neroAacUrl,
702 tr("Available from vendor web-site as free download:")
704 moreAboutText += makeToolText
706 tr("Aften - A/52 audio encoder"),
707 "aften.exe", "v?.?.?",
708 tr("Released under the terms of the GNU Lesser General Public License."),
709 "http://aften.sourceforge.net/"
711 moreAboutText += makeToolText
713 tr("FLAC - Free Lossless Audio Codec"),
714 "flac.exe", "v?.?.?",
715 tr("Open and patent-free lossless audio compression technology."),
716 "http://flac.sourceforge.net/"
718 moreAboutText += makeToolText
720 tr("Opus Audio Codec"),
721 "opusenc.exe", "#, ????-??-??",
722 tr("Totally open, royalty-free, highly versatile audio codec."),
723 "http://www.opus-codec.org/"
725 moreAboutText += makeToolText
727 tr("mpg123 - Fast Console MPEG Audio Player/Decoder"),
728 "mpg123.exe", "v?.??.?",
729 tr("Released under the terms of the GNU Lesser General Public License."),
730 "http://www.mpg123.de/"
732 moreAboutText += makeToolText
734 tr("FAAD - OpenSource MPEG-4 and MPEG-2 AAC Decoder"),
735 "faad.exe", "v?.?",
736 tr("Released under the terms of the GNU General Public License."),
737 "http://www.audiocoding.com/"
739 moreAboutText += makeToolText
741 tr("OggDec - Vorbis Decoder"),
742 "oggdec.exe", "v?.??.?",
743 tr("Command line Ogg Vorbis decoder created by John33."),
744 "http://www.rarewares.org/ogg-oggdec.php"
746 moreAboutText += makeToolText
748 tr("Valdec from AC3Filter Tools - AC3/DTS Decoder"),
749 "valdec.exe", "v?.??#",
750 tr("Released under the terms of the GNU Lesser General Public License."),
751 "http://www.ac3filter.net/projects/tools"
753 moreAboutText += makeToolText
755 tr("WavPack - Hybrid Lossless Compression"),
756 "wvunpack.exe", "v?.??.?",
757 tr("Completely open audio compression format."),
758 "http://www.wavpack.com/"
760 moreAboutText += makeToolText
762 tr("Musepack - Living Audio Compression"),
763 "mpcdec.exe", "r???",
764 tr("Released under the terms of the GNU Lesser General Public License."),
765 "http://www.musepack.net/"
767 moreAboutText += makeToolText
769 tr("Monkey's Audio - Lossless Audio Compressor"),
770 "mac.exe", "v?.??",
771 tr("Freely available source code, simple SDK and non-restrictive licensing."),
772 "http://www.monkeysaudio.com/"
774 moreAboutText += makeToolText
776 tr("Shorten - Lossless Audio Compressor"),
777 "shorten.exe", "v?.?.?",
778 tr("Released under the terms of the GNU Lesser General Public License."),
779 "http://etree.org/shnutils/shorten/"
781 moreAboutText += makeToolText
783 tr("Speex - Free Codec For Free Speech"),
784 "speexdec.exe", "v?.?",
785 tr("Open Source patent-free audio format designed for speech."),
786 "http://www.speex.org/"
788 moreAboutText += makeToolText
790 tr("The True Audio - Lossless Audio Codec"),
791 "tta.exe", "v?.?",
792 tr("Released under the terms of the GNU Lesser General Public License."),
793 "http://tta.sourceforge.net/"
795 moreAboutText += makeToolText
797 tr("refalac - Win32 command line ALAC encoder/decoder"),
798 "refalac.exe", "v?.??",
799 tr("The ALAC reference implementation by Apple is available under the Apache license."),
800 "http://alac.macosforge.org/"
802 moreAboutText += makeToolText
804 tr("wma2wav - Dump WMA files to Wave Audio"),
805 "wma2wav.exe", "????-??-??",
806 tr("Copyright (c) 2011 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved."),
807 "http://forum.doom9.org/showthread.php?t=140273"
809 moreAboutText += makeToolText
811 tr("avs2wav - Avisynth to Wave Audio converter"),
812 "avs2wav.exe", "v?.?",
813 tr("By Jory Stone <jcsston@toughguy.net> and LoRd_MuldeR <mulder2@gmx.de>."),
814 "http://forum.doom9.org/showthread.php?t=70882"
816 moreAboutText += makeToolText
818 tr("dcaenc"),
819 "dcaenc.exe", "????-??-??",
820 tr("Copyright (c) 2008-2011 Alexander E. Patrakov. Distributed under the LGPL."),
821 "https://gitlab.com/patrakov/dcaenc"
823 moreAboutText += makeToolText
825 tr("MediaInfo - Media File Analysis Tool"),
826 "mediainfo.exe", "v?.?.??",
827 tr("Released under the terms of the GNU Lesser General Public License."),
828 "http://mediainfo.sourceforge.net/"
830 moreAboutText += makeToolText
832 tr("SoX - Sound eXchange"),
833 "sox.exe", "v??.?.?",
834 tr("Released under the terms of the GNU Lesser General Public License."),
835 "http://sox.sourceforge.net/"
837 moreAboutText += makeToolText
839 tr("GnuPG - The GNU Privacy Guard"),
840 "gpgv.exe", "v?.?.??",
841 tr("Released under the terms of the GNU Lesser General Public License."),
842 "http://www.gnupg.org/"
844 moreAboutText += makeToolText
846 tr("GNU Wget - Software for retrieving files using HTTP"),
847 "wget.exe", "v?.??.?",
848 tr("Released under the terms of the GNU Lesser General Public License."),
849 "http://www.gnu.org/software/wget/"
851 moreAboutText += makeToolText
853 tr("Netcat for NT - TCP/IP Swiss Army Knife"),
854 "nc.exe", "v?.??",
855 tr("Released under the terms of the GNU Lesser General Public License."),
856 "https://eternallybored.org/misc/netcat/"
858 moreAboutText += makeToolText
860 tr("UPX - The Ultimate Packer for eXecutables"),
861 QString(), "v3.09",
862 tr("Released under the terms of the GNU Lesser General Public License."),
863 "http://upx.sourceforge.net/"
865 moreAboutText += makeToolText
867 tr("Silk Icons - Over 700 icons in PNG format"),
868 QString(), "v1.3",
869 tr("By Mark James, released under the Creative Commons 'BY' License."),
870 "http://www.famfamfam.com/lab/icons/silk/"
872 moreAboutText += makeToolText
874 tr("Angry Chicken and Ghost Scream sound"),
875 QString(), "v1.0",
876 tr("By Alexander, released under the Creative Commons 'BY' License."),
877 "http://www.orangefreesounds.com/"
879 moreAboutText += QString("</ul></td><td>&nbsp;</td></tr></table></div><br><i>%1</i><br>").arg
881 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.")
884 ui->softwareLabel->setText(moreAboutText);
885 ui->softwareIcon->setPixmap(QIcon(":/images/Logo_Software.png").pixmap(QSize(72,65)));
886 connect(ui->softwareLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
889 void AboutDialog::initLicenseTab(void)
891 bool bFoundHeader = false;
892 QRegExp header("^(\\s*)(GNU GENERAL PUBLIC LICENSE)(\\s*)$");
894 QString licenseText;
895 licenseText += ("<tt>");
897 QFile file(":/License.txt");
898 if(file.open(QIODevice::ReadOnly))
900 QTextStream stream(&file);
901 while((!stream.atEnd()) && (stream.status() == QTextStream::Ok))
903 QString line = stream.readLine();
904 line.replace('<', "&lt;").replace('>', "&gt;");
905 if((!bFoundHeader) && (header.indexIn(line) >= 0))
907 line.replace(header, "\\1<b>\\2</b>\\3");
908 bFoundHeader = true;
910 TRIM_RIGHT(line);
911 licenseText += QString("<nobr>%1</nobr><br>").arg(line.replace(' ', "&nbsp;"));
913 licenseText += QString("<br>");
914 stream.device()->close();
916 else
918 licenseText += QString("<font color=\"darkred\">Oups, failed to load license text. Please refer to:</font><br>");
919 licenseText += LINK("http://www.gnu.org/licenses/gpl-2.0.html");
922 licenseText += ("</tt>");
924 ui->licenseLabel->setText(licenseText);
925 ui->licenseIcon->setPixmap(QIcon(":/images/Logo_GNU.png").pixmap(QSize(72,65)));
926 connect(ui->licenseLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
930 QString AboutDialog::makeToolText(const QString &toolName, const QString &toolBin, const QString &toolVerFmt, const QString &toolLicense, const QString &toolWebsite, const QString &extraInfo)
932 QString toolText, toolTag, verStr(toolVerFmt);
934 if(!toolBin.isEmpty())
936 const unsigned int version = lamexp_tools_version(toolBin, &toolTag);
937 verStr = lamexp_version2string(toolVerFmt, version, tr("n/a"), toolTag);
940 toolText += QString("<li>%1<br>").arg(NOBR(QString("<b>%1 (%2)</b>").arg(toolName, verStr)));
941 toolText += QString("%1<br>").arg(NOBR(toolLicense));
942 if(!extraInfo.isEmpty()) toolText += QString("<i>%1</i><br>").arg(NOBR(extraInfo));
943 toolText += QString("<nobr>%1</nobr>").arg(LINK(toolWebsite));
944 toolText += QString("<font style=\"font-size:9px\"><br>&nbsp;</font>");
946 return toolText;