/////////////////////////////////////////////////////////////////////////////// // LameXP - Audio Encoder Front-End // Copyright (C) 2004-2010 LoRd_MuldeR // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // // http://www.gnu.org/licenses/gpl-2.0.txt /////////////////////////////////////////////////////////////////////////////// #include "Dialog_About.h" #include "Global.h" #include "Resource.h" #include "Model_Settings.h" //Qt includes #include #include #include #include #include #include #include #include #include //Win32 includes #include //Helper macros #define LINK(URL) QString("%2").arg(URL).arg(URL) #define CONTRIBUTOR(LANG, CNTR, ICON) QString("  %2  %3").arg(ICON, LANG, CNTR); #define VSTR(BASE,TOOL,FORMAT) QString(BASE).arg(lamexp_version2string(FORMAT, lamexp_tool_version(TOOL))) //Constants const char *AboutDialog::neroAacUrl = "http://www.nero.com/eng/technologies-aac-codec.html"; //////////////////////////////////////////////////////////// // Constructor //////////////////////////////////////////////////////////// AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstStart) : QMessageBox(parent), m_settings(settings) { QString aboutText; aboutText += "

LameXP - Audio Encoder Front-end

"; aboutText += QString("Copyright (C) 2004-%1 LoRd_MuldeR <MuldeR2@GMX.de>. Some rights reserved.
").arg(max(lamexp_version_date().year(),QDate::currentDate().year())); aboutText += QString().sprintf("Version %d.%02d %s, Build %d [%s]

", lamexp_version_major(), lamexp_version_minor(), lamexp_version_release(), lamexp_version_build(), lamexp_version_date().toString(Qt::ISODate).toLatin1().constData()); aboutText += "Please visit the official web-site at "; aboutText += LINK("http://mulder.dummwiedeutsch.de/") += " for news and updates!
"; aboutText += "

"; aboutText += "This program is free software; you can redistribute it and/or
"; aboutText += "modify it under the terms of the GNU General Public License
"; aboutText += "as published by the Free Software Foundation; either version 2
"; aboutText += "of the License, or (at your option) any later version.

"; aboutText += "This program is distributed in the hope that it will be useful,
"; aboutText += "but WITHOUT ANY WARRANTY; without even the implied warranty of
"; aboutText += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
"; aboutText += "GNU General Public License for more details.

"; aboutText += "You should have received a copy of the GNU General Public License
"; aboutText += "along with this program; if not, write to the Free Software
"; aboutText += "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

"; if(!firstStart) { aboutText += QString("
Please see %1 for details!

").arg(LINK("http://www.gnu.org/licenses/gpl-2.0.txt")); } aboutText += "

