Fixed changelog.
[LameXP.git] / src / Dialog_About.cpp
blobcce27475c600a981c1c26fa7df1547031489a515
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 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->setCursor(QCursor(Qt::PointingHandCursor));
201 m_disque->installEventFilter(this);
203 connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), this, SLOT(geometryUpdated()));
204 geometryUpdated();
206 m_discOpacity = 0.01;
207 m_disquePos.setX(static_cast<int>(MUtils::next_rand32() % static_cast<unsigned int>(m_disqueBound.right() - disque.width() - m_disqueBound.left())) + m_disqueBound.left());
208 m_disquePos.setY(static_cast<int>(MUtils::next_rand32() % static_cast<unsigned int>(m_disqueBound.bottom() - disque.height() - m_disqueBound.top())) + m_disqueBound.top());
209 m_disqueFlags[0] = (MUtils::next_rand32() > (UINT_MAX/2));
210 m_disqueFlags[1] = (MUtils::next_rand32() > (UINT_MAX/2));
211 m_disque->move(m_disquePos);
212 m_disque->setWindowOpacity(m_discOpacity);
213 m_disque->show();
215 m_disqueTimer = new QTimer;
216 connect(m_disqueTimer, SIGNAL(timeout()), this, SLOT(moveDisque()));
217 m_disqueTimer->start(10);
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()));
233 m_firstShow = firstStart;
236 AboutDialog::~AboutDialog(void)
238 if(m_disque)
240 m_disque->close();
241 MUTILS_DELETE(m_disque);
243 if(m_disqueTimer)
245 m_disqueTimer->stop();
246 MUTILS_DELETE(m_disqueTimer);
248 for(int i = 0; i < 4; i++)
250 MUTILS_DELETE(m_cartoon[i]);
252 MUTILS_DELETE(m_initFlags);
253 MUTILS_DELETE(ui);
256 ////////////////////////////////////////////////////////////
257 // Public Functions
258 ////////////////////////////////////////////////////////////
260 int AboutDialog::exec()
262 if(m_settings->soundsEnabled())
264 if(m_firstShow)
266 if(!MUtils::Sound::play_sound_file("imageres.dll", 5080, true))
268 MUtils::Sound::play_system_sound("SystemStart", true);
271 else
273 MUtils::Sound::play_sound("ghost", true);
277 switch(QDialog::exec())
279 case 1:
280 return 1;
281 break;
282 case 2:
283 return -1;
284 break;
285 default:
286 return 0;
287 break;
291 ////////////////////////////////////////////////////////////
292 // Slots
293 ////////////////////////////////////////////////////////////
295 #define TEMP_HIDE_DISQUE(CMD) do \
297 bool _tmp = (m_disque) ? m_disque->isVisible() : false; \
298 if(_tmp) m_disque->hide(); \
299 { CMD } \
300 if(_tmp) \
302 m_discOpacity = 0.01; \
303 m_disque->setWindowOpacity(m_discOpacity); \
304 m_disque->show(); \
307 while(0)
309 void AboutDialog::tabChanged(int index, const bool silent)
311 bool bInitialized = m_initFlags->value(ui->tabWidget->widget(index), false);
313 if(!bInitialized)
315 qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
317 if(QWidget *tab = ui->tabWidget->widget(index))
319 bool ok = false;
321 if(tab == ui->infoTab) { initInformationTab(); ok = true; }
322 if(tab == ui->contributorsTab) { initContributorsTab(); ok = true; }
323 if(tab == ui->softwareTab) { initSoftwareTab(); ok = true; }
324 if(tab == ui->licenseTab) { initLicenseTab(); ok = true; }
326 if(ok)
328 m_initFlags->insert(tab, true);
330 else
332 qWarning("Unknown tab %p encountered, cannot initialize !!!", tab);
337 ui->tabWidget->widget(index)->update();
338 qApp->processEvents();
339 qApp->restoreOverrideCursor();
342 //Play tick sound
343 if(m_settings->soundsEnabled() && (!silent))
345 MUtils::Sound::play_sound("tick", true);
348 //Scroll to the top
349 if(QWidget *tab = ui->tabWidget->widget(index))
351 if(tab == ui->infoTab) ui->infoScrollArea->verticalScrollBar()->setSliderPosition(0);
352 if(tab == ui->contributorsTab) ui->contributorsScrollArea->verticalScrollBar()->setSliderPosition(0);
353 if(tab == ui->softwareTab) ui->softwareScrollArea->verticalScrollBar()->setSliderPosition(0);
354 if(tab == ui->licenseTab) ui->licenseScrollArea->verticalScrollBar()->setSliderPosition(0);
357 //Update license button
358 ui->showLicenseButton->setChecked(ui->tabWidget->widget(index) == ui->licenseTab);
359 if(ui->tabWidget->widget(index) != ui->licenseTab) m_lastTab = index;
362 void AboutDialog::enableButtons(void)
364 ui->acceptButton->setEnabled(true);
365 ui->declineButton->setEnabled(true);
366 setCursor(QCursor(Qt::ArrowCursor));
369 void AboutDialog::openURL(const QString &url)
371 if(!QDesktopServices::openUrl(QUrl(url)))
373 MUtils::OS::shell_open(this, url);
377 void AboutDialog::showAboutQt(void)
379 TEMP_HIDE_DISQUE
381 QMessageBox::aboutQt(this);
385 void AboutDialog::gotoLicenseTab(void)
387 ui->tabWidget->setCurrentIndex(ui->tabWidget->indexOf(ui->showLicenseButton->isChecked() ? ui->licenseTab : ui->tabWidget->widget(m_lastTab)));
390 void AboutDialog::moveDisque(void)
392 int delta = 2;
393 QElapsedTimer elapsedTimer;
394 elapsedTimer.start();
396 if((!m_disqueDelay.isNull()) && m_disqueDelay->isValid())
398 const qint64 delay = m_disqueDelay->restart();
399 delta = qBound(1, static_cast<int>(ceil(static_cast<double>(delay) / 5.12)), 128);
401 else
403 m_disqueDelay.reset(new QElapsedTimer());
404 m_disqueDelay->start();
407 if(m_disque)
409 if(m_disquePos.x() <= m_disqueBound.left()) { m_disqueFlags[0] = true; m_rotateNext = true; }
410 if(m_disquePos.x() >= m_disqueBound.right()) { m_disqueFlags[0] = false; m_rotateNext = true; }
411 if(m_disquePos.y() <= m_disqueBound.top()) { m_disqueFlags[1] = true; m_rotateNext = true; }
412 if(m_disquePos.y() >= m_disqueBound.bottom()) { m_disqueFlags[1] = false; m_rotateNext = true; }
414 m_disquePos.setX(m_disqueFlags[0] ? (m_disquePos.x() + delta) : (m_disquePos.x() - delta));
415 m_disquePos.setY(m_disqueFlags[1] ? (m_disquePos.y() + delta) : (m_disquePos.y() - delta));
417 m_disque->move(m_disquePos);
419 if(m_rotateNext)
421 QPixmap *cartoon = NULL;
422 if(m_disqueFlags[0] == true && m_disqueFlags[1] != true) cartoon = m_cartoon[0];
423 if(m_disqueFlags[0] == true && m_disqueFlags[1] == true) cartoon = m_cartoon[1];
424 if(m_disqueFlags[0] != true && m_disqueFlags[1] == true) cartoon = m_cartoon[2];
425 if(m_disqueFlags[0] != true && m_disqueFlags[1] != true) cartoon = m_cartoon[3];
426 if(cartoon)
428 m_disque->setPixmap(*cartoon);
429 if(m_disque->size() != cartoon->size())
431 m_disque->resize(cartoon->size());
432 geometryUpdated();
435 m_rotateNext = false;
438 if(m_discOpacity != 1.0)
440 m_discOpacity = m_discOpacity + 0.01;
441 if(qFuzzyCompare(m_discOpacity, 1.0) || (m_discOpacity > 1.0))
443 m_discOpacity = 1.0;
445 m_disque->setWindowOpacity(m_discOpacity);
446 m_disque->update();
451 void AboutDialog::geometryUpdated(void)
453 if(m_disque)
455 QRect screenGeometry = QApplication::desktop()->availableGeometry();
456 m_disqueBound.setLeft(screenGeometry.left());
457 m_disqueBound.setRight(screenGeometry.width() - m_disque->width() + screenGeometry.left());
458 m_disqueBound.setTop(screenGeometry.top());
459 m_disqueBound.setBottom(screenGeometry.height() - m_disque->height() + screenGeometry.top());
461 else
463 m_disqueBound = QApplication::desktop()->availableGeometry();
467 void AboutDialog::adjustSize(void)
469 const int maxH = QApplication::desktop()->availableGeometry().height();
470 const int maxW = QApplication::desktop()->availableGeometry().width();
472 const int deltaH = ui->infoScrollArea->widget()->height() - ui->infoScrollArea->viewport()->height();
473 const int deltaW = ui->infoScrollArea->widget()->width() - ui->infoScrollArea->viewport()->width();
475 if(deltaH > 0)
477 this->resize(this->width(), qMin(this->height() + deltaH, maxH));
478 this->move(this->x(), this->y() - (deltaH / 2));
479 this->setMinimumHeight(qMax(this->minimumHeight(), this->height()));
482 if(deltaW > 0)
484 this->resize(qMin(this->width() + deltaW, maxW), this->height());
485 this->move(this->x() - (deltaW / 2), this->y());
486 this->setMinimumWidth(qMax(this->minimumWidth(), this->width()));
490 ////////////////////////////////////////////////////////////
491 // Protected Functions
492 ////////////////////////////////////////////////////////////
494 void AboutDialog::showEvent(QShowEvent *e)
496 QDialog::showEvent(e);
498 ui->tabWidget->setCurrentIndex(ui->tabWidget->indexOf(ui->infoTab));
499 tabChanged(m_lastTab = ui->tabWidget->currentIndex(), true);
501 if(m_firstShow)
503 ui->acceptButton->setEnabled(false);
504 ui->declineButton->setEnabled(false);
505 QTimer::singleShot(5000, this, SLOT(enableButtons()));
506 setCursor(QCursor(Qt::WaitCursor));
509 QTimer::singleShot(0, this, SLOT(adjustSize()));
512 void AboutDialog::closeEvent(QCloseEvent *e)
514 if(m_firstShow) e->ignore();
517 bool AboutDialog::eventFilter(QObject *obj, QEvent *event)
519 if((obj == m_disque) && (event->type() == QEvent::MouseButtonPress))
521 MUtils::Sound::play_sound("chicken", true);
522 if (!m_cartoon[0])
524 QPixmap cartoon(":/images/Cartoon.png");
525 for(int i = 0; i < 4; i++)
527 m_cartoon[i] = new QPixmap(cartoon.transformed(QMatrix().rotate(static_cast<double>(i*90) + 45.0), Qt::SmoothTransformation));
528 m_rotateNext = true;
531 QDesktopServices::openUrl(QUrl(disqueUrl));
534 return false;
537 ////////////////////////////////////////////////////////////
538 // Private Functions
539 ////////////////////////////////////////////////////////////
541 void AboutDialog::initInformationTab(void)
543 const QDate versionDate = MUtils::Version::app_build_date();
545 const QString versionStr = QString().sprintf
547 "Version %d.%02d %s, Build %d [%s], %s %s, Qt v%s",
548 lamexp_version_major(),
549 lamexp_version_minor(),
550 lamexp_version_release(),
551 lamexp_version_build(),
552 versionDate.toString(Qt::ISODate).toLatin1().constData(),
553 MUtils::Version::compiler_version(),
554 MUtils::Version::compiler_arch(),
555 qVersion()
558 const QString copyrightStr = QString().sprintf
560 "Copyright (C) 2004-%04d LoRd_MuldeR &lt;MuldeR2@GMX.de&gt;. Some rights reserved.",
561 qMax(versionDate.year(), MUtils::OS::current_date().year())
564 QString aboutText;
566 aboutText += QString("<h2>%1</h2>").arg(NOBR(tr("LameXP - Audio Encoder Front-end")));
567 aboutText += QString("<b>%1</b><br>").arg(NOBR(copyrightStr));
568 aboutText += QString("<b>%1</b><br><br>").arg(NOBR(versionStr));
569 aboutText += QString("%1<br>").arg(NOBR(tr("Please visit %1 for news and updates!").arg(LINK(lamexp_website_url()))));
571 #if QT_VERSION < QT_VERSION_CHECK(5,0,0)
572 const QDate currentDate = MUtils::OS::current_date();
573 if(MUTILS_DEBUG)
575 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0);
576 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))));
578 else if(lamexp_version_demo())
580 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0);
581 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))));
583 #else
584 const QDate currentDate = lamexp_current_date_safe();
585 if(LAMEXP_DEBUG)
587 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0i64);
588 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))));
590 else if(lamexp_version_demo())
592 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0i64);
593 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))));
595 #endif
597 aboutText += "<hr><br>";
599 aboutText += "<nobr><tt>This program is free software; you can redistribute it and/or modify<br>";
600 aboutText += "it under the terms of the GNU General Public License as published by<br>";
601 aboutText += "the Free Software Foundation; either version 2 of the License, or<br>";
602 aboutText += "(at your option) any later version, but always including the *additional*<br>";
603 aboutText += "restrictions defined in the \"License.txt\" file (see \"License\" tab).<br><br>";
604 aboutText += "This program is distributed in the hope that it will be useful,<br>";
605 aboutText += "but WITHOUT ANY WARRANTY; without even the implied warranty of<br>";
606 aboutText += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>";
607 aboutText += "GNU General Public License for more details.<br><br>";
608 aboutText += "You should have received a copy of the GNU General Public License<br>";
609 aboutText += "along with this program; if not, write to the Free Software<br>";
610 aboutText += "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110&minus;1301, USA.</tt></nobr><br>";
611 aboutText += "<hr><table style=\"margin-top:4px\"><tr>";
612 aboutText += "<td valign=\"middle\"><img src=\":/icons/error_big.png\"</td><td>&nbsp;</td>";
613 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 !!!"));
614 aboutText += "</tr></table>";
616 ui->infoLabel->setText(aboutText);
617 ui->infoIcon->setPixmap(lamexp_app_icon().pixmap(QSize(72,72)));
618 connect(ui->infoLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
621 void AboutDialog::initContributorsTab(void)
623 const QString spaces("&nbsp;&nbsp;&nbsp;&nbsp;");
624 const QString extraVSpace("<font style=\"font-size:7px\"><br>&nbsp;</font>");
626 QString contributorsAboutText;
627 contributorsAboutText += QString("<h3>%1</h3>").arg(NOBR(tr("The following people have contributed to LameXP:")));
628 contributorsAboutText += "<table style=\"margin-top:12px;white-space:nowrap\">";
630 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Programmers:"), extraVSpace);
631 QString icon = QString("<img src=\":/icons/%1.png\">").arg("user_gray");
632 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(icon, spaces);
633 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td>").arg(tr("Project Leader"), spaces);
634 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");
635 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>&nbsp;</b></td></tr>");
637 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Translators:"), extraVSpace);
638 for(int i = 0; g_lamexp_translators[i].pcName; i++)
640 QString flagIcon = (strlen(g_lamexp_translators[i].pcFlag) > 0) ? QString("<img src=\":/flags/%1.png\">").arg(g_lamexp_translators[i].pcFlag) : QString();
641 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(flagIcon, spaces);
642 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td>").arg(MUTILS_QSTR(g_lamexp_translators[i].pcLanguage), spaces);
643 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);
646 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>&nbsp;</b></td></tr>");
647 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Special thanks to:"), extraVSpace);
649 QString webIcon = QString("<img src=\":/icons/%1.png\">").arg("world");
650 for(int i = 0; g_lamexp_specialThanks[i].pcName; i++)
652 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(webIcon, spaces);
653 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));
656 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>&nbsp;</b></td></tr>");
657 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Official Mirrors:"), extraVSpace);
659 QString serverIcon = QString("<img src=\":/icons/%1.png\">").arg("server_database");
660 for(int i = 0; g_lamexp_mirrors[i].pcName; i++)
662 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(serverIcon, spaces);
663 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));
666 contributorsAboutText += "</table><br><br><br>";
667 contributorsAboutText += QString("<i>%1</i><br>").arg(NOBR(tr("If you are willing to contribute a LameXP translation, feel free to contact us!")));
669 ui->contributorsLabel->setText(contributorsAboutText);
670 ui->contributorsIcon->setPixmap(QIcon(":/images/Logo_Contributors.png").pixmap(QSize(72,84)));
671 connect(ui->contributorsLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
674 void AboutDialog::initSoftwareTab(void)
676 QString moreAboutText;
678 moreAboutText += QString("<h3>%1</h3>").arg(tr("The following third-party software is used in LameXP:"));
679 moreAboutText += "<div style=\"margin-left:-25px;white-space:nowrap\"><table><tr><td><ul>"; //;font-size:7pt
681 moreAboutText += makeToolText
683 tr("LAME - OpenSource mp3 Encoder"),
684 "lame.exe", "v?.???, #-?",
685 tr("Released under the terms of the GNU Lesser General Public License."),
686 "http://lame.sourceforge.net/"
688 moreAboutText += makeToolText
690 tr("OggEnc - Vorbis Encoder"),
691 "oggenc2.exe", "v?.??, libvorbis v?.?? + aoTuV b?.??_#",
692 tr("Completely open and patent-free audio encoding technology."),
693 "http://www.rarewares.org/ogg-oggenc.php"
695 moreAboutText += makeToolText
697 tr("Nero AAC Reference MPEG-4 Encoder"),
698 "neroAacEnc.exe", "v?.?.?.?",
699 tr("Freeware state-of-the-art HE-AAC encoder with 2-Pass support."),
700 neroAacUrl,
701 tr("Available from vendor web-site as free download:")
703 moreAboutText += makeToolText
705 tr("Aften - A/52 audio encoder"),
706 "aften.exe", "v?.?.?",
707 tr("Released under the terms of the GNU Lesser General Public License."),
708 "http://aften.sourceforge.net/"
710 moreAboutText += makeToolText
712 tr("FLAC - Free Lossless Audio Codec"),
713 "flac.exe", "v?.?.?",
714 tr("Open and patent-free lossless audio compression technology."),
715 "http://flac.sourceforge.net/"
717 moreAboutText += makeToolText
719 tr("Opus Audio Codec"),
720 "opusenc.exe", "#, ????-??-??",
721 tr("Totally open, royalty-free, highly versatile audio codec."),
722 "http://www.opus-codec.org/"
724 moreAboutText += makeToolText
726 tr("mpg123 - Fast Console MPEG Audio Player/Decoder"),
727 "mpg123.exe", "v?.??.?",
728 tr("Released under the terms of the GNU Lesser General Public License."),
729 "http://www.mpg123.de/"
731 moreAboutText += makeToolText
733 tr("FAAD - OpenSource MPEG-4 and MPEG-2 AAC Decoder"),
734 "faad.exe", "v?.?",
735 tr("Released under the terms of the GNU General Public License."),
736 "http://www.audiocoding.com/"
738 moreAboutText += makeToolText
740 tr("OggDec - Vorbis Decoder"),
741 "oggdec.exe", "v?.??.?",
742 tr("Command line Ogg Vorbis decoder created by John33."),
743 "http://www.rarewares.org/ogg-oggdec.php"
745 moreAboutText += makeToolText
747 tr("Valdec from AC3Filter Tools - AC3/DTS Decoder"),
748 "valdec.exe", "v?.??#",
749 tr("Released under the terms of the GNU Lesser General Public License."),
750 "http://www.ac3filter.net/projects/tools"
752 moreAboutText += makeToolText
754 tr("WavPack - Hybrid Lossless Compression"),
755 "wvunpack.exe", "v?.??.?",
756 tr("Completely open audio compression format."),
757 "http://www.wavpack.com/"
759 moreAboutText += makeToolText
761 tr("Musepack - Living Audio Compression"),
762 "mpcdec.exe", "r???",
763 tr("Released under the terms of the GNU Lesser General Public License."),
764 "http://www.musepack.net/"
766 moreAboutText += makeToolText
768 tr("Monkey's Audio - Lossless Audio Compressor"),
769 "mac.exe", "v?.??",
770 tr("Freely available source code, simple SDK and non-restrictive licensing."),
771 "http://www.monkeysaudio.com/"
773 moreAboutText += makeToolText
775 tr("Shorten - Lossless Audio Compressor"),
776 "shorten.exe", "v?.?.?",
777 tr("Released under the terms of the GNU Lesser General Public License."),
778 "http://etree.org/shnutils/shorten/"
780 moreAboutText += makeToolText
782 tr("Speex - Free Codec For Free Speech"),
783 "speexdec.exe", "v?.?",
784 tr("Open Source patent-free audio format designed for speech."),
785 "http://www.speex.org/"
787 moreAboutText += makeToolText
789 tr("The True Audio - Lossless Audio Codec"),
790 "tta.exe", "v?.?",
791 tr("Released under the terms of the GNU Lesser General Public License."),
792 "http://tta.sourceforge.net/"
794 moreAboutText += makeToolText
796 tr("refalac - Win32 command line ALAC encoder/decoder"),
797 "refalac.exe", "v?.??",
798 tr("The ALAC reference implementation by Apple is available under the Apache license."),
799 "http://alac.macosforge.org/"
801 moreAboutText += makeToolText
803 tr("wma2wav - Dump WMA files to Wave Audio"),
804 "wma2wav.exe", "????-??-??",
805 tr("Copyright (c) 2011 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved."),
806 "http://forum.doom9.org/showthread.php?t=140273"
808 moreAboutText += makeToolText
810 tr("avs2wav - Avisynth to Wave Audio converter"),
811 "avs2wav.exe", "v?.?",
812 tr("By Jory Stone <jcsston@toughguy.net> and LoRd_MuldeR <mulder2@gmx.de>."),
813 "http://forum.doom9.org/showthread.php?t=70882"
815 moreAboutText += makeToolText
817 tr("dcaenc"),
818 "dcaenc.exe", "????-??-??",
819 tr("Copyright (c) 2008-2011 Alexander E. Patrakov. Distributed under the LGPL."),
820 "https://gitlab.com/patrakov/dcaenc"
822 moreAboutText += makeToolText
824 tr("MediaInfo - Media File Analysis Tool"),
825 "mediainfo.exe", "v?.?.??",
826 tr("Released under the terms of the GNU Lesser General Public License."),
827 "http://mediainfo.sourceforge.net/"
829 moreAboutText += makeToolText
831 tr("SoX - Sound eXchange"),
832 "sox.exe", "v??.?.?",
833 tr("Released under the terms of the GNU Lesser General Public License."),
834 "http://sox.sourceforge.net/"
836 moreAboutText += makeToolText
838 tr("GnuPG - The GNU Privacy Guard"),
839 "gpgv.exe", "v?.?.??",
840 tr("Released under the terms of the GNU Lesser General Public License."),
841 "http://www.gnupg.org/"
843 moreAboutText += makeToolText
845 tr("GNU Wget - Software for retrieving files using HTTP"),
846 "wget.exe", "v?.??.?",
847 tr("Released under the terms of the GNU Lesser General Public License."),
848 "http://www.gnu.org/software/wget/"
850 moreAboutText += makeToolText
852 tr("Netcat for NT - TCP/IP Swiss Army Knife"),
853 "nc.exe", "v?.??",
854 tr("Released under the terms of the GNU Lesser General Public License."),
855 "https://eternallybored.org/misc/netcat/"
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></td><td>&nbsp;</td></tr></table></div><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(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)));
929 QString AboutDialog::makeToolText(const QString &toolName, const QString &toolBin, const QString &toolVerFmt, const QString &toolLicense, const QString &toolWebsite, const QString &extraInfo)
931 QString toolText, toolTag, verStr(toolVerFmt);
933 if(!toolBin.isEmpty())
935 const unsigned int version = lamexp_tools_version(toolBin, &toolTag);
936 verStr = lamexp_version2string(toolVerFmt, version, tr("n/a"), toolTag);
939 toolText += QString("<li>%1<br>").arg(NOBR(QString("<b>%1 (%2)</b>").arg(toolName, verStr)));
940 toolText += QString("%1<br>").arg(NOBR(toolLicense));
941 if(!extraInfo.isEmpty()) toolText += QString("<i>%1</i><br>").arg(NOBR(extraInfo));
942 toolText += QString("<nobr>%1</nobr>").arg(LINK(toolWebsite));
943 toolText += QString("<font style=\"font-size:9px\"><br>&nbsp;</font>");
945 return toolText;