OSDN Git Service

Update MediaInfo binaries to v0.7.53 (2012-01-24), compiled with ICL 12.1.6 and MSVC...
[lamexp/LameXP.git] / src / Dialog_About.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
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.
9 //
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.
14 //
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.
18 //
19 // http://www.gnu.org/licenses/gpl-2.0.txt
20 ///////////////////////////////////////////////////////////////////////////////
21
22 #include "Dialog_About.h"
23
24 #include "Global.h"
25 #include "Resource.h"
26 #include "Model_Settings.h"
27
28 #include <QDate>
29 #include <QApplication>
30 #include <QIcon>
31 #include <QPushButton>
32 #include <QDesktopServices>
33 #include <QUrl>
34 #include <QTimer>
35 #include <QFileInfo>
36 #include <QDir>
37 #include <QDesktopWidget>
38 #include <QLabel>
39
40 #include <MMSystem.h>
41 #include <math.h>
42
43 //Helper macros
44 #define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(QString(URL).replace("-", "&minus;"))
45
46 //Constants
47 const char *AboutDialog::neroAacUrl = "http://www.nero.com/eng/technologies-aac-codec.html";
48 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
49
50 //Contributors
51 static const struct 
52 {
53         char *pcFlag;
54         wchar_t *pcLanguage;
55         wchar_t *pcName;
56         char *pcMail;
57 }
58 g_lamexp_contributors[] =
59 {
60         {"en", L"Englisch",   L"LoRd_MuldeR",         "MuldeR2@GMX.de"        },
61         {"de", L"Deutsch",    L"LoRd_MuldeR",         "MuldeR2@GMX.de"        },
62         {"",   L"",           L"Bodo Thevissen",      "Bodo@thevissen.de"     },
63         {"es", L"Español",    L"Rub3nCT",             "Rub3nCT@gmail.com"     },
64         {"fr", L"Française",  L"Dodich Informatique", "Dodich@live.fr"        },
65         {"it", L"Italiano",   L"Roberto",             "Gulliver_69@libero.it" },
66         {"kr", L"한국어",        L"JaeHyung Lee",        "Kolanp@gmail.com"      },
67         {"pl", L"Polski",     L"Sir Daniel K",        "Sir.Daniel.K@gmail.com"},
68         {"ru", L"Русский",    L"Neonailol",           "Neonailol@gmail.com"   },
69         {"",   L"",           L"Иван Митин",          "bardak@inbox.ru"       },
70         {"tw", L"繁体中文",       L"456Vv",               "123@456vv.com"         },
71         {"uk", L"Українська", L"Arestarh",            "Arestarh@ukr.net"      },
72         {"zh", L"简体中文",       L"456Vv",               "123@456vv.com"         },
73         {NULL, NULL, NULL, NULL}
74 };
75
76 ////////////////////////////////////////////////////////////
77 // Constructor
78 ////////////////////////////////////////////////////////////
79
80 AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstStart)
81 :
82         QMessageBox(parent),
83         m_settings(settings),
84         m_disque(NULL),
85         m_disqueTimer(NULL),
86         m_rotateNext(false),
87         m_disqueDelay(_I64_MAX)
88 {
89         const QString versionStr = QString().sprintf
90         (
91                 "Version %d.%02d %s, Build %d [%s], %s %s, Qt v%s",
92                 lamexp_version_major(),
93                 lamexp_version_minor(),
94                 lamexp_version_release(),
95                 lamexp_version_build(),
96                 lamexp_version_date().toString(Qt::ISODate).toLatin1().constData(),
97                 lamexp_version_compiler(),
98                 lamexp_version_arch(),
99                 qVersion()
100         );
101         const QString copyrightStr = QString().sprintf
102         (
103                 "Copyright (C) 2004-%04d LoRd_MuldeR &lt;MuldeR2@GMX.de&gt;. Some rights reserved.",
104                 qMax(lamexp_version_date().year(), QDate::currentDate().year())
105         );
106
107         for(int i = 0; i < 4; i++)
108         {
109                 m_cartoon[i] = NULL;
110         }
111
112         QString aboutText;
113
114         aboutText += QString("<h2>%1</h2>").arg(NOBR(tr("LameXP - Audio Encoder Front-end")));
115         aboutText += QString("<b>%1</b><br>").arg(NOBR(copyrightStr));
116         aboutText += QString("<b>%1</b><br><br>").arg(NOBR(versionStr));
117         aboutText += QString("%1<br>").arg(NOBR(tr("Please visit %1 for news and updates!").arg(LINK(lamexp_website_url()))));
118         
119         if(LAMEXP_DEBUG)
120         {
121                 int daysLeft = qMax(QDate::currentDate().daysTo(lamexp_version_expires()), 0);
122                 aboutText += QString("<hr><font color=\"crimson\">%1</font>").arg(NOBR(QString("!!! --- DEBUG BUILD --- Expires at: %1 &middot; Days left: %2 --- DEBUG BUILD --- !!!").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(daysLeft))));
123         }
124         else if(lamexp_version_demo())
125         {
126                 int daysLeft = qMax(QDate::currentDate().daysTo(lamexp_version_expires()), 0);
127                 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))));
128         }
129         
130         aboutText += "<hr><br>";
131         aboutText += "<nobr><tt>This program is free software; you can redistribute it and/or<br>";
132         aboutText += "modify it under the terms of the GNU General Public License<br>";
133         aboutText += "as published by the Free Software Foundation; either version 2<br>";
134         aboutText += "of the License, or (at your option) any later version.<br><br>";
135         aboutText += "This program is distributed in the hope that it will be useful,<br>";
136         aboutText += "but WITHOUT ANY WARRANTY; without even the implied warranty of<br>";
137         aboutText += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>";
138         aboutText += "GNU General Public License for more details.<br><br>";
139         aboutText += "You should have received a copy of the GNU General Public License<br>";
140         aboutText += "along with this program; if not, write to the Free Software<br>";
141         aboutText += "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110&minus;1301, USA.</tt></nobr><br>";
142         aboutText += "<hr><table><tr>";
143         aboutText += "<td valign=\"middle\"><img src=\":/icons/error_big.png\"</td><td>&nbsp;</td>";
144         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 !!!"));
145         aboutText += "</tr></table><hr><br>";
146         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/")));
147
148         setText(aboutText);
149         setIconPixmap(lamexp_app_icon().pixmap(QSize(72,72)));
150         setWindowTitle(tr("About LameXP"));
151
152         if(firstStart)
153         {
154                 QPushButton *firstButton = addButton(tr("Show License Text"), QMessageBox::AcceptRole);
155                 firstButton->setIcon(QIcon(":/icons/script.png"));
156                 firstButton->setIconSize(QSize(16, 16));
157                 firstButton->setMinimumWidth(135);
158                 firstButton->disconnect();
159                 connect(firstButton, SIGNAL(clicked()), this, SLOT(openLicenseText()));
160
161                 QPushButton *secondButton = addButton(tr("Accept License"), QMessageBox::AcceptRole);
162                 secondButton->setIcon(QIcon(":/icons/accept.png"));
163                 secondButton->setIconSize(QSize(16, 16));
164                 secondButton->setMinimumWidth(120);
165
166                 QPushButton *thirdButton = addButton(tr("Decline License"), QMessageBox::AcceptRole);
167                 thirdButton->setIcon(QIcon(":/icons/delete.png"));
168                 thirdButton->setIconSize(QSize(16, 16));
169                 thirdButton->setMinimumWidth(120);
170                 thirdButton->setEnabled(false);
171         }
172         else
173         {
174                 QPushButton *firstButton = addButton(tr("3rd Party S/W"), QMessageBox::AcceptRole);
175                 firstButton->setIcon(QIcon(":/icons/page_white_cplusplus.png"));
176                 firstButton->setIconSize(QSize(16, 16));
177                 firstButton->setMinimumWidth(120);
178                 firstButton->disconnect();
179                 connect(firstButton, SIGNAL(clicked()), this, SLOT(showMoreAbout()));
180
181                 QPushButton *secondButton = addButton(tr("Contributors"), QMessageBox::AcceptRole);
182                 secondButton->setIcon(QIcon(":icons/user_suit.png"));
183                 secondButton->setIconSize(QSize(16, 16));
184                 secondButton->setMinimumWidth(120);
185                 secondButton->disconnect();
186                 connect(secondButton, SIGNAL(clicked()), this, SLOT(showAboutContributors()));
187
188                 QPushButton *thirdButton = addButton(tr("About Qt4"), QMessageBox::AcceptRole);
189                 thirdButton->setIcon(QIcon(":/images/Qt.svg"));
190                 thirdButton->setIconSize(QSize(16, 16));
191                 thirdButton->setMinimumWidth(120);
192                 thirdButton->disconnect();
193                 connect(thirdButton, SIGNAL(clicked()), this, SLOT(showAboutQt()));
194
195                 QPushButton *fourthButton = addButton(tr("Discard"), QMessageBox::AcceptRole);
196                 fourthButton->setIcon(QIcon(":/icons/cross.png"));
197                 fourthButton->setIconSize(QSize(16, 16));
198                 fourthButton->setMinimumWidth(90);
199
200                 QPixmap disque(":/images/Disque.png");
201                 QRect screenGeometry = QApplication::desktop()->availableGeometry();
202                 m_disque = new QLabel(this, Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
203                 m_disque->installEventFilter(this);
204                 m_disque->setStyleSheet("background:transparent;");
205                 m_disque->setAttribute(Qt::WA_TranslucentBackground);
206                 m_disque->setGeometry(qrand() % (screenGeometry.width() - disque.width()), qrand() % (screenGeometry.height() - disque.height()), disque.width(), disque.height());
207                 m_disque->setPixmap(disque);
208                 m_disque->setWindowOpacity(0.01);
209                 m_disque->show();
210                 m_disqueFlags[0] = (qrand() > (RAND_MAX/2));
211                 m_disqueFlags[1] = (qrand() > (RAND_MAX/2));
212                 m_disqueTimer = new QTimer;
213                 connect(m_disqueTimer, SIGNAL(timeout()), this, SLOT(moveDisque()));
214                 m_disqueTimer->setInterval(10);
215                 m_disqueTimer->start();
216         }
217         
218         m_firstShow = firstStart;
219 }
220
221 AboutDialog::~AboutDialog(void)
222 {
223         if(m_disque)
224         {
225                 m_disque->close();
226                 LAMEXP_DELETE(m_disque);
227         }
228         if(m_disqueTimer)
229         {
230                 m_disqueTimer->stop();
231                 LAMEXP_DELETE(m_disqueTimer);
232         }
233         for(int i = 0; i < 4; i++)
234         {
235                 LAMEXP_DELETE(m_cartoon[i]);
236         }
237
238 }
239
240 ////////////////////////////////////////////////////////////
241 // Public Functions
242 ////////////////////////////////////////////////////////////
243
244 int AboutDialog::exec()
245 {
246         if(m_settings->soundsEnabled())
247         {
248                 if(m_firstShow)
249                 {
250                         if(!playResoureSound("imageres.dll", 5080, true))
251                         {
252                                 PlaySound(TEXT("SystemStart"), NULL, SND_ALIAS | SND_ASYNC);
253                         }
254                 }
255                 else
256                 {
257                         PlaySound(MAKEINTRESOURCE(IDR_WAVE_ABOUT), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC);
258                 }
259         }
260         
261         switch(QMessageBox::exec())
262         {
263         case 1:
264                 return 1;
265                 break;
266         case 2:
267                 return -1;
268                 break;
269         default:
270                 return 0;
271                 break;
272         }
273 }
274
275 ////////////////////////////////////////////////////////////
276 // Slots
277 ////////////////////////////////////////////////////////////
278
279 #define TEMP_HIDE_DISQUE(CMD) \
280 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}
281
282 void AboutDialog::enableButtons(void)
283 {
284         const QList<QAbstractButton*> buttonList = buttons();
285         
286         for(int i = 0; i < buttonList.count(); i++)
287         {
288                 buttonList.at(i)->setEnabled(true);
289         }
290
291         setCursor(QCursor(Qt::ArrowCursor));
292 }
293
294 void AboutDialog::openLicenseText(void)
295 {
296         QDesktopServices::openUrl(QUrl("http://www.gnu.org/licenses/gpl-2.0.txt"));
297 }
298
299 void AboutDialog::showAboutQt(void)
300 {
301         TEMP_HIDE_DISQUE
302         (
303                 QMessageBox::aboutQt(this);
304         );
305 }
306
307 void AboutDialog::showAboutContributors(void)
308 {
309         TEMP_HIDE_DISQUE
310         (
311                 QString contributorsAboutText;
312
313                 contributorsAboutText += QString("<h3>%1</h3>").arg(NOBR(tr("The following people have contributed to LameXP:")));
314                 contributorsAboutText += QString("<b>%1</b>").arg(tr("Translators:"));
315                 contributorsAboutText += "<table style=\"margin-top:5px\">";
316                 for(int i = 0; g_lamexp_contributors[i].pcName; i++)
317                 {
318                         QString flagIcon = (strlen(g_lamexp_contributors[i].pcFlag) > 0) ? QString("<img src=\":/flags/%1.png\">").arg(g_lamexp_contributors[i].pcFlag) : QString();
319                         contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>&nbsp;&nbsp;</td>").arg(flagIcon);
320                         contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>&nbsp;&nbsp;</td>").arg(WCHAR2QSTR(g_lamexp_contributors[i].pcLanguage));
321                         contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>&nbsp;&nbsp;</td><td><a href=\"mailto:%2\">&lt;%2&gt;</a></td></tr>").arg(WCHAR2QSTR(g_lamexp_contributors[i].pcName), g_lamexp_contributors[i].pcMail);
322                 }
323                 contributorsAboutText += "</table>";
324                 contributorsAboutText += "<br><br>";
325                 contributorsAboutText += QString("<i>%1</i><br>").arg(NOBR(tr("If you are willing to contribute a LameXP translation, feel free to contact us!")));
326
327                 QMessageBox *contributorsAboutBox = new QMessageBox(this);
328                 contributorsAboutBox->setText(contributorsAboutText);
329                 contributorsAboutBox->setIconPixmap(dynamic_cast<QApplication*>(QApplication::instance())->windowIcon().pixmap(QSize(64,64)));
330
331                 QPushButton *closeButton = contributorsAboutBox->addButton(tr("Discard"), QMessageBox::AcceptRole);
332                 closeButton->setIcon(QIcon(":/icons/cross.png"));
333                 closeButton->setMinimumWidth(90);
334
335                 contributorsAboutBox->setWindowTitle(tr("About Contributors"));
336                 contributorsAboutBox->setIconPixmap(QIcon(":/images/Logo_Contributors.png").pixmap(QSize(64,74)));
337                 contributorsAboutBox->setWindowIcon(QIcon(":/icons/user_suit.png"));
338                 contributorsAboutBox->exec();
339
340                 LAMEXP_DELETE(contributorsAboutBox);
341         );
342 }
343
344 void AboutDialog::showMoreAbout(void)
345 {
346         TEMP_HIDE_DISQUE
347         (
348                 QString moreAboutText;
349
350                 moreAboutText += QString("<h3>%1</h3>").arg(tr("The following third-party software is used in LameXP:"));
351                 moreAboutText += "<div style=\"margin-left:-25px;font-size:7pt;white-space:nowrap\"><table><tr><td><ul>";
352         
353                 moreAboutText += makeToolText
354                 (
355                         tr("LAME - OpenSource mp3 Encoder"),
356                         "lame.exe", "v?.??, Final-?",
357                         tr("Released under the terms of the GNU Lesser General Public License."),
358                         "http://lame.sourceforge.net/"
359                 );
360                 moreAboutText += makeToolText
361                 (
362                         tr("OggEnc - Ogg Vorbis Encoder"),
363                         "oggenc2.exe", "v?.??, aoTuV Beta-?.??",
364                         tr("Completely open and patent-free audio encoding technology."),
365                         "http://www.vorbis.com/"
366                 );
367                 moreAboutText += makeToolText
368                 (
369                         tr("Nero AAC Reference MPEG-4 Encoder"),
370                         "neroAacEnc.exe", "v?.?.?.?",
371                         tr("Freeware state-of-the-art HE-AAC encoder with 2-Pass support."),
372                         neroAacUrl,
373                         tr("Available from vendor web-site as free download:")
374                 );
375                 moreAboutText += makeToolText
376                 (
377                         tr("Aften - A/52 audio encoder"),
378                         "aften.exe", "v?.?.?",
379                         tr("Released under the terms of the GNU Lesser General Public License."),
380                         "http://aften.sourceforge.net/"
381                 );
382                 moreAboutText += makeToolText
383                 (
384                         tr("FLAC - Free Lossless Audio Codec"),
385                         "flac.exe", "v?.?.?",
386                         tr("Open and patent-free lossless audio compression technology."),
387                         "http://flac.sourceforge.net/"
388                 );
389                 moreAboutText += makeToolText
390                 (
391                         tr("mpg123 - Fast Console MPEG Audio Player/Decoder"),
392                         "mpg123.exe", "v?.??.?",
393                         tr("Released under the terms of the GNU Lesser General Public License."),
394                         "http://www.mpg123.de/"
395                 );
396                 moreAboutText += makeToolText
397                 (
398                         tr("FAAD - OpenSource MPEG-4 and MPEG-2 AAC Decoder"),
399                         "faad.exe", "v?.?",
400                         tr("Released under the terms of the GNU General Public License."),
401                         "http://www.audiocoding.com/"
402                 );
403                 moreAboutText += makeToolText
404                 (
405                         tr("AC3Filter Tools - AC3/DTS Decoder"),
406                         "valdec.exe", "v?.??",
407                         tr("Released under the terms of the GNU Lesser General Public License."),
408                         "http://www.ac3filter.net/projects/tools"
409                 );
410                 moreAboutText += makeToolText
411                         (
412                         tr("WavPack - Hybrid Lossless Compression"),
413                         "wvunpack.exe", "v?.??.?",
414                         tr("Completely open audio compression format."),
415                         "http://www.wavpack.com/"
416                 );
417                 moreAboutText += makeToolText
418                         (
419                         tr("Musepack - Living Audio Compression"),
420                         "mpcdec.exe", "r???",
421                         tr("Released under the terms of the GNU Lesser General Public License."),
422                         "http://www.musepack.net/"
423                 );
424                 moreAboutText += makeToolText
425                 (
426                         tr("Monkey's Audio - Lossless Audio Compressor"),
427                         "mac.exe", "v?.??",
428                         tr("Freely available source code, simple SDK and non-restrictive licensing."),
429                         "http://www.monkeysaudio.com/"
430                 );
431                 moreAboutText += QString
432                 (
433                         "</ul></td><td><ul>" /* ----------------------------------------- */
434                 );
435                 moreAboutText += makeToolText
436                 (
437                         tr("Shorten - Lossless Audio Compressor"),
438                         "shorten.exe", "v?.?.?",
439                         tr("Released under the terms of the GNU Lesser General Public License."),
440                         "http://etree.org/shnutils/shorten/"
441                 );
442                 moreAboutText += makeToolText
443                 (
444                         tr("Speex - Free Codec For Free Speech"),
445                         "speexdec.exe", "v?.?",
446                         tr("Open Source patent-free audio format designed for speech."),
447                         "http://www.speex.org/"
448                 );
449                 moreAboutText += makeToolText
450                 (
451                         tr("The True Audio - Lossless Audio Codec"),
452                         "tta.exe", "v?.?",
453                         tr("Released under the terms of the GNU Lesser General Public License."),
454                         "http://tta.sourceforge.net/"
455                 );
456                 moreAboutText += makeToolText
457                 (
458                         tr("ALAC Decoder"),
459                         "alac.exe", "v?.?.?",
460                         tr("Copyright (c) 2004 David Hammerton. Contributions by Cody Brocious."),
461                         "http://craz.net/programs/itunes/alac.html"
462                 );
463                 moreAboutText += makeToolText
464                 (
465                         tr("wma2wav - Dump WMA files to Wave Audio"),
466                         "wma2wav.exe", "????-??-??",
467                         tr("Copyright (c) 2011 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved."),
468                         "http://forum.doom9.org/showthread.php?t=140273"
469                 );
470                 moreAboutText += makeToolText
471                 (
472                         tr("avs2wav - Avisynth to Wave Audio converter"),
473                         "avs2wav.exe", "v?.?",
474                         tr("By Jory Stone <jcsston@toughguy.net> and LoRd_MuldeR <mulder2@gmx.de>."),
475                         "http://forum.doom9.org/showthread.php?t=70882"
476                 );
477                 moreAboutText += makeToolText
478                 (
479                         tr("dcaenc"),
480                         "dcaenc.exe", "????-??-??",
481                         tr("Copyright (c) 2008-2011 Alexander E. Patrakov. Distributed under the LGPL."),
482                         "http://gitorious.org/dtsenc/dtsenc/trees/master"
483                 );
484                 moreAboutText += makeToolText
485                 (
486                         tr("MediaInfo - Media File Analysis Tool"),
487                         "mediainfo.exe", "v?.?.??",
488                         tr("Released under the terms of the GNU Lesser General Public License."),
489                         "http://mediainfo.sourceforge.net/"
490                 );
491                 moreAboutText += makeToolText
492                 (
493                         tr("SoX - Sound eXchange"),
494                         "sox.exe", "v??.?.?",
495                         tr("Released under the terms of the GNU Lesser General Public License."),
496                         "http://sox.sourceforge.net/"
497                 );
498                 moreAboutText += makeToolText
499                 (
500                         tr("GnuPG - The GNU Privacy Guard"),
501                         "gpgv.exe", "v?.?.??",
502                         tr("Released under the terms of the GNU Lesser General Public License."),
503                         "http://www.gnupg.org/"
504                 );
505                 moreAboutText += makeToolText
506                 (
507                         tr("GNU Wget - Software for retrieving files using HTTP"),
508                         "wget.exe", "v?.??.?",
509                         tr("Released under the terms of the GNU Lesser General Public License."),
510                         "http://www.gnu.org/software/wget/"
511                 );
512                 //moreAboutText += makeToolText
513                 //(
514                 //      tr("Silk Icons - Over 700  icons in PNG format"),
515                 //      QString(), "v1.3",
516                 //      tr("By Mark James, released under the Creative Commons 'by' License."),
517                 //      "http://www.famfamfam.com/lab/icons/silk/"
518                 //);
519                 moreAboutText += QString("</ul></td><td>&nbsp;</td></tr></table></div><i>%1</i><br>").arg
520                 (
521                         NOBR(tr("LameXP as a whole is copyrighted by LoRd_MuldeR. The copyright of third-party software used in LameXP belongs to the individual authors."))
522                 );
523
524                 QMessageBox *moreAboutBox = new QMessageBox(this);
525                 moreAboutBox->setText(moreAboutText);
526                 moreAboutBox->setIconPixmap(dynamic_cast<QApplication*>(QApplication::instance())->windowIcon().pixmap(QSize(64,64)));
527
528                 QPushButton *closeButton = moreAboutBox->addButton(tr("Discard"), QMessageBox::AcceptRole);
529                 closeButton->setIcon(QIcon(":/icons/cross.png"));
530                 closeButton->setMinimumWidth(90);
531
532                 moreAboutBox->setWindowTitle(tr("About Third-party Software"));
533                 moreAboutBox->setIconPixmap(QIcon(":/images/Logo_Software.png").pixmap(QSize(64,71)));
534                 moreAboutBox->setWindowIcon(QIcon(":/icons/page_white_cplusplus.png"));
535                 moreAboutBox->exec();
536                                 
537                 LAMEXP_DELETE(moreAboutBox);
538         );
539 }
540
541 void AboutDialog::moveDisque(void)
542 {
543         int delta = 2;
544         LARGE_INTEGER perfCount, perfFrequ;
545
546         if(QueryPerformanceFrequency(&perfFrequ) &&     QueryPerformanceCounter(&perfCount))
547         {
548                 if(m_disqueDelay != _I64_MAX)
549                 {
550                         const double delay = static_cast<double>(perfCount.QuadPart) - static_cast<double>(m_disqueDelay);
551                         delta = qMax(1, qMin(128, static_cast<int>(ceil(delay / static_cast<double>(perfFrequ.QuadPart) / 0.00512))));
552                 }
553                 m_disqueDelay = perfCount.QuadPart;
554         }
555
556         if(m_disque)
557         {
558                 QRect screenGeometry = QApplication::desktop()->availableGeometry();
559                 const int minX = screenGeometry.left();
560                 const int maxX = screenGeometry.width() - m_disque->width() + screenGeometry.left();
561                 const int minY = screenGeometry.top();
562                 const int maxY = screenGeometry.height() - m_disque->height() + screenGeometry.top();
563                 
564                 QPoint pos = m_disque->pos();
565                 pos.setX(m_disqueFlags[0] ? pos.x() + delta : pos.x() - delta);
566                 pos.setY(m_disqueFlags[1] ? pos.y() + delta : pos.y() - delta);
567
568                 if(pos.x() <= minX)
569                 {
570                         m_disqueFlags[0] = true;
571                         pos.setX(minX);
572                         m_rotateNext = true;
573                 }
574                 else if(pos.x() >= maxX)
575                 {
576                         m_disqueFlags[0] = false;
577                         pos.setX(maxX);
578                         m_rotateNext = true;
579                 }
580                 if(pos.y() <= minY)
581                 {
582                         m_disqueFlags[1] = true;
583                         pos.setY(minY);
584                         m_rotateNext = true;
585                 }
586                 else if(pos.y() >= maxY)
587                 {
588                         m_disqueFlags[1] = false;
589                         pos.setY(maxY);
590                         m_rotateNext = true;
591                 }
592
593                 m_disque->move(pos);
594
595                 if(m_rotateNext)
596                 {
597                         QPixmap *cartoon = NULL;
598                         if(m_disqueFlags[0] == true && m_disqueFlags[1] != true) cartoon = m_cartoon[0];
599                         if(m_disqueFlags[0] == true && m_disqueFlags[1] == true) cartoon = m_cartoon[1];
600                         if(m_disqueFlags[0] != true && m_disqueFlags[1] == true) cartoon = m_cartoon[2];
601                         if(m_disqueFlags[0] != true && m_disqueFlags[1] != true) cartoon = m_cartoon[3];
602                         if(cartoon)
603                         {
604                                 m_disque->setPixmap(*cartoon);
605                                 m_disque->resize(cartoon->size());
606                         }
607                         m_rotateNext = false;
608                 }
609
610                 if(m_disque->windowOpacity() < 0.9)
611                 {
612                         m_disque->setWindowOpacity(m_disque->windowOpacity() + 0.01);
613                 }
614         }
615 }
616 ////////////////////////////////////////////////////////////
617 // Protected Functions
618 ////////////////////////////////////////////////////////////
619
620 void AboutDialog::showEvent(QShowEvent *e)
621 {
622         QDialog::showEvent(e);
623         if(m_firstShow)
624         {
625                 const QList<QAbstractButton*> buttonList = buttons();
626
627                 for(int i = 1; i < buttonList.count(); i++)
628                 {
629                         buttonList.at(i)->setEnabled(false);
630                 }
631
632                 QTimer::singleShot(5000, this, SLOT(enableButtons()));
633                 setCursor(QCursor(Qt::WaitCursor));
634         }
635 }
636
637 bool AboutDialog::eventFilter(QObject *obj, QEvent *event)
638 {
639         if((obj == m_disque) && (event->type() == QEvent::MouseButtonPress))
640         {
641                 QPixmap cartoon(":/images/Cartoon.png");
642                 for(int i = 0; i < 4; i++)
643                 {
644                         if(!m_cartoon[i])
645                         {
646                                 m_cartoon[i] = new QPixmap(cartoon.transformed(QMatrix().rotate(static_cast<double>(i*90) + 45.0), Qt::SmoothTransformation));
647                                 m_rotateNext = true;
648                         }
649                 }
650                 QDesktopServices::openUrl(QUrl(disqueUrl));
651         }
652
653         return false;
654 }
655
656 ////////////////////////////////////////////////////////////
657 // Private Functions
658 ////////////////////////////////////////////////////////////
659
660 QString AboutDialog::makeToolText(const QString &toolName, const QString &toolBin, const QString &toolVerFmt, const QString &toolLicense, const QString &toolWebsite, const QString &extraInfo)
661 {
662         QString toolText, verStr(toolVerFmt);
663
664         if(!toolBin.isEmpty())
665         {
666                 verStr = lamexp_version2string(toolVerFmt, lamexp_tool_version(toolBin), tr("n/a"));
667         }
668
669         toolText += QString("<li>%1<br>").arg(NOBR(QString("<b>%1 (%2)</b>").arg(toolName, verStr)));
670         toolText += QString("%1<br>").arg(NOBR(toolLicense));
671         if(!extraInfo.isEmpty()) toolText += QString("<i>%1</i><br>").arg(NOBR(extraInfo));
672         toolText += QString("<nobr>%1</nobr>").arg(LINK(toolWebsite));
673         toolText += QString("<div style=\"font-size:1pt\"><br></div>");
674
675         return toolText;
676 }
677
678
679 bool AboutDialog::playResoureSound(const QString &library, const unsigned long soundId, const bool async)
680 {
681         HMODULE module = 0;
682         DWORD flags = SND_RESOURCE;
683         bool result = false;
684
685         QFileInfo libraryFile(library);
686         if(!libraryFile.isAbsolute())
687         {
688                 unsigned int buffSize = GetSystemDirectoryW(NULL, NULL) + 1;
689                 wchar_t *buffer = (wchar_t*) _malloca(buffSize * sizeof(wchar_t));
690                 unsigned int result = GetSystemDirectory(buffer, buffSize);
691                 if(result > 0 && result < buffSize)
692                 {
693                         libraryFile.setFile(QString("%1/%2").arg(QDir::fromNativeSeparators(QString::fromUtf16(reinterpret_cast<const unsigned short*>(buffer))), library));
694                 }
695                 _freea(buffer);
696         }
697
698         if(async)
699         {
700                 flags |= SND_ASYNC;
701         }
702         else
703         {
704                 flags |= SND_SYNC;
705         }
706
707         module = LoadLibraryW(reinterpret_cast<const wchar_t*>(QDir::toNativeSeparators(libraryFile.absoluteFilePath()).utf16()));
708
709         if(module)
710         {
711                 result = PlaySound((LPCTSTR) soundId, module, flags);
712                 FreeLibrary(module);
713         }
714
715         return result;
716 }