Updated MediaInfo binaries to v0.7.70 (2014-09-03), compiled with ICL 15.0 and MSVC...
[LameXP.git] / src / Dialog_About.cpp
blob8aac46fbcb2651ab2ab90fd665ecef26b3332572
1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2014 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 "../tmp/UIC_AboutDialog.h"
27 #include "Global.h"
28 #include "Model_Settings.h"
30 #include <math.h>
32 #include <QDate>
33 #include <QApplication>
34 #include <QIcon>
35 #include <QPushButton>
36 #include <QDesktopServices>
37 #include <QUrl>
38 #include <QTimer>
39 #include <QFileInfo>
40 #include <QDir>
41 #include <QDesktopWidget>
42 #include <QLabel>
43 #include <QMessageBox>
44 #include <QTextStream>
45 #include <QScrollBar>
46 #include <QCloseEvent>
47 #include <QWindowsVistaStyle>
48 #include <QWindowsXPStyle>
50 //Helper macros
51 #define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(QString(URL).replace("-", "&minus;"))
52 #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)
53 #define MAKE_TRANSPARENT(WIDGET) do { QPalette _p = (WIDGET)->palette(); _p.setColor(QPalette::Background, Qt::transparent); (WIDGET)->setPalette(_p); } while(0)
55 //Constants
56 const char *AboutDialog::neroAacUrl = "http://www.videohelp.com/tools/Nero-AAC-Codec"; //"http://www.nero.com/eng/company/about-nero/nero-aac-codec.php";
57 const char *AboutDialog::disqueUrl = "http://muldersoft.com/?player_url=38X-MXOB014";
59 //Contributors
60 static const struct
62 char *pcFlag;
63 wchar_t *pcLanguage;
64 wchar_t *pcName;
65 char *pcMail;
67 g_lamexp_translators[] =
69 {"en", L"Englisch", L"LoRd_MuldeR", "MuldeR2@GMX.de" },
70 {"de", L"Deutsch", L"LoRd_MuldeR", "MuldeR2@GMX.de" },
71 {"", L"", L"Bodo Thevissen", "Bodo@thevissen.de" },
72 {"es", L"Español", L"Rub3nCT", "Rub3nCT@gmail.com" },
73 {"fr", L"Française", L"Dodich Informatique", "Dodich@live.fr" },
74 {"it", L"Italiano", L"Roberto", "Gulliver_69@libero.it" },
75 {"kr", L"한국어", L"JaeHyung Lee", "Kolanp@gmail.com" },
76 {"pl", L"Polski", L"Sir Daniel K", "Sir.Daniel.K@gmail.com"},
77 {"ru", L"Русский", L"Neonailol", "Neonailol@gmail.com" },
78 {"", L"", L"Иван Митин", "bardak@inbox.ru" },
79 {"sv", L"Svenska", L"Åke Engelbrektson", "eson57@gmail.com" },
80 {"tw", L"繁体中文", L"456Vv", "123@456vv.com" },
81 {"uk", L"Українська", L"Arestarh", "Arestarh@ukr.net" },
82 {"zh", L"简体中文", L"456Vv", "123@456vv.com" },
83 {"", L"", L"庄泓川", "kidneybean@sohu.com" },
84 {NULL, NULL, NULL, NULL}
87 //Special Thanks
88 static const struct
90 char* pcName;
91 char *pcAddress;
93 g_lamexp_specialThanks[] =
95 { "Doom9's Forum", "http://forum.doom9.org/" },
96 { "Gleitz | German Doom9", "http://forum.gleitz.info/" },
97 { "Hydrogenaudio Forums", "http://www.hydrogenaudio.org/" },
98 { "RareWares", "http://www.rarewares.org/" },
99 { "GitHub", "http://github.com/" },
100 { "SourceForge", "http://sourceforge.net/" },
101 { "Qt Developer Network", "http://qt-project.org/" },
102 { "BerliOS Developer", "http://developer.berlios.de/" },
103 { "CodePlex", "http://www.codeplex.com/" },
104 { "Marius Hudea", "http://savedonthe.net/" },
105 { "Codecs.com", "http://www.codecs.com/" },
106 { NULL, NULL }
109 //Mirrors
110 static const struct
112 char* pcName;
113 char *pcAddress;
115 g_lamexp_mirrors[] =
117 { "GitHub.com", "https://github.com/lordmulder/LameXP" },
118 { "SourceForge.net", "http://sourceforge.net/p/lamexp/code/" },
119 { "Bitbucket.org", "https://bitbucket.org/lord_mulder/lamexp" },
120 { "Gitorious.org", "https://gitorious.org/lamexp" },
121 { "Codeplex.com", "https://lamexp.codeplex.com/SourceControl/latest" },
122 { "Berlios.de", "http://git.berlios.de/cgi-bin/gitweb.cgi?p=lamexp" },
123 { "Assembla.com", "https://www.assembla.com/spaces/lamexp/" },
124 { NULL, NULL }
127 ////////////////////////////////////////////////////////////
128 // Constructor
129 ////////////////////////////////////////////////////////////
131 AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstStart)
133 QDialog(parent),
134 ui(new Ui::AboutDialog),
135 m_settings(settings),
136 m_initFlags(new QMap<QWidget*,bool>),
137 m_disque(NULL),
138 m_disqueTimer(NULL),
139 m_rotateNext(false),
140 m_disqueDelay(_I64_MAX),
141 m_lastTab(0)
143 //Init the dialog, from the .ui file
144 ui->setupUi(this);
145 setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
146 resize(this->minimumSize());
148 //Disable "X" button
149 if(firstStart)
151 lamexp_enable_close_button(this, false);
154 //Init images
155 for(int i = 0; i < 4; i++)
157 m_cartoon[i] = NULL;
160 //Init tab widget
161 connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
163 //Make transparent
164 const type_info &styleType = typeid(*qApp->style());
165 if((typeid(QWindowsVistaStyle) == styleType) || (typeid(QWindowsXPStyle) == styleType))
167 MAKE_TRANSPARENT(ui->infoScrollArea);
168 MAKE_TRANSPARENT(ui->contributorsScrollArea);
169 MAKE_TRANSPARENT(ui->softwareScrollArea);
170 MAKE_TRANSPARENT(ui->licenseScrollArea);
173 //Show about dialog for the first time?
174 if(!firstStart)
176 lamexp_seed_rand();
178 ui->acceptButton->hide();
179 ui->declineButton->hide();
180 ui->aboutQtButton->show();
181 ui->closeButton->show();
183 QPixmap disque(":/images/Disque.png");
184 m_disque = new QLabel(this, Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
185 m_disque->resize(disque.size());
186 m_disque->setStyleSheet("background:transparent;");
187 m_disque->setAttribute(Qt::WA_TranslucentBackground);
188 m_disque->setPixmap(disque);
189 m_disque->installEventFilter(this);
191 connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), this, SLOT(geometryUpdated()));
192 geometryUpdated();
194 m_discOpacity = 0.01;
195 m_disquePos.setX(static_cast<int>(lamexp_rand() % static_cast<unsigned int>(m_disqueBound.right() - disque.width() - m_disqueBound.left())) + m_disqueBound.left());
196 m_disquePos.setY(static_cast<int>(lamexp_rand() % static_cast<unsigned int>(m_disqueBound.bottom() - disque.height() - m_disqueBound.top())) + m_disqueBound.top());
197 m_disqueFlags[0] = (lamexp_rand() > (UINT_MAX/2));
198 m_disqueFlags[1] = (lamexp_rand() > (UINT_MAX/2));
199 m_disque->move(m_disquePos);
200 m_disque->setWindowOpacity(m_discOpacity);
201 m_disque->show();
203 m_disqueTimer = new QTimer;
204 connect(m_disqueTimer, SIGNAL(timeout()), this, SLOT(moveDisque()));
205 m_disqueTimer->start(10);
207 connect(ui->aboutQtButton, SIGNAL(clicked()), this, SLOT(showAboutQt()));
209 else
211 ui->acceptButton->show();
212 ui->declineButton->show();
213 ui->aboutQtButton->hide();
214 ui->closeButton->hide();
217 //Activate "show license" button
218 ui->showLicenseButton->show();
219 connect(ui->showLicenseButton, SIGNAL(clicked()), this, SLOT(gotoLicenseTab()));
221 m_firstShow = firstStart;
224 AboutDialog::~AboutDialog(void)
226 if(m_disque)
228 m_disque->close();
229 LAMEXP_DELETE(m_disque);
231 if(m_disqueTimer)
233 m_disqueTimer->stop();
234 LAMEXP_DELETE(m_disqueTimer);
236 for(int i = 0; i < 4; i++)
238 LAMEXP_DELETE(m_cartoon[i]);
240 LAMEXP_DELETE(m_initFlags);
241 LAMEXP_DELETE(ui);
244 ////////////////////////////////////////////////////////////
245 // Public Functions
246 ////////////////////////////////////////////////////////////
248 int AboutDialog::exec()
250 if(m_settings->soundsEnabled())
252 if(m_firstShow)
254 if(!lamexp_play_sound_file("imageres.dll", 5080, true))
256 lamexp_play_sound_alias("SystemStart", true);
259 else
261 lamexp_play_sound("uuaarrgh", true);
265 switch(QDialog::exec())
267 case 1:
268 return 1;
269 break;
270 case 2:
271 return -1;
272 break;
273 default:
274 return 0;
275 break;
279 ////////////////////////////////////////////////////////////
280 // Slots
281 ////////////////////////////////////////////////////////////
283 #define TEMP_HIDE_DISQUE(CMD) do \
285 bool _tmp = (m_disque) ? m_disque->isVisible() : false; \
286 if(_tmp) m_disque->hide(); \
287 { CMD } \
288 if(_tmp) \
290 m_discOpacity = 0.01; \
291 m_disque->setWindowOpacity(m_discOpacity); \
292 m_disque->show(); \
295 while(0)
297 void AboutDialog::tabChanged(int index, const bool silent)
299 bool bInitialized = m_initFlags->value(ui->tabWidget->widget(index), false);
301 if(!bInitialized)
303 qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
305 if(QWidget *tab = ui->tabWidget->widget(index))
307 bool ok = false;
309 if(tab == ui->infoTab) { initInformationTab(); ok = true; }
310 if(tab == ui->contributorsTab) { initContributorsTab(); ok = true; }
311 if(tab == ui->softwareTab) { initSoftwareTab(); ok = true; }
312 if(tab == ui->licenseTab) { initLicenseTab(); ok = true; }
314 if(ok)
316 m_initFlags->insert(tab, true);
318 else
320 qWarning("Unknown tab %p encountered, cannot initialize !!!", tab);
325 ui->tabWidget->widget(index)->update();
326 qApp->processEvents();
327 qApp->restoreOverrideCursor();
330 //Play tick sound
331 if(m_settings->soundsEnabled() && (!silent))
333 lamexp_play_sound("tick", true);
336 //Scroll to the top
337 if(QWidget *tab = ui->tabWidget->widget(index))
339 if(tab == ui->infoTab) ui->infoScrollArea->verticalScrollBar()->setSliderPosition(0);
340 if(tab == ui->contributorsTab) ui->contributorsScrollArea->verticalScrollBar()->setSliderPosition(0);
341 if(tab == ui->softwareTab) ui->softwareScrollArea->verticalScrollBar()->setSliderPosition(0);
342 if(tab == ui->licenseTab) ui->licenseScrollArea->verticalScrollBar()->setSliderPosition(0);
345 //Update license button
346 ui->showLicenseButton->setChecked(ui->tabWidget->widget(index) == ui->licenseTab);
347 if(ui->tabWidget->widget(index) != ui->licenseTab) m_lastTab = index;
350 void AboutDialog::enableButtons(void)
352 ui->acceptButton->setEnabled(true);
353 ui->declineButton->setEnabled(true);
354 setCursor(QCursor(Qt::ArrowCursor));
357 void AboutDialog::openURL(const QString &url)
359 if(!QDesktopServices::openUrl(QUrl(url)))
361 lamexp_exec_shell(this, url);
365 void AboutDialog::showAboutQt(void)
367 TEMP_HIDE_DISQUE
369 QMessageBox::aboutQt(this);
373 void AboutDialog::gotoLicenseTab(void)
375 ui->tabWidget->setCurrentIndex(ui->tabWidget->indexOf(ui->showLicenseButton->isChecked() ? ui->licenseTab : ui->tabWidget->widget(m_lastTab)));
378 void AboutDialog::moveDisque(void)
380 int delta = 2;
381 const __int64 perfFrequ = lamexp_perfcounter_frequ();
382 const __int64 perfCount = lamexp_perfcounter_value();
384 if((perfFrequ >= 0) && (perfCount >= 0))
386 if(m_disqueDelay != _I64_MAX)
388 const double delay = static_cast<double>(perfCount) - static_cast<double>(m_disqueDelay);
389 delta = qMax(1, qMin(128, static_cast<int>(ceil(delay / static_cast<double>(perfFrequ) / 0.00512))));
391 m_disqueDelay = perfCount;
394 if(m_disque)
396 if(m_disquePos.x() <= m_disqueBound.left()) { m_disqueFlags[0] = true; m_rotateNext = true; }
397 if(m_disquePos.x() >= m_disqueBound.right()) { m_disqueFlags[0] = false; m_rotateNext = true; }
398 if(m_disquePos.y() <= m_disqueBound.top()) { m_disqueFlags[1] = true; m_rotateNext = true; }
399 if(m_disquePos.y() >= m_disqueBound.bottom()) { m_disqueFlags[1] = false; m_rotateNext = true; }
401 m_disquePos.setX(m_disqueFlags[0] ? (m_disquePos.x() + delta) : (m_disquePos.x() - delta));
402 m_disquePos.setY(m_disqueFlags[1] ? (m_disquePos.y() + delta) : (m_disquePos.y() - delta));
404 m_disque->move(m_disquePos);
406 if(m_rotateNext)
408 QPixmap *cartoon = NULL;
409 if(m_disqueFlags[0] == true && m_disqueFlags[1] != true) cartoon = m_cartoon[0];
410 if(m_disqueFlags[0] == true && m_disqueFlags[1] == true) cartoon = m_cartoon[1];
411 if(m_disqueFlags[0] != true && m_disqueFlags[1] == true) cartoon = m_cartoon[2];
412 if(m_disqueFlags[0] != true && m_disqueFlags[1] != true) cartoon = m_cartoon[3];
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_firstShow)
490 ui->acceptButton->setEnabled(false);
491 ui->declineButton->setEnabled(false);
492 QTimer::singleShot(5000, this, SLOT(enableButtons()));
493 setCursor(QCursor(Qt::WaitCursor));
496 QTimer::singleShot(0, this, SLOT(adjustSize()));
499 void AboutDialog::closeEvent(QCloseEvent *e)
501 if(m_firstShow) e->ignore();
504 bool AboutDialog::eventFilter(QObject *obj, QEvent *event)
506 if((obj == m_disque) && (event->type() == QEvent::MouseButtonPress))
508 QPixmap cartoon(":/images/Cartoon.png");
509 for(int i = 0; i < 4; i++)
511 if(!m_cartoon[i])
513 m_cartoon[i] = new QPixmap(cartoon.transformed(QMatrix().rotate(static_cast<double>(i*90) + 45.0), Qt::SmoothTransformation));
514 m_rotateNext = true;
517 QDesktopServices::openUrl(QUrl(disqueUrl));
520 return false;
523 ////////////////////////////////////////////////////////////
524 // Private Functions
525 ////////////////////////////////////////////////////////////
527 void AboutDialog::initInformationTab(void)
529 const QString versionStr = QString().sprintf
531 "Version %d.%02d %s, Build %d [%s], %s %s, Qt v%s",
532 lamexp_version_major(),
533 lamexp_version_minor(),
534 lamexp_version_release(),
535 lamexp_version_build(),
536 lamexp_version_date().toString(Qt::ISODate).toLatin1().constData(),
537 lamexp_version_compiler(),
538 lamexp_version_arch(),
539 qVersion()
542 const QString copyrightStr = QString().sprintf
544 "Copyright (C) 2004-%04d LoRd_MuldeR &lt;MuldeR2@GMX.de&gt;. Some rights reserved.",
545 qMax(lamexp_version_date().year(), lamexp_current_date_safe().year())
548 QString aboutText;
550 aboutText += QString("<h2>%1</h2>").arg(NOBR(tr("LameXP - Audio Encoder Front-end")));
551 aboutText += QString("<b>%1</b><br>").arg(NOBR(copyrightStr));
552 aboutText += QString("<b>%1</b><br><br>").arg(NOBR(versionStr));
553 aboutText += QString("%1<br>").arg(NOBR(tr("Please visit %1 for news and updates!").arg(LINK(lamexp_website_url()))));
555 #if QT_VERSION < QT_VERSION_CHECK(5,0,0)
556 const QDate currentDate = lamexp_current_date_safe();
557 if(LAMEXP_DEBUG)
559 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0);
560 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))));
562 else if(lamexp_version_demo())
564 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0);
565 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))));
567 #else
568 const QDate currentDate = lamexp_current_date_safe();
569 if(LAMEXP_DEBUG)
571 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0i64);
572 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))));
574 else if(lamexp_version_demo())
576 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0i64);
577 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))));
579 #endif
581 aboutText += "<hr><br>";
583 aboutText += "<nobr><tt>This program is free software; you can redistribute it and/or modify<br>";
584 aboutText += "it under the terms of the GNU General Public License as published by<br>";
585 aboutText += "the Free Software Foundation; either version 2 of the License, or<br>";
586 aboutText += "(at your option) any later version, but always including the *additional*<br>";
587 aboutText += "restrictions defined in the \"License.txt\" file (see \"License\" tab).<br><br>";
588 aboutText += "This program is distributed in the hope that it will be useful,<br>";
589 aboutText += "but WITHOUT ANY WARRANTY; without even the implied warranty of<br>";
590 aboutText += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>";
591 aboutText += "GNU General Public License for more details.<br><br>";
592 aboutText += "You should have received a copy of the GNU General Public License<br>";
593 aboutText += "along with this program; if not, write to the Free Software<br>";
594 aboutText += "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110&minus;1301, USA.</tt></nobr><br>";
595 aboutText += "<hr><table style=\"margin-top:4px\"><tr>";
596 aboutText += "<td valign=\"middle\"><img src=\":/icons/error_big.png\"</td><td>&nbsp;</td>";
597 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 !!!"));
598 aboutText += "</tr></table>";
600 ui->infoLabel->setText(aboutText);
601 ui->infoIcon->setPixmap(lamexp_app_icon().pixmap(QSize(72,72)));
602 connect(ui->infoLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
605 void AboutDialog::initContributorsTab(void)
607 const QString spaces("&nbsp;&nbsp;&nbsp;&nbsp;");
608 const QString extraVSpace("<font style=\"font-size:7px\"><br>&nbsp;</font>");
610 QString contributorsAboutText;
611 contributorsAboutText += QString("<h3>%1</h3>").arg(NOBR(tr("The following people have contributed to LameXP:")));
612 contributorsAboutText += "<table style=\"margin-top:12px;white-space:nowrap\">";
614 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Programmers:"), extraVSpace);
615 QString icon = QString("<img src=\":/icons/%1.png\">").arg("user_gray");
616 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(icon, spaces);
617 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td>").arg(tr("Project Leader"), spaces);
618 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");
619 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>&nbsp;</b></td></tr>");
621 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Translators:"), extraVSpace);
622 for(int i = 0; g_lamexp_translators[i].pcName; i++)
624 QString flagIcon = (strlen(g_lamexp_translators[i].pcFlag) > 0) ? QString("<img src=\":/flags/%1.png\">").arg(g_lamexp_translators[i].pcFlag) : QString();
625 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(flagIcon, spaces);
626 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td>").arg(WCHAR2QSTR(g_lamexp_translators[i].pcLanguage), spaces);
627 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td><td><a href=\"mailto:%3\">&lt;%3&gt;</a></td></tr>").arg(WCHAR2QSTR(g_lamexp_translators[i].pcName), spaces, g_lamexp_translators[i].pcMail);
630 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>&nbsp;</b></td></tr>");
631 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Special thanks to:"), extraVSpace);
633 QString webIcon = QString("<img src=\":/icons/%1.png\">").arg("world");
634 for(int i = 0; g_lamexp_specialThanks[i].pcName; i++)
636 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(webIcon, spaces);
637 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));
640 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>&nbsp;</b></td></tr>");
641 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Official Mirrors:"), extraVSpace);
643 QString serverIcon = QString("<img src=\":/icons/%1.png\">").arg("server_database");
644 for(int i = 0; g_lamexp_mirrors[i].pcName; i++)
646 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(serverIcon, spaces);
647 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));
650 contributorsAboutText += "</table><br><br><br>";
651 contributorsAboutText += QString("<i>%1</i><br>").arg(NOBR(tr("If you are willing to contribute a LameXP translation, feel free to contact us!")));
653 ui->contributorsLabel->setText(contributorsAboutText);
654 ui->contributorsIcon->setPixmap(QIcon(":/images/Logo_Contributors.png").pixmap(QSize(72,84)));
655 connect(ui->contributorsLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
658 void AboutDialog::initSoftwareTab(void)
660 QString moreAboutText;
662 moreAboutText += QString("<h3>%1</h3>").arg(tr("The following third-party software is used in LameXP:"));
663 moreAboutText += "<div style=\"margin-left:-25px;white-space:nowrap\"><table><tr><td><ul>"; //;font-size:7pt
665 moreAboutText += makeToolText
667 tr("LAME - OpenSource mp3 Encoder"),
668 "lame.exe", "v?.??, #-?",
669 tr("Released under the terms of the GNU Lesser General Public License."),
670 "http://lame.sourceforge.net/"
672 moreAboutText += makeToolText
674 tr("OggEnc - Vorbis Encoder"),
675 "oggenc2.exe", "v?.??, libvorbis v?.?? + aoTuV b?.??_#",
676 tr("Completely open and patent-free audio encoding technology."),
677 "http://www.rarewares.org/ogg-oggenc.php"
679 moreAboutText += makeToolText
681 tr("Nero AAC Reference MPEG-4 Encoder"),
682 "neroAacEnc.exe", "v?.?.?.?",
683 tr("Freeware state-of-the-art HE-AAC encoder with 2-Pass support."),
684 neroAacUrl,
685 tr("Available from vendor web-site as free download:")
687 moreAboutText += makeToolText
689 tr("Aften - A/52 audio encoder"),
690 "aften.exe", "v?.?.?",
691 tr("Released under the terms of the GNU Lesser General Public License."),
692 "http://aften.sourceforge.net/"
694 moreAboutText += makeToolText
696 tr("FLAC - Free Lossless Audio Codec"),
697 "flac.exe", "v?.?.?",
698 tr("Open and patent-free lossless audio compression technology."),
699 "http://flac.sourceforge.net/"
701 moreAboutText += makeToolText
703 tr("Opus Audio Codec"),
704 "opusenc.exe", "#, ????-??-??",
705 tr("Totally open, royalty-free, highly versatile audio codec."),
706 "http://www.opus-codec.org/"
708 moreAboutText += makeToolText
710 tr("mpg123 - Fast Console MPEG Audio Player/Decoder"),
711 "mpg123.exe", "v?.??.?",
712 tr("Released under the terms of the GNU Lesser General Public License."),
713 "http://www.mpg123.de/"
715 moreAboutText += makeToolText
717 tr("FAAD - OpenSource MPEG-4 and MPEG-2 AAC Decoder"),
718 "faad.exe", "v?.?",
719 tr("Released under the terms of the GNU General Public License."),
720 "http://www.audiocoding.com/"
722 moreAboutText += makeToolText
724 tr("OggDec - Vorbis Decoder"),
725 "oggdec.exe", "v?.??.?",
726 tr("Command line Ogg Vorbis decoder created by John33."),
727 "http://www.rarewares.org/ogg-oggdec.php"
729 moreAboutText += makeToolText
731 tr("Valdec from AC3Filter Tools - AC3/DTS Decoder"),
732 "valdec.exe", "v?.??#",
733 tr("Released under the terms of the GNU Lesser General Public License."),
734 "http://www.ac3filter.net/projects/tools"
736 moreAboutText += makeToolText
738 tr("WavPack - Hybrid Lossless Compression"),
739 "wvunpack.exe", "v?.??.?",
740 tr("Completely open audio compression format."),
741 "http://www.wavpack.com/"
743 moreAboutText += makeToolText
745 tr("Musepack - Living Audio Compression"),
746 "mpcdec.exe", "r???",
747 tr("Released under the terms of the GNU Lesser General Public License."),
748 "http://www.musepack.net/"
750 moreAboutText += makeToolText
752 tr("Monkey's Audio - Lossless Audio Compressor"),
753 "mac.exe", "v?.??",
754 tr("Freely available source code, simple SDK and non-restrictive licensing."),
755 "http://www.monkeysaudio.com/"
757 moreAboutText += makeToolText
759 tr("Shorten - Lossless Audio Compressor"),
760 "shorten.exe", "v?.?.?",
761 tr("Released under the terms of the GNU Lesser General Public License."),
762 "http://etree.org/shnutils/shorten/"
764 moreAboutText += makeToolText
766 tr("Speex - Free Codec For Free Speech"),
767 "speexdec.exe", "v?.?",
768 tr("Open Source patent-free audio format designed for speech."),
769 "http://www.speex.org/"
771 moreAboutText += makeToolText
773 tr("The True Audio - Lossless Audio Codec"),
774 "tta.exe", "v?.?",
775 tr("Released under the terms of the GNU Lesser General Public License."),
776 "http://tta.sourceforge.net/"
778 moreAboutText += makeToolText
780 tr("refalac - Win32 command line ALAC encoder/decoder"),
781 "refalac.exe", "v?.??",
782 tr("The ALAC reference implementation by Apple is available under the Apache license."),
783 "http://alac.macosforge.org/"
785 moreAboutText += makeToolText
787 tr("wma2wav - Dump WMA files to Wave Audio"),
788 "wma2wav.exe", "????-??-??",
789 tr("Copyright (c) 2011 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved."),
790 "http://forum.doom9.org/showthread.php?t=140273"
792 moreAboutText += makeToolText
794 tr("avs2wav - Avisynth to Wave Audio converter"),
795 "avs2wav.exe", "v?.?",
796 tr("By Jory Stone <jcsston@toughguy.net> and LoRd_MuldeR <mulder2@gmx.de>."),
797 "http://forum.doom9.org/showthread.php?t=70882"
799 moreAboutText += makeToolText
801 tr("dcaenc"),
802 "dcaenc.exe", "????-??-??",
803 tr("Copyright (c) 2008-2011 Alexander E. Patrakov. Distributed under the LGPL."),
804 "http://gitorious.org/dtsenc/dtsenc/trees/master"
806 moreAboutText += makeToolText
808 tr("MediaInfo - Media File Analysis Tool"),
809 "mediainfo.exe", "v?.?.??",
810 tr("Released under the terms of the GNU Lesser General Public License."),
811 "http://mediainfo.sourceforge.net/"
813 moreAboutText += makeToolText
815 tr("SoX - Sound eXchange"),
816 "sox.exe", "v??.?.?",
817 tr("Released under the terms of the GNU Lesser General Public License."),
818 "http://sox.sourceforge.net/"
820 moreAboutText += makeToolText
822 tr("GnuPG - The GNU Privacy Guard"),
823 "gpgv.exe", "v?.?.??",
824 tr("Released under the terms of the GNU Lesser General Public License."),
825 "http://www.gnupg.org/"
827 moreAboutText += makeToolText
829 tr("GNU Wget - Software for retrieving files using HTTP"),
830 "wget.exe", "v?.??.?",
831 tr("Released under the terms of the GNU Lesser General Public License."),
832 "http://www.gnu.org/software/wget/"
834 moreAboutText += makeToolText
836 tr("UPX - The Ultimate Packer for eXecutables"),
837 QString(), "v3.09",
838 tr("Released under the terms of the GNU Lesser General Public License."),
839 "http://upx.sourceforge.net/"
841 moreAboutText += makeToolText
843 tr("Silk Icons - Over 700 icons in PNG format"),
844 QString(), "v1.3",
845 tr("By Mark James, released under the Creative Commons 'by' License."),
846 "http://www.famfamfam.com/lab/icons/silk/"
848 moreAboutText += QString("</ul></td><td>&nbsp;</td></tr></table></div><br><i>%1</i><br>").arg
850 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.")
853 ui->softwareLabel->setText(moreAboutText);
854 ui->softwareIcon->setPixmap(QIcon(":/images/Logo_Software.png").pixmap(QSize(72,65)));
855 connect(ui->softwareLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
858 void AboutDialog::initLicenseTab(void)
860 bool bFoundHeader = false;
861 QRegExp header("^(\\s*)(GNU GENERAL PUBLIC LICENSE)(\\s*)$");
863 QString licenseText;
864 licenseText += ("<tt>");
866 QFile file(":/License.txt");
867 if(file.open(QIODevice::ReadOnly))
869 QTextStream stream(&file);
870 while((!stream.atEnd()) && (stream.status() == QTextStream::Ok))
872 QString line = stream.readLine();
873 line.replace('<', "&lt;").replace('>', "&gt;");
874 if((!bFoundHeader) && (header.indexIn(line) >= 0))
876 line.replace(header, "\\1<b>\\2</b>\\3");
877 bFoundHeader = true;
879 TRIM_RIGHT(line);
880 licenseText += QString("<nobr>%1</nobr><br>").arg(line.replace(' ', "&nbsp;"));
882 licenseText += QString("<br>");
883 stream.device()->close();
885 else
887 licenseText += QString("<font color=\"darkred\">Oups, failed to load license text. Please refer to:</font><br>");
888 licenseText += LINK("http://www.gnu.org/licenses/gpl-2.0.html");
891 licenseText += ("</tt>");
893 ui->licenseLabel->setText(licenseText);
894 ui->licenseIcon->setPixmap(QIcon(":/images/Logo_GNU.png").pixmap(QSize(72,65)));
895 connect(ui->licenseLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
899 QString AboutDialog::makeToolText(const QString &toolName, const QString &toolBin, const QString &toolVerFmt, const QString &toolLicense, const QString &toolWebsite, const QString &extraInfo)
901 QString toolText, toolTag, verStr(toolVerFmt);
903 if(!toolBin.isEmpty())
905 const unsigned int version = lamexp_tool_version(toolBin, &toolTag);
906 verStr = lamexp_version2string(toolVerFmt, version, tr("n/a"), &toolTag);
909 toolText += QString("<li>%1<br>").arg(NOBR(QString("<b>%1 (%2)</b>").arg(toolName, verStr)));
910 toolText += QString("%1<br>").arg(NOBR(toolLicense));
911 if(!extraInfo.isEmpty()) toolText += QString("<i>%1</i><br>").arg(NOBR(extraInfo));
912 toolText += QString("<nobr>%1</nobr>").arg(LINK(toolWebsite));
913 toolText += QString("<font style=\"font-size:9px\"><br>&nbsp;</font>");
915 return toolText;