QTfrontend/pages.cpp
changeset 1684 b3f4ec08f0a4
parent 1677 0655bb13af01
child 1701 ad7a7fd14d36
--- a/QTfrontend/pages.cpp	Fri Jan 16 15:43:19 2009 +0000
+++ b/QTfrontend/pages.cpp	Fri Jan 16 18:37:21 2009 +0000
@@ -164,16 +164,23 @@
 	CBGrave->setMaxCount(65535);
 	CBGrave->setIconSize(QSize(32, 32));
 	GBTLayout->addWidget(CBGrave);
-	
-	CBVoicepack = new QComboBox(GBoxTeam);
+
 	{
-		QDir tmpdir;
-		tmpdir.cd(datadir->absolutePath());
-		tmpdir.cd("Sounds/voices");
-		QStringList list = tmpdir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name);
-		CBVoicepack->addItems(list);
+		QHBoxLayout * hbox = new QHBoxLayout();
+		CBVoicepack = new QComboBox(GBoxTeam);
+		{
+			QDir tmpdir;
+			tmpdir.cd(datadir->absolutePath());
+			tmpdir.cd("Sounds/voices");
+			QStringList list = tmpdir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name);
+			CBVoicepack->addItems(list);
+		}
+		hbox->addWidget(CBVoicepack, 100);
+		BtnTestSound = addButton(":/res/lightbulb_on.png", hbox, 1, true);
+		hbox->setStretchFactor(BtnTestSound, 1);
+		connect(BtnTestSound, SIGNAL(clicked()), this, SLOT(testSound()));
+		GBTLayout->addLayout(hbox);
 	}
-	GBTLayout->addWidget(CBVoicepack);
 
 	GBoxFort = new QGroupBox(this);
 	GBoxFort->setTitle(QGroupBox::tr("Fort"));
@@ -257,6 +264,17 @@
 	FortPreview->setPixmap(pix);
 }
 
+void PageEditTeam::testSound()
+{
+	QDir tmpdir;
+	tmpdir.cd(datadir->absolutePath());
+	tmpdir.cd("Sounds/voices");
+	tmpdir.cd(CBVoicepack->currentText());
+	QStringList list = tmpdir.entryList(QStringList() << "*.ogg", QDir::Files);
+	if (list.size())
+		;//QSound::play(tmpdir.absolutePath() + list[rand() % list.size()]);
+}
+
 PageMultiplayer::PageMultiplayer(QWidget* parent) :
   AbstractPage(parent)
 {