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 {"fr", L"Française", L"Dodich Informatique", "Dodich@live.fr" },
61 {"it", L"Italiano", L"Roberto", "Gulliver_69@libero.it"},
62 {"es", L"Español", L"Rub3nCT", "Rub3nCT@gmail.com" },
63 {"ru", L"Русский", L"Neonailol", "Neonailol@gmail.com" },
64 {"uk", L"Українська", L"Arestarh", "arestarh@ukr.net" },
65 {NULL, NULL, NULL, NULL}
68 ////////////////////////////////////////////////////////////
70 ////////////////////////////////////////////////////////////
72 AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstStart)
79 aboutText += QString("<h2>%1</h2>").arg(tr("LameXP − Audio Encoder Front-end"));
80 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()));
81 aboutText += QString().sprintf("<b>Version %d.%02d %s, Build %d [%s]</b><br><br>", lamexp_version_major(), lamexp_version_minor(), lamexp_version_release(), lamexp_version_build(), lamexp_version_date().toString(Qt::ISODate).toLatin1().constData());
82 aboutText += QString("<nobr>%1</nobr><br>").arg(tr("Please visit %1 for news and updates!").arg(LINK("http://forum.doom9.org/showthread.php?t=157726")));
83 aboutText += "<hr><br>";
84 aboutText += "<nobr><tt>This program is free software; you can redistribute it and/or<br>";
85 aboutText += "modify it under the terms of the GNU General Public License<br>";
86 aboutText += "as published by the Free Software Foundation; either version 2<br>";
87 aboutText += "of the License, or (at your option) any later version.<br><br>";
88 aboutText += "This program is distributed in the hope that it will be useful,<br>";
89 aboutText += "but WITHOUT ANY WARRANTY; without even the implied warranty of<br>";
90 aboutText += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>";
91 aboutText += "GNU General Public License for more details.<br><br>";
92 aboutText += "You should have received a copy of the GNU General Public License<br>";
93 aboutText += "along with this program; if not, write to the Free Software<br>";
94 aboutText += "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</tt></nobr><br>";
95 aboutText += "<hr><table><tr>";
96 aboutText += "<td valign=\"middle\"><img src=\":/icons/error_big.png\"</td><td> </td>";
97 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 !!!"));
98 aboutText += "</tr></table><hr><br>";
99 aboutText += QString("%1<br>").arg(tr("Special thanks go out to \"John33\" from %1 for his continuous support.").arg(LINK("http://www.rarewares.org/")));
102 setIconPixmap(dynamic_cast<QApplication*>(QApplication::instance())->windowIcon().pixmap(QSize(64,64)));
103 setWindowTitle(tr("About LameXP"));
107 QPushButton *firstButton = addButton(tr("Show License Text"), QMessageBox::AcceptRole);
108 firstButton->setIcon(QIcon(":/icons/script.png"));
109 firstButton->setIconSize(QSize(16, 16));
110 firstButton->setMinimumWidth(135);
111 firstButton->disconnect();
112 connect(firstButton, SIGNAL(clicked()), this, SLOT(openLicenseText()));
114 QPushButton *secondButton = addButton(tr("Accept License"), QMessageBox::AcceptRole);
115 secondButton->setIcon(QIcon(":/icons/accept.png"));
116 secondButton->setIconSize(QSize(16, 16));
117 secondButton->setMinimumWidth(120);
119 QPushButton *thirdButton = addButton(tr("Decline License"), QMessageBox::AcceptRole);
120 thirdButton->setIcon(QIcon(":/icons/delete.png"));
121 thirdButton->setIconSize(QSize(16, 16));
122 thirdButton->setMinimumWidth(120);
123 thirdButton->setEnabled(false);
127 QPushButton *firstButton = addButton(tr("3rd Party S/W"), QMessageBox::AcceptRole);
128 firstButton->setIcon(QIcon(":/icons/page_white_cplusplus.png"));
129 firstButton->setIconSize(QSize(16, 16));
130 firstButton->setMinimumWidth(120);
131 firstButton->disconnect();
132 connect(firstButton, SIGNAL(clicked()), this, SLOT(showMoreAbout()));
134 QPushButton *secondButton = addButton(tr("Contributors"), QMessageBox::AcceptRole);
135 secondButton->setIcon(QIcon(":icons/user_suit.png"));
136 secondButton->setIconSize(QSize(16, 16));
137 secondButton->setMinimumWidth(120);
138 secondButton->disconnect();
139 connect(secondButton, SIGNAL(clicked()), this, SLOT(showAboutContributors()));
141 QPushButton *thirdButton = addButton(tr("About Qt4"), QMessageBox::AcceptRole);
142 thirdButton->setIcon(QIcon(":/images/Qt.svg"));
143 thirdButton->setIconSize(QSize(16, 16));
144 thirdButton->setMinimumWidth(120);
145 thirdButton->disconnect();
146 connect(thirdButton, SIGNAL(clicked()), this, SLOT(showAboutQt()));
148 QPushButton *fourthButton = addButton(tr("Discard"), QMessageBox::AcceptRole);
149 fourthButton->setIcon(QIcon(":/icons/cross.png"));
150 fourthButton->setIconSize(QSize(16, 16));
151 fourthButton->setMinimumWidth(90);
154 m_firstShow = firstStart;
157 AboutDialog::~AboutDialog(void)
161 ////////////////////////////////////////////////////////////
163 ////////////////////////////////////////////////////////////
165 int AboutDialog::exec()
167 if(m_settings->soundsEnabled())
171 if(!playResoureSound("imageres.dll", 5080, true))
173 PlaySound(TEXT("SystemStart"), NULL, SND_ALIAS | SND_ASYNC);
178 PlaySound(MAKEINTRESOURCE(IDR_WAVE_ABOUT), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC);
182 switch(QMessageBox::exec())
196 ////////////////////////////////////////////////////////////
198 ////////////////////////////////////////////////////////////
200 void AboutDialog::enableButtons(void)
202 const QList<QAbstractButton*> buttonList = buttons();
204 for(int i = 0; i < buttonList.count(); i++)
206 buttonList.at(i)->setEnabled(true);
209 setCursor(QCursor(Qt::ArrowCursor));
212 void AboutDialog::openLicenseText(void)
214 QDesktopServices::openUrl(QUrl("http://www.gnu.org/licenses/gpl-2.0.txt"));
217 void AboutDialog::showAboutQt(void)
219 QMessageBox::aboutQt(this);
222 void AboutDialog::showAboutContributors(void)
224 QString contributorsAboutText;
226 contributorsAboutText += QString("<h3><nobr>%1</nobr></h3>").arg(tr("The following people have contributed to LameXP:"));
227 contributorsAboutText += QString("<b>%1</b>").arg(tr("Translators:"));
228 contributorsAboutText += "<table style=\"margin-top:5px\">";
229 for(int i = 0; g_lamexp_contributors[i].pcName; i++)
231 contributorsAboutText += QString("<tr><td valign=\"middle\"><img src=\":/flags/%1.png\"></td><td> </td>").arg(g_lamexp_contributors[i].pcFlag);
232 contributorsAboutText += QString("<td valign=\"middle\">%2</td><td> </td>").arg(WCHAR2QSTR(g_lamexp_contributors[i].pcLanguage));
233 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);
235 contributorsAboutText += "</table>";
236 contributorsAboutText += "<br><br>";
237 contributorsAboutText += QString("<nobr><i>%1</i></nobr><br>").arg(tr("If you are willing to contribute a LameXP translation, feel free to contact us!"));
239 QMessageBox *contributorsAboutBox = new QMessageBox(this);
240 contributorsAboutBox->setText(contributorsAboutText);
241 contributorsAboutBox->setIconPixmap(dynamic_cast<QApplication*>(QApplication::instance())->windowIcon().pixmap(QSize(64,64)));
243 QPushButton *closeButton = contributorsAboutBox->addButton(tr("Discard"), QMessageBox::AcceptRole);
244 closeButton->setIcon(QIcon(":/icons/cross.png"));
245 closeButton->setMinimumWidth(90);
247 contributorsAboutBox->setWindowTitle(tr("About Contributors"));
248 contributorsAboutBox->setIconPixmap(QIcon(":/images/Logo_Contributors.png").pixmap(QSize(64,74)));
249 contributorsAboutBox->setWindowIcon(QIcon(":/icons/user_suit.png"));
250 contributorsAboutBox->exec();
252 LAMEXP_DELETE(contributorsAboutBox);
255 void AboutDialog::showMoreAbout(void)
257 QString moreAboutText;
259 moreAboutText += QString("<h3>%1</h3>").arg(tr("The following third-party software is used in LameXP:"));
260 moreAboutText += "<div style=\"margin-left:-25px;font-size:8pt;white-space:nowrap\"><table><tr><td><ul>";
262 moreAboutText += makeToolText
264 tr("LAME − OpenSource mp3 Encoder"),
265 "lame.exe", "v?.??, Alpha-??",
266 tr("Released under the terms of the GNU Lesser General Public License."),
267 "http://lame.sourceforge.net/"
269 moreAboutText += makeToolText
271 tr("OggEnc − Ogg Vorbis Encoder"),
272 "oggenc2_i386.exe", "v?.??, aoTuV Beta-?.??",
273 tr("Completely open and patent-free audio encoding technology."),
274 "http://www.vorbis.com/"
276 moreAboutText += makeToolText
278 tr("Nero AAC Reference MPEG-4 Encoder"),
279 "neroAacEnc.exe", "v?.?.?.?",
280 tr("Freeware state-of-the-art HE-AAC encoder with 2-Pass support."),
282 tr("Available from vendor web-site as free download:")
284 moreAboutText += makeToolText
286 tr("FLAC − Free Lossless Audio Codec"),
287 "flac.exe", "v?.?.?",
288 tr("Open and patent-free lossless audio compression technology."),
289 "http://flac.sourceforge.net/"
291 moreAboutText += makeToolText
293 tr("mpg123 − Fast Console MPEG Audio Player/Decoder"),
294 "mpg123.exe", "v?.??.?",
295 tr("Released under the terms of the GNU Lesser General Public License."),
296 "http://www.mpg123.de/"
298 moreAboutText += makeToolText
300 tr("FAAD − OpenSource MPEG-4 and MPEG-2 AAC Decoder"),
302 tr("Released under the terms of the GNU General Public License."),
303 "http://www.audiocoding.com/"
305 moreAboutText += makeToolText
307 tr("AC3Filter Tools − AC3/DTS Decoder"),
308 "valdec.exe", "v?.??",
309 tr("Released under the terms of the GNU Lesser General Public License."),
310 "http://www.ac3filter.net/projects/tools"
312 moreAboutText += makeToolText
314 tr("WavPack − Hybrid Lossless Compression"),
315 "wvunpack.exe", "v?.??.?",
316 tr("Completely open audio compression format."),
317 "http://www.wavpack.com/"
319 moreAboutText += makeToolText
321 tr("Musepack − Living Audio Compression"),
322 "mpcdec.exe", "r???",
323 tr("Released under the terms of the GNU Lesser General Public License."),
324 "http://www.musepack.net/"
326 moreAboutText += QString
330 moreAboutText += makeToolText
332 tr("Monkey's Audio − Lossless Audio Compressor"),
334 tr("Freely available source code, simple SDK and non-restrictive licensing."),
335 "http://www.monkeysaudio.com/"
337 moreAboutText += makeToolText
339 tr("Shorten − Lossless Audio Compressor"),
340 "shorten.exe", "v?.?.?",
341 tr("Released under the terms of the GNU Lesser General Public License."),
342 "http://etree.org/shnutils/shorten/"
344 moreAboutText += makeToolText
346 tr("Speex − Free Codec For Free Speech"),
347 "speexdec.exe", "v?.?",
348 tr("Open Source patent-free audio format designed for speech."),
349 "http://www.speex.org/"
351 moreAboutText += makeToolText
353 tr("The True Audio − Lossless Audio Codec"),
354 "ttaenc.exe", "v?.?.?",
355 tr("Released under the terms of the GNU Lesser General Public License."),
356 "http://tta.sourceforge.net/"
358 moreAboutText += makeToolText
360 tr("MediaInfo − Media File Analysis Tool"),
361 "mediainfo_i386.exe", "v?.?.??",
362 tr("Released under the terms of the GNU Lesser General Public License."),
363 "http://mediainfo.sourceforge.net/"
365 moreAboutText += makeToolText
367 tr("SoX − Sound eXchange"),
368 "sox.exe", "v??.?.?",
369 tr("Released under the terms of the GNU Lesser General Public License."),
370 "http://sox.sourceforge.net/"
372 moreAboutText += makeToolText
374 tr("GnuPG − The GNU Privacy Guard"),
375 "gpgv.exe", "v?.?.??",
376 tr("Released under the terms of the GNU Lesser General Public License."),
377 "http://www.gnupg.org/"
381 moreAboutText += makeToolText
383 tr("GNU Wget − Software for retrieving files using HTTP"),
384 "wget.exe", "v?.??.?",
385 tr("Released under the terms of the GNU Lesser General Public License."),
386 "http://www.gnu.org/software/wget/"
390 moreAboutText += makeToolText
392 tr("Silk Icons − Over 700 icons in PNG format"),
394 tr("By Mark James, released under the Creative Commons 'by' License."),
395 "http://www.famfamfam.com/lab/icons/silk/"
397 moreAboutText += QString("</ul></td><td> </td></tr></table></div><i>%1</i><br>").arg
399 tr("LameXP as a whole is copyrighted by LoRd_MuldeR. The copyright of thrird-party software used in LameXP belongs to the individual authors.")
402 QMessageBox *moreAboutBox = new QMessageBox(this);
403 moreAboutBox->setText(moreAboutText);
404 moreAboutBox->setIconPixmap(dynamic_cast<QApplication*>(QApplication::instance())->windowIcon().pixmap(QSize(64,64)));
406 QPushButton *closeButton = moreAboutBox->addButton(tr("Discard"), QMessageBox::AcceptRole);
407 closeButton->setIcon(QIcon(":/icons/cross.png"));
408 closeButton->setMinimumWidth(90);
410 moreAboutBox->setWindowTitle(tr("About Third-party Software"));
411 moreAboutBox->setIconPixmap(QIcon(":/images/Logo_Software.png").pixmap(QSize(64,71)));
412 moreAboutBox->setWindowIcon(QIcon(":/icons/page_white_cplusplus.png"));
413 moreAboutBox->exec();
415 LAMEXP_DELETE(moreAboutBox);
418 ////////////////////////////////////////////////////////////
419 // Protected Functions
420 ////////////////////////////////////////////////////////////
422 void AboutDialog::showEvent(QShowEvent *e)
424 QDialog::showEvent(e);
427 const QList<QAbstractButton*> buttonList = buttons();
429 for(int i = 1; i < buttonList.count(); i++)
431 buttonList.at(i)->setEnabled(false);
434 QTimer::singleShot(5000, this, SLOT(enableButtons()));
435 setCursor(QCursor(Qt::WaitCursor));
439 ////////////////////////////////////////////////////////////
441 ////////////////////////////////////////////////////////////
443 QString AboutDialog::makeToolText(const QString &toolName, const QString &toolBin, const QString &toolVerFmt, const QString &toolLicense, const QString &toolWebsite, const QString &extraInfo)
445 QString toolText, verStr(toolVerFmt);
447 if(!toolBin.isEmpty())
449 verStr = lamexp_version2string(toolVerFmt, lamexp_tool_version(toolBin), tr("n/a"));
452 toolText += QString("<li><nobr><b>%1 (%2)</b></nobr><br>").arg(toolName, verStr);
453 toolText += QString("<nobr>%1</nobr><br>").arg(toolLicense);
454 if(!extraInfo.isEmpty()) toolText += QString("<nobr><i>%1</i></nobr><br>").arg(extraInfo);
455 toolText += QString("<a href=\"%1\">%1</a>").arg(toolWebsite);
456 toolText += QString("<div style=\"font-size:1pt\"><br></div>");
462 bool AboutDialog::playResoureSound(const QString &library, const unsigned long soundId, const bool async)
465 DWORD flags = SND_RESOURCE;
468 QFileInfo libraryFile(library);
469 if(!libraryFile.isAbsolute())
471 unsigned int buffSize = GetSystemDirectoryW(NULL, NULL) + 1;
472 wchar_t *buffer = (wchar_t*) _malloca(buffSize * sizeof(wchar_t));
473 unsigned int result = GetSystemDirectory(buffer, buffSize);
474 if(result > 0 && result < buffSize)
476 libraryFile.setFile(QString("%1/%2").arg(QDir::fromNativeSeparators(QString::fromUtf16(reinterpret_cast<const unsigned short*>(buffer))), library));
490 module = LoadLibraryW(reinterpret_cast<const wchar_t*>(QDir::toNativeSeparators(libraryFile.absoluteFilePath()).utf16()));
494 result = PlaySound((LPCTSTR) soundId, module, flags);