QTfrontend/pages.cpp
changeset 2377 f3fab2b09e0c
parent 2369 c3eb11f1ab3a
child 2392 a55dbef5cf31
equal deleted inserted replaced
2376:ece7b87f1334 2377:f3fab2b09e0c
    60 #include "misc.h"
    60 #include "misc.h"
    61 #include "togglebutton.h"
    61 #include "togglebutton.h"
    62 #include "hwform.h"
    62 #include "hwform.h"
    63 #include "SDLs.h"
    63 #include "SDLs.h"
    64 
    64 
    65 PageMain::PageMain(QWidget* parent) : 
    65 PageMain::PageMain(QWidget* parent) :
    66   AbstractPage(parent)
    66   AbstractPage(parent)
    67 {
    67 {
    68     if(frontendEffects) setAttribute(Qt::WA_NoSystemBackground, true);
    68     if(frontendEffects) setAttribute(Qt::WA_NoSystemBackground, true);
    69 	QGridLayout * pageLayout = new QGridLayout(this);
    69 	QGridLayout * pageLayout = new QGridLayout(this);
    70 	//pageLayout->setColumnStretch(0, 1);
    70 	//pageLayout->setColumnStretch(0, 1);
   109 	tbw->addTab(page2, tr("Advanced"));
   109 	tbw->addTab(page2, tr("Advanced"));
   110 	pageLayout->addWidget(tbw, 0, 0, 1, 3);
   110 	pageLayout->addWidget(tbw, 0, 0, 1, 3);
   111 	BtnTeamDiscard = addButton(":/res/Exit.png", pageLayout, 1, 0, true);
   111 	BtnTeamDiscard = addButton(":/res/Exit.png", pageLayout, 1, 0, true);
   112 	BtnTeamSave = addButton(":/res/Save.png", pageLayout, 1, 2, true);;
   112 	BtnTeamSave = addButton(":/res/Save.png", pageLayout, 1, 2, true);;
   113 	BtnTeamSave->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}");
   113 	BtnTeamSave->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}");
   114 	
   114 
   115 	QHBoxLayout * page1Layout = new QHBoxLayout(page1);
   115 	QHBoxLayout * page1Layout = new QHBoxLayout(page1);
   116 	page1Layout->setAlignment(Qt::AlignTop);
   116 	page1Layout->setAlignment(Qt::AlignTop);
   117 	QGridLayout * page2Layout = new QGridLayout(page2);
   117 	QGridLayout * page2Layout = new QGridLayout(page2);
   118 
   118 
   119 // ====== Page 1 ======
   119 // ====== Page 1 ======
   121 	QVBoxLayout * vbox2 = new QVBoxLayout();
   121 	QVBoxLayout * vbox2 = new QVBoxLayout();
   122 	QVBoxLayout * vbox3 = new QVBoxLayout();
   122 	QVBoxLayout * vbox3 = new QVBoxLayout();
   123 	page1Layout->addLayout(vbox1);
   123 	page1Layout->addLayout(vbox1);
   124 	page1Layout->addLayout(vbox2);
   124 	page1Layout->addLayout(vbox2);
   125 	page1Layout->addLayout(vbox3);
   125 	page1Layout->addLayout(vbox3);
   126 	
   126 
   127 	GBoxHedgehogs = new QGroupBox(this);
   127 	GBoxHedgehogs = new QGroupBox(this);
   128 	GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members"));
   128 	GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members"));
   129 	GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
   129 	GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
   130 	QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs);
   130 	QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs);
   131 
   131 
   132 	signalMapper = new QSignalMapper(this);
   132 	signalMapper = new QSignalMapper(this);
   133 	
   133 
   134 	HatsModel * hatsModel = new HatsModel(GBoxHedgehogs);
   134 	HatsModel * hatsModel = new HatsModel(GBoxHedgehogs);
   135 	for(int i = 0; i < 8; i++)
   135 	for(int i = 0; i < 8; i++)
   136 	{
   136 	{
   137 		HHHats[i] = new QComboBox(GBoxHedgehogs);
   137 		HHHats[i] = new QComboBox(GBoxHedgehogs);
   138 		HHHats[i]->setModel(hatsModel);
   138 		HHHats[i]->setModel(hatsModel);
   144 
   144 
   145 		HHNameEdit[i] = new QLineEdit(GBoxHedgehogs);
   145 		HHNameEdit[i] = new QLineEdit(GBoxHedgehogs);
   146 		HHNameEdit[i]->setMaxLength(64);
   146 		HHNameEdit[i]->setMaxLength(64);
   147 		HHNameEdit[i]->setMinimumWidth(120);
   147 		HHNameEdit[i]->setMinimumWidth(120);
   148 		GBHLayout->addWidget(HHNameEdit[i], i, 1);
   148 		GBHLayout->addWidget(HHNameEdit[i], i, 1);
   149 		
   149 
   150 		randButton[i] = addButton(":/res/dice.png", GBHLayout, i, 3, true);
   150 		randButton[i] = addButton(":/res/dice.png", GBHLayout, i, 3, true);
   151 
   151 
   152 		connect(randButton[i], SIGNAL(clicked()), signalMapper, SLOT(map()));
   152 		connect(randButton[i], SIGNAL(clicked()), signalMapper, SLOT(map()));
   153          	signalMapper->setMapping(randButton[i], i);
   153          	signalMapper->setMapping(randButton[i], i);
   154 
   154 
   165 	QVBoxLayout * GBTLayout = new QVBoxLayout(GBoxTeam);
   165 	QVBoxLayout * GBTLayout = new QVBoxLayout(GBoxTeam);
   166 	TeamNameEdit = new QLineEdit(GBoxTeam);
   166 	TeamNameEdit = new QLineEdit(GBoxTeam);
   167 	TeamNameEdit->setMaxLength(64);
   167 	TeamNameEdit->setMaxLength(64);
   168 	GBTLayout->addWidget(TeamNameEdit);
   168 	GBTLayout->addWidget(TeamNameEdit);
   169 	vbox2->addWidget(GBoxTeam);
   169 	vbox2->addWidget(GBoxTeam);
   170 	
   170 
   171 	CBTeamLvl = new QComboBox(GBoxTeam);
   171 	CBTeamLvl = new QComboBox(GBoxTeam);
   172 	CBTeamLvl->setIconSize(QSize(48, 48));
   172 	CBTeamLvl->setIconSize(QSize(48, 48));
   173 	CBTeamLvl->addItem(QIcon(":/res/botlevels/0.png"), QComboBox::tr("Human"));
   173 	CBTeamLvl->addItem(QIcon(":/res/botlevels/0.png"), QComboBox::tr("Human"));
   174 	for(int i = 5; i > 0; i--)
   174 	for(int i = 5; i > 0; i--)
   175 		CBTeamLvl->addItem(
   175 		CBTeamLvl->addItem(
   176 				QIcon(QString(":/res/botlevels/%1.png").arg(6 - i)),
   176 				QIcon(QString(":/res/botlevels/%1.png").arg(6 - i)),
   177 				QString("%1 %2").arg(QComboBox::tr("Level")).arg(i)
   177 				QString("%1 %2").arg(QComboBox::tr("Level")).arg(i)
   178 				);
   178 				);
   179 	GBTLayout->addWidget(CBTeamLvl);
   179 	GBTLayout->addWidget(CBTeamLvl);
   180 	
   180 
   181 	CBGrave = new QComboBox(GBoxTeam);
   181 	CBGrave = new QComboBox(GBoxTeam);
   182 	CBGrave->setMaxCount(65535);
   182 	CBGrave->setMaxCount(65535);
   183 	CBGrave->setIconSize(QSize(32, 32));
   183 	CBGrave->setIconSize(QSize(32, 32));
   184 	GBTLayout->addWidget(CBGrave);
   184 	GBTLayout->addWidget(CBGrave);
   185 
   185 
   220 	tmpdir.cd("Forts");
   220 	tmpdir.cd("Forts");
   221 	tmpdir.setFilter(QDir::Files);
   221 	tmpdir.setFilter(QDir::Files);
   222 
   222 
   223 	connect(CBFort, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(CBFort_activated(const QString &)));
   223 	connect(CBFort, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(CBFort_activated(const QString &)));
   224 	CBFort->addItems(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L\\.png"), "\\1"));
   224 	CBFort->addItems(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L\\.png"), "\\1"));
   225 	
   225 
   226 	tmpdir.cd("../Graphics/Graves");
   226 	tmpdir.cd("../Graphics/Graves");
   227 	QStringList list = tmpdir.entryList(QStringList("*.png"));
   227 	QStringList list = tmpdir.entryList(QStringList("*.png"));
   228 	for (QStringList::Iterator it = list.begin(); it != list.end(); ++it )
   228 	for (QStringList::Iterator it = list.begin(); it != list.end(); ++it )
   229 	{
   229 	{
   230 		QPixmap pix(datadir->absolutePath() + "/Graphics/Graves/" + *it);
   230 		QPixmap pix(datadir->absolutePath() + "/Graphics/Graves/" + *it);
   293 	tmpdir.cd("Sounds/voices");
   293 	tmpdir.cd("Sounds/voices");
   294 	tmpdir.cd(CBVoicepack->currentText());
   294 	tmpdir.cd(CBVoicepack->currentText());
   295 	QStringList list = tmpdir.entryList(QStringList() << "Illgetyou.ogg" << "Incoming.ogg" << "Stupid.ogg" << "Coward.ogg" << "Firstblood.ogg", QDir::Files);
   295 	QStringList list = tmpdir.entryList(QStringList() << "Illgetyou.ogg" << "Incoming.ogg" << "Stupid.ogg" << "Coward.ogg" << "Firstblood.ogg", QDir::Files);
   296 	if (list.size()) {
   296 	if (list.size()) {
   297 		sound = openal_loadfile(QString(tmpdir.absolutePath() + "/" + list[rand() % list.size()]).toLocal8Bit().constData());
   297 		sound = openal_loadfile(QString(tmpdir.absolutePath() + "/" + list[rand() % list.size()]).toLocal8Bit().constData());
   298 		openal_playsound(sound);										   
   298 		openal_playsound(sound);
   299 	}
   299 	}
   300 }
   300 }
   301 
   301 
   302 PageMultiplayer::PageMultiplayer(QWidget* parent) :
   302 PageMultiplayer::PageMultiplayer(QWidget* parent) :
   303   AbstractPage(parent)
   303   AbstractPage(parent)
   352 		GBTlayout->addLayout(layout1);
   352 		GBTlayout->addLayout(layout1);
   353 		BtnNewTeam = addButton(tr("New team"), layout1, 0);
   353 		BtnNewTeam = addButton(tr("New team"), layout1, 0);
   354 		BtnEditTeam = addButton(tr("Edit team"), layout1, 1);
   354 		BtnEditTeam = addButton(tr("Edit team"), layout1, 1);
   355 		layout1->setStretchFactor(BtnNewTeam, 100);
   355 		layout1->setStretchFactor(BtnNewTeam, 100);
   356 		layout1->setStretchFactor(BtnEditTeam, 100);
   356 		layout1->setStretchFactor(BtnEditTeam, 100);
   357 		
   357 
   358 		QHBoxLayout * layout2 = new QHBoxLayout;
   358 		QHBoxLayout * layout2 = new QHBoxLayout;
   359 		GBTlayout->addLayout(layout2);
   359 		GBTlayout->addLayout(layout2);
   360 		
   360 
   361 		labelNN = new QLabel(teamsBox);
   361 		labelNN = new QLabel(teamsBox);
   362 		labelNN->setText(QLabel::tr("Net nick"));
   362 		labelNN->setText(QLabel::tr("Net nick"));
   363 		layout2->addWidget(labelNN);
   363 		layout2->addWidget(labelNN);
   364 
   364 
   365 		editNetNick = new QLineEdit(teamsBox);
   365 		editNetNick = new QLineEdit(teamsBox);
   366 		editNetNick->setMaxLength(20);
   366 		editNetNick->setMaxLength(20);
   367 		editNetNick->setText(QLineEdit::tr("unnamed"));
   367 		editNetNick->setText(QLineEdit::tr("unnamed"));
   368 		layout2->addWidget(editNetNick);
   368 		layout2->addWidget(editNetNick);
   369 		
   369 
   370 		gbTBLayout->addWidget(teamsBox, 0, 0);
   370 		gbTBLayout->addWidget(teamsBox, 0, 0);
   371 	}
   371 	}
   372 
   372 
   373 	{
   373 	{
   374 		IconedGroupBox* groupWeapons = new IconedGroupBox(this);
   374 		IconedGroupBox* groupWeapons = new IconedGroupBox(this);
   392 		AGGroupBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
   392 		AGGroupBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
   393 		AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options"));
   393 		AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options"));
   394 
   394 
   395 		QVBoxLayout * GBAlayout = new QVBoxLayout(AGGroupBox);
   395 		QVBoxLayout * GBAlayout = new QVBoxLayout(AGGroupBox);
   396 		QHBoxLayout * GBAreslayout = new QHBoxLayout(0);
   396 		QHBoxLayout * GBAreslayout = new QHBoxLayout(0);
   397             
   397 
   398 		QLabel * resolution = new QLabel(AGGroupBox);
   398 		QLabel * resolution = new QLabel(AGGroupBox);
   399 		resolution->setText(QLabel::tr("Resolution"));
   399 		resolution->setText(QLabel::tr("Resolution"));
   400 		GBAreslayout->addWidget(resolution);
   400 		GBAreslayout->addWidget(resolution);
   401 
   401 
   402 		CBResolution = new QComboBox(AGGroupBox);
   402 		CBResolution = new QComboBox(AGGroupBox);
   462             //autoupdate
   462             //autoupdate
   463 		CBAutoUpdate = new QCheckBox(AGGroupBox);
   463 		CBAutoUpdate = new QCheckBox(AGGroupBox);
   464 		CBAutoUpdate->setText(QCheckBox::tr("Check for updates at startup"));
   464 		CBAutoUpdate->setText(QCheckBox::tr("Check for updates at startup"));
   465 		GBAlayout->addWidget(CBAutoUpdate);
   465 		GBAlayout->addWidget(CBAutoUpdate);
   466 #endif
   466 #endif
   467             
   467 
   468             fpsedit = new FPSEdit(AGGroupBox);
   468             fpsedit = new FPSEdit(AGGroupBox);
   469             GBAfpslayout->addWidget(fpsedit);
   469             GBAfpslayout->addWidget(fpsedit);
   470             gbTBLayout->addWidget(AGGroupBox, 0, 1, 2, 1);
   470             gbTBLayout->addWidget(AGGroupBox, 0, 1, 2, 1);
   471 	}
   471 	}
   472 
   472 
   489 	BtnNetSvrStart->setText(QPushButton::tr("Start server"));
   489 	BtnNetSvrStart->setText(QPushButton::tr("Start server"));
   490 	BtnNetSvrStart->setVisible(haveServer);
   490 	BtnNetSvrStart->setVisible(haveServer);
   491 	pageLayout->addWidget(BtnNetSvrStart, 4, 2);
   491 	pageLayout->addWidget(BtnNetSvrStart, 4, 2);
   492 
   492 
   493 	BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true);
   493 	BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true);
   494 	
   494 
   495 	ConnGroupBox = new QGroupBox(this);
   495 	ConnGroupBox = new QGroupBox(this);
   496 	ConnGroupBox->setTitle(QGroupBox::tr("Net game"));
   496 	ConnGroupBox->setTitle(QGroupBox::tr("Net game"));
   497 	pageLayout->addWidget(ConnGroupBox, 2, 0, 1, 3);
   497 	pageLayout->addWidget(ConnGroupBox, 2, 0, 1, 3);
   498 	GBClayout = new QGridLayout(ConnGroupBox);
   498 	GBClayout = new QGridLayout(ConnGroupBox);
   499 	GBClayout->setColumnStretch(0, 1);
   499 	GBClayout->setColumnStretch(0, 1);
   634 
   634 
   635 	QHBoxLayout * bottomLayout = new QHBoxLayout;
   635 	QHBoxLayout * bottomLayout = new QHBoxLayout;
   636 	pageLayout->addLayout(bottomLayout, 3, 0, 1, 2);
   636 	pageLayout->addLayout(bottomLayout, 3, 0, 1, 2);
   637 
   637 
   638 	BtnBack = addButton(":/res/Exit.png", bottomLayout, 0, true);
   638 	BtnBack = addButton(":/res/Exit.png", bottomLayout, 0, true);
   639 	
   639 
   640 	BtnGo = new QPushButton(this);
   640 	BtnGo = new QPushButton(this);
   641 	BtnGo->setToolTip(QPushButton::tr("Ready"));
   641 	BtnGo->setToolTip(QPushButton::tr("Ready"));
   642 	BtnGo->setIcon(QIcon(":/res/lightbulb_off.png"));
   642 	BtnGo->setIcon(QIcon(":/res/lightbulb_off.png"));
   643 	BtnGo->setIconSize(QSize(25, 34));
   643 	BtnGo->setIconSize(QSize(25, 34));
   644 	BtnGo->setMinimumWidth(50);
   644 	BtnGo->setMinimumWidth(50);
   653 	restrictTeamAdds = new QAction(QAction::tr("Restrict Team Additions"), menu);
   653 	restrictTeamAdds = new QAction(QAction::tr("Restrict Team Additions"), menu);
   654 	restrictTeamAdds->setCheckable(true);
   654 	restrictTeamAdds->setCheckable(true);
   655 	//menu->addAction(startGame);
   655 	//menu->addAction(startGame);
   656 	menu->addAction(restrictJoins);
   656 	menu->addAction(restrictJoins);
   657 	menu->addAction(restrictTeamAdds);
   657 	menu->addAction(restrictTeamAdds);
   658 	
   658 
   659 	BtnMaster->setMenu(menu);
   659 	BtnMaster->setMenu(menu);
   660 
   660 
   661 	BtnStart = addButton(QAction::tr("Start"), bottomLayout, 3);
   661 	BtnStart = addButton(QAction::tr("Start"), bottomLayout, 3);
   662 
   662 
   663 	bottomLayout->insertStretch(1, 100);
   663 	bottomLayout->insertStretch(1, 100);
   708 	BtnSimpleGamePage->setToolTip(tr("Simple Game (a quick game against the computer, settings are chosen for you)"));
   708 	BtnSimpleGamePage->setToolTip(tr("Simple Game (a quick game against the computer, settings are chosen for you)"));
   709 	topLine->addSpacing(60);
   709 	topLine->addSpacing(60);
   710 	BtnMultiplayer = addButton(":/res/Multiplayer.png", topLine, 1, true);
   710 	BtnMultiplayer = addButton(":/res/Multiplayer.png", topLine, 1, true);
   711 	BtnMultiplayer->setToolTip(tr("Multiplayer (play a hotseat game against your friends, or AI teams)"));
   711 	BtnMultiplayer->setToolTip(tr("Multiplayer (play a hotseat game against your friends, or AI teams)"));
   712 	topLine->addStretch();
   712 	topLine->addStretch();
   713 	
   713 
   714 
   714 
   715 	BtnTrainPage = addButton(":/res/Trainings.png", middleLine, 0, true);
   715 	BtnTrainPage = addButton(":/res/Trainings.png", middleLine, 0, true);
   716 	BtnTrainPage->setToolTip(tr("Training Mode (Practice your skills in a range of training missions). IN DEVELOPMENT"));
   716 	BtnTrainPage->setToolTip(tr("Training Mode (Practice your skills in a range of training missions). IN DEVELOPMENT"));
   717 	
   717 
   718 	BtnBack = addButton(":/res/Exit.png", bottomLine, 0, true);
   718 	BtnBack = addButton(":/res/Exit.png", bottomLine, 0, true);
   719 	bottomLine->addStretch();
   719 	bottomLine->addStretch();
   720 
   720 
   721 	BtnDemos = addButton(":/res/Record.png", bottomLine, 1, true);
   721 	BtnDemos = addButton(":/res/Record.png", bottomLine, 1, true);
   722 	BtnDemos->setToolTip(tr("Demos (Watch recorded demos)"));
   722 	BtnDemos->setToolTip(tr("Demos (Watch recorded demos)"));
   742 
   742 
   743 PageSelectWeapon::PageSelectWeapon(QWidget* parent) :
   743 PageSelectWeapon::PageSelectWeapon(QWidget* parent) :
   744   AbstractPage(parent)
   744   AbstractPage(parent)
   745 {
   745 {
   746 	QGridLayout * pageLayout = new QGridLayout(this);
   746 	QGridLayout * pageLayout = new QGridLayout(this);
   747 	
   747 
   748 	pWeapons = new SelWeaponWidget(cAmmoNumber, this);
   748 	pWeapons = new SelWeaponWidget(cAmmoNumber, this);
   749 	pageLayout->addWidget(pWeapons, 0, 0, 1, 4);
   749 	pageLayout->addWidget(pWeapons, 0, 0, 1, 4);
   750 
   750 
   751 	BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true);
   751 	BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true);
   752 	BtnDefault = addButton(tr("Default"), pageLayout, 1, 1);
   752 	BtnDefault = addButton(tr("Default"), pageLayout, 1, 1);
   771 	QGridLayout * pageLayout = new QGridLayout(this);
   771 	QGridLayout * pageLayout = new QGridLayout(this);
   772 
   772 
   773 	roomName = new QLineEdit(this);
   773 	roomName = new QLineEdit(this);
   774 	roomName->setMaxLength(60);
   774 	roomName->setMaxLength(60);
   775 	pageLayout->addWidget(roomName, 0, 0);
   775 	pageLayout->addWidget(roomName, 0, 0);
   776 	
   776 
   777 	roomsList = new QTableWidget(this);
   777 	roomsList = new QTableWidget(this);
   778 	roomsList->setColumnCount(3);
   778 	roomsList->setColumnCount(3);
   779 	roomsList->setSelectionBehavior(QAbstractItemView::SelectRows);
   779 	roomsList->setSelectionBehavior(QAbstractItemView::SelectRows);
   780 	roomsList->verticalHeader()->setVisible(false);
   780 	roomsList->verticalHeader()->setVisible(false);
   781 	roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
   781 	roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
   782 	roomsList->setAlternatingRowColors(true);
   782 	roomsList->setAlternatingRowColors(true);
   783 	pageLayout->addWidget(roomsList, 1, 0, 3, 1);
   783 	pageLayout->addWidget(roomsList, 1, 0, 3, 1);
   784 	pageLayout->setRowStretch(2, 100);
   784 	pageLayout->setRowStretch(2, 100);
   785 	
   785 
   786 	chatWidget = new HWChatWidget(this);
   786 	chatWidget = new HWChatWidget(this);
   787 	pageLayout->addWidget(chatWidget, 4, 0, 1, 2);
   787 	pageLayout->addWidget(chatWidget, 4, 0, 1, 2);
   788 	pageLayout->setRowStretch(4, 350);
   788 	pageLayout->setRowStretch(4, 350);
   789 
   789 
   790 	BtnCreate = addButton(tr("Create"), pageLayout, 0, 1);
   790 	BtnCreate = addButton(tr("Create"), pageLayout, 0, 1);
   791 	BtnJoin = addButton(tr("Join"), pageLayout, 1, 1);
   791 	BtnJoin = addButton(tr("Join"), pageLayout, 1, 1);
   792 	BtnRefresh = addButton(tr("Refresh"), pageLayout, 3, 1);
   792 	BtnRefresh = addButton(tr("Refresh"), pageLayout, 3, 1);
   793 	
   793 
   794 	BtnBack = addButton(":/res/Exit.png", pageLayout, 5, 0, true);
   794 	BtnBack = addButton(":/res/Exit.png", pageLayout, 5, 0, true);
   795 	BtnAdmin = addButton(tr("Admin features"), pageLayout, 5, 1);
   795 	BtnAdmin = addButton(tr("Admin features"), pageLayout, 5, 1);
   796 
   796 
   797 	connect(BtnCreate, SIGNAL(clicked()), this, SLOT(onCreateClick()));
   797 	connect(BtnCreate, SIGNAL(clicked()), this, SLOT(onCreateClick()));
   798 	connect(BtnJoin, SIGNAL(clicked()), this, SLOT(onJoinClick()));
   798 	connect(BtnJoin, SIGNAL(clicked()), this, SLOT(onJoinClick()));
   817 
   817 
   818    roomsList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
   818    roomsList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
   819    roomsList->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents);
   819    roomsList->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents);
   820    roomsList->horizontalHeader()->setResizeMode(2, QHeaderView::ResizeToContents);
   820    roomsList->horizontalHeader()->setResizeMode(2, QHeaderView::ResizeToContents);
   821 
   821 
   822 	
   822 
   823 	if (list.size() % 3)
   823 	if (list.size() % 3)
   824 		return;
   824 		return;
   825 
   825 
   826 	roomsList->setRowCount(list.size() / 3);
   826 	roomsList->setRowCount(list.size() / 3);
   827 	for(int i = 0; i < list.size(); i += 3)
   827 	for(int i = 0; i < list.size(); i += 3)
   878 PageScheme::PageScheme(QWidget* parent) :
   878 PageScheme::PageScheme(QWidget* parent) :
   879 	AbstractPage(parent)
   879 	AbstractPage(parent)
   880 {
   880 {
   881 	QGridLayout * pageLayout = new QGridLayout(this);
   881 	QGridLayout * pageLayout = new QGridLayout(this);
   882 	QGroupBox * gb = new QGroupBox(this);
   882 	QGroupBox * gb = new QGroupBox(this);
   883 	
   883 
   884 	QGridLayout * gl = new QGridLayout();
   884 	QGridLayout * gl = new QGridLayout();
   885 	gb->setLayout(gl);
   885 	gb->setLayout(gl);
   886 	QSizePolicy sp;
   886 	QSizePolicy sp;
   887 	sp.setVerticalPolicy(QSizePolicy::MinimumExpanding);
   887 	sp.setVerticalPolicy(QSizePolicy::MinimumExpanding);
   888 	sp.setHorizontalPolicy(QSizePolicy::Expanding);
   888 	sp.setHorizontalPolicy(QSizePolicy::Expanding);
   889 
   889 
   890 	pageLayout->addWidget(gb, 1,0,13,4);
   890 	pageLayout->addWidget(gb, 1,0,13,4);
   891 	
   891 
   892 	gbGameModes = new QGroupBox(QGroupBox::tr("Game Modifiers"), gb);
   892 	gbGameModes = new QGroupBox(QGroupBox::tr("Game Modifiers"), gb);
   893 	gbBasicSettings = new QGroupBox(QGroupBox::tr("Basic Settings"), gb);
   893 	gbBasicSettings = new QGroupBox(QGroupBox::tr("Basic Settings"), gb);
   894 
   894 
   895 	gbGameModes->setStyleSheet(".QGroupBox {"
   895 	gbGameModes->setStyleSheet(".QGroupBox {"
   896 			"background-color: #130f2c; background-image:url();"
   896 			"background-color: #130f2c; background-image:url();"
   901 
   901 
   902 	gbGameModes->setSizePolicy(sp);
   902 	gbGameModes->setSizePolicy(sp);
   903 	gbBasicSettings->setSizePolicy(sp);
   903 	gbBasicSettings->setSizePolicy(sp);
   904 	gl->addWidget(gbGameModes,0,0,1,3,Qt::AlignTop);
   904 	gl->addWidget(gbGameModes,0,0,1,3,Qt::AlignTop);
   905 	gl->addWidget(gbBasicSettings,0,3,1,3,Qt::AlignTop);
   905 	gl->addWidget(gbBasicSettings,0,3,1,3,Qt::AlignTop);
   906 	
   906 
   907 	QGridLayout * glGMLayout = new QGridLayout(gbGameModes);
   907 	QGridLayout * glGMLayout = new QGridLayout(gbGameModes);
   908 	QGridLayout * glBSLayout = new QGridLayout(gbBasicSettings);
   908 	QGridLayout * glBSLayout = new QGridLayout(gbBasicSettings);
   909 	gbGameModes->setLayout(glGMLayout);
   909 	gbGameModes->setLayout(glGMLayout);
   910 	gbBasicSettings->setLayout(glBSLayout);
   910 	gbBasicSettings->setLayout(glBSLayout);
   911 	// Left
   911 	// Left
   912 	
   912 
   913 	TBW_mode_Forts = new ToggleButtonWidget(gbGameModes, ":/res/btnForts.png");
   913 	TBW_mode_Forts = new ToggleButtonWidget(gbGameModes, ":/res/btnForts.png");
   914 	TBW_mode_Forts->setText(ToggleButtonWidget::tr("Fort Mode"));
   914 	TBW_mode_Forts->setText(ToggleButtonWidget::tr("Fort Mode"));
   915     TBW_mode_Forts->setToolTip(tr("Defend your fort and destroy the opponents, two team colours max!"));
   915     TBW_mode_Forts->setToolTip(tr("Defend your fort and destroy the opponents, two team colours max!"));
   916 	glGMLayout->addWidget(TBW_mode_Forts,0,0,1,1);
   916 	glGMLayout->addWidget(TBW_mode_Forts,0,0,1,1);
   917 
   917 
   965     TBW_artillery->setToolTip(tr("Your hogs are unable to move, put your artillery skills to the test"));
   965     TBW_artillery->setToolTip(tr("Your hogs are unable to move, put your artillery skills to the test"));
   966 	glGMLayout->addWidget(TBW_artillery,2,2,1,1);
   966 	glGMLayout->addWidget(TBW_artillery,2,2,1,1);
   967 
   967 
   968 	// Right
   968 	// Right
   969 	QLabel * l;
   969 	QLabel * l;
   970 	
   970 
   971 	l = new QLabel(gbBasicSettings);
   971 	l = new QLabel(gbBasicSettings);
   972 	l->setText(QLabel::tr("Damage Modifier"));
   972 	l->setText(QLabel::tr("Damage Modifier"));
   973 	l->setWordWrap(true);
   973 	l->setWordWrap(true);
   974 	glBSLayout->addWidget(l,0,0,1,1);
   974 	glBSLayout->addWidget(l,0,0,1,1);
   975 	l = new QLabel(gbBasicSettings);
   975 	l = new QLabel(gbBasicSettings);
   976 	l->setFixedSize(32,32);
   976 	l->setFixedSize(32,32);
   977 	l->setPixmap(QPixmap(":/res/iconDamage.png"));
   977 	l->setPixmap(QPixmap(":/res/iconDamage.png"));
   978 	glBSLayout->addWidget(l,0,1,1,1);
   978 	glBSLayout->addWidget(l,0,1,1,1);
   979 	
   979 
   980 	SB_DamageModifier = new QSpinBox(gbBasicSettings);
   980 	SB_DamageModifier = new QSpinBox(gbBasicSettings);
   981 	SB_DamageModifier->setRange(10, 300);
   981 	SB_DamageModifier->setRange(10, 300);
   982 	SB_DamageModifier->setValue(100);
   982 	SB_DamageModifier->setValue(100);
   983 	SB_DamageModifier->setSingleStep(25);
   983 	SB_DamageModifier->setSingleStep(25);
   984 	glBSLayout->addWidget(SB_DamageModifier,0,2,1,1);
   984 	glBSLayout->addWidget(SB_DamageModifier,0,2,1,1);
   989 	glBSLayout->addWidget(l,1,0,1,1);
   989 	glBSLayout->addWidget(l,1,0,1,1);
   990 	l = new QLabel(gbBasicSettings);
   990 	l = new QLabel(gbBasicSettings);
   991 	l->setFixedSize(32,32);
   991 	l->setFixedSize(32,32);
   992 	l->setPixmap(QPixmap(":/res/iconTime.png"));
   992 	l->setPixmap(QPixmap(":/res/iconTime.png"));
   993 	glBSLayout->addWidget(l,1,1,1,1);
   993 	glBSLayout->addWidget(l,1,1,1,1);
   994 	
   994 
   995 	SB_TurnTime = new QSpinBox(gbBasicSettings);
   995 	SB_TurnTime = new QSpinBox(gbBasicSettings);
   996 	SB_TurnTime->setRange(1, 99);
   996 	SB_TurnTime->setRange(1, 99);
   997 	SB_TurnTime->setValue(45);
   997 	SB_TurnTime->setValue(45);
   998 	SB_TurnTime->setSingleStep(15);
   998 	SB_TurnTime->setSingleStep(15);
   999 	glBSLayout->addWidget(SB_TurnTime,1,2,1,1);
   999 	glBSLayout->addWidget(SB_TurnTime,1,2,1,1);
  1000 	
  1000 
  1001 	l = new QLabel(gbBasicSettings);
  1001 	l = new QLabel(gbBasicSettings);
  1002 	l->setText(QLabel::tr("Initial Health"));
  1002 	l->setText(QLabel::tr("Initial Health"));
  1003 	l->setWordWrap(true);
  1003 	l->setWordWrap(true);
  1004 	glBSLayout->addWidget(l,2,0,1,1);
  1004 	glBSLayout->addWidget(l,2,0,1,1);
  1005 	l = new QLabel(gbBasicSettings);
  1005 	l = new QLabel(gbBasicSettings);
  1006 	l->setFixedSize(32,32);
  1006 	l->setFixedSize(32,32);
  1007 	l->setPixmap(QPixmap(":/res/iconHealth.png"));
  1007 	l->setPixmap(QPixmap(":/res/iconHealth.png"));
  1008 	glBSLayout->addWidget(l,2,1,1,1);
  1008 	glBSLayout->addWidget(l,2,1,1,1);
  1009 	
  1009 
  1010 	SB_InitHealth = new QSpinBox(gbBasicSettings);
  1010 	SB_InitHealth = new QSpinBox(gbBasicSettings);
  1011 	SB_InitHealth->setRange(50, 200);
  1011 	SB_InitHealth->setRange(50, 200);
  1012 	SB_InitHealth->setValue(100);
  1012 	SB_InitHealth->setValue(100);
  1013 	SB_InitHealth->setSingleStep(25);
  1013 	SB_InitHealth->setSingleStep(25);
  1014 	glBSLayout->addWidget(SB_InitHealth,2,2,1,1);
  1014 	glBSLayout->addWidget(SB_InitHealth,2,2,1,1);
  1015 	
  1015 
  1016 	l = new QLabel(gbBasicSettings);
  1016 	l = new QLabel(gbBasicSettings);
  1017 	l->setText(QLabel::tr("Sudden Death Timeout"));
  1017 	l->setText(QLabel::tr("Sudden Death Timeout"));
  1018 	l->setWordWrap(true);
  1018 	l->setWordWrap(true);
  1019 	glBSLayout->addWidget(l,3,0,1,1);
  1019 	glBSLayout->addWidget(l,3,0,1,1);
  1020 	l = new QLabel(gbBasicSettings);
  1020 	l = new QLabel(gbBasicSettings);
  1025 	SB_SuddenDeath = new QSpinBox(gbBasicSettings);
  1025 	SB_SuddenDeath = new QSpinBox(gbBasicSettings);
  1026 	SB_SuddenDeath->setRange(0, 50);
  1026 	SB_SuddenDeath->setRange(0, 50);
  1027 	SB_SuddenDeath->setValue(15);
  1027 	SB_SuddenDeath->setValue(15);
  1028 	SB_SuddenDeath->setSingleStep(3);
  1028 	SB_SuddenDeath->setSingleStep(3);
  1029 	glBSLayout->addWidget(SB_SuddenDeath,3,2,1,1);
  1029 	glBSLayout->addWidget(SB_SuddenDeath,3,2,1,1);
  1030 	
  1030 
  1031 	l = new QLabel(gbBasicSettings);
  1031 	l = new QLabel(gbBasicSettings);
  1032 	l->setText(QLabel::tr("Crate Drops"));
  1032 	l->setText(QLabel::tr("Crate Drops"));
  1033 	l->setWordWrap(true);
  1033 	l->setWordWrap(true);
  1034 	glBSLayout->addWidget(l,4,0,1,1);
  1034 	glBSLayout->addWidget(l,4,0,1,1);
  1035 	l = new QLabel(gbBasicSettings);
  1035 	l = new QLabel(gbBasicSettings);
  1074 
  1074 
  1075 	l = new QLabel(gbBasicSettings);
  1075 	l = new QLabel(gbBasicSettings);
  1076 	l->setText(QLabel::tr("Scheme Name:"));
  1076 	l->setText(QLabel::tr("Scheme Name:"));
  1077 
  1077 
  1078 	LE_name = new QLineEdit(this);
  1078 	LE_name = new QLineEdit(this);
  1079 	
  1079 
  1080 	gl->addWidget(LE_name,14,1,1,5);
  1080 	gl->addWidget(LE_name,14,1,1,5);
  1081 	gl->addWidget(l,14,0,1,1);
  1081 	gl->addWidget(l,14,0,1,1);
  1082 
  1082 
  1083 	mapper = new QDataWidgetMapper(this);
  1083 	mapper = new QDataWidgetMapper(this);
  1084 
  1084 
  1097 
  1097 
  1098 void PageScheme::setModel(QAbstractItemModel * model)
  1098 void PageScheme::setModel(QAbstractItemModel * model)
  1099 {
  1099 {
  1100 	mapper->setModel(model);
  1100 	mapper->setModel(model);
  1101 	selectScheme->setModel(model);
  1101 	selectScheme->setModel(model);
  1102 	
  1102 
  1103 	mapper->addMapping(LE_name, 0);
  1103 	mapper->addMapping(LE_name, 0);
  1104 	mapper->addMapping(TBW_mode_Forts->button(), 1);
  1104 	mapper->addMapping(TBW_mode_Forts->button(), 1);
  1105 	mapper->addMapping(TBW_teamsDivide->button(), 2);
  1105 	mapper->addMapping(TBW_teamsDivide->button(), 2);
  1106 	mapper->addMapping(TBW_solid->button(), 3);
  1106 	mapper->addMapping(TBW_solid->button(), 3);
  1107 	mapper->addMapping(TBW_border->button(), 4);
  1107 	mapper->addMapping(TBW_border->button(), 4);