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)
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>";
78 aboutText += "<hr><table><tr>";
79 aboutText += "<td valign=\"middle\"><img src=\":/icons/error_big.png\"</td><td> </td>";
80 aboutText += "<td><font color=\"darkred\">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 !!!</font></td>";
81 aboutText += "</tr></table><hr><br>";
82 aboutText += QString("Special thanks go out to \"John33\" from %1 for his continuous support.<br>").arg(LINK("http://www.rarewares.org/"));
85 setIconPixmap(dynamic_cast<QApplication*>(QApplication::instance())->windowIcon().pixmap(QSize(64,64)));
86 setWindowTitle("About LameXP");
90 QPushButton *firstButton = addButton("Show License Text", QMessageBox::AcceptRole);
91 firstButton->setIcon(QIcon(":/icons/script.png"));
92 firstButton->setMinimumWidth(135);
93 firstButton->disconnect();
94 connect(firstButton, SIGNAL(clicked()), this, SLOT(openLicenseText()));
96 QPushButton *secondButton = addButton("Accept License", QMessageBox::AcceptRole);
97 secondButton->setIcon(QIcon(":/icons/accept.png"));
98 secondButton->setMinimumWidth(120);
100 QPushButton *thirdButton = addButton("Decline License", QMessageBox::AcceptRole);
101 thirdButton->setIcon(QIcon(":/icons/delete.png"));
102 thirdButton->setMinimumWidth(120);
103 thirdButton->setEnabled(false);
107 QPushButton *firstButton = addButton("3rd Party S/W", QMessageBox::AcceptRole);
108 firstButton->setIcon(QIcon(":/icons/page_white_cplusplus.png"));
109 firstButton->setMinimumWidth(120);
110 firstButton->disconnect();
111 connect(firstButton, SIGNAL(clicked()), this, SLOT(showMoreAbout()));
113 QPushButton *secondButton = addButton("Contributors", QMessageBox::AcceptRole);
114 secondButton->setIcon(QIcon(":icons/user_suit.png"));
115 secondButton->setMinimumWidth(120);
116 secondButton->disconnect();
117 connect(secondButton, SIGNAL(clicked()), this, SLOT(showAboutContributors()));
119 QPushButton *thirdButton = addButton("About Qt4", QMessageBox::AcceptRole);
120 thirdButton->setIcon(QIcon(":/images/Qt.svg"));
121 thirdButton->setMinimumWidth(120);
122 thirdButton->disconnect();
123 connect(thirdButton, SIGNAL(clicked()), this, SLOT(showAboutQt()));
125 QPushButton *fourthButton = addButton("Discard", QMessageBox::AcceptRole);
126 fourthButton->setIcon(QIcon(":/icons/cross.png"));
127 fourthButton->setMinimumWidth(90);
130 m_firstShow = firstStart;
133 AboutDialog::~AboutDialog(void)
137 ////////////////////////////////////////////////////////////
139 ////////////////////////////////////////////////////////////
141 int AboutDialog::exec()
143 if(m_settings->soundsEnabled())
145 if(!m_firstShow || !playResoureSound("imageres.dll", 5080, true))
147 PlaySound(MAKEINTRESOURCE(IDR_WAVE_ABOUT), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC);
151 switch(QMessageBox::exec())
165 ////////////////////////////////////////////////////////////
167 ////////////////////////////////////////////////////////////
169 void AboutDialog::enableButtons(void)
171 const QList<QAbstractButton*> buttonList = buttons();
173 for(int i = 0; i < buttonList.count(); i++)
175 buttonList.at(i)->setEnabled(true);
178 setCursor(QCursor(Qt::ArrowCursor));
181 void AboutDialog::openLicenseText(void)
183 QDesktopServices::openUrl(QUrl("http://www.gnu.org/licenses/gpl-2.0.txt"));
186 void AboutDialog::showAboutQt(void)
188 QMessageBox::aboutQt(this);
191 void AboutDialog::showAboutContributors(void)
193 QString contributorsAboutText;
194 contributorsAboutText += "<h3>The following people have contributed to LameXP:</h3>";
195 contributorsAboutText += "<b>Translators:</b>";
196 contributorsAboutText += "<table style=\"margin-top:5px\">";
197 contributorsAboutText += CONTRIBUTOR("Englisch", "LoRd_MuldeR <MuldeR2@GMX.de>", ":/flags/gb.png");
198 contributorsAboutText += CONTRIBUTOR("Deutsch", "LoRd_MuldeR <MuldeR2@GMX.de>", ":/flags/de.png");
199 contributorsAboutText += "</table>";
200 contributorsAboutText += "<br><br>";
201 contributorsAboutText += "<i>If you are willing to contribute a LameXP translation, feel free to contact us!</i><br>";
203 QMessageBox *contributorsAboutBox = new QMessageBox(this);
204 contributorsAboutBox->setText(contributorsAboutText);
205 contributorsAboutBox->setIconPixmap(dynamic_cast<QApplication*>(QApplication::instance())->windowIcon().pixmap(QSize(64,64)));
207 QPushButton *closeButton = contributorsAboutBox->addButton("Discard", QMessageBox::AcceptRole);
208 closeButton->setIcon(QIcon(":/icons/cross.png"));
209 closeButton->setMinimumWidth(90);
211 contributorsAboutBox->setWindowTitle("About Contributors");
212 contributorsAboutBox->setIconPixmap(QIcon(":/images/Logo_Contributors.png").pixmap(QSize(64,74)));
213 contributorsAboutBox->setWindowIcon(QIcon(":/icons/user_suit.png"));
214 contributorsAboutBox->exec();
216 LAMEXP_DELETE(contributorsAboutBox);
219 void AboutDialog::showMoreAbout(void)
221 QString moreAboutText;
222 moreAboutText += "<h3>The following third-party software is used in LameXP:</h3>";
223 moreAboutText += "<div style=\"margin-left:-25px;font-size:8pt\"><ul>";
225 moreAboutText += VSTR( "<li><b>LAME - OpenSource mp3 Encoder (%1)</b><br>", "lame.exe", "v?.?? a??");
226 moreAboutText += "Released under the terms of the GNU Leser General Public License.<br>";
227 moreAboutText += LINK("http://lame.sourceforge.net/");
228 moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
230 moreAboutText += VSTR("<li><b>OggEnc - Ogg Vorbis Encoder (%1)</b>", "oggenc2_i386.exe", "v?.??");
231 moreAboutText += "<br>Completely open and patent-free audio encoding technology.<br>";
232 moreAboutText += LINK("http://www.vorbis.com/");
233 moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
235 moreAboutText += VSTR("<li><b>Nero AAC reference MPEG-4 Encoder (%1)</b><br>", "neroAacEnc.exe", "v?.?.?.?");
236 moreAboutText += "Freeware state-of-the-art HE-AAC encoder with 2-Pass support.<br>";
237 moreAboutText += "<i>Available from vendor web-site as free download:</i><br>";
238 moreAboutText += LINK(neroAacUrl);
239 moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
241 moreAboutText += VSTR("<li><b>FLAC - Free Lossless Audio Codec (%1)</b><br>", "flac.exe", "v?.?.?");
242 moreAboutText += "Open and patent-free lossless audio compression technology.<br>";
243 moreAboutText += LINK("http://flac.sourceforge.net/");
244 moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
246 moreAboutText += VSTR("<li><b>AC3Filter Tools - AC3/DTS Decoder (%1)</b><br>", "valdec.exe", "v?.??");
247 moreAboutText += "Released under the terms of the GNU Leser General Public License.<br>";
248 moreAboutText += LINK("http://www.ac3filter.net/projects/tools");
249 moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
251 moreAboutText += VSTR("<li><b>MediaInfo - Media File Analysis Tool (%1)</b><br>", "mediainfo_i386.exe", "v?.?.?");
252 moreAboutText += "Released under the terms of the GNU Leser General Public License.<br>";
253 moreAboutText += LINK("http://mediainfo.sourceforge.net/");
254 moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
256 moreAboutText += VSTR("<li><b>SoX - Sound eXchange (%1)</b><br>", "sox.exe", "v??.?.?");
257 moreAboutText += "Released under the terms of the GNU Leser General Public License.<br>";
258 moreAboutText += LINK("http://sox.sourceforge.net/");
259 moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
261 moreAboutText += VSTR("<li><b>GnuPG - The GNU Privacy Guard (%1)</b><br>", "gpgv.exe", "v?.?.??");
262 moreAboutText += "Released under the terms of the GNU Leser General Public License.<br>";
263 moreAboutText += LINK("http://www.gnupg.org/");
264 moreAboutText += "<div style=\"font-size:1pt\"><br></div>";
266 moreAboutText += "<li><b>Silk Icons - Over 700 icons in PNG format (v1.3)</b><br>";
267 moreAboutText += "<nobr>By Mark James, released under the Creative Commons 'by' License.</nobr><br>";
268 moreAboutText += LINK("http://www.famfamfam.com/lab/icons/silk/");
269 moreAboutText += "<br></ul></div>";
271 QMessageBox *moreAboutBox = new QMessageBox(this);
272 moreAboutBox->setText(moreAboutText);
273 moreAboutBox->setIconPixmap(dynamic_cast<QApplication*>(QApplication::instance())->windowIcon().pixmap(QSize(64,64)));
275 QPushButton *closeButton = moreAboutBox->addButton("Discard", QMessageBox::AcceptRole);
276 closeButton->setIcon(QIcon(":/icons/cross.png"));
277 closeButton->setMinimumWidth(90);
279 moreAboutBox->setWindowTitle("About Third-party Software");
280 moreAboutBox->setIconPixmap(QIcon(":/images/Logo_Software.png").pixmap(QSize(64,71)));
281 moreAboutBox->setWindowIcon(QIcon(":/icons/page_white_cplusplus.png"));
282 moreAboutBox->exec();
284 LAMEXP_DELETE(moreAboutBox);
287 ////////////////////////////////////////////////////////////
288 // Protected Functions
289 ////////////////////////////////////////////////////////////
291 void AboutDialog::showEvent(QShowEvent *e)
293 QDialog::showEvent(e);
296 const QList<QAbstractButton*> buttonList = buttons();
298 for(int i = 1; i < buttonList.count(); i++)
300 buttonList.at(i)->setEnabled(false);
303 QTimer::singleShot(5000, this, SLOT(enableButtons()));
304 setCursor(QCursor(Qt::WaitCursor));
308 ////////////////////////////////////////////////////////////
310 ////////////////////////////////////////////////////////////
312 bool AboutDialog::playResoureSound(const QString &library, const unsigned long soundId, const bool async)
315 DWORD flags = SND_RESOURCE;
318 QFileInfo libraryFile(library);
319 if(!libraryFile.isAbsolute())
321 unsigned int buffSize = GetSystemDirectoryW(NULL, NULL) + 1;
322 wchar_t *buffer = (wchar_t*) _malloca(buffSize * sizeof(wchar_t));
323 unsigned int result = GetSystemDirectory(buffer, buffSize);
324 if(result > 0 && result < buffSize)
326 libraryFile.setFile(QString("%1/%2").arg(QDir::fromNativeSeparators(QString::fromUtf16(reinterpret_cast<const unsigned short*>(buffer))), library));
340 module = LoadLibraryW(reinterpret_cast<const wchar_t*>(QDir::toNativeSeparators(libraryFile.absoluteFilePath()).utf16()));
344 result = PlaySound((LPCTSTR) soundId, module, flags);