"; aboutText += QString("Special thanks go out to \"John33\" from %1 for his continuous support.
").arg(LINK("http://www.rarewares.org/")); setText(aboutText); setIconPixmap(dynamic_cast(QApplication::instance())->windowIcon().pixmap(QSize(64,64))); setWindowTitle("About LameXP"); if(firstStart) { QPushButton *firstButton = addButton("Show License Text", QMessageBox::AcceptRole); firstButton->setIcon(QIcon(":/icons/script.png")); firstButton->setMinimumWidth(135); firstButton->disconnect(); connect(firstButton, SIGNAL(clicked()), this, SLOT(openLicenseText())); QPushButton *secondButton = addButton("Accept License", QMessageBox::AcceptRole); secondButton->setIcon(QIcon(":/icons/accept.png")); secondButton->setMinimumWidth(120); QPushButton *thirdButton = addButton("Decline License", QMessageBox::AcceptRole); thirdButton->setIcon(QIcon(":/icons/delete.png")); thirdButton->setMinimumWidth(120); thirdButton->setEnabled(false); } else { QPushButton *firstButton = addButton("3rd Party S/W", QMessageBox::AcceptRole); firstButton->setIcon(QIcon(":/icons/page_white_cplusplus.png")); firstButton->setMinimumWidth(120); firstButton->disconnect(); connect(firstButton, SIGNAL(clicked()), this, SLOT(showMoreAbout())); QPushButton *secondButton = addButton("Contributors", QMessageBox::AcceptRole); secondButton->setIcon(QIcon(":icons/user_suit.png")); secondButton->setMinimumWidth(120); secondButton->disconnect(); connect(secondButton, SIGNAL(clicked()), this, SLOT(showAboutContributors())); QPushButton *thirdButton = addButton("About Qt4", QMessageBox::AcceptRole); thirdButton->setIcon(QIcon(":/images/Qt.svg")); thirdButton->setMinimumWidth(120); thirdButton->disconnect(); connect(thirdButton, SIGNAL(clicked()), this, SLOT(showAboutQt())); QPushButton *fourthButton = addButton("Discard", QMessageBox::AcceptRole); fourthButton->setIcon(QIcon(":/icons/cross.png")); fourthButton->setMinimumWidth(90); } m_firstShow = firstStart; } AboutDialog::~AboutDialog(void) { } //////////////////////////////////////////////////////////// // Public Functions //////////////////////////////////////////////////////////// int AboutDialog::exec() { if(m_settings->soundsEnabled()) { if(!m_firstShow || !playResoureSound("imageres.dll", 5080, true)) { PlaySound(MAKEINTRESOURCE(IDR_WAVE_ABOUT), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC); } } switch(QMessageBox::exec()) { case 1: return 1; break; case 2: return -1; break; default: return 0; break; } } //////////////////////////////////////////////////////////// // Slots //////////////////////////////////////////////////////////// void AboutDialog::enableButtons(void) { const QList buttonList = buttons(); for(int i = 0; i < buttonList.count(); i++) { buttonList.at(i)->setEnabled(true); } setCursor(QCursor(Qt::ArrowCursor)); } void AboutDialog::openLicenseText(void) { QDesktopServices::openUrl(QUrl("http://www.gnu.org/licenses/gpl-2.0.txt")); } void AboutDialog::showAboutQt(void) { QMessageBox::aboutQt(this); } void AboutDialog::showAboutContributors(void) { QString contributorsAboutText; contributorsAboutText += "

The following people have contributed to LameXP:

"; contributorsAboutText += "Translators:"; contributorsAboutText += ""; contributorsAboutText += CONTRIBUTOR("Englisch", "LoRd_MuldeR <MuldeR2@GMX.de>", ":/flags/gb.png"); contributorsAboutText += CONTRIBUTOR("Deutsch", "LoRd_MuldeR <MuldeR2@GMX.de>", ":/flags/de.png"); contributorsAboutText += "
"; contributorsAboutText += "

"; contributorsAboutText += "If you are willing to contribute a LameXP translation, feel free to contact us!
"; QMessageBox *contributorsAboutBox = new QMessageBox(this); contributorsAboutBox->setText(contributorsAboutText); contributorsAboutBox->setIconPixmap(dynamic_cast(QApplication::instance())->windowIcon().pixmap(QSize(64,64))); QPushButton *closeButton = contributorsAboutBox->addButton("Discard", QMessageBox::AcceptRole); closeButton->setIcon(QIcon(":/icons/cross.png")); closeButton->setMinimumWidth(90); contributorsAboutBox->setWindowTitle("About Contributors"); contributorsAboutBox->setIconPixmap(QIcon(":/images/Logo_Contributors.png").pixmap(QSize(64,74))); contributorsAboutBox->setWindowIcon(QIcon(":/icons/user_suit.png")); contributorsAboutBox->exec(); LAMEXP_DELETE(contributorsAboutBox); } void AboutDialog::showMoreAbout(void) { QString moreAboutText; moreAboutText += "

The following third-party software is used in LameXP:

