QTfrontend/pages.cpp
changeset 636 dc93ac775bb9
parent 632 5e09ae25729f
child 638 e1cc516488f2
equal deleted inserted replaced
635:0fb6d55ecd66 636:dc93ac775bb9
    26 #include <QLineEdit>
    26 #include <QLineEdit>
    27 #include <QListWidget>
    27 #include <QListWidget>
    28 #include <QApplication>
    28 #include <QApplication>
    29 #include <QSpinBox>
    29 #include <QSpinBox>
    30 #include <QTextEdit>
    30 #include <QTextEdit>
       
    31 #include <QRadioButton>
    31 
    32 
    32 #include "pages.h"
    33 #include "pages.h"
    33 #include "sdlkeys.h"
    34 #include "sdlkeys.h"
    34 #include "hwconsts.h"
    35 #include "hwconsts.h"
    35 #include "gamecfgwidget.h"
    36 #include "gamecfgwidget.h"
   427 	QGridLayout * GBNlayout = new QGridLayout(NNGroupBox);
   428 	QGridLayout * GBNlayout = new QGridLayout(NNGroupBox);
   428 	labelNN = new QLabel(NNGroupBox);
   429 	labelNN = new QLabel(NNGroupBox);
   429 	labelNN->setText(QLabel::tr("Net nick"));
   430 	labelNN->setText(QLabel::tr("Net nick"));
   430 	GBNlayout->addWidget(labelNN, 0, 0);
   431 	GBNlayout->addWidget(labelNN, 0, 0);
   431 
   432 
   432 	editNetNick	= new QLineEdit(NNGroupBox);
   433 	editNetNick = new QLineEdit(NNGroupBox);
   433 	editNetNick->setMaxLength(20);
   434 	editNetNick->setMaxLength(20);
   434 	editNetNick->setText(QLineEdit::tr("unnamed"));
   435 	editNetNick->setText(QLineEdit::tr("unnamed"));
   435 	GBNlayout->addWidget(editNetNick, 0, 1);
   436 	GBNlayout->addWidget(editNetNick, 0, 1);
       
   437 
       
   438 	QGroupBox * NetTypeGroupBox = new QGroupBox(this);
       
   439 	NetTypeGroupBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
       
   440 	NetTypeGroupBox->setTitle(QGroupBox::tr("Connection type"));
       
   441 	pageLayout->addWidget(NetTypeGroupBox, 0, 1);
       
   442 
       
   443 	QVBoxLayout * GBTlayout = new QVBoxLayout(NetTypeGroupBox);
       
   444 	rbLocalGame = new QRadioButton(NetTypeGroupBox);
       
   445 	rbLocalGame->setText(tr("Local game"));
       
   446 	rbLocalGame->setChecked(true);
       
   447 	GBTlayout->addWidget(rbLocalGame);
       
   448 	rbInternetGame = new QRadioButton(NetTypeGroupBox);
       
   449 	rbInternetGame->setText(tr("Internet game"));
       
   450 	GBTlayout->addWidget(rbInternetGame);
   436 
   451 
   437 	ConnGroupBox = new QGroupBox(this);
   452 	ConnGroupBox = new QGroupBox(this);
   438 	ConnGroupBox->setTitle(QGroupBox::tr("Net game"));
   453 	ConnGroupBox->setTitle(QGroupBox::tr("Net game"));
   439 	pageLayout->addWidget(ConnGroupBox, 2, 0, 1, 3);
   454 	pageLayout->addWidget(ConnGroupBox, 2, 0, 1, 3);
   440 	GBClayout = new QGridLayout(ConnGroupBox);
   455 	GBClayout = new QGridLayout(ConnGroupBox);
   467 
   482 
   468 	BtnBack = new QPushButton(this);
   483 	BtnBack = new QPushButton(this);
   469 	BtnBack->setFont(*font14);
   484 	BtnBack->setFont(*font14);
   470 	BtnBack->setText(QPushButton::tr("Back"));
   485 	BtnBack->setText(QPushButton::tr("Back"));
   471 	pageLayout->addWidget(BtnBack, 3, 0);
   486 	pageLayout->addWidget(BtnBack, 3, 0);
       
   487 
       
   488 	connect(rbLocalGame, SIGNAL(toggled(bool)), this, SLOT(changeServersList()));
   472 }
   489 }
   473 
   490 
   474 void PageNet::changeServersList()
   491 void PageNet::changeServersList()
   475 {
   492 {
   476 	if (netServersWidget) delete netServersWidget;
   493 	if (netServersWidget) delete netServersWidget;
   477 
   494 
   478 	netServersWidget = new HWNetWwwWidget(ConnGroupBox);
   495 	if (rbLocalGame->isChecked())
       
   496 		netServersWidget = new HWNetUdpWidget(ConnGroupBox);
       
   497 	else
       
   498 		netServersWidget = new HWNetWwwWidget(ConnGroupBox);
   479 	GBClayout->addWidget(netServersWidget, 1, 0, 2, 2);
   499 	GBClayout->addWidget(netServersWidget, 1, 0, 2, 2);
   480 
   500 
   481 	connect(BtnUpdateSList, SIGNAL(clicked()), netServersWidget, SLOT(updateList()));
   501 	connect(BtnUpdateSList, SIGNAL(clicked()), netServersWidget, SLOT(updateList()));
   482 	netServersWidget->updateList();
   502 	netServersWidget->updateList();
   483 }
   503 }