From 800c94abd379e288968bb3fef73963a47127571c Mon Sep 17 00:00:00 2001 From: lordmulder Date: Sat, 18 Dec 2010 16:49:04 +0100 Subject: [PATCH] Clean-up about dialog a bit. --- res/Icons.qrc | 1 + src/Config.h | 2 +- src/Dialog_About.cpp | 60 ++++++++++++++++++++++++++++++++++++++++---- src/Dialog_About.h | 2 ++ 4 files changed, 59 insertions(+), 6 deletions(-) diff --git a/res/Icons.qrc b/res/Icons.qrc index 6fccecd4..d4fa9f82 100644 --- a/res/Icons.qrc +++ b/res/Icons.qrc @@ -56,6 +56,7 @@ icons/paste_plain.png icons/play.png icons/resultset_next.png + icons/script.png icons/script_edit.png icons/server_error.png icons/sound.png diff --git a/src/Config.h b/src/Config.h index d00118d5..ebe616c2 100644 --- a/src/Config.h +++ b/src/Config.h @@ -25,7 +25,7 @@ #define VER_LAMEXP_MAJOR 4 #define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_LO 0 -#define VER_LAMEXP_BUILD 162 +#define VER_LAMEXP_BUILD 163 #define VER_LAMEXP_SUFFIX TechPreview /* diff --git a/src/Dialog_About.cpp b/src/Dialog_About.cpp index 93897ed6..b6195797 100644 --- a/src/Dialog_About.cpp +++ b/src/Dialog_About.cpp @@ -33,6 +33,8 @@ #include #include #include +#include +#include //Win32 includes #include @@ -73,10 +75,11 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta 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 += "This software uses the 'slick' icon set by Mark James – http://www.famfamfam.com/.
"; - aboutText += "Released under the Creative Commons Attribution 2.5 License.
"; - aboutText += "
"; aboutText += QString("Special thanks go out to \"John33\" from %1 for his continuous support.
").arg(LINK("http://www.rarewares.org/")); setText(aboutText); @@ -86,7 +89,7 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta if(firstStart) { QPushButton *firstButton = addButton("Show License Text", QMessageBox::AcceptRole); - firstButton->setIcon(QIcon(":/icons/script_edit.png")); + firstButton->setIcon(QIcon(":/icons/script.png")); firstButton->setMinimumWidth(135); firstButton->disconnect(); connect(firstButton, SIGNAL(clicked()), this, SLOT(openLicenseText())); @@ -140,7 +143,10 @@ int AboutDialog::exec() { if(m_settings->soundsEnabled()) { - PlaySound(MAKEINTRESOURCE(IDR_WAVE_ABOUT), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC); + if(!m_firstShow || !playResoureSound("imageres.dll", 5080, true)) + { + PlaySound(MAKEINTRESOURCE(IDR_WAVE_ABOUT), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC); + } } switch(QMessageBox::exec()) @@ -241,6 +247,11 @@ void AboutDialog::showMoreAbout(void) 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 += "
  • 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); @@ -283,3 +294,42 @@ void AboutDialog::showEvent(QShowEvent *e) //////////////////////////////////////////////////////////// // 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; +} \ No newline at end of file diff --git a/src/Dialog_About.h b/src/Dialog_About.h index 2304df46..9ca15eb5 100644 --- a/src/Dialog_About.h +++ b/src/Dialog_About.h @@ -49,4 +49,6 @@ protected: private: bool m_firstShow; SettingsModel *m_settings; + + bool playResoureSound(const QString &library, const unsigned long soundId, const bool async); };