QTfrontend/pages.cpp
changeset 4410 f9e38ce1e813
parent 4396 3cfd2e15464a
child 4412 c9a78ba03679
equal deleted inserted replaced
4409:a752e543d7b4 4410:f9e38ce1e813
   438 PageMultiplayer::PageMultiplayer(QWidget* parent) :
   438 PageMultiplayer::PageMultiplayer(QWidget* parent) :
   439   AbstractPage(parent)
   439   AbstractPage(parent)
   440 {
   440 {
   441     QGridLayout * pageLayout = new QGridLayout(this);
   441     QGridLayout * pageLayout = new QGridLayout(this);
   442 
   442 
   443     BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true);
   443     BtnBack = addButton(":/res/Exit.png", pageLayout, 3, 0, true);
   444 
   444 
   445     gameCFG = new GameCFGWidget(this);
   445     gameCFG = new GameCFGWidget(this);
   446     pageLayout->addWidget(gameCFG, 0, 0, 1, 2);
   446     pageLayout->addWidget(gameCFG, 0, 0, 1, 2);
   447 
   447 
   448     pageLayout->setRowStretch(1, 1);
   448     QPushButton * btnSetup = new QPushButton(this);
       
   449     btnSetup->setText(QPushButton::tr("Setup"));
       
   450     connect(btnSetup, SIGNAL(clicked()), this, SIGNAL(SetupClicked()));
       
   451     pageLayout->addWidget(btnSetup, 1, 0, 1, 2);
       
   452 
       
   453     pageLayout->setRowStretch(2, 1);
   449 
   454 
   450     teamsSelect = new TeamSelWidget(this);
   455     teamsSelect = new TeamSelWidget(this);
   451     pageLayout->addWidget(teamsSelect, 0, 2, 2, 2);
   456     pageLayout->addWidget(teamsSelect, 0, 2, 3, 2);
   452 
   457 
   453     BtnStartMPGame = addButton(tr("Start"), pageLayout, 2, 3);
   458     BtnStartMPGame = addButton(tr("Start"), pageLayout, 3, 3);
   454 }
   459 }
   455 
   460 
   456 PageOptions::PageOptions(QWidget* parent) :
   461 PageOptions::PageOptions(QWidget* parent) :
   457   AbstractPage(parent)
   462   AbstractPage(parent)
   458 {
   463 {
   520 
   525 
   521             gbTBLayout->addWidget(teamsBox, 0, 0);
   526             gbTBLayout->addWidget(teamsBox, 0, 0);
   522         }
   527         }
   523 
   528 
   524         {
   529         {
   525             // TODO: This box should contain controls for all schemes: game modes and weapons
       
   526 
       
   527             IconedGroupBox* groupWeapons = new IconedGroupBox(this);
   530             IconedGroupBox* groupWeapons = new IconedGroupBox(this);
       
   531             
   528             //groupWeapons->setContentTopPadding(0);
   532             //groupWeapons->setContentTopPadding(0);
   529             //groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
   533             //groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
   530             groupWeapons->setIcon(QIcon(":/res/weaponsicon.png"));
   534             groupWeapons->setIcon(QIcon(":/res/weaponsicon.png"));
   531             groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
   535             groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
   532             groupWeapons->setTitle(QGroupBox::tr("Weapons"));
   536             groupWeapons->setTitle(QGroupBox::tr("Schemes and Weapons"));
   533             QGridLayout * WeaponsLayout = new QGridLayout(groupWeapons);
   537             QGridLayout * WeaponsLayout = new QGridLayout(groupWeapons);
   534 
   538 
       
   539             QLabel* SchemeLabel = new QLabel(groupWeapons);
       
   540             SchemeLabel->setText(QLabel::tr("Game scheme"));
       
   541             WeaponsLayout->addWidget(SchemeLabel, 1, 0);
       
   542 
       
   543             SchemesName = new QComboBox(groupWeapons);
       
   544             WeaponsLayout->addWidget(SchemesName, 1, 1);
       
   545 
       
   546             SchemeNew = new QPushButton(groupWeapons);
       
   547             SchemeNew->setToolTip(tr("New scheme"));
       
   548             SchemeNew->setIconSize(pmNew.size());
       
   549             SchemeNew->setIcon(pmNew);
       
   550             SchemeNew->setMaximumWidth(pmNew.width() + 6);
       
   551             WeaponsLayout->addWidget(SchemeNew, 1, 2);
       
   552 
       
   553             SchemeEdit = new QPushButton(groupWeapons);
       
   554             SchemeEdit->setToolTip(tr("Edit scheme"));
       
   555             SchemeEdit->setIconSize(pmEdit.size());
       
   556             SchemeEdit->setIcon(pmEdit);
       
   557             SchemeEdit->setMaximumWidth(pmEdit.width() + 6);
       
   558             WeaponsLayout->addWidget(SchemeEdit, 1, 3);
       
   559 
       
   560             SchemeDelete = new QPushButton(groupWeapons);
       
   561             SchemeDelete->setToolTip(tr("Delete scheme"));
       
   562             SchemeDelete->setIconSize(pmDelete.size());
       
   563             SchemeDelete->setIcon(pmDelete);
       
   564             SchemeDelete->setMaximumWidth(pmDelete.width() + 6);
       
   565             SchemeDelete->setEnabled(false);
       
   566             SchemeDelete->setVisible(false); // hide for now
       
   567             WeaponsLayout->addWidget(SchemeDelete, 1, 4);
       
   568 
       
   569             QLabel* WeaponLabel = new QLabel(groupWeapons);
       
   570             WeaponLabel->setText(QLabel::tr("Weapons"));
       
   571             WeaponsLayout->addWidget(WeaponLabel, 2, 0);
       
   572 
   535             WeaponsName = new QComboBox(groupWeapons);
   573             WeaponsName = new QComboBox(groupWeapons);
   536             WeaponsLayout->addWidget(WeaponsName, 0, 0);
   574             WeaponsLayout->addWidget(WeaponsName, 2, 1);
   537 
   575 
   538             WeaponsButt = new QPushButton(groupWeapons);
   576             WeaponNew = new QPushButton(groupWeapons);
   539             WeaponsButt->setToolTip(tr("New weapon scheme"));
   577             WeaponNew->setToolTip(tr("New weapon set"));
   540             WeaponsButt->setIconSize(pmNew.size());
   578             WeaponNew->setIconSize(pmNew.size());
   541             WeaponsButt->setIcon(pmNew);
   579             WeaponNew->setIcon(pmNew);
   542             WeaponsButt->setMaximumWidth(pmNew.width() + 6);
   580             WeaponNew->setMaximumWidth(pmNew.width() + 6);
   543             WeaponsLayout->addWidget(WeaponsButt, 0, 1);
   581             WeaponsLayout->addWidget(WeaponNew, 2, 2);
   544 
   582 
   545             WeaponEdit = new QPushButton(groupWeapons);
   583             WeaponEdit = new QPushButton(groupWeapons);
   546             WeaponEdit->setToolTip(tr("Edit weapon scheme"));
   584             WeaponEdit->setToolTip(tr("Edit weapon set"));
   547             WeaponEdit->setIconSize(pmEdit.size());
   585             WeaponEdit->setIconSize(pmEdit.size());
   548             WeaponEdit->setIcon(pmEdit);
   586             WeaponEdit->setIcon(pmEdit);
   549             WeaponEdit->setMaximumWidth(pmEdit.width() + 6);
   587             WeaponEdit->setMaximumWidth(pmEdit.width() + 6);
   550             WeaponsLayout->addWidget(WeaponEdit, 0, 2);
   588             WeaponsLayout->addWidget(WeaponEdit, 2, 3);
   551 
   589 
   552             WeaponDelete = new QPushButton(groupWeapons);
   590             WeaponDelete = new QPushButton(groupWeapons);
   553             WeaponDelete->setToolTip(tr("Delete weapon scheme"));
   591             WeaponDelete->setToolTip(tr("Delete weapon set"));
   554             WeaponDelete->setIconSize(pmDelete.size());
   592             WeaponDelete->setIconSize(pmDelete.size());
   555             WeaponDelete->setIcon(pmDelete);
   593             WeaponDelete->setIcon(pmDelete);
   556             WeaponDelete->setMaximumWidth(pmDelete.width() + 6);
   594             WeaponDelete->setMaximumWidth(pmDelete.width() + 6);
   557             WeaponDelete->setEnabled(false);
   595             WeaponDelete->setEnabled(false);
   558             WeaponDelete->setVisible(false); // hide for now
   596             WeaponDelete->setVisible(false); // hide for now
   559             WeaponsLayout->addWidget(WeaponDelete, 0, 3);
   597             WeaponsLayout->addWidget(WeaponDelete, 2, 4);
   560 
   598 
   561             WeaponTooltip = new QCheckBox(this);
   599             WeaponTooltip = new QCheckBox(this);
   562             WeaponTooltip->setText(QCheckBox::tr("Show ammo menu tooltips"));
   600             WeaponTooltip->setText(QCheckBox::tr("Show ammo menu tooltips"));
   563             WeaponsLayout->addWidget(WeaponTooltip, 1, 0, 1, 3);
   601             WeaponsLayout->addWidget(WeaponTooltip, 3, 0, 1, 4);
   564 
   602 
   565             gbTBLayout->addWidget(groupWeapons, 1, 0);
   603             gbTBLayout->addWidget(groupWeapons, 1, 0);
   566         }
   604         }
   567 
   605 
   568         {
   606         {
   728             hr->setFrameStyle(QFrame::HLine);
   766             hr->setFrameStyle(QFrame::HLine);
   729             hr->setLineWidth(3);
   767             hr->setLineWidth(3);
   730             hr->setFixedHeight(10);
   768             hr->setFixedHeight(10);
   731             GBAlayout->addWidget(hr);
   769             GBAlayout->addWidget(hr);
   732 
   770 
   733                 QLabel *restartNote = new QLabel(this);
   771             QLabel *restartNote = new QLabel(this);
   734             restartNote->setText(QString("* ") + QLabel::tr("Restart game to apply"));
   772             restartNote->setText(QString("* ") + QLabel::tr("Restart game to apply"));
   735             restartNote->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
   773             restartNote->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
   736             GBAlayout->addWidget(restartNote);
   774             GBAlayout->addWidget(restartNote);
   737 
   775 
   738             gbTBLayout->addWidget(AGGroupBox, 0, 1, 3, 1);
   776             gbTBLayout->addWidget(AGGroupBox, 0, 1, 3, 1);
   893     pageLayout->setColumnStretch(1, 50);
   931     pageLayout->setColumnStretch(1, 50);
   894 
   932 
   895     // chatwidget
   933     // chatwidget
   896     pChatWidget = new HWChatWidget(this, gameSettings, sdli, true);
   934     pChatWidget = new HWChatWidget(this, gameSettings, sdli, true);
   897     pChatWidget->setShowReady(true); // show status bulbs by default
   935     pChatWidget->setShowReady(true); // show status bulbs by default
   898     pageLayout->addWidget(pChatWidget, 1, 0, 1, 2);
   936     pageLayout->addWidget(pChatWidget, 2, 0, 1, 2);
   899     pageLayout->setRowStretch(1, 100);
   937     pageLayout->setRowStretch(1, 100);
   900 
   938 
   901     pGameCFG = new GameCFGWidget(this);
   939     pGameCFG = new GameCFGWidget(this);
   902     pageLayout->addWidget(pGameCFG, 0, 0);
   940     pageLayout->addWidget(pGameCFG, 0, 0);
   903 
   941 
       
   942     QPushButton * btnSetup = new QPushButton(this);
       
   943     btnSetup->setText(QPushButton::tr("Setup"));
       
   944     connect(btnSetup, SIGNAL(clicked()), this, SIGNAL(SetupClicked()));
       
   945     pageLayout->addWidget(btnSetup, 1, 0);
       
   946 
   904     pNetTeamsWidget = new TeamSelWidget(this);
   947     pNetTeamsWidget = new TeamSelWidget(this);
   905     pNetTeamsWidget->setAcceptOuter(true);
   948     pNetTeamsWidget->setAcceptOuter(true);
   906     pageLayout->addWidget(pNetTeamsWidget, 0, 1);
   949     pageLayout->addWidget(pNetTeamsWidget, 0, 1, 2, 1);
   907 
   950 
   908 
   951 
   909     QHBoxLayout * bottomLayout = new QHBoxLayout;
   952     QHBoxLayout * bottomLayout = new QHBoxLayout;
   910     pageLayout->addLayout(bottomLayout, 3, 0, 1, 2);
   953     pageLayout->addLayout(bottomLayout, 4, 0, 1, 2);
   911 
   954 
   912     BtnBack = addButton(":/res/Exit.png", bottomLayout, 0, true);
   955     BtnBack = addButton(":/res/Exit.png", bottomLayout, 0, true);
   913 
   956 
   914     BtnGo = new QPushButton(this);
   957     BtnGo = new QPushButton(this);
   915     BtnGo->setToolTip(QPushButton::tr("Ready"));
   958     BtnGo->setToolTip(QPushButton::tr("Ready"));
  1656     SB_HealthDecrease->setValue(5);
  1699     SB_HealthDecrease->setValue(5);
  1657     SB_HealthDecrease->setSingleStep(1);
  1700     SB_HealthDecrease->setSingleStep(1);
  1658     glBSLayout->addWidget(SB_HealthDecrease,5,2,1,1);
  1701     glBSLayout->addWidget(SB_HealthDecrease,5,2,1,1);
  1659 
  1702 
  1660     l = new QLabel(gbBasicSettings);
  1703     l = new QLabel(gbBasicSettings);
  1661     l->setText(QLabel::tr("Crate Drops"));
  1704     l->setText(QLabel::tr("% Rope Length"));
  1662     l->setWordWrap(true);
  1705     l->setWordWrap(true);
  1663     glBSLayout->addWidget(l,6,0,1,1);
  1706     glBSLayout->addWidget(l,6,0,1,1);
  1664     l = new QLabel(gbBasicSettings);
  1707     l = new QLabel(gbBasicSettings);
  1665     l->setFixedSize(32,32);
  1708     l->setFixedSize(32,32);
  1666     l->setPixmap(QPixmap(":/res/iconBox.png"));
  1709     l->setPixmap(QPixmap(":/res/iconRope.png"));
  1667     glBSLayout->addWidget(l,6,1,1,1);
  1710     glBSLayout->addWidget(l,6,1,1,1);
  1668     SB_CaseProb = new FreqSpinBox(gbBasicSettings);
       
  1669     SB_CaseProb->setRange(0, 9);
       
  1670     SB_CaseProb->setValue(5);
       
  1671     glBSLayout->addWidget(SB_CaseProb,6,2,1,1);
       
  1672 
       
  1673     l = new QLabel(gbBasicSettings);
       
  1674     l->setText(QLabel::tr("% Rope Length"));
       
  1675     l->setWordWrap(true);
       
  1676     glBSLayout->addWidget(l,7,0,1,1);
       
  1677     l = new QLabel(gbBasicSettings);
       
  1678     l->setFixedSize(32,32);
       
  1679     l->setPixmap(QPixmap(":/res/iconRope.png"));
       
  1680     glBSLayout->addWidget(l,7,1,1,1);
       
  1681     SB_RopeModifier = new QSpinBox(gbBasicSettings);
  1711     SB_RopeModifier = new QSpinBox(gbBasicSettings);
  1682     SB_RopeModifier->setRange(25, 999);
  1712     SB_RopeModifier->setRange(25, 999);
  1683     SB_RopeModifier->setValue(100);
  1713     SB_RopeModifier->setValue(100);
  1684     SB_RopeModifier->setSingleStep(25);
  1714     SB_RopeModifier->setSingleStep(25);
  1685     glBSLayout->addWidget(SB_RopeModifier,7,2,1,1);
  1715     glBSLayout->addWidget(SB_RopeModifier,6,2,1,1);
       
  1716 
       
  1717     l = new QLabel(gbBasicSettings);
       
  1718     l->setText(QLabel::tr("Crate Drops"));
       
  1719     l->setWordWrap(true);
       
  1720     glBSLayout->addWidget(l,7,0,1,1);
       
  1721     l = new QLabel(gbBasicSettings);
       
  1722     l->setFixedSize(32,32);
       
  1723     l->setPixmap(QPixmap(":/res/iconBox.png"));
       
  1724     glBSLayout->addWidget(l,7,1,1,1);
       
  1725     SB_CaseProb = new FreqSpinBox(gbBasicSettings);
       
  1726     SB_CaseProb->setRange(0, 9);
       
  1727     SB_CaseProb->setValue(5);
       
  1728     glBSLayout->addWidget(SB_CaseProb,7,2,1,1);
  1686 
  1729 
  1687     l = new QLabel(gbBasicSettings);
  1730     l = new QLabel(gbBasicSettings);
  1688     l->setText(QLabel::tr("% Health Crates"));
  1731     l->setText(QLabel::tr("% Health Crates"));
  1689     l->setWordWrap(true);
  1732     l->setWordWrap(true);
  1690     glBSLayout->addWidget(l,8,0,1,1);
  1733     glBSLayout->addWidget(l,8,0,1,1);