Only enable chirp for room owner
authornemo
Tue, 09 Feb 2010 03:21:09 +0000
changeset 2776 9572aae13d49
parent 2775 3445ce5e9c79
child 2777 95a1a69d491c
Only enable chirp for room owner
QTfrontend/chatwidget.cpp
QTfrontend/chatwidget.h
QTfrontend/gameuiconfig.cpp
QTfrontend/gameuiconfig.h
QTfrontend/hwform.cpp
QTfrontend/newnetclient.cpp
QTfrontend/newnetclient.h
QTfrontend/pages.cpp
QTfrontend/pages.h
--- a/QTfrontend/chatwidget.cpp	Tue Feb 09 02:03:31 2010 +0000
+++ b/QTfrontend/chatwidget.cpp	Tue Feb 09 03:21:09 2010 +0000
@@ -37,7 +37,7 @@
     this->gameSettings = gameSettings;
     this->sdli = sdli;
     this->notify = notify;
-    if(notify && gameSettings->value("audio/sound", true).toBool()) {
+    if(notify && gameSettings->value("audio/frontendsound", true).toBool()) {
        QDir tmpdir;
 
        tmpdir.cd(datadir->absolutePath());
@@ -126,13 +126,13 @@
 	chatText->moveCursor(QTextCursor::End);
 }
 
-void HWChatWidget::nickAdded(const QString& nick)
+void HWChatWidget::nickAdded(const QString& nick, bool isChief)
 {
 	QListWidgetItem * item = new QListWidgetItem(nick);
 	item->setIcon(QIcon(":/res/hh_small.png"));
 	chatNicks->addItem(item);
 
-    if(notify && gameSettings->value("audio/sound", true).toBool()) {
+    if(isChief && notify && gameSettings->value("audio/frontendsound", true).toBool()) {
        Mix_PlayChannel(-1, sound, 0);
     }
 }
--- a/QTfrontend/chatwidget.h	Tue Feb 09 02:03:31 2010 +0000
+++ b/QTfrontend/chatwidget.h	Tue Feb 09 03:21:09 2010 +0000
@@ -42,7 +42,7 @@
  public slots:
   void onChatString(const QString& str);
   void onServerMessage(const QString& str);
-  void nickAdded(const QString& nick);
+  void nickAdded(const QString& nick, bool isChief);
   void nickRemoved(const QString& nick);
   void clear();
   void setReadyStatus(const QString & nick, bool isReady);
--- a/QTfrontend/gameuiconfig.cpp	Tue Feb 09 02:03:31 2010 +0000
+++ b/QTfrontend/gameuiconfig.cpp	Tue Feb 09 03:21:09 2010 +0000
@@ -34,7 +34,7 @@
 {
 	Form = FormWidgets;
 
-	connect(Form->ui.pageOptions->CBEnableMusic, SIGNAL(toggled(bool)), Form, SLOT(Music(bool)));
+	connect(Form->ui.pageOptions->CBEnableFrontendMusic, SIGNAL(toggled(bool)), Form, SLOT(Music(bool)));
 
 	//Form->resize(value("window/width", 640).toUInt(), value("window/height", 450).toUInt());
 	resizeToConfigValues();
@@ -50,10 +50,12 @@
 	Form->ui.pageOptions->CBReduceQuality->setChecked(value("video/reducequality", false).toBool());
 	Form->ui.pageOptions->CBFrontendEffects->setChecked(frontendEffects);
 	Form->ui.pageOptions->CBEnableSound->setChecked(value("audio/sound", true).toBool());
+	Form->ui.pageOptions->CBEnableFrontendSound->setChecked(value("audio/frontendsound", true).toBool());
 #ifdef _WIN32
 //	Form->ui.pageOptions->CBHardwareSound->setChecked(value("audio/hardware", false).toBool());
 #endif
 	Form->ui.pageOptions->CBEnableMusic->setChecked(value("audio/music", true).toBool());
+	Form->ui.pageOptions->CBEnableFrontendMusic->setChecked(value("audio/frontendmusic", true).toBool());
 	Form->ui.pageOptions->volumeBox->setValue(value("audio/volume", 100).toUInt());
 
 	QString netNick = value("net/nick", "").toString();
@@ -126,10 +128,12 @@
 	}
 
 	setValue("audio/sound", isSoundEnabled());
+	setValue("audio/frontendsound", isFrontendSoundEnabled());
 #ifdef _WIN32
 //	setValue("audio/hardware", isSoundHardware());
 #endif
 	setValue("audio/music", isMusicEnabled());
+	setValue("audio/frontendmusic", isFrontendMusicEnabled());
 	setValue("audio/volume", Form->ui.pageOptions->volumeBox->value());
 
 	setValue("net/nick", netNick());
@@ -190,6 +194,10 @@
 {
 	return Form->ui.pageOptions->CBEnableSound->isChecked();
 }
+bool GameUIConfig::isFrontendSoundEnabled()
+{
+	return Form->ui.pageOptions->CBEnableFrontendSound->isChecked();
+}
 
 #ifdef _WIN32
 bool GameUIConfig::isSoundHardware()
@@ -203,6 +211,10 @@
 {
 	return Form->ui.pageOptions->CBEnableMusic->isChecked();
 }
+bool GameUIConfig::isFrontendMusicEnabled()
+{
+	return Form->ui.pageOptions->CBEnableFrontendMusic->isChecked();
+}
 
 bool GameUIConfig::isShowFPSEnabled()
 {
--- a/QTfrontend/gameuiconfig.h	Tue Feb 09 02:03:31 2010 +0000
+++ b/QTfrontend/gameuiconfig.h	Tue Feb 09 03:21:09 2010 +0000
@@ -36,10 +36,12 @@
 	QRect vid_Resolution();
 	bool vid_Fullscreen();
 	bool isSoundEnabled();
+	bool isFrontendSoundEnabled();
 #ifdef _WIN32
 	bool isSoundHardware();
 #endif
 	bool isMusicEnabled();
+	bool isFrontendMusicEnabled();
 	bool isShowFPSEnabled();
 	bool isAltDamageEnabled();
 	bool appendDateTimeToRecordName();
--- a/QTfrontend/hwform.cpp	Tue Feb 09 02:03:31 2010 +0000
+++ b/QTfrontend/hwform.cpp	Tue Feb 09 03:21:09 2010 +0000
@@ -637,12 +637,12 @@
 		ui.pageRoomsList->chatWidget, SLOT(onChatString(const QString&)));
 
 // nick list stuff
-	connect(hwnet, SIGNAL(nickAdded(const QString&)),
-		ui.pageNetGame->pChatWidget, SLOT(nickAdded(const QString&)));
+	connect(hwnet, SIGNAL(nickAdded(const QString&, bool)),
+		ui.pageNetGame->pChatWidget, SLOT(nickAdded(const QString&, bool)));
 	connect(hwnet, SIGNAL(nickRemoved(const QString&)),
 		ui.pageNetGame->pChatWidget, SLOT(nickRemoved(const QString&)));
-	connect(hwnet, SIGNAL(nickAddedLobby(const QString&)),
-		ui.pageRoomsList->chatWidget, SLOT(nickAdded(const QString&)));
+	connect(hwnet, SIGNAL(nickAddedLobby(const QString&, bool)),
+		ui.pageRoomsList->chatWidget, SLOT(nickAdded(const QString&, bool)));
 	connect(hwnet, SIGNAL(nickRemovedLobby(const QString&)),
 		ui.pageRoomsList->chatWidget, SLOT(nickRemoved(const QString&)));
 
@@ -793,7 +793,7 @@
 		case gsFinished: {
 			//setVisible(true);
 			GoBack();
-			Music(ui.pageOptions->CBEnableMusic->isChecked());
+			Music(ui.pageOptions->CBEnableFrontendMusic->isChecked());
 			if (wBackground) wBackground->startAnimation();
 			GoToPage(ID_PAGE_GAMESTATS);
 			if (hwnet) hwnet->gameFinished();
@@ -804,7 +804,7 @@
 			quint8 id = ui.Pages->currentIndex();
 			if (id == ID_PAGE_INGAME) {
 				GoBack();
-				Music(ui.pageOptions->CBEnableMusic->isChecked());
+				Music(ui.pageOptions->CBEnableFrontendMusic->isChecked());
 				if (wBackground) wBackground->startAnimation();
 				if (hwnet) hwnet->gameFinished();
 			}
--- a/QTfrontend/newnetclient.cpp	Tue Feb 09 02:03:31 2010 +0000
+++ b/QTfrontend/newnetclient.cpp	Tue Feb 09 03:21:09 2010 +0000
@@ -375,7 +375,7 @@
 				if (isChief)
 					emit configAsked();
 			}
-			emit nickAdded(lst[i]);
+			emit nickAdded(lst[i], isChief);
 			emit chatStringFromNet(tr("%1 *** %2 has joined the room").arg('\x03').arg(lst[i]));
 		}
 		return;
@@ -397,7 +397,7 @@
 				emit Connected();
 			}
 
-			emit nickAddedLobby(lst[i]);
+			emit nickAddedLobby(lst[i], false);
 			emit chatStringLobby(tr("%1 *** %2 has joined").arg('\x03').arg(lst[i]));
 		}
 		return;
--- a/QTfrontend/newnetclient.h	Tue Feb 09 02:03:31 2010 +0000
+++ b/QTfrontend/newnetclient.h	Tue Feb 09 03:21:09 2010 +0000
@@ -90,9 +90,9 @@
   void Disconnected();
   void EnteredGame();
   void LeftRoom();
-  void nickAdded(const QString& nick);
+  void nickAdded(const QString& nick, bool isChief);
   void nickRemoved(const QString& nick);
-  void nickAddedLobby(const QString& nick);
+  void nickAddedLobby(const QString& nick, bool isChief);
   void nickRemovedLobby(const QString& nick);
   void FromNet(const QByteArray & buf);
   void adminAccess(bool);
--- a/QTfrontend/pages.cpp	Tue Feb 09 02:03:31 2010 +0000
+++ b/QTfrontend/pages.cpp	Tue Feb 09 03:21:09 2010 +0000
@@ -454,10 +454,19 @@
             CBEnableSound = new QCheckBox(AGGroupBox);
             CBEnableSound->setText(QCheckBox::tr("Enable sound"));
             GBAlayout->addWidget(CBEnableSound);
