skip button sound when exiting
authorbovi
Tue, 17 Jan 2012 23:42:30 +0100
changeset 6583 4218782d8ca0
parent 6582 d32b5fde9ea6
child 6584 5bb48450b978
skip button sound when exiting
QTfrontend/gameuiconfig.cpp
QTfrontend/ui/page/AbstractPage.cpp
QTfrontend/ui/page/AbstractPage.h
QTfrontend/ui/page/pagemain.cpp
QTfrontend/ui/widget/bgwidget.cpp
QTfrontend/ui/widget/qpushbuttonwithsound.cpp
QTfrontend/ui/widget/qpushbuttonwithsound.h
--- a/QTfrontend/gameuiconfig.cpp	Tue Jan 17 23:36:15 2012 +0100
+++ b/QTfrontend/gameuiconfig.cpp	Tue Jan 17 23:42:30 2012 +0100
@@ -61,7 +61,7 @@
     Form->ui.pageOptions->CBFrontendEffects->setChecked(frontendEffects);
     Form->ui.pageOptions->CBEnableSound->setChecked(value("audio/sound", true).toBool());
     Form->ui.pageOptions->CBEnableFrontendSound->setChecked(value("frontend/sound", true).toBool());
-    Form->ui.pageOptions->CBEnableMusic->setChecked(value("audio/music", true).toBool());
+    Form->ui.pageOptions->CBEnableMusic->setChecked(value(" audio/music", true).toBool());
     Form->ui.pageOptions->CBEnableFrontendMusic->setChecked(value("frontend/music", true).toBool());
     Form->ui.pageOptions->volumeBox->setValue(value("audio/volume", 100).toUInt());
 
--- a/QTfrontend/ui/page/AbstractPage.cpp	Tue Jan 17 23:36:15 2012 +0100
+++ b/QTfrontend/ui/page/AbstractPage.cpp	Tue Jan 17 23:42:30 2012 +0100
@@ -71,7 +71,7 @@
     connectSignals();
 }
 
-QPushButton * AbstractPage::formattedButton(const QString & name, bool hasIcon)
+QPushButtonWithSound * AbstractPage::formattedButton(const QString & name, bool hasIcon)
 {
     QPushButtonWithSound * btn = new QPushButtonWithSound(this);
 
@@ -93,16 +93,16 @@
     return btn;
 }
 
-QPushButton * AbstractPage::addButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan, int columnSpan, bool hasIcon)
+QPushButtonWithSound * AbstractPage::addButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan, int columnSpan, bool hasIcon)
 {
-    QPushButton * btn = formattedButton(name, hasIcon);
+    QPushButtonWithSound * btn = formattedButton(name, hasIcon);
     grid->addWidget(btn, row, column, rowSpan, columnSpan);
     return btn;
 }
 
-QPushButton * AbstractPage::addButton(const QString & name, QBoxLayout * box, int where, bool hasIcon)
+QPushButtonWithSound * AbstractPage::addButton(const QString & name, QBoxLayout * box, int where, bool hasIcon)
 {
-    QPushButton * btn = formattedButton(name, hasIcon);
+    QPushButtonWithSound * btn = formattedButton(name, hasIcon);
     box->addWidget(btn, where);
     return btn;
 }
--- a/QTfrontend/ui/page/AbstractPage.h	Tue Jan 17 23:36:15 2012 +0100
+++ b/QTfrontend/ui/page/AbstractPage.h	Tue Jan 17 23:42:30 2012 +0100
@@ -25,13 +25,13 @@
 #define ABSTRACTPAGE_H
 
 #include <QWidget>
-#include <QPushButton>
+#include <qpushbuttonwithsound.h>
 #include <QFont>
 #include <QGridLayout>
 #include <QComboBox>
 #include <QSignalMapper>
 
-class QPushButton;
+class QPushButtonWithSound;
 class QGroupBox;
 class QComboBox;
 class QLabel;
@@ -134,7 +134,7 @@
          *
          * @return the button.
          */
-        QPushButton * formattedButton(const QString & name, bool hasIcon = false);
+        QPushButtonWithSound * formattedButton(const QString & name, bool hasIcon = false);
 
         /**
          * @brief Creates a default formatted button and adds it to a
@@ -150,7 +150,7 @@
          *
          * @return the button.
          */
-        QPushButton * addButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan = 1, int columnSpan = 1, bool hasIcon = false);
+        QPushButtonWithSound * addButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan = 1, int columnSpan = 1, bool hasIcon = false);
 
         /**
          * @brief Creates a default formatted button and adds it to a
@@ -163,7 +163,7 @@
          *
          * @return the button.
          */
-        QPushButton * addButton(const QString & name, QBoxLayout * box, int where, bool hasIcon = false);
+        QPushButtonWithSound * addButton(const QString & name, QBoxLayout * box, int where, bool hasIcon = false);
 
         /**
          * @brief Changes visibility of the back-button.
@@ -177,9 +177,7 @@
         QLabel * descLabel; ///< text description
         QString * defautDesc;
 
-    private:
-
-        QPushButton * btnBack; ///< back button
+        QPushButtonWithSound * btnBack; ///< back button
 };
 
 #endif
--- a/QTfrontend/ui/page/pagemain.cpp	Tue Jan 17 23:36:15 2012 +0100
+++ b/QTfrontend/ui/page/pagemain.cpp	Tue Jan 17 23:42:30 2012 +0100
@@ -67,6 +67,9 @@
     BtnDataDownload->setWhatsThis(tr("Access the user created content downloadable from our website"));
     pageLayout->setAlignment(BtnDataDownload, Qt::AlignHCenter);
 
+    // disable exit button sound
+    btnBack->isSoundEnabled = false;
+
     return pageLayout;
 }
 
--- a/QTfrontend/ui/widget/bgwidget.cpp	Tue Jan 17 23:36:15 2012 +0100
+++ b/QTfrontend/ui/widget/bgwidget.cpp	Tue Jan 17 23:42:30 2012 +0100
@@ -182,7 +182,7 @@
 void BGWidget::stopAnimation()
 {
     timerAnimation->stop();
-	repaint();
+    repaint();
 }
 
 void BGWidget::init()
--- a/QTfrontend/ui/widget/qpushbuttonwithsound.cpp	Tue Jan 17 23:36:15 2012 +0100
+++ b/QTfrontend/ui/widget/qpushbuttonwithsound.cpp	Tue Jan 17 23:42:30 2012 +0100
@@ -8,14 +8,15 @@
 #include <gameuiconfig.h>
 
 QPushButtonWithSound::QPushButtonWithSound(QWidget *parent) :
-    QPushButton(parent)
+    QPushButton(parent),
+    isSoundEnabled(true)
 {
     connect(this, SIGNAL(clicked()), this, SLOT(buttonClicked()));
 }
 
 void QPushButtonWithSound::buttonClicked()
 {
-    if (!HWForm::config->isFrontendSoundEnabled())
+    if ( !isSoundEnabled || !HWForm::config->isFrontendSoundEnabled())
         return;
 
     HWDataManager & dataMgr = HWDataManager::instance();
--- a/QTfrontend/ui/widget/qpushbuttonwithsound.h	Tue Jan 17 23:36:15 2012 +0100
+++ b/QTfrontend/ui/widget/qpushbuttonwithsound.h	Tue Jan 17 23:42:30 2012 +0100
@@ -8,7 +8,7 @@
     Q_OBJECT
 public:
     explicit QPushButtonWithSound(QWidget *parent = 0);
-
+    bool isSoundEnabled;
 signals:
     
 public slots: