QTfrontend/pages.cpp
changeset 2428 6800f8aa0184
parent 2414 fd9ca82077d8
child 2437 10e4b5fc0d93
equal deleted inserted replaced
2427:241e3bb6a146 2428:6800f8aa0184
   241 	GBoxBinds->setTitle(QGroupBox::tr("Key binds"));
   241 	GBoxBinds->setTitle(QGroupBox::tr("Key binds"));
   242 	QGridLayout * GBBLayout = new QGridLayout(GBoxBinds);
   242 	QGridLayout * GBBLayout = new QGridLayout(GBoxBinds);
   243 	BindsBox = new QToolBox(GBoxBinds);
   243 	BindsBox = new QToolBox(GBoxBinds);
   244 	BindsBox->setLineWidth(0);
   244 	BindsBox->setLineWidth(0);
   245 	GBBLayout->addWidget(BindsBox);
   245 	GBBLayout->addWidget(BindsBox);
   246 	page_A = new QWidget(this);
       
   247 	BindsBox->addItem(page_A, QToolBox::tr("Actions"));
       
   248 	page_W = new QWidget(this);
       
   249 	BindsBox->addItem(page_W, QToolBox::tr("Weapons"));
       
   250 	page_WP = new QWidget(this);
       
   251 	BindsBox->addItem(page_WP, QToolBox::tr("Weapon properties"));
       
   252 	page_O = new QWidget(this);
       
   253 	BindsBox->addItem(page_O, QToolBox::tr("Other"));
       
   254 	page2Layout->addWidget(GBoxBinds, 0, 0);
   246 	page2Layout->addWidget(GBoxBinds, 0, 0);
   255 
   247 
   256 	QStringList binds;
       
   257 	for(int i = 0; strlen(sdlkeys[i][1]) > 0; i++)
       
   258 	{
       
   259 		binds << sdlkeys[i][1];
       
   260 	}
       
   261 
       
   262 	quint16 widind = 0, i = 0;
   248 	quint16 widind = 0, i = 0;
       
   249 	quint16 num = 0;
       
   250 	QWidget * curW = NULL;
       
   251 	QGridLayout * pagelayout = NULL;
       
   252 	QLabel* l = NULL;
   263 	while (i < BINDS_NUMBER) {
   253 	while (i < BINDS_NUMBER) {
   264 		quint16 num = 0;
   254 		if(cbinds[i].category != NULL)
   265 		QWidget * curW = BindsBox->widget(widind);
   255 		{
   266 		QGridLayout * pagelayout = new QGridLayout(curW);
   256 			if(curW != NULL)
   267 		do {
   257 			{
   268 			LBind[i] = new QLabel(curW);
   258 				l = new QLabel(curW);
   269 			LBind[i]->setText(QApplication::translate("binds", cbinds[i].name));
   259 				l->setText("");
   270 			LBind[i]->setAlignment(Qt::AlignRight);
   260 				pagelayout->addWidget(l, num++, 0, 1, 2);
   271 			pagelayout->addWidget(LBind[i], num, 0);
   261 			}
   272 			CBBind[i] = new QComboBox(curW);
   262 			curW = new QWidget(this);
   273 			CBBind[i]->addItems(binds);
   263 			BindsBox->addItem(curW, QApplication::translate("binds (categories)", cbinds[i].category));
   274 			pagelayout->addWidget(CBBind[i], num, 1);
   264 			pagelayout = new QGridLayout(curW);
   275 			num++;
   265 			num = 0;
   276 		} while (!cbinds[i++].chwidget);
   266 		}
   277 		pagelayout->addWidget(new QWidget(curW), num, 0, 1, 2);
   267 		if(cbinds[i].description != NULL)
   278 		widind++;
   268 		{
       
   269 			l = new QLabel(curW);
       
   270 			l->setText((num > 0 ? QString("\n") : QString("")) + QApplication::translate("binds (descriptions)", cbinds[i].description));
       
   271 			pagelayout->addWidget(l, num++, 0, 1, 2);
       
   272 		}
       
   273 
       
   274 		l = new QLabel(curW);
       
   275 		l->setText(QApplication::translate("binds", cbinds[i].name));
       
   276 		l->setAlignment(Qt::AlignRight);
       
   277 		pagelayout->addWidget(l, num, 0);
       
   278 		CBBind[i] = new QComboBox(curW);
       
   279 		for(int j = 0; sdlkeys[j][1][0] != '\0'; j++)
       
   280 			CBBind[i]->addItem(QApplication::translate("binds (keys)", sdlkeys[j][1]).contains(": ") ? QApplication::translate("binds (keys)", sdlkeys[j][1]) : QApplication::translate("binds (keys)", "Keyboard") + QString(": ") + QApplication::translate("binds (keys)", sdlkeys[j][1]), sdlkeys[j][0]);
       
   281 		pagelayout->addWidget(CBBind[i++], num++, 1);
   279 	}
   282 	}
   280 }
   283 }
   281 
   284 
   282 void PageEditTeam::CBFort_activated(const QString & fortname)
   285 void PageEditTeam::CBFort_activated(const QString & fortname)
   283 {
   286 {
   396             AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options"));
   399             AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options"));
   397 
   400 
   398             QVBoxLayout * GBAlayout = new QVBoxLayout(AGGroupBox);
   401             QVBoxLayout * GBAlayout = new QVBoxLayout(AGGroupBox);
   399             QHBoxLayout * GBAreslayout = new QHBoxLayout(0);
   402             QHBoxLayout * GBAreslayout = new QHBoxLayout(0);
   400 
   403 
       
   404             CBFrontendFullscreen = new QCheckBox(AGGroupBox);
       
   405             CBFrontendFullscreen->setText(QCheckBox::tr("Frontend fullscreen"));
       
   406             GBAlayout->addWidget(CBFrontendFullscreen);
       
   407 
       
   408             CBFrontendEffects = new QCheckBox(AGGroupBox);
       
   409             CBFrontendEffects->setText(QCheckBox::tr("Frontend effects (requires restart)"));
       
   410             GBAlayout->addWidget(CBFrontendEffects);
       
   411 
   401             QLabel * resolution = new QLabel(AGGroupBox);
   412             QLabel * resolution = new QLabel(AGGroupBox);
   402             resolution->setText(QLabel::tr("Resolution"));
   413             resolution->setText(QLabel::tr("Resolution"));
   403             GBAreslayout->addWidget(resolution);
   414             GBAreslayout->addWidget(resolution);
   404 
   415 
   405             CBResolution = new QComboBox(AGGroupBox);
   416             CBResolution = new QComboBox(AGGroupBox);
   406             GBAreslayout->addWidget(CBResolution);
   417             GBAreslayout->addWidget(CBResolution);
   407             GBAlayout->addLayout(GBAreslayout);
   418             GBAlayout->addLayout(GBAreslayout);
       
   419 
       
   420             CBFullscreen = new QCheckBox(AGGroupBox);
       
   421             CBFullscreen->setText(QCheckBox::tr("Fullscreen"));
       
   422             GBAlayout->addWidget(CBFullscreen);
   408 
   423 
   409             QHBoxLayout * GBAfpslayout = new QHBoxLayout(0);
   424             QHBoxLayout * GBAfpslayout = new QHBoxLayout(0);
   410             QLabel * maxfps = new QLabel(AGGroupBox);
   425             QLabel * maxfps = new QLabel(AGGroupBox);
   411             maxfps->setText(QLabel::tr("FPS limit"));
   426             maxfps->setText(QLabel::tr("FPS limit"));
   412             GBAfpslayout->addWidget(maxfps);
   427             GBAfpslayout->addWidget(maxfps);
   413             GBAlayout->addLayout(GBAfpslayout);
   428             GBAlayout->addLayout(GBAfpslayout);
   414 
   429 
   415             CBReduceQuality = new QCheckBox(AGGroupBox);
   430             CBReduceQuality = new QCheckBox(AGGroupBox);
   416             CBReduceQuality->setText(QCheckBox::tr("Reduce Quality"));
   431             CBReduceQuality->setText(QCheckBox::tr("Reduced quality"));
   417             GBAlayout->addWidget(CBReduceQuality);
   432             GBAlayout->addWidget(CBReduceQuality);
   418 
   433 
   419             CBFrontendEffects = new QCheckBox(AGGroupBox);
       
   420             CBFrontendEffects->setText(QCheckBox::tr("Frontend Effects (Requires Restart)"));
       
   421             GBAlayout->addWidget(CBFrontendEffects);
       
   422 
       
   423             CBFullscreen = new QCheckBox(AGGroupBox);
       
   424             CBFullscreen->setText(QCheckBox::tr("Fullscreen"));
       
   425             GBAlayout->addWidget(CBFullscreen);
       
   426 
       
   427             CBFrontendFullscreen = new QCheckBox(AGGroupBox);
       
   428             CBFrontendFullscreen->setText(QCheckBox::tr("Frontend fullscreen"));
       
   429             GBAlayout->addWidget(CBFrontendFullscreen);
       
   430 
       
   431             CBHardwareSound = new QCheckBox(AGGroupBox);
   434             CBHardwareSound = new QCheckBox(AGGroupBox);
   432             CBHardwareSound->setText(QCheckBox::tr("Use hardware sound (if available; requires restart)"));
   435             CBHardwareSound->setText(QCheckBox::tr("Hardware sound (if available; requires restart)"));
   433             //CBHardwareSound->setEnabled(openal_ready());
   436             //CBHardwareSound->setEnabled(openal_ready());
   434             GBAlayout->addWidget(CBHardwareSound);
   437             GBAlayout->addWidget(CBHardwareSound);
   435 
   438 
   436             CBEnableSound = new QCheckBox(AGGroupBox);
   439             CBEnableSound = new QCheckBox(AGGroupBox);
   437             CBEnableSound->setText(QCheckBox::tr("Enable sound"));
   440             CBEnableSound->setText(QCheckBox::tr("Enable sound"));
   774 PageRoomsList::PageRoomsList(QWidget* parent) :
   777 PageRoomsList::PageRoomsList(QWidget* parent) :
   775   AbstractPage(parent)
   778   AbstractPage(parent)
   776 {
   779 {
   777 	QGridLayout * pageLayout = new QGridLayout(this);
   780 	QGridLayout * pageLayout = new QGridLayout(this);
   778 
   781 
   779 	QHBoxLayout * newRoomLayout = new QHBoxLayout(this);
   782 	QHBoxLayout * newRoomLayout = new QHBoxLayout();
   780 	QLabel * roomNameLabel = new QLabel(this);
   783 	QLabel * roomNameLabel = new QLabel(this);
   781 	roomNameLabel->setText(tr("Room Name:"));
   784 	roomNameLabel->setText(tr("Room Name:"));
   782 	roomName = new QLineEdit(this);
   785 	roomName = new QLineEdit(this);
   783 	roomName->setMaxLength(60);
   786 	roomName->setMaxLength(60);
   784 	newRoomLayout->addWidget(roomNameLabel);
   787 	newRoomLayout->addWidget(roomNameLabel);