1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2011 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"
26 #include "Model_Settings.h"
30 #include <QApplication>
32 #include <QPushButton>
33 #include <QDesktopServices>
43 #define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(URL)
46 const char *AboutDialog::neroAacUrl = "http://www.nero.com/eng/technologies-aac-codec.html";
56 g_lamexp_contributors[] =
58 {"en", L"Englisch", L"LoRd_MuldeR", "MuldeR2@GMX.de" },
59 {"de", L"Deutsch", L"LoRd_MuldeR", "MuldeR2@GMX.de" },
60 {"", L"", L"Bodo Thevissen", "Bodo@thevissen.de" },
61 {"es", L"Español", L"Rub3nCT", "Rub3nCT@gmail.com" },
62 {"fr", L"Française", L"Dodich Informatique", "Dodich@live.fr" },
63 {"it", L"Italiano", L"Roberto", "Gulliver_69@libero.it"},
64 {"kr", L"한국말", L"JaeHyung Lee", "Kolanp@gmail.com" },
65 {"ru", L"Русский", L"Neonailol", "Neonailol@gmail.com" },
66 {"uk", L"Українська", L"Arestarh", "Arestarh@ukr.net" },
67 {NULL, NULL, NULL, NULL}
70 ////////////////////////////////////////////////////////////
72 ////////////////////////////////////////////////////////////
74 AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstStart)
79 const QString versionStr = QString().sprintf
81 "Version %d.%02d %s, Build %d [%s], %s, Qt v%s",
82 lamexp_version_major(),
83 lamexp_version_minor(),
84 lamexp_version_release(),
85 lamexp_version_build(),
86 lamexp_version_date().toString(Qt::ISODate).toLatin1().constData(),
87 lamexp_version_compiler(),
93 aboutText += QString("<h2>%1</h2>").arg(tr("LameXP − Audio Encoder Front-end"));
94 aboutText += QString("<b>Copyright (C) 2004-%1 LoRd_MuldeR <MuldeR2@GMX.de>. Some rights reserved.</b><br>").arg(max(lamexp_version_date().year(), QDate::currentDate().year()));
95 aboutText += QString("<b>%1</b><br><br>").arg(versionStr);
96 aboutText += QString("<nobr>%1</nobr><br>").arg(tr("Please visit %1 for news and updates!").arg(LINK(lamexp_website_url())));
98 if(lamexp_version_demo())
100 aboutText += QString("<hr><nobr><font color=\"crimson\">%1</font></nobr>").arg(tr("Note: This demo (pre-release) version of LameXP will expire at %1. Still %2 days left.").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(QDate::currentDate().daysTo(lamexp_version_expires()))));
103 aboutText += "<hr><br>";
104 aboutText += "<nobr><tt>This program is free software; you can redistribute it and/or<br>";
105 aboutText += "modify it under the terms of the GNU General Public License<br>";
106 aboutText += "as published by the Free Software Foundation; either version 2<br>";
107 aboutText += "of the License, or (at your option) any later version.<br><br>";
108 aboutText += "This program is distributed in the hope that it will be useful,<br>";
109 aboutText += "but WITHOUT ANY WARRANTY; without even the implied warranty of<br>";
110 aboutText += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>";
111 aboutText += "GNU General Public License for more details.<br><br>";
112 aboutText += "You should have received a copy of the GNU General Public License<br>";
113 aboutText += "along with this program; if not, write to the Free Software<br>";
114 aboutText += "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</tt></nobr><br>";
115 aboutText += "<hr><table><tr>";
116 aboutText += "<td valign=\"middle\"><img src=\":/icons/error_big.png\"</td><td> </td>";
117 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 !!!"));
118 aboutText += "</tr></table><hr><br>";
119 aboutText += QString("%1<br>").arg(tr("Special thanks go out to \"John33\" from %1 for his continuous support.").arg(LINK("http://www.rarewares.org/")));
122 setIconPixmap(dynamic_cast<QApplication*>(QApplication::instance())->windowIcon().pixmap(QSize(64,64)));
123 setWindowTitle(tr("About LameXP"));
127 QPushButton *firstButton = addButton(tr("Show License Text"), QMessageBox::AcceptRole);
128 firstButton->setIcon(QIcon(":/icons/script.png"));
129 firstButton->setIconSize(QSize(16, 16));
130 firstButton->setMinimumWidth(135);
131 firstButton->disconnect();
132 connect(firstButton, SIGNAL(clicked()), this, SLOT(openLicenseText()));
134 QPushButton *secondButton = addButton(tr("Accept License"), QMessageBox::AcceptRole);
135 secondButton->setIcon(QIcon(":/icons/accept.png"));
136 secondButton->setIconSize(QSize(16, 16));
137 secondButton->setMinimumWidth(120);
139 QPushButton *thirdButton = addButton(tr("Decline License"), QMessageBox::AcceptRole);
140 thirdButton->setIcon(QIcon(":/icons/delete.png"));
141 thirdButton->setIconSize(QSize(16, 16));
142 thirdButton->setMinimumWidth(120);
143 thirdButton->setEnabled(false);
147 QPushButton *firstButton = addButton(tr("3rd Party S/W"), QMessageBox::AcceptRole);
148 firstButton->setIcon(QIcon(":/icons/page_white_cplusplus.png"));
149 firstButton->setIconSize(QSize(16, 16));
150 firstButton->setMinimumWidth(120);
151 firstButton->disconnect();
152 connect(firstButton, SIGNAL(clicked()), this, SLOT(showMoreAbout()));
154 QPushButton *secondButton = addButton(tr("Contributors"), QMessageBox::AcceptRole);
155 secondButton->setIcon(QIcon(":icons/user_suit.png"));
156 secondButton->setIconSize(QSize(16, 16));
157 secondButton->setMinimumWidth(120);
158 secondButton->disconnect();
159 connect(secondButton, SIGNAL(clicked()), this, SLOT(showAboutContributors()));
161 QPushButton *thirdButton = addButton(tr("About Qt4"), QMessageBox::AcceptRole);
162 thirdButton->setIcon(QIcon(":/images/Qt.svg"));
163 thirdButton->setIconSize(QSize(16, 16));
164 thirdButton->setMinimumWidth(120);
165 thirdButton->disconnect();
166 connect(thirdButton, SIGNAL(clicked()), this, SLOT(showAboutQt()));
168 QPushButton *fourthButton = addButton(tr("Discard"), QMessageBox::AcceptRole);
169 fourthButton->setIcon(QIcon(":/icons/cross.png"));
170 fourthButton->setIconSize(QSize(16, 16));
171 fourthButton->setMinimumWidth(90);
174 m_firstShow = firstStart;
177 AboutDialog::~AboutDialog(void)
181 ////////////////////////////////////////////////////////////
183 ////////////////////////////////////////////////////////////
185 int AboutDialog::exec()
187 if(m_settings->soundsEnabled())
191 if(!playResoureSound("imageres.dll", 5080, true))
193 PlaySound(TEXT("SystemStart"), NULL, SND_ALIAS | SND_ASYNC);
198 PlaySound(MAKEINTRESOURCE(IDR_WAVE_ABOUT), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC);
202 switch(QMessageBox::exec())
216 ////////////////////////////////////////////////////////////
218 ////////////////////////////////////////////////////////////
220 void AboutDialog::enableButtons(void)
222 const QList<QAbstractButton*> buttonList = buttons();
224 for(int i = 0; i < buttonList.count(); i++)
226 buttonList.at(i)->setEnabled(true);
229 setCursor(QCursor(Qt::ArrowCursor));
232 void AboutDialog::openLicenseText(void)
234 QDesktopServices::openUrl(QUrl("http://www.gnu.org/licenses/gpl-2.0.txt"));
237 void AboutDialog::showAboutQt(void)
239 QMessageBox::aboutQt(this);
242 void AboutDialog::showAboutContributors(void)
244 QString contributorsAboutText;
246 contributorsAboutText += QString("<h3><nobr>%1</nobr></h3>").arg(tr("The following people have contributed to LameXP:"));
247 contributorsAboutText += QString("<b>%1</b>").arg(tr("Translators:"));
248 contributorsAboutText += "<table style=\"margin-top:5px\">";
249 for(int i = 0; g_lamexp_contributors[i].pcName; i++)
251 QString flagIcon = (strlen(g_lamexp_contributors[i].pcFlag) > 0) ? QString("<img src=\":/flags/%1.png\">").arg(g_lamexp_contributors[i].pcFlag) : QString();
252 contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td> </td>").arg(flagIcon);
253 contributorsAboutText += QString("<td valign=\"middle\">%2</td><td> </td>").arg(WCHAR2QSTR(g_lamexp_contributors[i].pcLanguage));
254 contributorsAboutText += QString("<td valign=\"middle\">%3</td><td> </td><td><%4></td></tr>").arg(WCHAR2QSTR(g_lamexp_contributors[i].pcName), g_lamexp_contributors[i].pcMail);
256 contributorsAboutText += "</table>";
257 contributorsAboutText += "<br><br>";
258 contributorsAboutText += QString("<nobr><i>%1</i></nobr><br>").arg(tr("If you are willing to contribute a LameXP translation, feel free to contact us!"));
260 QMessageBox *contributorsAboutBox = new QMessageBox(this);
261 contributorsAboutBox->setText(contributorsAboutText);
262 contributorsAboutBox->setIconPixmap(dynamic_cast<QApplication*>(QApplication::instance())->windowIcon().pixmap(QSize(64,64)));
264 QPushButton *closeButton = contributorsAboutBox->addButton(tr("Discard"), QMessageBox::AcceptRole);
265 closeButton->setIcon(QIcon(":/icons/cross.png"));
266 closeButton->setMinimumWidth(90);
268 contributorsAboutBox->setWindowTitle(tr("About Contributors"));
269 contributorsAboutBox->setIconPixmap(QIcon(":/images/Logo_Contributors.png").pixmap(QSize(64,74)));
270 contributorsAboutBox->setWindowIcon(QIcon(":/icons/user_suit.png"));
271 contributorsAboutBox->exec();
273 LAMEXP_DELETE(contributorsAboutBox);
276 void AboutDialog::showMoreAbout(void)
278 QString moreAboutText;
280 moreAboutText += QString("<h3>%1</h3>").arg(tr("The following third-party software is used in LameXP:"));
281 moreAboutText += "<div style=\"margin-left:-25px;font-size:8pt;white-space:nowrap\"><table><tr><td><ul>";
283 moreAboutText += makeToolText
285 tr("LAME − OpenSource mp3 Encoder"),
286 "lame.exe", "v?.??, Alpha-??",
287 tr("Released under the terms of the GNU Lesser General Public License."),
288 "http://lame.sourceforge.net/"
290 moreAboutText += makeToolText
292 tr("OggEnc − Ogg Vorbis Encoder"),
293 "oggenc2_i386.exe", "v?.??, aoTuV Beta-?.??",
294 tr("Completely open and patent-free audio encoding technology."),
295 "http://www.vorbis.com/"
297 moreAboutText += makeToolText
299 tr("Nero AAC Reference MPEG-4 Encoder"),
300 "neroAacEnc.exe", "v?.?.?.?",
301 tr("Freeware state-of-the-art HE-AAC encoder with 2-Pass support."),
303 tr("Available from vendor web-site as free download:")
305 moreAboutText += makeToolText
307 tr("FLAC − Free Lossless Audio Codec"),
308 "flac.exe", "v?.?.?",
309 tr("Open and patent-free lossless audio compression technology."),
310 "http://flac.sourceforge.net/"
312 moreAboutText += makeToolText
314 tr("mpg123 − Fast Console MPEG Audio Player/Decoder"),
315 "mpg123.exe", "v?.??.?",
316 tr("Released under the terms of the GNU Lesser General Public License."),
317 "http://www.mpg123.de/"
319 moreAboutText += makeToolText
321 tr("FAAD − OpenSource MPEG-4 and MPEG-2 AAC Decoder"),
323 tr("Released under the terms of the GNU General Public License."),
324 "http://www.audiocoding.com/"
326 moreAboutText += makeToolText
328 tr("AC3Filter Tools − AC3/DTS Decoder"),
329 "valdec.exe", "v?.??",
330 tr("Released under the terms of the GNU Lesser General Public License."),
331 "http://www.ac3filter.net/projects/tools"
333 moreAboutText += makeToolText
335 tr("WavPack − Hybrid Lossless Compression"),
336 "wvunpack.exe", "v?.??.?",
337 tr("Completely open audio compression format."),
338 "http://www.wavpack.com/"
340 moreAboutText += makeToolText
342 tr("Musepack − Living Audio Compression"),
343 "mpcdec.exe", "r???",
344 tr("Released under the terms of the GNU Lesser General Public License."),
345 "http://www.musepack.net/"
347 moreAboutText += QString
351 moreAboutText += makeToolText
353 tr("Monkey's Audio − Lossless Audio Compressor"),
355 tr("Freely available source code, simple SDK and non-restrictive licensing."),
356 "http://www.monkeysaudio.com/"
358 moreAboutText += makeToolText
360 tr("Shorten − Lossless Audio Compressor"),
361 "shorten.exe", "v?.?.?",
362 tr("Released under the terms of the GNU Lesser General Public License."),
363 "http://etree.org/shnutils/shorten/"
365 moreAboutText += makeToolText
367 tr("Speex − Free Codec For Free Speech"),
368 "speexdec.exe", "v?.?",
369 tr("Open Source patent-free audio format designed for speech."),
370 "http://www.speex.org/"
372 moreAboutText += makeToolText
374 tr("The True Audio − Lossless Audio Codec"),
376 tr("Released under the terms of the GNU Lesser General Public License."),
377 "http://tta.sourceforge.net/"
379 moreAboutText += makeToolText
381 tr("MediaInfo − Media File Analysis Tool"),
382 "mediainfo_i386.exe", "v?.?.??",
383 tr("Released under the terms of the GNU Lesser General Public License."),
384 "http://mediainfo.sourceforge.net/"
386 moreAboutText += makeToolText
388 tr("SoX − Sound eXchange"),
389 "sox.exe", "v??.?.?",
390 tr("Released under the terms of the GNU Lesser General Public License."),
391 "http://sox.sourceforge.net/"
393 moreAboutText += makeToolText
395 tr("GnuPG − The GNU Privacy Guard"),
396 "gpgv.exe", "v?.?.??",
397 tr("Released under the terms of the GNU Lesser General Public License."),
398 "http://www.gnupg.org/"
402 moreAboutText += makeToolText
404 tr("GNU Wget − Software for retrieving files using HTTP"),
405 "wget.exe", "v?.??.?",
406 tr("Released under the terms of the GNU Lesser General Public License."),
407 "http://www.gnu.org/software/wget/"
411 moreAboutText += makeToolText
413 tr("Silk Icons − Over 700 icons in PNG format"),
415 tr("By Mark James, released under the Creative Commons 'by' License."),
416 "http://www.famfamfam.com/lab/icons/silk/"
418 moreAboutText += QString("</ul></td><td> </td></tr></table></div><i>%1</i><br>").arg
420 tr("LameXP as a whole is copyrighted by LoRd_MuldeR. The copyright of thrird-party software used in LameXP belongs to the individual authors.")
423 QMessageBox *moreAboutBox = new QMessageBox(this);
424 moreAboutBox->setText(moreAboutText);
425 moreAboutBox->setIconPixmap(dynamic_cast<QApplication*>(QApplication::instance())->windowIcon().pixmap(QSize(64,64)));
427 QPushButton *closeButton = moreAboutBox->addButton(tr("Discard"), QMessageBox::AcceptRole);
428 closeButton->setIcon(QIcon(":/icons/cross.png"));
429 closeButton->setMinimumWidth(90);
431 moreAboutBox->setWindowTitle(tr("About Third-party Software"));
432 moreAboutBox->setIconPixmap(QIcon(":/images/Logo_Software.png").pixmap(QSize(64,71)));
433 moreAboutBox->setWindowIcon(QIcon(":/icons/page_white_cplusplus.png"));
434 moreAboutBox->exec();
436 LAMEXP_DELETE(moreAboutBox);
439 ////////////////////////////////////////////////////////////
440 // Protected Functions
441 ////////////////////////////////////////////////////////////
443 void AboutDialog::showEvent(QShowEvent *e)
445 QDialog::showEvent(e);
448 const QList<QAbstractButton*> buttonList = buttons();
450 for(int i = 1; i < buttonList.count(); i++)
452 buttonList.at(i)->setEnabled(false);
455 QTimer::singleShot(5000, this, SLOT(enableButtons()));
456 setCursor(QCursor(Qt::WaitCursor));
460 ////////////////////////////////////////////////////////////
462 ////////////////////////////////////////////////////////////
464 QString AboutDialog::makeToolText(const QString &toolName, const QString &toolBin, const QString &toolVerFmt, const QString &toolLicense, const QString &toolWebsite, const QString &extraInfo)
466 QString toolText, verStr(toolVerFmt);
468 if(!toolBin.isEmpty())
470 verStr = lamexp_version2string(toolVerFmt, lamexp_tool_version(toolBin), tr("n/a"));
473 toolText += QString("<li><nobr><b>%1 (%2)</b></nobr><br>").arg(toolName, verStr);
474 toolText += QString("<nobr>%1</nobr><br>").arg(toolLicense);
475 if(!extraInfo.isEmpty()) toolText += QString("<nobr><i>%1</i></nobr><br>").arg(extraInfo);
476 toolText += QString("<a href=\"%1\">%1</a>").arg(toolWebsite);
477 toolText += QString("<div style=\"font-size:1pt\"><br></div>");
483 bool AboutDialog::playResoureSound(const QString &library, const unsigned long soundId, const bool async)
486 DWORD flags = SND_RESOURCE;
489 QFileInfo libraryFile(library);
490 if(!libraryFile.isAbsolute())
492 unsigned int buffSize = GetSystemDirectoryW(NULL, NULL) + 1;
493 wchar_t *buffer = (wchar_t*) _malloca(buffSize * sizeof(wchar_t));
494 unsigned int result = GetSystemDirectory(buffer, buffSize);
495 if(result > 0 && result < buffSize)
497 libraryFile.setFile(QString("%1/%2").arg(QDir::fromNativeSeparators(QString::fromUtf16(reinterpret_cast<const unsigned short*>(buffer))), library));
511 module = LoadLibraryW(reinterpret_cast<const wchar_t*>(QDir::toNativeSeparators(libraryFile.absoluteFilePath()).utf16()));
515 result = PlaySound((LPCTSTR) soundId, module, flags);