OSDN Git Service

Catched a few more cases where MUtils::Sound::play_sound() was called directly instea...
authorLoRd_MuldeR <mulder2@gmx.de>
Sat, 28 Mar 2020 14:03:22 +0000 (15:03 +0100)
committerLoRd_MuldeR <mulder2@gmx.de>
Sat, 28 Mar 2020 14:03:22 +0000 (15:03 +0100)
src/Config.h
src/Dialog_About.cpp
src/Dialog_MainWindow.cpp

index 97ee869..2a0586e 100644 (file)
@@ -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
 
 ///////////////////////////////////////////////////////////////////////////////
index c8fc458..e337948 100644 (file)
@@ -62,6 +62,7 @@
 //Helper macros
 #define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(QString(URL).replace("-", "&minus;"))
 #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");
index 4505622..ced914e 100644 (file)
@@ -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<br>%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;
                }