96 //pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
96 //pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
97 |
97 |
98 BtnExit = addButton(":/res/Exit.png", pageLayout, 4, 0, 1, 1, true); |
98 BtnExit = addButton(":/res/Exit.png", pageLayout, 4, 0, 1, 1, true); |
99 } |
99 } |
100 |
100 |
101 PageEditTeam::PageEditTeam(QWidget* parent) : |
101 PageEditTeam::PageEditTeam(QWidget* parent, SDLInteraction & sdli) : |
102 AbstractPage(parent) |
102 AbstractPage(parent) |
103 { |
103 { |
104 QGridLayout * pageLayout = new QGridLayout(this); |
104 QGridLayout * pageLayout = new QGridLayout(this); |
105 QTabWidget * tbw = new QTabWidget(this); |
105 QTabWidget * tbw = new QTabWidget(this); |
106 QWidget * page1 = new QWidget(this); |
106 QWidget * page1 = new QWidget(this); |
193 QStringList list = tmpdir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name); |
193 QStringList list = tmpdir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name); |
194 CBVoicepack->addItems(list); |
194 CBVoicepack->addItems(list); |
195 } |
195 } |
196 hbox->addWidget(CBVoicepack, 100); |
196 hbox->addWidget(CBVoicepack, 100); |
197 BtnTestSound = addButton(":/res/PlaySound.png", hbox, 1, true); |
197 BtnTestSound = addButton(":/res/PlaySound.png", hbox, 1, true); |
198 //BtnTestSound->setEnabled(oalb_ready()); |
|
199 hbox->setStretchFactor(BtnTestSound, 1); |
198 hbox->setStretchFactor(BtnTestSound, 1); |
200 connect(BtnTestSound, SIGNAL(clicked()), this, SLOT(testSound())); |
199 connect(BtnTestSound, SIGNAL(clicked()), this, SLOT(testSound(sdli))); |
201 GBTLayout->addLayout(hbox); |
200 GBTLayout->addLayout(hbox); |
202 } |
201 } |
203 |
202 |
204 GBoxFort = new QGroupBox(this); |
203 GBoxFort = new QGroupBox(this); |
205 GBoxFort->setTitle(QGroupBox::tr("Fort")); |
204 GBoxFort->setTitle(QGroupBox::tr("Fort")); |
286 { |
285 { |
287 QPixmap pix(datadir->absolutePath() + "/Forts/" + fortname + "L.png"); |
286 QPixmap pix(datadir->absolutePath() + "/Forts/" + fortname + "L.png"); |
288 FortPreview->setPixmap(pix); |
287 FortPreview->setPixmap(pix); |
289 } |
288 } |
290 |
289 |
291 void PageEditTeam::testSound() |
290 void PageEditTeam::testSound(SDLInteraction &sdli) |
292 { |
291 { |
293 int sound; |
292 Mix_Music *sound; |
294 QDir tmpdir; |
293 QDir tmpdir; |
295 |
294 sdli.SDLMusicInit(); |
296 OpenAL_Init(); |
|
297 |
295 |
298 tmpdir.cd(datadir->absolutePath()); |
296 tmpdir.cd(datadir->absolutePath()); |
299 tmpdir.cd("Sounds/voices"); |
297 tmpdir.cd("Sounds/voices"); |
300 tmpdir.cd(CBVoicepack->currentText()); |
298 tmpdir.cd(CBVoicepack->currentText()); |
301 QStringList list = tmpdir.entryList(QStringList() << "Illgetyou.ogg" << "Incoming.ogg" << "Stupid.ogg" << "Coward.ogg" << "Firstblood.ogg", QDir::Files); |
299 QStringList list = tmpdir.entryList(QStringList() << "Illgetyou.ogg" << "Incoming.ogg" << "Stupid.ogg" << "Coward.ogg" << "Firstblood.ogg", QDir::Files); |
302 if (list.size()) { |
300 if (list.size()) { |
303 sound = oalb_loadfile(QString(tmpdir.absolutePath() + "/" + list[rand() % list.size()]).toLocal8Bit().constData()); |
301 sound = Mix_LoadMUS(QString(tmpdir.absolutePath() + "/" + list[rand() % list.size()]).toLocal8Bit().constData()); |
304 oalb_playsound(sound, 0); |
302 Mix_PlayMusic(sound, 0); |
305 } |
303 } |
306 } |
304 } |
307 |
305 |
308 PageMultiplayer::PageMultiplayer(QWidget* parent) : |
306 PageMultiplayer::PageMultiplayer(QWidget* parent) : |
309 AbstractPage(parent) |
307 AbstractPage(parent) |
429 |
427 |
430 CBReduceQuality = new QCheckBox(AGGroupBox); |
428 CBReduceQuality = new QCheckBox(AGGroupBox); |
431 CBReduceQuality->setText(QCheckBox::tr("Reduced quality")); |
429 CBReduceQuality->setText(QCheckBox::tr("Reduced quality")); |
432 GBAlayout->addWidget(CBReduceQuality); |
430 GBAlayout->addWidget(CBReduceQuality); |
433 |
431 |
434 #ifdef _WIN32 |
|
435 CBHardwareSound = new QCheckBox(AGGroupBox); |
|
436 CBHardwareSound->setText(QCheckBox::tr("Hardware sound (if available; requires restart)")); |
|
437 //CBHardwareSound->setEnabled(oalb_ready()); |
|
438 GBAlayout->addWidget(CBHardwareSound); |
|
439 #endif |
|
440 |
|
441 CBEnableSound = new QCheckBox(AGGroupBox); |
432 CBEnableSound = new QCheckBox(AGGroupBox); |
442 CBEnableSound->setText(QCheckBox::tr("Enable sound")); |
433 CBEnableSound->setText(QCheckBox::tr("Enable sound")); |
443 //CBEnableSound->setEnabled(oalb_ready()); |
|
444 GBAlayout->addWidget(CBEnableSound); |
434 GBAlayout->addWidget(CBEnableSound); |
445 CBEnableMusic = new QCheckBox(AGGroupBox); |
435 CBEnableMusic = new QCheckBox(AGGroupBox); |
446 CBEnableMusic->setText(QCheckBox::tr("Enable music")); |
436 CBEnableMusic->setText(QCheckBox::tr("Enable music")); |
447 //CBEnableMusic->setEnabled(oalb_ready()); |
|
448 GBAlayout->addWidget(CBEnableMusic); |
437 GBAlayout->addWidget(CBEnableMusic); |
449 |
438 |
450 QHBoxLayout * GBAvollayout = new QHBoxLayout(0); |
439 QHBoxLayout * GBAvollayout = new QHBoxLayout(0); |
451 QLabel * vol = new QLabel(AGGroupBox); |
440 QLabel * vol = new QLabel(AGGroupBox); |
452 vol->setText(QLabel::tr("Initial sound volume")); |
441 vol->setText(QLabel::tr("Initial sound volume")); |
453 GBAvollayout->addWidget(vol); |
442 GBAvollayout->addWidget(vol); |
454 GBAlayout->addLayout(GBAvollayout); |
443 GBAlayout->addLayout(GBAvollayout); |
455 volumeBox = new QSpinBox(AGGroupBox); |
444 volumeBox = new QSpinBox(AGGroupBox); |
456 volumeBox->setRange(0, 100); |
445 volumeBox->setRange(0, 100); |
457 volumeBox->setSingleStep(5); |
446 volumeBox->setSingleStep(5); |
458 //volumeBox->setEnabled(oalb_ready()); |
|
459 GBAvollayout->addWidget(volumeBox); |
447 GBAvollayout->addWidget(volumeBox); |
460 |
448 |
461 CBShowFPS = new QCheckBox(AGGroupBox); |
449 CBShowFPS = new QCheckBox(AGGroupBox); |
462 CBShowFPS->setText(QCheckBox::tr("Show FPS")); |
450 CBShowFPS->setText(QCheckBox::tr("Show FPS")); |
463 GBAlayout->addWidget(CBShowFPS); |
451 GBAlayout->addWidget(CBShowFPS); |