Team class now supports voicepacks
authorunc0rr
Tue, 13 Jan 2009 18:56:14 +0000
changeset 1659 fd593a5e71fb
parent 1658 208a3258afdf
child 1660 0eaa6cf36276
Team class now supports voicepacks
QTfrontend/pages.cpp
QTfrontend/pages.h
QTfrontend/team.cpp
QTfrontend/team.h
--- a/QTfrontend/pages.cpp	Tue Jan 13 15:33:46 2009 +0000
+++ b/QTfrontend/pages.cpp	Tue Jan 13 18:56:14 2009 +0000
@@ -165,6 +165,16 @@
 	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);
+	}
+	GBTLayout->addWidget(CBVoicepack);
+
 	GBoxFort = new QGroupBox(this);
 	GBoxFort->setTitle(QGroupBox::tr("Fort"));
 	QGridLayout * GBFLayout = new QGridLayout(GBoxFort);
--- a/QTfrontend/pages.h	Tue Jan 13 15:33:46 2009 +0000
+++ b/QTfrontend/pages.h	Tue Jan 13 18:56:14 2009 +0000
@@ -148,6 +148,7 @@
 	SquareLabel *FortPreview;
 	QComboBox *CBGrave;
 	QComboBox *CBTeamLvl;
+	QComboBox *CBVoicepack;
 	QGroupBox *GBoxBinds;
 	QToolBox *BindsBox;
 	QWidget *page_A;
--- a/QTfrontend/team.cpp	Tue Jan 13 15:33:46 2009 +0000
+++ b/QTfrontend/team.cpp	Tue Jan 13 18:56:14 2009 +0000
@@ -42,6 +42,7 @@
 	}
 	Grave = "Statue";
 	Fort = "Plane";
+	Voicepack = "Default";
 	for(int i = 0; i < BINDS_NUMBER; i++)
 	{
 		binds[i].action = cbinds[i].action;
@@ -145,6 +146,11 @@
 			str.remove(0, 5);
 			Fort = str;
 		} else
+		if (str.startsWith("voicepack "))
+		{
+			str.remove(0, 10);
+			Voicepack = str;
+		} else
 		if (str.startsWith("bind "))
 		{
 			str.remove(0, 5);
@@ -190,6 +196,7 @@
 	}
 	stream << "grave " << Grave << endl;
 	stream << "fort " << Fort << endl;
+	stream << "voicepack " << Voicepack << endl;
 	for(int i = 0; i < BINDS_NUMBER; i++)
 	{
 		stream << "bind " << binds[i].strbind << " " << binds[i].action << endl;
@@ -211,6 +218,7 @@
 	hwform->ui.pageEditTeam->CBGrave->setCurrentIndex(hwform->ui.pageEditTeam->CBGrave->findText(Grave));
 
 	hwform->ui.pageEditTeam->CBFort->setCurrentIndex(hwform->ui.pageEditTeam->CBFort->findText(Fort));
+	hwform->ui.pageEditTeam->CBVoicepack->setCurrentIndex(hwform->ui.pageEditTeam->CBVoicepack->findText(Voicepack));
 	//hwform->ui.pageEditTeam->CBFort_activated(Fort);
 
 	for(int i = 0; i < BINDS_NUMBER; i++)
@@ -231,6 +239,7 @@
 
 	Grave = hwform->ui.pageEditTeam->CBGrave->currentText();
 	Fort = hwform->ui.pageEditTeam->CBFort->currentText();
+	Voicepack = hwform->ui.pageEditTeam->CBVoicepack->currentText();
 	for(int i = 0; i < BINDS_NUMBER; i++)
 	{
 		binds[i].strbind = hwform->ui.pageEditTeam->CBBind[i]->currentText();
@@ -247,7 +256,7 @@
 
 	sl.push_back(QString("egrave " + Grave));
 	sl.push_back(QString("efort " + Fort));
-	sl.push_back(QString("evoicepack Default"));
+	sl.push_back(QString("evoicepack " + Voicepack));
 
 	if (!m_isNetTeam)
 		for(int i = 0; i < BINDS_NUMBER; i++)
--- a/QTfrontend/team.h	Tue Jan 13 15:33:46 2009 +0000
+++ b/QTfrontend/team.h	Tue Jan 13 18:56:14 2009 +0000
@@ -45,6 +45,7 @@
 		QString HHHat[8];
 		QString Grave;
 		QString Fort;
+		QString Voicepack;
 		unsigned int difficulty;
 		BindAction binds[BINDS_NUMBER];