1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de>
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.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License along
16 // with this program; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 // http://www.gnu.org/licenses/gpl-2.0.txt
20 ///////////////////////////////////////////////////////////////////////////////
22 #include "Dialog_About.h"
24 #include "../tmp/UIC_AboutDialog.h"
28 #include "Model_Settings.h"
31 #include <QApplication>
33 #include <QPushButton>
34 #include <QDesktopServices>
39 #include <QDesktopWidget>
41 #include <QMessageBox>
42 #include <QTextStream>
44 #include <QCloseEvent>
45 #include <QWindowsVistaStyle>
46 #include <QWindowsXPStyle>
53 #define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(QString(URL).replace("-", "−"))
54 #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)
55 #define MAKE_TRANSPARENT(WIDGET) do { QPalette _p = (WIDGET)->palette(); _p.setColor(QPalette::Background, Qt::transparent); (WIDGET)->setPalette(_p); } while(0)
59 const char *AboutDialog::neroAacUrl = "http://www.nero.com/eng/technologies-aac-codec.html";
60 const char *AboutDialog::disqueUrl = "http://mulder.brhack.net/?player_url=38X-MXOB014"; //http://mulder.brhack.net/?player_url=yF6W-w0iAMM; http://www.youtube.com/watch_popup?v=yF6W-w0iAMM&vq=large
70 g_lamexp_translators[] =
72 {"en", L"Englisch", L"LoRd_MuldeR", "MuldeR2@GMX.de" },
73 {"de", L"Deutsch", L"LoRd_MuldeR", "MuldeR2@GMX.de" },
74 {"", L"", L"Bodo Thevissen", "Bodo@thevissen.de" },
75 {"es", L"Español", L"Rub3nCT", "Rub3nCT@gmail.com" },
76 {"fr", L"Française", L"Dodich Informatique", "Dodich@live.fr" },
77 {"it", L"Italiano", L"Roberto", "Gulliver_69@libero.it" },
78 {"kr", L"한국어", L"JaeHyung Lee", "Kolanp@gmail.com" },
79 {"pl", L"Polski", L"Sir Daniel K", "Sir.Daniel.K@gmail.com"},
80 {"ru", L"Русский", L"Neonailol", "Neonailol@gmail.com" },
81 {"", L"", L"Иван Митин", "bardak@inbox.ru" },
82 {"sv", L"Svenska", L"Åke Engelbrektson", "eson57@gmail.com" },
83 {"tw", L"繁体中文", L"456Vv", "123@456vv.com" },
84 {"uk", L"Українська", L"Arestarh", "Arestarh@ukr.net" },
85 {"zh", L"简体中文", L"456Vv", "123@456vv.com" },
86 {NULL, NULL, NULL, NULL}
89 ////////////////////////////////////////////////////////////
91 ////////////////////////////////////////////////////////////
93 AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstStart)
96 ui(new Ui::AboutDialog),
98 m_initFlags(new QMap<QWidget*,bool>),
102 m_disqueDelay(_I64_MAX),
105 //Init the dialog, from the .ui file
107 setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
108 resize(this->minimumSize());
113 if(HMENU hMenu = GetSystemMenu((HWND) winId(), FALSE))
115 EnableMenuItem(hMenu, SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);
120 for(int i = 0; i < 4; i++)
126 connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
129 const type_info &styleType = typeid(*qApp->style());
130 if((typeid(QWindowsVistaStyle) == styleType) || (typeid(QWindowsXPStyle) == styleType))
132 MAKE_TRANSPARENT(ui->infoScrollArea);
133 MAKE_TRANSPARENT(ui->contributorsScrollArea);
134 MAKE_TRANSPARENT(ui->softwareScrollArea);
135 MAKE_TRANSPARENT(ui->licenseScrollArea);
138 //Show about dialog for the first time?
143 ui->acceptButton->hide();
144 ui->declineButton->hide();
145 ui->aboutQtButton->show();
146 ui->closeButton->show();
148 QPixmap disque(":/images/Disque.png");
149 QRect screenGeometry = QApplication::desktop()->availableGeometry();
150 m_disque = new QLabel(this, Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
151 m_disque->installEventFilter(this);
152 m_disque->setStyleSheet("background:transparent;");
153 m_disque->setAttribute(Qt::WA_TranslucentBackground);
154 m_disque->setGeometry(static_cast<int>(lamexp_rand() % static_cast<unsigned int>(screenGeometry.width() - disque.width())), static_cast<int>(lamexp_rand() % static_cast<unsigned int>(screenGeometry.height() - disque.height())), disque.width(), disque.height());
155 m_disque->setPixmap(disque);
156 m_disque->setWindowOpacity(0.01);
158 m_disqueFlags[0] = (lamexp_rand() > (UINT_MAX/2));
159 m_disqueFlags[1] = (lamexp_rand() > (UINT_MAX/2));
160 m_disqueTimer = new QTimer;
161 connect(m_disqueTimer, SIGNAL(timeout()), this, SLOT(moveDisque()));
162 m_disqueTimer->setInterval(10);
163 m_disqueTimer->start();
165 connect(ui->aboutQtButton, SIGNAL(clicked()), this, SLOT(showAboutQt()));
169 ui->acceptButton->show();
170 ui->declineButton->show();
171 ui->aboutQtButton->hide();
172 ui->closeButton->hide();
175 //Activate "show license" button
176 ui->showLicenseButton->show();
177 connect(ui->showLicenseButton, SIGNAL(clicked()), this, SLOT(gotoLicenseTab()));
179 m_firstShow = firstStart;
182 AboutDialog::~AboutDialog(void)
187 LAMEXP_DELETE(m_disque);
191 m_disqueTimer->stop();
192 LAMEXP_DELETE(m_disqueTimer);
194 for(int i = 0; i < 4; i++)
196 LAMEXP_DELETE(m_cartoon[i]);
198 LAMEXP_DELETE(m_initFlags);
202 ////////////////////////////////////////////////////////////
204 ////////////////////////////////////////////////////////////
206 int AboutDialog::exec()
208 if(m_settings->soundsEnabled())
212 if(!playResoureSound("imageres.dll", 5080, true))
214 PlaySound(TEXT("SystemStart"), NULL, SND_ALIAS | SND_ASYNC);
219 PlaySound(MAKEINTRESOURCE(IDR_WAVE_ABOUT), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC);
223 switch(QDialog::exec())
237 ////////////////////////////////////////////////////////////
239 ////////////////////////////////////////////////////////////
241 #define TEMP_HIDE_DISQUE(CMD) \
242 if(m_disque) { bool _tmp = m_disque->isVisible(); if(_tmp) m_disque->hide(); {CMD}; if(_tmp) { m_disque->show(); m_disque->setWindowOpacity(0.01); } } else {CMD}
244 void AboutDialog::tabChanged(int index)
246 bool bInitialized = m_initFlags->value(ui->tabWidget->widget(index), false);
250 qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
252 if(QWidget *tab = ui->tabWidget->widget(index))
256 if(tab == ui->infoTab) { initInformationTab(); ok = true; }
257 if(tab == ui->contributorsTab) { initContributorsTab(); ok = true; }
258 if(tab == ui->softwareTab) { initSoftwareTab(); ok = true; }
259 if(tab == ui->licenseTab) { initLicenseTab(); ok = true; }
263 m_initFlags->insert(tab, true);
267 qWarning("Unknown tab %p encountered, cannot initialize !!!", tab);
272 ui->tabWidget->widget(index)->update();
273 qApp->processEvents();
274 qApp->restoreOverrideCursor();
278 if(QWidget *tab = ui->tabWidget->widget(index))
280 if(tab == ui->infoTab) ui->infoScrollArea->verticalScrollBar()->setSliderPosition(0);
281 if(tab == ui->contributorsTab) ui->contributorsScrollArea->verticalScrollBar()->setSliderPosition(0);
282 if(tab == ui->softwareTab) ui->softwareScrollArea->verticalScrollBar()->setSliderPosition(0);
283 if(tab == ui->licenseTab) ui->licenseScrollArea->verticalScrollBar()->setSliderPosition(0);
286 //Update license button
287 ui->showLicenseButton->setChecked(ui->tabWidget->widget(index) == ui->licenseTab);
288 if(ui->tabWidget->widget(index) != ui->licenseTab) m_lastTab = index;
291 void AboutDialog::enableButtons(void)
293 ui->acceptButton->setEnabled(true);
294 ui->declineButton->setEnabled(true);
295 setCursor(QCursor(Qt::ArrowCursor));
298 void AboutDialog::openURL(const QString &url)
300 if(!QDesktopServices::openUrl(QUrl(url)))
302 ShellExecuteW(this->winId(), L"open", QWCHAR(url), NULL, NULL, SW_SHOW);
306 void AboutDialog::showAboutQt(void)
310 QMessageBox::aboutQt(this);
314 void AboutDialog::gotoLicenseTab(void)
316 ui->tabWidget->setCurrentIndex(ui->tabWidget->indexOf(ui->showLicenseButton->isChecked() ? ui->licenseTab : ui->tabWidget->widget(m_lastTab)));
319 void AboutDialog::moveDisque(void)
322 LARGE_INTEGER perfCount, perfFrequ;
324 if(QueryPerformanceFrequency(&perfFrequ) && QueryPerformanceCounter(&perfCount))
326 if(m_disqueDelay != _I64_MAX)
328 const double delay = static_cast<double>(perfCount.QuadPart) - static_cast<double>(m_disqueDelay);
329 delta = qMax(1, qMin(128, static_cast<int>(ceil(delay / static_cast<double>(perfFrequ.QuadPart) / 0.00512))));
331 m_disqueDelay = perfCount.QuadPart;
336 QRect screenGeometry = QApplication::desktop()->availableGeometry();
337 const int minX = screenGeometry.left();
338 const int maxX = screenGeometry.width() - m_disque->width() + screenGeometry.left();
339 const int minY = screenGeometry.top();
340 const int maxY = screenGeometry.height() - m_disque->height() + screenGeometry.top();
342 QPoint pos = m_disque->pos();
343 pos.setX(m_disqueFlags[0] ? pos.x() + delta : pos.x() - delta);
344 pos.setY(m_disqueFlags[1] ? pos.y() + delta : pos.y() - delta);
348 m_disqueFlags[0] = true;
352 else if(pos.x() >= maxX)
354 m_disqueFlags[0] = false;
360 m_disqueFlags[1] = true;
364 else if(pos.y() >= maxY)
366 m_disqueFlags[1] = false;
375 QPixmap *cartoon = NULL;
376 if(m_disqueFlags[0] == true && m_disqueFlags[1] != true) cartoon = m_cartoon[0];
377 if(m_disqueFlags[0] == true && m_disqueFlags[1] == true) cartoon = m_cartoon[1];
378 if(m_disqueFlags[0] != true && m_disqueFlags[1] == true) cartoon = m_cartoon[2];
379 if(m_disqueFlags[0] != true && m_disqueFlags[1] != true) cartoon = m_cartoon[3];
382 m_disque->setPixmap(*cartoon);
383 m_disque->resize(cartoon->size());
385 m_rotateNext = false;
388 if(m_disque->windowOpacity() < 0.9)
390 m_disque->setWindowOpacity(m_disque->windowOpacity() + 0.01);
395 void AboutDialog::adjustSize(void)
397 int maximumHeight = QApplication::desktop()->availableGeometry().height();
399 int delta = ui->infoScrollArea->widget()->height() - ui->infoScrollArea->viewport()->height();
402 this->resize(this->width(), qMin(this->height() + delta, maximumHeight));
403 this->move(this->x(), this->y() - (delta/2));
404 this->setMinimumHeight(qMax(this->minimumHeight(), this->height()));
408 ////////////////////////////////////////////////////////////
409 // Protected Functions
410 ////////////////////////////////////////////////////////////
412 void AboutDialog::showEvent(QShowEvent *e)
414 QDialog::showEvent(e);
416 ui->tabWidget->setCurrentIndex(ui->tabWidget->indexOf(ui->infoTab));
417 tabChanged(m_lastTab = ui->tabWidget->currentIndex());
421 ui->acceptButton->setEnabled(false);
422 ui->declineButton->setEnabled(false);
423 QTimer::singleShot(5000, this, SLOT(enableButtons()));
424 setCursor(QCursor(Qt::WaitCursor));
427 QTimer::singleShot(0, this, SLOT(adjustSize()));
430 void AboutDialog::closeEvent(QCloseEvent *e)
432 if(m_firstShow) e->ignore();
435 bool AboutDialog::eventFilter(QObject *obj, QEvent *event)
437 if((obj == m_disque) && (event->type() == QEvent::MouseButtonPress))
439 QPixmap cartoon(":/images/Cartoon.png");
440 for(int i = 0; i < 4; i++)
444 m_cartoon[i] = new QPixmap(cartoon.transformed(QMatrix().rotate(static_cast<double>(i*90) + 45.0), Qt::SmoothTransformation));
448 QDesktopServices::openUrl(QUrl(disqueUrl));
454 ////////////////////////////////////////////////////////////
456 ////////////////////////////////////////////////////////////
458 void AboutDialog::initInformationTab(void)
460 const QString versionStr = QString().sprintf
462 "Version %d.%02d %s, Build %d [%s], %s %s, Qt v%s",
463 lamexp_version_major(),
464 lamexp_version_minor(),
465 lamexp_version_release(),
466 lamexp_version_build(),
467 lamexp_version_date().toString(Qt::ISODate).toLatin1().constData(),
468 lamexp_version_compiler(),
469 lamexp_version_arch(),
473 const QString copyrightStr = QString().sprintf
475 "Copyright (C) 2004-%04d LoRd_MuldeR <MuldeR2@GMX.de>. Some rights reserved.",
476 qMax(lamexp_version_date().year(), lamexp_current_date_safe().year())
481 aboutText += QString("<h2>%1</h2>").arg(NOBR(tr("LameXP - Audio Encoder Front-end")));
482 aboutText += QString("<b>%1</b><br>").arg(NOBR(copyrightStr));
483 aboutText += QString("<b>%1</b><br><br>").arg(NOBR(versionStr));
484 aboutText += QString("%1<br>").arg(NOBR(tr("Please visit %1 for news and updates!").arg(LINK(lamexp_website_url()))));
486 #if QT_VERSION < QT_VERSION_CHECK(5,0,0)
487 const QDate currentDate = lamexp_current_date_safe();
490 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0);
491 aboutText += QString("<hr><font color=\"crimson\">%1</font>").arg(NOBR(QString("!!! --- DEBUG BUILD --- Expires at: %1 · Days left: %2 --- DEBUG BUILD --- !!!").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(daysLeft))));
493 else if(lamexp_version_demo())
495 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0);
496 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))));
499 const QDate currentDate = lamexp_current_date_safe();
502 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0i64);
503 aboutText += QString("<hr><font color=\"crimson\">%1</font>").arg(NOBR(QString("!!! --- DEBUG BUILD --- Expires at: %1 · Days left: %2 --- DEBUG BUILD --- !!!").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(daysLeft))));
505 else if(lamexp_version_demo())
507 int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0i64);
508 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))));
512 aboutText += "<hr><br>";
513 aboutText += "<nobr><tt>This program is free software; you can redistribute it and/or<br>";
514 aboutText += "modify it under the terms of the GNU General Public License<br>";
515 aboutText += "as published by the Free Software Foundation; either version 2<br>";
516 aboutText += "of the License, or (at your option) any later version.<br><br>";
517 aboutText += "This program is distributed in the hope that it will be useful,<br>";
518 aboutText += "but WITHOUT ANY WARRANTY; without even the implied warranty of<br>";
519 aboutText += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>";
520 aboutText += "GNU General Public License for more details.<br><br>";
521 aboutText += "You should have received a copy of the GNU General Public License<br>";
522 aboutText += "along with this program; if not, write to the Free Software<br>";
523 aboutText += "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110−1301, USA.</tt></nobr><br>";
524 aboutText += "<hr><table style=\"margin-top:4px\"><tr>";
525 aboutText += "<td valign=\"middle\"><img src=\":/icons/error_big.png\"</td><td> </td>";
526 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 !!!"));
527 aboutText += "</tr></table>";
528 //aboutText += QString("%1<br>").arg(NOBR(tr("Special thanks go out to \"John33\" from %1 for his continuous support.")).arg(LINK("http://www.rarewares.org/")));
530 ui->infoLabel->setText(aboutText);
531 ui->infoIcon->setPixmap(lamexp_app_icon().pixmap(QSize(72,72)));
532 connect(ui->infoLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
535 void AboutDialog::initContributorsTab(void)
537 const QString spaces(" ");
538 const QString extraVSpace("<font style=\"font-size:7px\"><br> </font>");
540 QString contributorsAboutText;
541 contributorsAboutText += QString("<h3>%1</h3>").arg(NOBR(tr("The following people have contributed to LameXP:")));
542 contributorsAboutText += "<table style=\"margin-top:12px;white-space:nowrap\">";
544 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Programmers:"), extraVSpace);
545 QString icon = QString("<img src=\":/icons/%1.png\">").arg("user_gray");
546 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(icon, spaces);
547 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td>").arg(tr("Project Leader"), spaces);
548 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td><td><a href=\"mailto:%2\"><%3></a></td></tr>").arg("LoRd_MuldeR", spaces, "MuldeR2@GMX.de");
549 contributorsAboutText += QString("<tr><td colspan=\"7\"><b> </b></td></tr>");
551 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Translators:"), extraVSpace);
552 for(int i = 0; g_lamexp_translators[i].pcName; i++)
554 QString flagIcon = (strlen(g_lamexp_translators[i].pcFlag) > 0) ? QString("<img src=\":/flags/%1.png\">").arg(g_lamexp_translators[i].pcFlag) : QString();
555 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(flagIcon, spaces);
556 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td>").arg(WCHAR2QSTR(g_lamexp_translators[i].pcLanguage), spaces);
557 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td><td><a href=\"mailto:%2\"><%3></a></td></tr>").arg(WCHAR2QSTR(g_lamexp_translators[i].pcName), spaces, g_lamexp_translators[i].pcMail);
560 contributorsAboutText += QString("<tr><td colspan=\"7\"><b> </b></td></tr>");
561 contributorsAboutText += QString("<tr><td colspan=\"7\"><b>%1</b>%2</td></tr>").arg(tr("Special thanks to:"), extraVSpace);
563 QString webIcon = QString("<img src=\":/icons/%1.png\">").arg("world");
564 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(webIcon, spaces);
565 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td><td valign=\"middle\" colspan=\"3\"><a href=\"%3\">%3</td></tr>").arg(tr("Doom9's Forum"), spaces, "http://forum.doom9.org/");
566 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(webIcon, spaces);
567 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td><td valign=\"middle\" colspan=\"3\"><a href=\"%3\">%3</td></tr>").arg(tr("Gleitz | German Doom9"), spaces, "http://forum.gleitz.info/");
568 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(webIcon, spaces);
569 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td><td valign=\"middle\" colspan=\"3\"><a href=\"%3\">%3</td></tr>").arg(tr("Hydrogenaudio Forums"), spaces, "http://www.hydrogenaudio.org/");
570 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(webIcon, spaces);
571 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td><td valign=\"middle\" colspan=\"3\"><a href=\"%3\">%3</td></tr>").arg(tr("RareWares"), spaces, "http://www.rarewares.org/");
572 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(webIcon, spaces);
573 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td><td valign=\"middle\" colspan=\"3\"><a href=\"%3\">%3</td></tr>").arg(tr("GitHub"), spaces, "http://github.com/");
574 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(webIcon, spaces);
575 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td><td valign=\"middle\" colspan=\"3\"><a href=\"%3\">%3</td></tr>").arg(tr("SourceForge"), spaces, "http://sourceforge.net/");
576 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(webIcon, spaces);
577 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td><td valign=\"middle\" colspan=\"3\"><a href=\"%3\">%3</td></tr>").arg(tr("Qt Developer Network"), spaces, "http://qt-project.org/");
578 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(webIcon, spaces);
579 contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td><td valign=\"middle\" colspan=\"3\"><a href=\"%3\">%3</td></tr>").arg(tr("Marius Hudea"), spaces, "http://savedonthe.net/");
581 contributorsAboutText += "</table><br><br><br>";
582 contributorsAboutText += QString("<i>%1</i><br>").arg(NOBR(tr("If you are willing to contribute a LameXP translation, feel free to contact us!")));
584 ui->contributorsLabel->setText(contributorsAboutText);
585 ui->contributorsIcon->setPixmap(QIcon(":/images/Logo_Contributors.png").pixmap(QSize(72,84)));
586 connect(ui->contributorsLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
589 void AboutDialog::initSoftwareTab(void)
591 QString moreAboutText;
593 moreAboutText += QString("<h3>%1</h3>").arg(tr("The following third-party software is used in LameXP:"));
594 moreAboutText += "<div style=\"margin-left:-25px;white-space:nowrap\"><table><tr><td><ul>"; //;font-size:7pt
596 moreAboutText += makeToolText
598 tr("LAME - OpenSource mp3 Encoder"),
599 "lame.exe", "v?.??, #-?",
600 tr("Released under the terms of the GNU Lesser General Public License."),
601 "http://lame.sourceforge.net/"
603 moreAboutText += makeToolText
605 tr("OggEnc - Ogg Vorbis Encoder"),
606 "oggenc2.exe", "v?.??, aoTuV #-?.??",
607 tr("Completely open and patent-free audio encoding technology."),
608 "http://www.vorbis.com/"
610 moreAboutText += makeToolText
612 tr("Nero AAC Reference MPEG-4 Encoder"),
613 "neroAacEnc.exe", "v?.?.?.?",
614 tr("Freeware state-of-the-art HE-AAC encoder with 2-Pass support."),
616 tr("Available from vendor web-site as free download:")
618 moreAboutText += makeToolText
620 tr("Aften - A/52 audio encoder"),
621 "aften.exe", "v?.?.?",
622 tr("Released under the terms of the GNU Lesser General Public License."),
623 "http://aften.sourceforge.net/"
625 moreAboutText += makeToolText
627 tr("FLAC - Free Lossless Audio Codec"),
628 "flac.exe", "v?.?.?",
629 tr("Open and patent-free lossless audio compression technology."),
630 "http://flac.sourceforge.net/"
632 moreAboutText += makeToolText
634 tr("Opus Audio Codec"),
635 "opusenc.exe", "????-??-??",
636 tr("Totally open, royalty-free, highly versatile audio codec."),
637 "http://www.opus-codec.org/"
639 moreAboutText += makeToolText
641 tr("mpg123 - Fast Console MPEG Audio Player/Decoder"),
642 "mpg123.exe", "v?.??.?",
643 tr("Released under the terms of the GNU Lesser General Public License."),
644 "http://www.mpg123.de/"
646 moreAboutText += makeToolText
648 tr("FAAD - OpenSource MPEG-4 and MPEG-2 AAC Decoder"),
650 tr("Released under the terms of the GNU General Public License."),
651 "http://www.audiocoding.com/"
653 moreAboutText += makeToolText
655 tr("Valdec from AC3Filter Tools - AC3/DTS Decoder"),
656 "valdec.exe", "v?.?.?#",
657 tr("Released under the terms of the GNU Lesser General Public License."),
658 "http://www.ac3filter.net/projects/tools"
660 moreAboutText += makeToolText
662 tr("WavPack - Hybrid Lossless Compression"),
663 "wvunpack.exe", "v?.??.?",
664 tr("Completely open audio compression format."),
665 "http://www.wavpack.com/"
667 moreAboutText += makeToolText
669 tr("Musepack - Living Audio Compression"),
670 "mpcdec.exe", "r???",
671 tr("Released under the terms of the GNU Lesser General Public License."),
672 "http://www.musepack.net/"
674 moreAboutText += makeToolText
676 tr("Monkey's Audio - Lossless Audio Compressor"),
678 tr("Freely available source code, simple SDK and non-restrictive licensing."),
679 "http://www.monkeysaudio.com/"
681 moreAboutText += makeToolText
683 tr("Shorten - Lossless Audio Compressor"),
684 "shorten.exe", "v?.?.?",
685 tr("Released under the terms of the GNU Lesser General Public License."),
686 "http://etree.org/shnutils/shorten/"
688 moreAboutText += makeToolText
690 tr("Speex - Free Codec For Free Speech"),
691 "speexdec.exe", "v?.?",
692 tr("Open Source patent-free audio format designed for speech."),
693 "http://www.speex.org/"
695 moreAboutText += makeToolText
697 tr("The True Audio - Lossless Audio Codec"),
699 tr("Released under the terms of the GNU Lesser General Public License."),
700 "http://tta.sourceforge.net/"
702 //moreAboutText += makeToolText
704 // tr("ALAC Decoder"),
705 // "alac.exe", "v?.?.?",
706 // tr("Copyright (c) 2004 David Hammerton. Contributions by Cody Brocious."),
707 // "http://craz.net/programs/itunes/alac.html"
709 moreAboutText += makeToolText
711 tr("refalac - Win32 command line ALAC encoder/decoder"),
712 "refalac.exe", "v?.??",
713 tr("The ALAC reference implementation by Apple is available under the Apache license."),
714 "http://alac.macosforge.org/"
716 moreAboutText += makeToolText
718 tr("wma2wav - Dump WMA files to Wave Audio"),
719 "wma2wav.exe", "????-??-??",
720 tr("Copyright (c) 2011 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved."),
721 "http://forum.doom9.org/showthread.php?t=140273"
723 moreAboutText += makeToolText
725 tr("avs2wav - Avisynth to Wave Audio converter"),
726 "avs2wav.exe", "v?.?",
727 tr("By Jory Stone <jcsston@toughguy.net> and LoRd_MuldeR <mulder2@gmx.de>."),
728 "http://forum.doom9.org/showthread.php?t=70882"
730 moreAboutText += makeToolText
733 "dcaenc.exe", "????-??-??",
734 tr("Copyright (c) 2008-2011 Alexander E. Patrakov. Distributed under the LGPL."),
735 "http://gitorious.org/dtsenc/dtsenc/trees/master"
737 moreAboutText += makeToolText
739 tr("MediaInfo - Media File Analysis Tool"),
740 "mediainfo.exe", "v?.?.??",
741 tr("Released under the terms of the GNU Lesser General Public License."),
742 "http://mediainfo.sourceforge.net/"
744 moreAboutText += makeToolText
746 tr("SoX - Sound eXchange"),
747 "sox.exe", "v??.?.?",
748 tr("Released under the terms of the GNU Lesser General Public License."),
749 "http://sox.sourceforge.net/"
751 moreAboutText += makeToolText
753 tr("GnuPG - The GNU Privacy Guard"),
754 "gpgv.exe", "v?.?.??",
755 tr("Released under the terms of the GNU Lesser General Public License."),
756 "http://www.gnupg.org/"
758 moreAboutText += makeToolText
760 tr("GNU Wget - Software for retrieving files using HTTP"),
761 "wget.exe", "v?.??.?",
762 tr("Released under the terms of the GNU Lesser General Public License."),
763 "http://www.gnu.org/software/wget/"
765 moreAboutText += makeToolText
767 tr("UPX - The Ultimate Packer for eXecutables"),
769 tr("Released under the terms of the GNU Lesser General Public License."),
770 "http://upx.sourceforge.net/"
772 moreAboutText += makeToolText
774 tr("Silk Icons - Over 700 icons in PNG format"),
776 tr("By Mark James, released under the Creative Commons 'by' License."),
777 "http://www.famfamfam.com/lab/icons/silk/"
779 moreAboutText += QString("</ul></td><td> </td></tr></table></div><br><i>%1</i><br>").arg
781 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.")
784 ui->softwareLabel->setText(moreAboutText);
785 ui->softwareIcon->setPixmap(QIcon(":/images/Logo_Software.png").pixmap(QSize(72,65)));
786 connect(ui->softwareLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
789 void AboutDialog::initLicenseTab(void)
792 licenseText += ("<tt>");
794 QFile file(":/License.txt");
795 if(file.open(QIODevice::ReadOnly))
797 QTextStream stream(&file);
798 unsigned int counter = 0;
799 while((!stream.atEnd()) && (stream.status() == QTextStream::Ok))
801 QString line = stream.readLine();
802 const bool bIsBlank = line.trimmed().isEmpty();
803 line.replace('<', "<").replace('>', ">");
808 if(!bIsBlank) licenseText += QString("<font size=\"+2\">%1</font><br>").arg(line.simplified());
811 if(!bIsBlank) licenseText += QString("<font size=\"+1\">%1 − %2</font><br>").arg(line.simplified(), LINK("http://www.gnu.org/licenses/gpl-2.0.html"));
815 licenseText += QString("<nobr>%1</nobr><br>").arg(line.replace(' ', " "));
819 if(!bIsBlank) counter++;
821 licenseText += QString("<br>");
822 stream.device()->close();
826 licenseText += QString("<font color=\"darkred\">Oups, failed to load license text. Please refer to:</font><br>");
827 licenseText += LINK("http://www.gnu.org/licenses/gpl-2.0.html");
830 licenseText += ("</tt>");
832 ui->licenseLabel->setText(licenseText);
833 ui->licenseIcon->setPixmap(QIcon(":/images/Logo_GNU.png").pixmap(QSize(72,65)));
834 connect(ui->licenseLabel, SIGNAL(linkActivated(QString)), this, SLOT(openURL(QString)));
838 QString AboutDialog::makeToolText(const QString &toolName, const QString &toolBin, const QString &toolVerFmt, const QString &toolLicense, const QString &toolWebsite, const QString &extraInfo)
840 QString toolText, toolTag, verStr(toolVerFmt);
842 if(!toolBin.isEmpty())
844 const unsigned int version = lamexp_tool_version(toolBin, &toolTag);
845 verStr = lamexp_version2string(toolVerFmt, version, tr("n/a"), &toolTag);
848 toolText += QString("<li>%1<br>").arg(NOBR(QString("<b>%1 (%2)</b>").arg(toolName, verStr)));
849 toolText += QString("%1<br>").arg(NOBR(toolLicense));
850 if(!extraInfo.isEmpty()) toolText += QString("<i>%1</i><br>").arg(NOBR(extraInfo));
851 toolText += QString("<nobr>%1</nobr>").arg(LINK(toolWebsite));
852 toolText += QString("<font style=\"font-size:9px\"><br> </font>");
858 bool AboutDialog::playResoureSound(const QString &library, const unsigned long soundId, const bool async)
861 DWORD flags = SND_RESOURCE;
864 QFileInfo libraryFile(library);
865 if(!libraryFile.isAbsolute())
867 unsigned int buffSize = GetSystemDirectoryW(NULL, NULL) + 1;
868 wchar_t *buffer = (wchar_t*) _malloca(buffSize * sizeof(wchar_t));
869 unsigned int result = GetSystemDirectory(buffer, buffSize);
870 if(result > 0 && result < buffSize)
872 libraryFile.setFile(QString("%1/%2").arg(QDir::fromNativeSeparators(QString::fromUtf16(reinterpret_cast<const unsigned short*>(buffer))), library));
886 module = LoadLibraryW(reinterpret_cast<const wchar_t*>(QDir::toNativeSeparators(libraryFile.absoluteFilePath()).utf16()));
890 result = PlaySound((LPCTSTR) soundId, module, flags);