A button for checking voicepack (doesn't work yet)
authorunc0rr
Fri, 16 Jan 2009 18:37:21 +0000
changeset 1684 b3f4ec08f0a4
parent 1683 af34da5726aa
child 1685 0b61b158ad2a
A button for checking voicepack (doesn't work yet)
QTfrontend/SDLs.cpp
QTfrontend/SDLs.h
QTfrontend/pages.cpp
QTfrontend/pages.h
--- a/QTfrontend/SDLs.cpp	Fri Jan 16 15:43:19 2009 +0000
+++ b/QTfrontend/SDLs.cpp	Fri Jan 16 18:37:21 2009 +0000
@@ -69,3 +69,8 @@
 {
 	Mix_FadeOutMusic(2000);
 }
+
+void SDLInteraction::PlaySound(const QString & filename)
+{
+
+}
\ No newline at end of file
--- a/QTfrontend/SDLs.h	Fri Jan 16 15:43:19 2009 +0000
+++ b/QTfrontend/SDLs.h	Fri Jan 16 18:37:21 2009 +0000
@@ -37,6 +37,7 @@
 	QStringList getResolutions() const;
 	void StartMusic();
 	void StopMusic();
+	void PlaySound(const QString & filename);
 };
 
 #endif
--- 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)
 {
--- a/QTfrontend/pages.h	Fri Jan 16 15:43:19 2009 +0000
+++ b/QTfrontend/pages.h	Fri Jan 16 18:37:21 2009 +0000
@@ -157,6 +157,7 @@
 	QWidget *page_O;
 	QPushButton *BtnTeamDiscard;
 	QPushButton *BtnTeamSave;
+	QPushButton * BtnTestSound;
 	QLineEdit * TeamNameEdit;
 	QLineEdit * HHNameEdit[8];
 	QComboBox * HHHats[8];
@@ -167,6 +168,9 @@
 
 private:
 	QLabel * LBind[BINDS_NUMBER];
+
+private slots:
+	void testSound();
 };
 
 class PageMultiplayer : public AbstractPage