QTfrontend/pages.cpp
changeset 2443 fececcbc2189
parent 2442 228757f6c54d
child 2447 08d623a494e6
equal deleted inserted replaced
2442:228757f6c54d 2443:fececcbc2189
   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(openal_ready());
   198 		//BtnTestSound->setEnabled(oalb_ready());
   199 		hbox->setStretchFactor(BtnTestSound, 1);
   199 		hbox->setStretchFactor(BtnTestSound, 1);
   200 		connect(BtnTestSound, SIGNAL(clicked()), this, SLOT(testSound()));
   200 		connect(BtnTestSound, SIGNAL(clicked()), this, SLOT(testSound()));
   201 		GBTLayout->addLayout(hbox);
   201 		GBTLayout->addLayout(hbox);
   202 	}
   202 	}
   203 
   203 
   298 	tmpdir.cd(datadir->absolutePath());
   298 	tmpdir.cd(datadir->absolutePath());
   299 	tmpdir.cd("Sounds/voices");
   299 	tmpdir.cd("Sounds/voices");
   300 	tmpdir.cd(CBVoicepack->currentText());
   300 	tmpdir.cd(CBVoicepack->currentText());
   301 	QStringList list = tmpdir.entryList(QStringList() << "Illgetyou.ogg" << "Incoming.ogg" << "Stupid.ogg" << "Coward.ogg" << "Firstblood.ogg", QDir::Files);
   301 	QStringList list = tmpdir.entryList(QStringList() << "Illgetyou.ogg" << "Incoming.ogg" << "Stupid.ogg" << "Coward.ogg" << "Firstblood.ogg", QDir::Files);
   302 	if (list.size()) {
   302 	if (list.size()) {
   303 		sound = openal_loadfile(QString(tmpdir.absolutePath() + "/" + list[rand() % list.size()]).toLocal8Bit().constData());
   303 		sound = oalb_loadfile(QString(tmpdir.absolutePath() + "/" + list[rand() % list.size()]).toLocal8Bit().constData());
   304 		openal_playsound(sound);
   304 		oalb_playsound(sound, 0);
   305 	}
   305 	}
   306 }
   306 }
   307 
   307 
   308 PageMultiplayer::PageMultiplayer(QWidget* parent) :
   308 PageMultiplayer::PageMultiplayer(QWidget* parent) :
   309   AbstractPage(parent)
   309   AbstractPage(parent)
   429 
   429 
   430             CBReduceQuality = new QCheckBox(AGGroupBox);
   430             CBReduceQuality = new QCheckBox(AGGroupBox);
   431             CBReduceQuality->setText(QCheckBox::tr("Reduced quality"));
   431             CBReduceQuality->setText(QCheckBox::tr("Reduced quality"));
   432             GBAlayout->addWidget(CBReduceQuality);
   432             GBAlayout->addWidget(CBReduceQuality);
   433 
   433 
       
   434 #ifdef _WIN32
   434             CBHardwareSound = new QCheckBox(AGGroupBox);
   435             CBHardwareSound = new QCheckBox(AGGroupBox);
   435             CBHardwareSound->setText(QCheckBox::tr("Hardware sound (if available; requires restart)"));
   436             CBHardwareSound->setText(QCheckBox::tr("Hardware sound (if available; requires restart)"));
   436             //CBHardwareSound->setEnabled(openal_ready());
   437             //CBHardwareSound->setEnabled(oalb_ready());
   437             GBAlayout->addWidget(CBHardwareSound);
   438             GBAlayout->addWidget(CBHardwareSound);
       
   439 #endif
   438 
   440 
   439             CBEnableSound = new QCheckBox(AGGroupBox);
   441             CBEnableSound = new QCheckBox(AGGroupBox);
   440             CBEnableSound->setText(QCheckBox::tr("Enable sound"));
   442             CBEnableSound->setText(QCheckBox::tr("Enable sound"));
   441             //CBEnableSound->setEnabled(openal_ready());
   443             //CBEnableSound->setEnabled(oalb_ready());
   442             GBAlayout->addWidget(CBEnableSound);
   444             GBAlayout->addWidget(CBEnableSound);
   443             CBEnableMusic = new QCheckBox(AGGroupBox);
   445             CBEnableMusic = new QCheckBox(AGGroupBox);
   444             CBEnableMusic->setText(QCheckBox::tr("Enable music"));
   446             CBEnableMusic->setText(QCheckBox::tr("Enable music"));
   445             //CBEnableMusic->setEnabled(openal_ready());
   447             //CBEnableMusic->setEnabled(oalb_ready());
   446             GBAlayout->addWidget(CBEnableMusic);
   448             GBAlayout->addWidget(CBEnableMusic);
   447 
   449 
   448             QHBoxLayout * GBAvollayout = new QHBoxLayout(0);
   450             QHBoxLayout * GBAvollayout = new QHBoxLayout(0);
   449             QLabel * vol = new QLabel(AGGroupBox);
   451             QLabel * vol = new QLabel(AGGroupBox);
   450             vol->setText(QLabel::tr("Initial sound volume"));
   452             vol->setText(QLabel::tr("Initial sound volume"));
   451             GBAvollayout->addWidget(vol);
   453             GBAvollayout->addWidget(vol);
   452             GBAlayout->addLayout(GBAvollayout);
   454             GBAlayout->addLayout(GBAvollayout);
   453             volumeBox = new QSpinBox(AGGroupBox);
   455             volumeBox = new QSpinBox(AGGroupBox);
   454             volumeBox->setRange(0, 100);
   456             volumeBox->setRange(0, 100);
   455             volumeBox->setSingleStep(5);
   457             volumeBox->setSingleStep(5);
   456             //volumeBox->setEnabled(openal_ready());
   458             //volumeBox->setEnabled(oalb_ready());
   457             GBAvollayout->addWidget(volumeBox);
   459             GBAvollayout->addWidget(volumeBox);
   458 
   460 
   459             CBShowFPS = new QCheckBox(AGGroupBox);
   461             CBShowFPS = new QCheckBox(AGGroupBox);
   460             CBShowFPS->setText(QCheckBox::tr("Show FPS"));
   462             CBShowFPS->setText(QCheckBox::tr("Show FPS"));
   461             GBAlayout->addWidget(CBShowFPS);
   463             GBAlayout->addWidget(CBShowFPS);
   787 	newRoomLayout->addWidget(roomNameLabel);
   789 	newRoomLayout->addWidget(roomNameLabel);
   788 	newRoomLayout->addWidget(roomName);
   790 	newRoomLayout->addWidget(roomName);
   789 	pageLayout->addLayout(newRoomLayout, 0, 0);
   791 	pageLayout->addLayout(newRoomLayout, 0, 0);
   790 
   792 
   791 	roomsList = new QTableWidget(this);
   793 	roomsList = new QTableWidget(this);
   792 	roomsList->setColumnCount(7);
       
   793 	roomsList->setSelectionBehavior(QAbstractItemView::SelectRows);
   794 	roomsList->setSelectionBehavior(QAbstractItemView::SelectRows);
   794 	roomsList->verticalHeader()->setVisible(false);
   795 	roomsList->verticalHeader()->setVisible(false);
   795 	roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
   796 	roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
   796 	roomsList->setAlternatingRowColors(true);
   797 	roomsList->setAlternatingRowColors(true);
   797 	pageLayout->addWidget(roomsList, 1, 0, 3, 1);
   798 	pageLayout->addWidget(roomsList, 1, 0, 3, 1);
   820 }
   821 }
   821 
   822 
   822 void PageRoomsList::setRoomsList(const QStringList & list)
   823 void PageRoomsList::setRoomsList(const QStringList & list)
   823 {
   824 {
   824 	roomsList->clear();
   825 	roomsList->clear();
       
   826 	roomsList->setColumnCount(7);
   825 	roomsList->setHorizontalHeaderLabels(
   827 	roomsList->setHorizontalHeaderLabels(
   826 			QStringList() <<
   828 			QStringList() <<
   827 			QTableWidget::tr("Room Name") <<
   829 			QTableWidget::tr("Room Name") <<
   828 			QTableWidget::tr("C") <<
   830 			QTableWidget::tr("C") <<
   829 			QTableWidget::tr("T") <<
   831 			QTableWidget::tr("T") <<
   901 		item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
   903 		item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
   902 		item->setToolTip(tr("The Weapon Scheme defines available weapons and their ammunition count."));
   904 		item->setToolTip(tr("The Weapon Scheme defines available weapons and their ammunition count."));
   903 		roomsList->setItem(r, 6, item);
   905 		roomsList->setItem(r, 6, item);
   904 
   906 
   905 	}
   907 	}
   906 	roomsList->resizeColumnsToContents();
   908 	//roomsList->resizeColumnsToContents();
   907 }
   909 }
   908 
   910 
   909 void PageRoomsList::onCreateClick()
   911 void PageRoomsList::onCreateClick()
   910 {
   912 {
   911 	if (roomName->text().size())
   913 	if (roomName->text().size())