"; moreAboutText += "
    "; moreAboutText += VSTR( "
  • LAME - OpenSource mp3 Encoder (%1)
    ", "lame.exe", "v?.?? a??"); moreAboutText += "Released under the terms of the GNU Leser General Public License.
    "; moreAboutText += LINK("http://lame.sourceforge.net/"); moreAboutText += "
    "; moreAboutText += VSTR("
  • OggEnc - Ogg Vorbis Encoder (%1)", "oggenc2_i386.exe", "v?.??"); moreAboutText += "
    Completely open and patent-free audio encoding technology.
    "; moreAboutText += LINK("http://www.vorbis.com/"); moreAboutText += "
    "; moreAboutText += VSTR("
  • Nero AAC reference MPEG-4 Encoder (%1)
    ", "neroAacEnc.exe", "v?.?.?.?"); moreAboutText += "Freeware state-of-the-art HE-AAC encoder with 2-Pass support.
    "; moreAboutText += "Available from vendor web-site as free download:
    "; moreAboutText += LINK(neroAacUrl); moreAboutText += "
    "; moreAboutText += VSTR("
  • FLAC - Free Lossless Audio Codec (%1)
    ", "flac.exe", "v?.?.?"); moreAboutText += "Open and patent-free lossless audio compression technology.
    "; moreAboutText += LINK("http://flac.sourceforge.net/"); moreAboutText += "
    "; moreAboutText += VSTR("
  • MediaInfo - Media File Analysis Tool (%1)
    ", "mediainfo_i386.exe", "v?.?.?"); moreAboutText += "Released under the terms of the GNU Leser General Public License.
    "; moreAboutText += LINK("http://mediainfo.sourceforge.net/"); moreAboutText += "
    "; moreAboutText += VSTR("
  • SoX - Sound eXchange (%1)
    ", "sox.exe", "v??.?.?"); moreAboutText += "Released under the terms of the GNU Leser General Public License.
    "; moreAboutText += LINK("http://sox.sourceforge.net/"); moreAboutText += "
    "; moreAboutText += "
  • Silk Icons - Over 700 icons in PNG format (v1.3)
    "; moreAboutText += "By Mark James, released under the Creative Commons 'by' License.
    "; moreAboutText += LINK("http://www.famfamfam.com/lab/icons/silk/"); moreAboutText += "
"; QMessageBox *moreAboutBox = new QMessageBox(this); moreAboutBox->setText(moreAboutText); moreAboutBox->setIconPixmap(dynamic_cast(QApplication::instance())->windowIcon().pixmap(QSize(64,64))); QPushButton *closeButton = moreAboutBox->addButton("Discard", QMessageBox::AcceptRole); closeButton->setIcon(QIcon(":/icons/cross.png")); closeButton->setMinimumWidth(90); moreAboutBox->setWindowTitle("About Third-party Software"); moreAboutBox->setIconPixmap(QIcon(":/images/Logo_Software.png").pixmap(QSize(64,71))); moreAboutBox->setWindowIcon(QIcon(":/icons/page_white_cplusplus.png")); moreAboutBox->exec(); LAMEXP_DELETE(moreAboutBox); } //////////////////////////////////////////////////////////// // Protected Functions //////////////////////////////////////////////////////////// void AboutDialog::showEvent(QShowEvent *e) { QDialog::showEvent(e); if(m_firstShow) { const QList buttonList = buttons(); for(int i = 1; i < buttonList.count(); i++) { buttonList.at(i)->setEnabled(false); } QTimer::singleShot(5000, this, SLOT(enableButtons())); setCursor(QCursor(Qt::WaitCursor)); } } //////////////////////////////////////////////////////////// // Private Functions //////////////////////////////////////////////////////////// bool AboutDialog::playResoureSound(const QString &library, const unsigned long soundId, const bool async) { HMODULE module = 0; DWORD flags = SND_RESOURCE; bool result = false; QFileInfo libraryFile(library); if(!libraryFile.isAbsolute()) { unsigned int buffSize = GetSystemDirectoryW(NULL, NULL) + 1; wchar_t *buffer = (wchar_t*) _malloca(buffSize * sizeof(wchar_t)); unsigned int result = GetSystemDirectory(buffer, buffSize); if(result > 0 && result < buffSize) { libraryFile.setFile(QString("%1/%2").arg(QDir::fromNativeSeparators(QString::fromUtf16(reinterpret_cast(buffer))), library)); } _freea(buffer); } if(async) { flags |= SND_ASYNC; } else { flags |= SND_SYNC; } module = LoadLibraryW(reinterpret_cast(QDir::toNativeSeparators(libraryFile.absoluteFilePath()).utf16())); if(module) { result = PlaySound((LPCTSTR) soundId, module, flags); FreeLibrary(module); } return result; }