1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2010 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)
44 #define CONTRIBUTOR(LANG, CNTR, ICON) QString("<tr><td valign=\"middle\"><img src=\"%1\"></td><td> </td><td valign=\"middle\">%2</td><td> </td><td valign=\"middle\">%3</td></tr>").arg(ICON, LANG, CNTR);
45 #define VSTR(BASE,TOOL,FORMAT) QString(BASE).arg(lamexp_version2string(FORMAT, lamexp_tool_version(TOOL)))
48 const char *AboutDialog::neroAacUrl = "http://www.nero.com/eng/technologies-aac-codec.html";
50 ////////////////////////////////////////////////////////////
52 ////////////////////////////////////////////////////////////
54 AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstStart)
61 aboutText += "<h2>LameXP - Audio Encoder Front-end</h2>";
62 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()));
63 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());
64 aboutText += "<nobr>Please visit "; //the official web-site at
65 aboutText += LINK("http://forum.doom9.org/showthread.php?t=157726") += " for news and updates!</nobr><br>"; //LINK("http://mulder.dummwiedeutsch.de/")
66 aboutText += "<hr><br>";
67 aboutText += "<nobr><tt>This program is free software; you can redistribute it and/or<br>";
68 aboutText += "modify it under the terms of the GNU General Public License<br>";
69 aboutText += "as published by the Free Software Foundation; either version 2<br>";
70 aboutText += "of the License, or (at your option) any later version.<br><br>";
71 aboutText += "This program is distributed in the hope that it will be useful,<br>";
72 aboutText += "but WITHOUT ANY WARRANTY; without even the implied warranty of<br>";
73 aboutText += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>";
74 aboutText += "GNU General Public License for more details.<br><br>";
75 aboutText += "You should have received a copy of the GNU General Public License<br>";
76 aboutText += "along with this program; if not, write to the Free Software<br>";
77 aboutText += "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</tt></nobr><br>";
80 aboutText += QString("<br>Please see %1 for details!</br><br>").arg(LINK("http://www.gnu.org/licenses/gpl-2.0.txt"));
82 aboutText += "<hr><br>";
83 aboutText += QString("Special thanks go out to \"John33\" from %1 for his continuous support.<br>").arg(LINK("http://www.rarewares.org/"));
86 setIconPixmap(dynamic_cast<QApplication*>(QApplication::instance())->windowIcon().pixmap(QSize(64,64)));
87 setWindowTitle("About LameXP");
91 QPushButton *firstButton = addButton("Show License Text", QMessageBox::AcceptRole);
92 firstButton->setIcon(QIcon(":/icons/script.png"));
93 firstButton->setMinimumWidth(135);
94 firstButton->disconnect();
95 connect(firstButton, SIGNAL(clicked()), this, SLOT(openLicenseText()));
97 QPushButton *secondButton = addButton("Accept License", QMessageBox::AcceptRole);
98 secondButton->setIcon(QIcon(":/icons/accept.png"));
99 secondButton->setMinimumWidth(120);
101 QPushButton *thirdButton = addButton("Decline License", QMessageBox::AcceptRole);
102 thirdButton->setIcon(QIcon(":/icons/delete.png"));
103 thirdButton->setMinimumWidth(120);
104 thirdButton->setEnabled(false);
108 QPushButton *firstButton = addButton("3rd Party S/W", QMessageBox::AcceptRole);
109 firstButton->setIcon(QIcon(":/icons/page_white_cplusplus.png"));
110 firstButton->setMinimumWidth(120);
111 firstButton->disconnect();
112 connect(firstButton, SIGNAL(clicked()), this, SLOT(showMoreAbout()));
114 QPushButton *secondButton = addButton("Contributors", QMessageBox::AcceptRole);
115 secondButton->setIcon(QIcon(":icons/user_suit.png"));
116 secondButton->setMinimumWidth(120);
117 secondButton->disconnect();
118 connect(secondButton, SIGNAL(clicked()), this, SLOT(showAboutContributors()));
120 QPushButton *thirdButton = addButton("About Qt4", QMessageBox::AcceptRole);
121 thirdButton->setIcon(QIcon(":/images/Qt.svg"));
122 thirdButton->setMinimumWidth(120);
123 thirdButton->disconnect();
124 connect(thirdButton, SIGNAL(clicked()), this, SLOT(showAboutQt()));
126 QPushButton *fourthButton = addButton("Discard", QMessageBox::AcceptRole);
127 fourthButton->setIcon(QIcon(":/icons/cross.png"));
128 fourthButton->setMinimumWidth(90);
131 m_firstShow = firstStart;
134 AboutDialog::~AboutDialog(void)
138 ////////////////////////////////////////////////////////////
140 ////////////////////////////////////////////////////////////
142 int AboutDialog::exec()
144 if(m_settings->soundsEnabled())
146 if(!m_firstShow || !playResoureSound("imageres.dll", 5080, true))
148 PlaySound(MAKEINTRESOURCE(IDR_WAVE_ABOUT), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC);
152 switch(QMessageBox::exec())
166 ////////////////////////////////////////////////////////////
168 ////////////////////////////////////////////////////////////
170 void AboutDialog::enableButtons(void)
172 const QList<QAbstractButton*> buttonList = buttons();
174 for(int i = 0; i < buttonList.count(); i++)
176 buttonList.at(i)->setEnabled(true);
179 setCursor(QCursor(Qt::ArrowCursor));
182 void AboutDialog::openLicenseText(void)
184 QDesktopServices::openUrl(QUrl("http://www.gnu.org/licenses/gpl-2.0.txt"));
187 void AboutDialog::showAboutQt(void)
189 QMessageBox::aboutQt(this);
192 void AboutDialog::showAboutContributors(void)
194 QString contributorsAboutText;
195 contributorsAboutText += "<h3>The following people have contributed to LameXP:</h3>";
196 contributorsAboutText += "<b>Translators:</b>";
197 contributorsAboutText += "<table style=\"margin-top:5px\">";
198 contributorsAboutText += CONTRIBUTOR("Englisch", "LoRd_MuldeR <MuldeR2@GMX.de>", ":/flags/gb.png");
199 contributorsAboutText += CONTRIBUTOR("Deutsch", "LoRd_MuldeR <MuldeR2@GMX.de>", ":/flags/de.png");
200 contributorsAboutText += "</table>";
201 contributorsAboutText += "<br><br>";
202 contributorsAboutText += "<i>If you are willing to contribute a LameXP translation, feel free to contact us!</i><br>";
204 QMessageBox *contributorsAboutBox = new QMessageBox(this);
205 contributorsAboutBox->setText(contributorsAboutText);
206 contributorsAboutBox->setIconPixmap(dynamic_cast<QApplication*>(QApplication::instance())->windowIcon().pixmap(QSize(64,64)));
208 QPushButton *closeButton = contributorsAboutBox->addButton("Discard", QMessageBox::AcceptRole);
209 closeButton->setIcon(QIcon(":/icons/cross.png"));
210 closeButton->setMinimumWidth(90);
212 contributorsAboutBox->setWindowTitle("About Contributors");
213 contributorsAboutBox->setIconPixmap(QIcon(":/images/Logo_Contributors.png").pixmap(QSize(64,74)));
214 contributorsAboutBox->setWindowIcon(QIcon(":/icons/user_suit.png"));
215 contributorsAboutBox->exec();
217 LAMEXP_DELETE(contributorsAboutBox);
220 void AboutDialog::showMoreAbout(void)
222 QString moreAboutText;
223 moreAboutText += "<h3>The following third-party software is used in LameXP:</h3>";
224 moreAboutText += "<div style=\"margin-left:-25px;font-size:8pt\"><ul>";
226 moreAboutText += VSTR( "<li><b>LAME - OpenSource mp3 Encoder (%1)</b><br>", "lame.exe", "v?.?? a??");
227 moreAboutText += "Released under the terms of the GNU Leser General Public License.<br>";
228 moreAboutText += LINK("http://lame.sourceforge.net/");
229 moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
231 moreAboutText += VSTR("<li><b>OggEnc - Ogg Vorbis Encoder (%1)</b>", "oggenc2_i386.exe", "v?.??");
232 moreAboutText += "<br>Completely open and patent-free audio encoding technology.<br>";
233 moreAboutText += LINK("http://www.vorbis.com/");
234 moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
236 moreAboutText += VSTR("<li><b>Nero AAC reference MPEG-4 Encoder (%1)</b><br>", "neroAacEnc.exe", "v?.?.?.?");
237 moreAboutText += "Freeware state-of-the-art HE-AAC encoder with 2-Pass support.<br>";
238 moreAboutText += "<i>Available from vendor web-site as free download:</i><br>";
239 moreAboutText += LINK(neroAacUrl);
240 moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
242 moreAboutText += VSTR("<li><b>FLAC - Free Lossless Audio Codec (%1)</b><br>", "flac.exe", "v?.?.?");
243 moreAboutText += "Open and patent-free lossless audio compression technology.<br>";
244 moreAboutText += LINK("http://flac.sourceforge.net/");
245 moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
247 moreAboutText += VSTR("<li><b>AC3Filter Tools - AC3/DTS Decoder (%1)</b><br>", "valdec.exe", "v?.??");
248 moreAboutText += "Released under the terms of the GNU Leser General Public License.<br>";
249 moreAboutText += LINK("http://www.ac3filter.net/projects/tools");
250 moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
252 moreAboutText += VSTR("<li><b>MediaInfo - Media File Analysis Tool (%1)</b><br>", "mediainfo_i386.exe", "v?.?.?");
253 moreAboutText += "Released under the terms of the GNU Leser General Public License.<br>";
254 moreAboutText += LINK("http://mediainfo.sourceforge.net/");
255 moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
257 moreAboutText += VSTR("<li><b>SoX - Sound eXchange (%1)</b><br>", "sox.exe", "v??.?.?");
258 moreAboutText += "Released under the terms of the GNU Leser General Public License.<br>";
259 moreAboutText += LINK("http://sox.sourceforge.net/");
260 moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
262 moreAboutText += VSTR("<li><b>GnuPG - The GNU Privacy Guard (%1)</b><br>", "gpgv.exe", "v?.?.??");
263 moreAboutText += "Released under the terms of the GNU Leser General Public License.<br>";
264 moreAboutText += LINK("http://www.gnupg.org/");
265 moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
267 moreAboutText += "<li><b>Silk Icons - Over 700 icons in PNG format (v1.3)</b><br>";
268 moreAboutText += "<nobr>By Mark James, released under the Creative Commons 'by' License.</nobr><br>";
269 moreAboutText += LINK("http://www.famfamfam.com/lab/icons/silk/");
270 moreAboutText += "<br></ul></div>";
272 QMessageBox *moreAboutBox = new QMessageBox(this);
273 moreAboutBox->setText(moreAboutText);
274 moreAboutBox->setIconPixmap(dynamic_cast<QApplication*>(QApplication::instance())->windowIcon().pixmap(QSize(64,64)));
276 QPushButton *closeButton = moreAboutBox->addButton("Discard", QMessageBox::AcceptRole);
277 closeButton->setIcon(QIcon(":/icons/cross.png"));
278 closeButton->setMinimumWidth(90);
280 moreAboutBox->setWindowTitle("About Third-party Software");
281 moreAboutBox->setIconPixmap(QIcon(":/images/Logo_Software.png").pixmap(QSize(64,71)));
282 moreAboutBox->setWindowIcon(QIcon(":/icons/page_white_cplusplus.png"));
283 moreAboutBox->exec();
285 LAMEXP_DELETE(moreAboutBox);
288 ////////////////////////////////////////////////////////////
289 // Protected Functions
290 ////////////////////////////////////////////////////////////
292 void AboutDialog::showEvent(QShowEvent *e)
294 QDialog::showEvent(e);
297 const QList<QAbstractButton*> buttonList = buttons();
299 for(int i = 1; i < buttonList.count(); i++)
301 buttonList.at(i)->setEnabled(false);
304 QTimer::singleShot(5000, this, SLOT(enableButtons()));
305 setCursor(QCursor(Qt::WaitCursor));
309 ////////////////////////////////////////////////////////////
311 ////////////////////////////////////////////////////////////
313 bool AboutDialog::playResoureSound(const QString &library, const unsigned long soundId, const bool async)
316 DWORD flags = SND_RESOURCE;
319 QFileInfo libraryFile(library);
320 if(!libraryFile.isAbsolute())
322 unsigned int buffSize = GetSystemDirectoryW(NULL, NULL) + 1;
323 wchar_t *buffer = (wchar_t*) _malloca(buffSize * sizeof(wchar_t));
324 unsigned int result = GetSystemDirectory(buffer, buffSize);
325 if(result > 0 && result < buffSize)
327 libraryFile.setFile(QString("%1/%2").arg(QDir::fromNativeSeparators(QString::fromUtf16(reinterpret_cast<const unsigned short*>(buffer))), library));
341 module = LoadLibraryW(reinterpret_cast<const wchar_t*>(QDir::toNativeSeparators(libraryFile.absoluteFilePath()).utf16()));
345 result = PlaySound((LPCTSTR) soundId, module, flags);