PageEditTeam: Disable sound test button when frontend sounds are disabled
authorWuzzy <Wuzzy2@mail.ru>
Fri, 31 May 2019 21:10:17 +0200
changeset 15090 33eca3f0a9aa
parent 15089 24994035a0e0
child 15091 5c8c729a16ce
PageEditTeam: Disable sound test button when frontend sounds are disabled
QTfrontend/hwform.cpp
QTfrontend/hwform.h
QTfrontend/ui/page/pageeditteam.cpp
QTfrontend/ui/page/pageeditteam.h
--- a/QTfrontend/hwform.cpp	Fri May 31 21:34:32 2019 +0300
+++ b/QTfrontend/hwform.cpp	Fri May 31 21:10:17 2019 +0200
@@ -168,6 +168,9 @@
 
     config = new GameUIConfig(this, DataManager::instance().settingsFileName());
     frontendEffects = config->value("frontend/effects", true).toBool();
+    bool frontendSounds = config->value("frontend/sound", true).toBool();
+    onFrontendSoundsToggled(frontendSounds);
+
     playerHash = QString(QCryptographicHash::hash(config->value("net/nick", config->getRandomNick()).toString().toUtf8(), QCryptographicHash::Md5).toHex());
 
     // Icons for finished missions
@@ -289,6 +292,7 @@
     connect(ui.pageOptions->SchemeNew, SIGNAL(clicked()), this, SLOT(GoToNewScheme()));
     connect(ui.pageOptions->SchemeDelete, SIGNAL(clicked()), this, SLOT(DeleteScheme()));
     connect(ui.pageOptions->CBFrontendEffects, SIGNAL(toggled(bool)), this, SLOT(onFrontendEffects(bool)) );
+    connect(ui.pageOptions->CBFrontendSound, SIGNAL(toggled(bool)), this, SLOT(onFrontendSoundsToggled(bool)));
 
     connect(ui.pageNet->BtnSpecifyServer, SIGNAL(clicked()), this, SLOT(NetConnect()));
     connect(ui.pageNet->BtnNetSvrStart, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
@@ -410,6 +414,11 @@
         wBackground->stopAnimation();
 }
 
+void HWForm::onFrontendSoundsToggled(bool value)
+{
+    ui.pageEditTeam->frontendSoundsToggled(value);
+}
+
 /*
 void HWForm::keyReleaseEvent(QKeyEvent *event)
 {
--- a/QTfrontend/hwform.h	Fri May 31 21:34:32 2019 +0300
+++ b/QTfrontend/hwform.h	Fri May 31 21:10:17 2019 +0200
@@ -132,6 +132,7 @@
         void EditWeapons(QString oldWeaponsName, QString newWeaponsName, QString ammo);
         void onFrontendFullscreen(bool value);
         void onFrontendEffects(bool value);
+        void onFrontendSoundsToggled(bool value);
         void Music(bool checked);
         void UpdateCampaignPage(int index);
         void UpdateCampaignPageTeam(int index);
--- a/QTfrontend/ui/page/pageeditteam.cpp	Fri May 31 21:34:32 2019 +0300
+++ b/QTfrontend/ui/page/pageeditteam.cpp	Fri May 31 21:10:17 2019 +0200
@@ -440,6 +440,11 @@
     hboxCPUWidget->setHidden(index == 0);
 }
 
+void PageEditTeam::frontendSoundsToggled(bool value)
+{
+    btnTestSound->setEnabled(value);
+}
+
 void PageEditTeam::testSound()
 {
     DataManager & dataMgr = DataManager::instance();
--- a/QTfrontend/ui/page/pageeditteam.h	Fri May 31 21:34:32 2019 +0300
+++ b/QTfrontend/ui/page/pageeditteam.h	Fri May 31 21:10:17 2019 +0200
@@ -45,6 +45,7 @@
     public slots:
         void CBTeamLvl_activated(const int index);
         void CBFort_activated(const int index);
+        void frontendSoundsToggled(bool value);
 
     private:
         QTabWidget * tbw;