From 7179ad161ee9a9bc84cabbe02c7db1facc35dbf0 Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Sat, 28 Mar 2020 15:03:22 +0100 Subject: [PATCH] Catched a few more cases where MUtils::Sound::play_sound() was called directly instead of using PLAY_SOUND_OPTIONAL macro. --- src/Config.h | 2 +- src/Dialog_About.cpp | 7 ++++--- src/Dialog_MainWindow.cpp | 8 ++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Config.h b/src/Config.h index 97ee869a..2a0586e4 100644 --- a/src/Config.h +++ b/src/Config.h @@ -35,7 +35,7 @@ #define VER_LAMEXP_MINOR_LO 9 #define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_PATCH 1 -#define VER_LAMEXP_BUILD 2242 +#define VER_LAMEXP_BUILD 2244 #define VER_LAMEXP_CONFG 2188 /////////////////////////////////////////////////////////////////////////////// diff --git a/src/Dialog_About.cpp b/src/Dialog_About.cpp index c8fc4585..e3379483 100644 --- a/src/Dialog_About.cpp +++ b/src/Dialog_About.cpp @@ -62,6 +62,7 @@ //Helper macros #define LINK(URL) QString("%2").arg(URL).arg(QString(URL).replace("-", "−")) #define TRIM_RIGHT(STR) do { while(STR.endsWith(QChar(' ')) || STR.endsWith(QChar('\t')) || STR.endsWith(QChar('\r')) || STR.endsWith(QChar('\n'))) STR.chop(1); } while(0) +#define PLAY_SOUND_OPTIONAL(NAME, ASYNC) do { if(m_settings->soundsEnabled()) MUtils::Sound::play_sound((NAME), (ASYNC)); } while(0) #define MAKE_TRANSPARENT(WIDGET) do { QPalette _p = (WIDGET)->palette(); _p.setColor(QPalette::Background, Qt::transparent); (WIDGET)->setPalette(_p); } while(0) //Constants @@ -260,7 +261,7 @@ int AboutDialog::exec() } else { - MUtils::Sound::play_sound("ghost", true); + PLAY_SOUND_OPTIONAL("ghost", true); } } @@ -332,7 +333,7 @@ void AboutDialog::tabChanged(int index, const bool silent) //Play tick sound if(m_settings->soundsEnabled() && (!silent)) { - MUtils::Sound::play_sound("tick", true); + PLAY_SOUND_OPTIONAL("tick", true); } //Scroll to the top @@ -513,7 +514,7 @@ bool AboutDialog::eventFilter(QObject *obj, QEvent *event) { if((!m_disque.isNull()) && (obj == m_disque.data()) && (event->type() == QEvent::MouseButtonPress)) { - MUtils::Sound::play_sound("chicken", true); + PLAY_SOUND_OPTIONAL("chicken", true); if (!m_cartoon[0]) { QPixmap cartoon(":/images/Cartoon.png"); diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp index 45056225..ced914ea 100644 --- a/src/Dialog_MainWindow.cpp +++ b/src/Dialog_MainWindow.cpp @@ -1469,7 +1469,7 @@ void MainWindow::windowShown(void) { m_settings->licenseAccepted(1); m_settings->syncNow(); - MUtils::Sound::play_sound("woohoo", false); + PLAY_SOUND_OPTIONAL("woohoo", false); if (lamexp_version_demo()) { showAnnounceBox(); @@ -1492,7 +1492,7 @@ void MainWindow::windowShown(void) if(m_settings->licenseAccepted() <= 0) { QApplication::processEvents(); - MUtils::Sound::play_sound("whammy", false); + PLAY_SOUND_OPTIONAL("whammy", false); QMessageBox::critical(this, tr("License Declined"), tr("You have declined the license. Consequently the application will exit now!"), tr("Goodbye!")); QFileInfo uninstallerInfo = QFileInfo(QString("%1/Uninstall.exe").arg(QApplication::applicationDirPath())); if(uninstallerInfo.exists()) @@ -1514,7 +1514,7 @@ void MainWindow::windowShown(void) if(MUtils::OS::current_date() >= lamexp_version_expires()) { qWarning("Binary has expired !!!"); - MUtils::Sound::play_sound("whammy", false); + PLAY_SOUND_OPTIONAL("whammy", false); if(QMessageBox::warning(this, tr("LameXP - Expired"), NOBREAK(QString("%1
%2").arg(tr("This demo (pre-release) version of LameXP has expired at %1.").arg(lamexp_version_expires().toString(Qt::ISODate)), tr("LameXP is free software and release versions won't expire."))), tr("Check for Updates"), tr("Exit Program")) == 0) { checkForUpdates(); @@ -1557,7 +1557,7 @@ void MainWindow::windowShown(void) return; default: QEventLoop loop; QTimer::singleShot(7000, &loop, SLOT(quit())); - MUtils::Sound::play_sound("waiting", true); + PLAY_SOUND_OPTIONAL("waiting", true); showBanner(tr("Skipping update check this time, please be patient..."), &loop); break; } -- 2.11.4.GIT