+
+            CBEnableFrontendSound = new QCheckBox(AGGroupBox);
+            CBEnableFrontendSound->setText(QCheckBox::tr("Enable frontend sounds"));
+            GBAlayout->addWidget(CBEnableFrontendSound);
+
             CBEnableMusic = new QCheckBox(AGGroupBox);
             CBEnableMusic->setText(QCheckBox::tr("Enable music"));
             GBAlayout->addWidget(CBEnableMusic);
 
+            CBEnableFrontendMusic = new QCheckBox(AGGroupBox);
+            CBEnableFrontendMusic->setText(QCheckBox::tr("Enable frontend music"));
+            GBAlayout->addWidget(CBEnableFrontendMusic);
+
             QHBoxLayout * GBAvollayout = new QHBoxLayout(0);
             QLabel * vol = new QLabel(AGGroupBox);
             vol->setText(QLabel::tr("Initial sound volume"));
--- a/QTfrontend/pages.h	Tue Feb 09 02:03:31 2010 +0000
+++ b/QTfrontend/pages.h	Tue Feb 09 03:21:09 2010 +0000
@@ -215,10 +215,12 @@
 	IconedGroupBox *AGGroupBox;
 	QComboBox *CBResolution;
 	QCheckBox *CBEnableSound;
+	QCheckBox *CBEnableFrontendSound;
 #ifdef _WIN32
 	QCheckBox *CBHardwareSound;
 #endif
 	QCheckBox *CBEnableMusic;
+	QCheckBox *CBEnableFrontendMusic;
 	QCheckBox *CBFullscreen;
 	QCheckBox *CBFrontendFullscreen;
 	QCheckBox *CBShowFPS;