QTfrontend/pages.cpp
branchexperimental3D
changeset 4004 b1c2c2f6fc5e
parent 3698 793386610068
parent 3999 411e71912f4c
child 4006 45b63c2a694f
equal deleted inserted replaced
3698:793386610068 4004:b1c2c2f6fc5e
    90     pageLayout->setAlignment(BtnNet, Qt::AlignHCenter);
    90     pageLayout->setAlignment(BtnNet, Qt::AlignHCenter);
    91 
    91 
    92     mainNote = new QLabel(this);
    92     mainNote = new QLabel(this);
    93     mainNote->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
    93     mainNote->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
    94     mainNote->setWordWrap(true);
    94     mainNote->setWordWrap(true);
    95 
    95     mainNote->setOpenExternalLinks(true);
    96     QStringList Tips;
    96 
    97     Tips << tr("Simply pick the same color as a friend to play together as a team. Each of you will still control his or her own hedgehogs but they'll win or lose together.", "Tips");
    97     if(!isDevBuild)
    98     Tips << tr("Some weapons might do only low damage but they can be a lot more devastating in the right situation. Try to use the Desert Eagle to knock multiple hedgehogs into the water.", "Tips");
    98     {
    99     Tips << tr("If you're unsure what to do and don't want to waste ammo, skip one round. But don't let too much time pass as there will be Sudden Death!", "Tips");
    99         QStringList Tips;
   100     Tips << tr("Want to save ropse? Release the rope in mid air and then shoot again. As long as you don't touch the ground you'll reuse your rope without wasting ammo!", "Tips");
   100         Tips << tr("Simply pick the same color as a friend to play together as a team. Each of you will still control his or her own hedgehogs but they'll win or lose together.", "Tips");
   101     Tips << tr("If you'd like to keep others from using your preferred nickname on the official server, register an account at http://www.hedgewars.org/.", "Tips");
   101         Tips << tr("Some weapons might do only low damage but they can be a lot more devastating in the right situation. Try to use the Desert Eagle to knock multiple hedgehogs into the water.", "Tips");
   102     Tips << tr("You're bored of default gameplay? Try one of the missions - they'll offer different gameplay depending on the one you picked.", "Tips");
   102         Tips << tr("If you're unsure what to do and don't want to waste ammo, skip one round. But don't let too much time pass as there will be Sudden Death!", "Tips");
   103     Tips << tr("By default the game will always record the last game played as a demo. Select 'Local Game' and pick the 'Demos' button on the lower right corner to play or manage them.", "Tips");
   103         Tips << tr("Want to save ropse? Release the rope in mid air and then shoot again. As long as you don't touch the ground you'll reuse your rope without wasting ammo!", "Tips");
   104     Tips << tr("Hedgewars is Open Source and Freeware we create in our spare time. If you've got problems, ask on our forums but please don't expect 24/7 support!", "Tips");
   104         Tips << tr("If you'd like to keep others from using your preferred nickname on the official server, register an account at http://www.hedgewars.org/.", "Tips");
   105     Tips << tr("Hedgewars is Open Source and Freeware we create in our spare time. If you like it, help us with a small donation or contribute your own work!", "Tips");
   105         Tips << tr("You're bored of default gameplay? Try one of the missions - they'll offer different gameplay depending on the one you picked.", "Tips");
   106     Tips << tr("Hedgewars is Open Source and Freeware we create in our spare time. Share it with your family and friends as you like!", "Tips");
   106         Tips << tr("By default the game will always record the last game played as a demo. Select 'Local Game' and pick the 'Demos' button on the lower right corner to play or manage them.", "Tips");
   107     Tips << tr("From time to time there will be official tournaments. Upcoming events will be announced at http://www.hedgewars.org/ some days in advance.", "Tips");
   107         Tips << tr("Hedgewars is Open Source and Freeware we create in our spare time. If you've got problems, ask on our forums but please don't expect 24/7 support!", "Tips");
   108     Tips << tr("Hedgewars is available in many languages. If the translation in your language seems to be missing or outdated, feel free to contact us!", "Tips");
   108         Tips << tr("Hedgewars is Open Source and Freeware we create in our spare time. If you like it, help us with a small donation or contribute your own work!", "Tips");
   109     Tips << tr("Hedgewars can be run on lots of different operating systems including Microsoft Windows, Mac OS X and Linux.", "Tips");
   109         Tips << tr("Hedgewars is Open Source and Freeware we create in our spare time. Share it with your family and friends as you like!", "Tips");
   110     Tips << tr("Always remember you're able to set up your own games in local and network/online play. You're not restricted to the 'Simple Game' option.", "Tips");
   110         Tips << tr("Hedgewars is Open Source and Freeware we create in our spare time. If someone sold you the game, you should try get a refund!", "Tips");
   111     Tips << tr("Connect one or more gamepads before launching the game to be able to assign their controls to your teams.", "Tips");
   111         Tips << tr("From time to time there will be official tournaments. Upcoming events will be announced at http://www.hedgewars.org/ some days in advance.", "Tips");
   112     Tips << tr("Create an account on http://www.hedgewars.org/ to keep others from using your most favourite nickname while playing on the official server.", "Tips");
   112         Tips << tr("Hedgewars is available in many languages. If the translation in your language seems to be missing or outdated, feel free to contact us!", "Tips");
   113     Tips << tr("While playing you should give yourself a short break at least once an hour.", "Tips");
   113         Tips << tr("Hedgewars can be run on lots of different operating systems including Microsoft Windows, Mac OS X and Linux.", "Tips");
   114     Tips << tr("If your graphics card isn't able to provide hardware accelerated OpenGL, try to enable the low quality mode to improve performance.", "Tips");
   114         Tips << tr("Always remember you're able to set up your own games in local and network/online play. You're not restricted to the 'Simple Game' option.", "Tips");
   115     Tips << tr("We're open to suggestions and constructive feedback. If you don't like something or got a great idea, let us know!", "Tips");
   115         Tips << tr("Connect one or more gamepads before starting the game to be able to assign their controls to your teams.", "Tips");
   116     Tips << tr("Especially while playing online be polite and always remember there might be some minors playing with or against you as well!", "Tips");
   116         Tips << tr("Create an account on %1 to keep others from using your most favourite nickname while playing on the official server.", "Tips").arg("<a href=\"http://www.hedgewars.org/\">http://www.hedgewars.org/</a>");
   117     Tips << tr("Special game modes such as 'Vampirism' or 'Karma' allow you to develop completely new tactics. Try them in a custom game!", "Tips");
   117         Tips << tr("While playing you should give yourself a short break at least once an hour.", "Tips");
   118     Tips << tr("The Windows version of Hedgewars supports Xfire. Make sure to add Hedgwars to its game list so your friends can see you playing.", "Tips");
   118         Tips << tr("If your graphics card isn't able to provide hardware accelerated OpenGL, try to enable the low quality mode to improve performance.", "Tips");
   119     Tips << tr("You should never install Hedgewars on computers you don't own (school, university, work, etc.). Please ask the responsible person instead!", "Tips");
   119         Tips << tr("If your graphics card isn't able to provide hardware accelerated OpenGL, try to update the associated drivers.", "Tips");
   120     Tips << tr("Hedgewars can be perfect for short games during breaks. Just ensure you don't add too many hedgehogs or use an huge map. Reducing time and health might help as well.", "Tips");
   120         Tips << tr("We're open to suggestions and constructive feedback. If you don't like something or got a great idea, let us know!", "Tips");
   121     Tips << tr("No hedgehogs were harmed in making this game.", "Tips");
   121         Tips << tr("Especially while playing online be polite and always remember there might be some minors playing with or against you as well!", "Tips");
   122     
   122         Tips << tr("Special game modes such as 'Vampirism' or 'Karma' allow you to develop completely new tactics. Try them in a custom game!", "Tips");
   123 
   123         Tips << tr("The Windows version of Hedgewars supports Xfire. Make sure to add Hedgwars to its game list so your friends can see you playing.", "Tips");
   124     if(isDevBuild)
   124         Tips << tr("You should never install Hedgewars on computers you don't own (school, university, work, etc.). Please ask the responsible person instead!", "Tips");
       
   125         Tips << tr("Hedgewars can be perfect for short games during breaks. Just ensure you don't add too many hedgehogs or use an huge map. Reducing time and health might help as well.", "Tips");
       
   126         Tips << tr("No hedgehogs were harmed in making this game.", "Tips");
       
   127         Tips << tr("There are three different jumps available. Tap [high jump] twice to do a very high/backwards jump.", "Tips");
       
   128         Tips << tr("Afraid of falling off a cliff? Hold down [precise] to turn [left] or [right] without actually moving.", "Tips");
       
   129         Tips << tr("Some weapons require special strategies or just lots of training, so don't give up on a particular tool if you miss an enemy once.", "Tips");
       
   130         Tips << tr("Most weapons won't work once they touch the water. The Homing Bee as well as the Cake are exceptions to this.", "Tips");
       
   131         Tips << tr("The Old Limbuger only causes a small explosion. However the wind affected smelly cloud can poison lots of hogs at once.", "Tips");
       
   132         Tips << tr("The Piano Strike is the most damaging air strike. You'll lose the hedgehog performing it, so there's a huge downside as well.", "Tips");
       
   133         Tips << tr("The Homing Bee can be tricky to use. It's turn radius depends on it's velocity, so try to not use full power.", "Tips");
       
   134         Tips << tr("Sticky Mines are a perfect tool to create small chain reactions knocking enemy hedgehogs into dire situations ... or water.", "Tips");
       
   135         Tips << tr("The Hammer is most effective when used on bridges or girders. Hit hogs will just break through the ground.", "Tips");
       
   136         Tips << tr("If you're stuck behind an enemy hedgehog, use the Hammer to free yourself without getting damaged by an explosion.", "Tips");
       
   137         Tips << tr("The Cake's maximum walking distance depends on the ground it has to pass. Use [attack] to detonate it early.", "Tips");
       
   138         Tips << tr("The Flame Thrower is a weapon but it can be used for tunnel digging as well.", "Tips");
       
   139         Tips << tr("Use the Incinerating Grenade to temporary keep hedgehogs from passing terrain such as tunnels or platforms.", "Tips");
       
   140         Tips << tr("Want to know who's behind the game? Click on the Hedgewars logo in the main menu to see the credits.", "Tips");
       
   141         Tips << tr("Like Hedgewars? Become a fan on %1 or join our group at %2. You could follow us on %3 as well!", "Tips").arg("<a href=\"http://www.facebook.com/Hedgewars\">Facebook</a>").arg("<a href=\"http://steamcommunity.com/groups/hedgewars\">Steam Community</a>").arg("<a href=\"http://twitter.com/hedgewars\">Twitter</a>");
       
   142         Tips << tr("Feel free to draw your own graves, hats, flags or even maps and themes! But note that you'll have to share them somewhere to use them online.", "Tips");
       
   143         Tips << tr("Really want to wear a specific hat? Donate to us and receive an exclusive hat of your choice!", "Tips");
       
   144         // The following tip will require links to app store entries first.
       
   145         //Tips << tr("Want to play Hedgewars any time? Grab the Mobile version for %1 and %2.", "Tips").arg("").arg("");
       
   146         Tips << tr("Keep your video card drivers up to date to avoid issues playing the game.", "Tips");
       
   147         //Tips << tr("", "Tips");
       
   148 #ifdef _WIN32
       
   149         Tips << tr("You can find your Hedgewars configuration files under \"My Documents\\Hedgewars\". Create backups or take the files with you, but don't edit them by hand.", "Tips");
       
   150         Tips << tr("You're able to associate Hedgewars related files (savegames and demo recordings) with the game to launch them right from your favorite file or internet browser.", "Tips");
       
   151 #else
       
   152         Tips << tr("You can find your Hedgewars configuration files under \"Hedgewars\" in your home directory. Create backups or take the files with you, but don't edit them by hand.", "Tips");
       
   153 #endif
       
   154         mainNote->setText(QLabel::tr("Tip: ") + Tips[QTime(0, 0, 0).secsTo(QTime::currentTime()) % Tips.length()]);
       
   155     }
       
   156     else
   125         mainNote->setText(QLabel::tr("This development build is 'work in progress' and may not be compatible with other versions of the game. Some features might be broken or incomplete. Use at your own risk!"));
   157         mainNote->setText(QLabel::tr("This development build is 'work in progress' and may not be compatible with other versions of the game. Some features might be broken or incomplete. Use at your own risk!"));
   126     else
       
   127         mainNote->setText(QLabel::tr("Tip: ") + Tips[QTime(0, 0, 0).secsTo(QTime::currentTime()) % Tips.length()]);
       
   128 
   158 
   129     pageLayout->addWidget(mainNote, 4, 1, 1, 2);
   159     pageLayout->addWidget(mainNote, 4, 1, 1, 2);
   130 
   160 
   131     BtnSetup = addButton(":/res/Settings.png", pageLayout, 4, 3, true);
   161     BtnSetup = addButton(":/res/Settings.png", pageLayout, 4, 3, true);
   132 
   162 
   299     }
   329     }
   300 
   330 
   301     tmpdir.cd(datadir->absolutePath());
   331     tmpdir.cd(datadir->absolutePath());
   302     tmpdir.cd("Graphics/Flags");
   332     tmpdir.cd("Graphics/Flags");
   303     list = tmpdir.entryList(QStringList("*.png"));
   333     list = tmpdir.entryList(QStringList("*.png"));
       
   334     
       
   335     // add the default flag
       
   336     CBFlag->addItem(QIcon(QPixmap(datadir->absolutePath() + "/Graphics/Flags/hedgewars.png").copy(0, 0, 22, 15)), "Hedgewars", "hedgewars");
       
   337 
       
   338     CBFlag->insertSeparator(CBFlag->count());
       
   339     // add all country flags
   304     for (QStringList::Iterator it = list.begin(); it != list.end(); ++it )
   340     for (QStringList::Iterator it = list.begin(); it != list.end(); ++it )
   305     {
   341     {
   306         QPixmap pix(datadir->absolutePath() + "/Graphics/Flags/" + *it);
   342         QPixmap pix(datadir->absolutePath() + "/Graphics/Flags/" + *it);
   307         QIcon icon(pix.copy(0, 0, 22, 15));
   343         QIcon icon(pix.copy(0, 0, 22, 15));
   308         if(it->compare("cpu.png")) // skip cpu flag
   344         if(it->compare("cpu.png") && it->compare("hedgewars.png") && (it->indexOf("cm_") == -1)) // skip cpu and hedgewars flags as well as all community flags
   309             CBFlag->addItem(icon, (*it).replace(QRegExp("^(.*)\\.png"), "\\1"));
   345         {
       
   346             QString flag = (*it).replace(QRegExp("^(.*)\\.png"), "\\1");
       
   347             CBFlag->addItem(icon, QString(flag).replace("_", " "), flag);
       
   348         }
       
   349     }
       
   350     CBFlag->insertSeparator(CBFlag->count());
       
   351     // add all community flags
       
   352     for (QStringList::Iterator it = list.begin(); it != list.end(); ++it )
       
   353     {
       
   354         QPixmap pix(datadir->absolutePath() + "/Graphics/Flags/" + *it);
       
   355         QIcon icon(pix.copy(0, 0, 22, 15));
       
   356         if(it->indexOf("cm_") > -1) // skip non community flags this time
       
   357         {
       
   358             QString flag = (*it).replace(QRegExp("^(.*)\\.png"), "\\1");
       
   359             CBFlag->addItem(icon, QString(flag).replace("cm_", QComboBox::tr("Community") + ": "), flag);
       
   360         }
   310     }
   361     }
   311 
   362 
   312     vbox1->addStretch();
   363     vbox1->addStretch();
   313     vbox2->addStretch();
   364     vbox2->addStretch();
   314 
   365 
   558 #ifdef SPARKLE_ENABLED
   609 #ifdef SPARKLE_ENABLED
   559             CBAutoUpdate = new QCheckBox(groupMisc);
   610             CBAutoUpdate = new QCheckBox(groupMisc);
   560             CBAutoUpdate->setText(QCheckBox::tr("Check for updates at startup"));
   611             CBAutoUpdate->setText(QCheckBox::tr("Check for updates at startup"));
   561             MiscLayout->addWidget(CBAutoUpdate, 4, 0, 1, 2);
   612             MiscLayout->addWidget(CBAutoUpdate, 4, 0, 1, 2);
   562 #endif
   613 #endif
   563 
   614 #ifdef _WIN32
       
   615             BtnAssociateFiles = new QPushButton(groupMisc);
       
   616             BtnAssociateFiles->setText(QPushButton::tr("Associate file extensions"));
       
   617             BtnAssociateFiles->setEnabled(!custom_data && !custom_config);
       
   618             MiscLayout->addWidget(BtnAssociateFiles, 4, 0, 1, 2);
       
   619 #endif
   564             gbTBLayout->addWidget(groupMisc, 2, 0);
   620             gbTBLayout->addWidget(groupMisc, 2, 0);
   565         }
   621         }
   566 
   622 
   567         {
   623         {
   568             AGGroupBox = new IconedGroupBox(this);
   624             AGGroupBox = new IconedGroupBox(this);
   611             GBAlayout->addWidget(CBFullscreen);
   667             GBAlayout->addWidget(CBFullscreen);
   612             connect(CBFullscreen, SIGNAL(stateChanged(int)), this, SLOT(setFullscreen(void)));
   668             connect(CBFullscreen, SIGNAL(stateChanged(int)), this, SLOT(setFullscreen(void)));
   613 
   669 
   614             QLabel * quality = new QLabel(AGGroupBox);
   670             QLabel * quality = new QLabel(AGGroupBox);
   615             quality->setText(QLabel::tr("Quality"));
   671             quality->setText(QLabel::tr("Quality"));
       
   672             quality->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
   616             GBAqualayout->addWidget(quality);
   673             GBAqualayout->addWidget(quality);
   617             
   674             
   618             SLQuality = new QSlider(Qt::Horizontal, AGGroupBox);
   675             SLQuality = new QSlider(Qt::Horizontal, AGGroupBox);
   619             SLQuality->setTickPosition(QSlider::TicksBelow);
   676             SLQuality->setTickPosition(QSlider::TicksBelow);
   620             SLQuality->setMaximum(5);
   677             SLQuality->setMaximum(5);
   621             SLQuality->setMinimum(0);
   678             SLQuality->setMinimum(0);
   622             SLQuality->setFixedWidth(150);
   679             SLQuality->setFixedWidth(150);
   623             GBAqualayout->addWidget(SLQuality);
   680             GBAqualayout->addWidget(SLQuality);
   624             GBAlayout->addLayout(GBAqualayout);
   681             GBAlayout->addLayout(GBAqualayout);
   625 
       
   626             QLabel * stereo = new QLabel(AGGroupBox);
   682             QLabel * stereo = new QLabel(AGGroupBox);
   627             stereo->setText(QLabel::tr("Stereo rendering"));
   683             stereo->setText(QLabel::tr("Stereo rendering"));
   628             GBAstereolayout->addWidget(stereo);
   684             GBAstereolayout->addWidget(stereo);
   629 
   685 
   630             CBStereoMode = new QComboBox(AGGroupBox);
   686             CBStereoMode = new QComboBox(AGGroupBox);
   960     BtnMultiplayer = addButton(":/res/Multiplayer.png", topLine, 1, true);
  1016     BtnMultiplayer = addButton(":/res/Multiplayer.png", topLine, 1, true);
   961     BtnMultiplayer->setToolTip(tr("Multiplayer (play a hotseat game against your friends, or AI teams)"));
  1017     BtnMultiplayer->setToolTip(tr("Multiplayer (play a hotseat game against your friends, or AI teams)"));
   962     topLine->addStretch();
  1018     topLine->addStretch();
   963 
  1019 
   964 
  1020 
   965     BtnTrainPage = addButton(":/res/Trainings.png", middleLine, 0, true);
  1021     BtnCampaignPage = addButton(":/res/SimpleGame.png", middleLine, 0, true);
       
  1022     BtnCampaignPage->setToolTip(tr("Campaign Mode (...). IN DEVELOPMENT"));
       
  1023 
       
  1024     BtnTrainPage = addButton(":/res/Trainings.png", middleLine, 1, true);
   966     BtnTrainPage->setToolTip(tr("Training Mode (Practice your skills in a range of training missions). IN DEVELOPMENT"));
  1025     BtnTrainPage->setToolTip(tr("Training Mode (Practice your skills in a range of training missions). IN DEVELOPMENT"));
   967 
  1026 
   968     BtnBack = addButton(":/res/Exit.png", bottomLine, 0, true);
  1027     BtnBack = addButton(":/res/Exit.png", bottomLine, 0, true);
   969     bottomLine->addStretch();
  1028     bottomLine->addStretch();
   970 
  1029 
   991     QDir tmpdir;
  1050     QDir tmpdir;
   992     tmpdir.cd(datadir->absolutePath());
  1051     tmpdir.cd(datadir->absolutePath());
   993     tmpdir.cd("Missions/Training");
  1052     tmpdir.cd("Missions/Training");
   994     tmpdir.setFilter(QDir::Files);
  1053     tmpdir.setFilter(QDir::Files);
   995     CBSelect->addItems(tmpdir.entryList(QStringList("*.lua")).replaceInStrings(QRegExp("^(.*)\\.lua"), "\\1"));
  1054     CBSelect->addItems(tmpdir.entryList(QStringList("*.lua")).replaceInStrings(QRegExp("^(.*)\\.lua"), "\\1"));
       
  1055     for(int i = 0; i < CBSelect->count(); i++)
       
  1056         CBSelect->setItemData(i, CBSelect->itemText(i));
   996 
  1057 
   997     pageLayout->addWidget(CBSelect, 1, 1);
  1058     pageLayout->addWidget(CBSelect, 1, 1);
   998     
  1059     
   999     BtnStartTrain = new QPushButton(this);
  1060     BtnStartTrain = new QPushButton(this);
  1000     BtnStartTrain->setFont(*font14);
  1061     BtnStartTrain->setFont(*font14);
  1001     BtnStartTrain->setText(QPushButton::tr("Go!"));
  1062     BtnStartTrain->setText(QPushButton::tr("Go!"));
  1002     pageLayout->addWidget(BtnStartTrain, 1, 2);
  1063     pageLayout->addWidget(BtnStartTrain, 1, 2);
  1003 
  1064 
  1004     BtnBack = addButton(":/res/Exit.png", pageLayout, 3, 0, true);
  1065     BtnBack = addButton(":/res/Exit.png", pageLayout, 3, 0, true);
       
  1066 }
       
  1067 
       
  1068 PageCampaign::PageCampaign(QWidget* parent) : AbstractPage(parent)
       
  1069 {
       
  1070     QGridLayout * pageLayout = new QGridLayout(this);
       
  1071     pageLayout->setColumnStretch(0, 1);
       
  1072     pageLayout->setColumnStretch(1, 2);
       
  1073     pageLayout->setColumnStretch(2, 1);
       
  1074     pageLayout->setRowStretch(0, 1);
       
  1075     pageLayout->setRowStretch(3, 1);
       
  1076 
       
  1077     CBSelect = new QComboBox(this);
       
  1078     CBTeam = new QComboBox(this);
       
  1079 
       
  1080     pageLayout->addWidget(CBTeam, 1, 1);
       
  1081     pageLayout->addWidget(CBSelect, 2, 1);
       
  1082     
       
  1083     BtnStartCampaign = new QPushButton(this);
       
  1084     BtnStartCampaign->setFont(*font14);
       
  1085     BtnStartCampaign->setText(QPushButton::tr("Go!"));
       
  1086     pageLayout->addWidget(BtnStartCampaign, 2, 2);
       
  1087 
       
  1088     BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true);
  1005 }
  1089 }
  1006 
  1090 
  1007 PageSelectWeapon::PageSelectWeapon(QWidget* parent) :
  1091 PageSelectWeapon::PageSelectWeapon(QWidget* parent) :
  1008   AbstractPage(parent)
  1092   AbstractPage(parent)
  1009 {
  1093 {
  1048     roomsList = new QTableWidget(this);
  1132     roomsList = new QTableWidget(this);
  1049     roomsList->setSelectionBehavior(QAbstractItemView::SelectRows);
  1133     roomsList->setSelectionBehavior(QAbstractItemView::SelectRows);
  1050     roomsList->verticalHeader()->setVisible(false);
  1134     roomsList->verticalHeader()->setVisible(false);
  1051     roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
  1135     roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
  1052     roomsList->setAlternatingRowColors(true);
  1136     roomsList->setAlternatingRowColors(true);
       
  1137     roomsList->setShowGrid(false);
       
  1138     roomsList->setSelectionMode(QAbstractItemView::SingleSelection);
  1053     pageLayout->addWidget(roomsList, 1, 0, 3, 1);
  1139     pageLayout->addWidget(roomsList, 1, 0, 3, 1);
  1054     pageLayout->setRowStretch(2, 100);
  1140     pageLayout->setRowStretch(2, 100);
       
  1141     
       
  1142     QHBoxLayout * filterLayout = new QHBoxLayout();
       
  1143     
       
  1144     QLabel * stateLabel = new QLabel(this);
       
  1145     stateLabel->setText(tr("State:"));
       
  1146     CBState = new QComboBox(this);
       
  1147     CBState->addItem(QComboBox::tr("Any"));
       
  1148     CBState->addItem(QComboBox::tr("In lobby"));
       
  1149     CBState->addItem(QComboBox::tr("In progress"));
       
  1150     filterLayout->addWidget(stateLabel);
       
  1151     filterLayout->addWidget(CBState);
       
  1152     filterLayout->addSpacing(30);
       
  1153     
       
  1154     QLabel * ruleLabel = new QLabel(this);
       
  1155     ruleLabel->setText(tr("Rules:"));
       
  1156     CBRules = new QComboBox(this);
       
  1157     CBRules->addItem(QComboBox::tr("Any"));
       
  1158     CBRules->addItem(QComboBox::tr("Default"));
       
  1159     CBRules->addItem(QComboBox::tr("Pro mode"));
       
  1160     CBRules->addItem(QComboBox::tr("Shoppa"));
       
  1161     CBRules->addItem(QComboBox::tr("Basketball"));
       
  1162     CBRules->addItem(QComboBox::tr("Minefield"));
       
  1163     CBRules->addItem(QComboBox::tr("Barrel mayhem"));
       
  1164     CBRules->addItem(QComboBox::tr("Tunnel hogs"));
       
  1165     filterLayout->addWidget(ruleLabel);
       
  1166     filterLayout->addWidget(CBRules);
       
  1167     filterLayout->addSpacing(30);
       
  1168     
       
  1169     QLabel * weaponLabel = new QLabel(this);
       
  1170     weaponLabel->setText(tr("Weapons:"));
       
  1171     CBWeapons = new QComboBox(this);
       
  1172     CBWeapons->addItem(QComboBox::tr("Any"));
       
  1173     CBWeapons->addItem(QComboBox::tr("Basketball"));
       
  1174     CBWeapons->addItem(QComboBox::tr("Crazy"));
       
  1175     CBWeapons->addItem(QComboBox::tr("Default"));
       
  1176     CBWeapons->addItem(QComboBox::tr("Minefield"));
       
  1177     CBWeapons->addItem(QComboBox::tr("Pro mode"));
       
  1178     CBWeapons->addItem(QComboBox::tr("Shoppa"));
       
  1179     filterLayout->addWidget(weaponLabel);
       
  1180     filterLayout->addWidget(CBWeapons);
       
  1181     filterLayout->addSpacing(30);
       
  1182 
       
  1183     QLabel * searchLabel = new QLabel(this);
       
  1184     searchLabel->setText(tr("Search:"));
       
  1185     searchText = new QLineEdit(this);
       
  1186     searchText->setMaxLength(60);
       
  1187     filterLayout->addWidget(searchLabel);
       
  1188     filterLayout->addWidget(searchText);
       
  1189 
       
  1190     pageLayout->addLayout(filterLayout, 4, 0);
  1055 
  1191 
  1056     chatWidget = new HWChatWidget(this, gameSettings, sdli, false);
  1192     chatWidget = new HWChatWidget(this, gameSettings, sdli, false);
  1057     pageLayout->addWidget(chatWidget, 4, 0, 1, 2);
  1193     pageLayout->addWidget(chatWidget, 5, 0, 1, 2);
  1058     pageLayout->setRowStretch(4, 350);
  1194     pageLayout->setRowStretch(5, 350);
  1059 
  1195 
  1060     BtnCreate = addButton(tr("Create"), pageLayout, 0, 1);
  1196     BtnCreate = addButton(tr("Create"), pageLayout, 0, 1);
  1061     BtnJoin = addButton(tr("Join"), pageLayout, 1, 1);
  1197     BtnJoin = addButton(tr("Join"), pageLayout, 1, 1);
  1062     BtnRefresh = addButton(tr("Refresh"), pageLayout, 3, 1);
  1198     BtnRefresh = addButton(tr("Refresh"), pageLayout, 3, 1);
  1063 
  1199     BtnClear = addButton(tr("Clear"), pageLayout, 4, 1);
  1064     BtnBack = addButton(":/res/Exit.png", pageLayout, 5, 0, true);
  1200 
  1065     BtnAdmin = addButton(tr("Admin features"), pageLayout, 5, 1);
  1201     BtnBack = addButton(":/res/Exit.png", pageLayout, 6, 0, true);
       
  1202     BtnAdmin = addButton(tr("Admin features"), pageLayout, 6, 1);
  1066 
  1203 
  1067     connect(BtnCreate, SIGNAL(clicked()), this, SLOT(onCreateClick()));
  1204     connect(BtnCreate, SIGNAL(clicked()), this, SLOT(onCreateClick()));
  1068     connect(BtnJoin, SIGNAL(clicked()), this, SLOT(onJoinClick()));
  1205     connect(BtnJoin, SIGNAL(clicked()), this, SLOT(onJoinClick()));
  1069     connect(BtnRefresh, SIGNAL(clicked()), this, SLOT(onRefreshClick()));
  1206     connect(BtnRefresh, SIGNAL(clicked()), this, SLOT(onRefreshClick()));
       
  1207     connect(BtnClear, SIGNAL(clicked()), this, SLOT(onClearClick()));
  1070     connect(roomsList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(onJoinClick()));
  1208     connect(roomsList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(onJoinClick()));
       
  1209     connect(CBState, SIGNAL(currentIndexChanged (int)), this, SLOT(onRefreshClick()));
       
  1210     connect(CBRules, SIGNAL(currentIndexChanged (int)), this, SLOT(onRefreshClick()));
       
  1211     connect(CBWeapons, SIGNAL(currentIndexChanged (int)), this, SLOT(onRefreshClick()));
       
  1212     connect(searchText, SIGNAL(textChanged (const QString &)), this, SLOT(onRefreshClick()));
       
  1213     connect(this, SIGNAL(askJoinConfirmation (const QString &)), this, SLOT(onJoinConfirmation(const QString &)), Qt::QueuedConnection);
       
  1214     
       
  1215     gameInLobby = false;
  1071 }
  1216 }
  1072 
  1217 
  1073 void PageRoomsList::setAdmin(bool flag)
  1218 void PageRoomsList::setAdmin(bool flag)
  1074 {
  1219 {
  1075     BtnAdmin->setVisible(flag);
  1220     BtnAdmin->setVisible(flag);
  1076 }
  1221 }
  1077 
  1222 
  1078 void PageRoomsList::setRoomsList(const QStringList & list)
  1223 void PageRoomsList::setRoomsList(const QStringList & list)
  1079 {
  1224 {
       
  1225     QBrush red(QColor(255, 0, 0));
       
  1226     QBrush orange(QColor(127, 127, 0));
       
  1227     QBrush yellow(QColor(255, 255, 0));
       
  1228     QBrush green(QColor(0, 255, 0));
       
  1229 
       
  1230     listFromServer = list;
       
  1231     
       
  1232     QString selection = "";
       
  1233     
       
  1234     if(QTableWidgetItem *item = roomsList->item(roomsList->currentRow(), 0))
       
  1235         selection = item->text();
       
  1236     
  1080     roomsList->clear();
  1237     roomsList->clear();
  1081     roomsList->setColumnCount(7);
  1238     roomsList->setColumnCount(7);
  1082     roomsList->setHorizontalHeaderLabels(
  1239     roomsList->setHorizontalHeaderLabels(
  1083             QStringList() <<
  1240             QStringList() <<
  1084             QTableWidget::tr("Room Name") <<
  1241             QTableWidget::tr("Room Name") <<
  1100 //  roomsList->horizontalHeader()->resizeSection(6, 100);
  1257 //  roomsList->horizontalHeader()->resizeSection(6, 100);
  1101 
  1258 
  1102     // set resize modes
  1259     // set resize modes
  1103 //  roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
  1260 //  roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
  1104 
  1261 
       
  1262     bool gameCanBeJoined = true;
       
  1263 
  1105     if (list.size() % 8)
  1264     if (list.size() % 8)
  1106         return;
  1265         return;
  1107 
  1266 
  1108     roomsList->setRowCount(list.size() / 8);
  1267     roomsList->setRowCount(list.size() / 8);
  1109     for(int i = 0, r = 0; i < list.size(); i += 8, r++)
  1268     for(int i = 0, r = 0; i < list.size(); i += 8, r++)
  1110     {
  1269     {
       
  1270         // if we are joining a game
       
  1271         // TODO: Should NOT be done here
       
  1272         if (gameInLobby) {
       
  1273             if (gameInLobbyName == list[i + 1]) {
       
  1274                 gameCanBeJoined = list[i].compare("True");
       
  1275             }
       
  1276         }
       
  1277         
       
  1278         // check filter settings
       
  1279         #define NO_FILTER_MATCH roomsList->setRowCount(roomsList->rowCount() - 1); --r; continue
       
  1280         
       
  1281         if (list[i].compare("True") && CBState->currentIndex() == 2) { NO_FILTER_MATCH; }
       
  1282         if (list[i].compare("False") && CBState->currentIndex() == 1) { NO_FILTER_MATCH; }
       
  1283         if (CBRules->currentIndex() != 0 && list[i + 6].compare(CBRules->currentText())) { NO_FILTER_MATCH; }
       
  1284         if (CBWeapons->currentIndex() != 0 && list[i + 7].compare(CBWeapons->currentText())) { NO_FILTER_MATCH; }
       
  1285         bool found = list[i + 1].contains(searchText->text(), Qt::CaseInsensitive);
       
  1286         if (!found) {
       
  1287             for (int a = 4; a <= 7; ++a) {
       
  1288                 QString compString = list[i + a];
       
  1289                 if (a == 5 && compString == "+rnd+") {
       
  1290                     compString = "Random Map";
       
  1291                 } else if (a == 5 && compString == "+maze+") {
       
  1292                     compString = "Random Maze";
       
  1293                 }
       
  1294                 if (compString.contains(searchText->text(), Qt::CaseInsensitive)) {
       
  1295                     found = true;
       
  1296                     break;
       
  1297                 }
       
  1298             }
       
  1299         }
       
  1300         if (!searchText->text().isEmpty() && !found) { NO_FILTER_MATCH; }
       
  1301         
  1111         QTableWidgetItem * item;
  1302         QTableWidgetItem * item;
  1112         item = new QTableWidgetItem(list[i + 1]); // room name
  1303         item = new QTableWidgetItem(list[i + 1]); // room name
  1113         item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
  1304         item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
  1114         
  1305         
  1115         // pick appropriate room icon and tooltip (game in progress yes/no; later maybe locked rooms etc.)
  1306         // pick appropriate room icon and tooltip (game in progress yes/no; later maybe locked rooms etc.)
  1134 
  1325 
  1135         item = new QTableWidgetItem(list[i + 3]); // number of teams
  1326         item = new QTableWidgetItem(list[i + 3]); // number of teams
  1136         item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
  1327         item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
  1137         item->setTextAlignment(Qt::AlignCenter);
  1328         item->setTextAlignment(Qt::AlignCenter);
  1138         item->setToolTip(tr("There are %1 teams participating in this room.", "", list[i + 3].toInt()).arg(list[i + 3]));
  1329         item->setToolTip(tr("There are %1 teams participating in this room.", "", list[i + 3].toInt()).arg(list[i + 3]));
       
  1330         //Should we highlight "full" games? Might get misinterpreted
       
  1331         //if(list[i + 3].toInt() >= cMaxTeams)
       
  1332         //    item->setForeground(red);
  1139         roomsList->setItem(r, 2, item);
  1333         roomsList->setItem(r, 2, item);
  1140 
  1334 
  1141         item = new QTableWidgetItem(list[i + 4].left(15)); // name of host
  1335         item = new QTableWidgetItem(list[i + 4].left(15)); // name of host
  1142         item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
  1336         item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
  1143         item->setToolTip(tr("%1 is the host. He may adjust settings and start the game.").arg(list[i + 4]));
  1337         item->setToolTip(tr("%1 is the host. He may adjust settings and start the game.").arg(list[i + 4]));
  1144         roomsList->setItem(r, 3, item);
  1338         roomsList->setItem(r, 3, item);
  1145 
  1339 
  1146         if(list[i + 5] == "+rnd+")
  1340         if(list[i + 5] == "+rnd+")
       
  1341         {
  1147             item = new QTableWidgetItem(tr("Random Map")); // selected map (is randomized)
  1342             item = new QTableWidgetItem(tr("Random Map")); // selected map (is randomized)
       
  1343             item->setIcon(QIcon(":/res/mapRandom.png"));
       
  1344         }
  1148         else if (list[i+5] == "+maze+")
  1345         else if (list[i+5] == "+maze+")
       
  1346         {
  1149             item = new QTableWidgetItem(tr("Random Maze"));
  1347             item = new QTableWidgetItem(tr("Random Maze"));
       
  1348             item->setIcon(QIcon(":/res/mapMaze.png"));
       
  1349         }
  1150         else
  1350         else
  1151         {
  1351         {
  1152             item = new QTableWidgetItem(list[i + 5]); // selected map
  1352             item = new QTableWidgetItem(list[i + 5]); // selected map
  1153             
  1353             
  1154             // check to see if we've got this map
  1354             // check to see if we've got this map
  1155             // not perfect but a start
  1355             // not perfect but a start
  1156             if(!mapList->contains(list[i + 5]))
  1356             if(!mapList->contains(list[i + 5]))
  1157                 item->setForeground(QBrush(QColor(255, 0, 0)));
  1357             {
       
  1358                 item->setForeground(red);
       
  1359                 item->setIcon(QIcon(":/res/mapMissing.png"));
       
  1360             }
       
  1361             else
       
  1362             {
       
  1363                 // todo: mission icon?
       
  1364                 item->setIcon(QIcon(":/res/mapCustom.png"));
       
  1365             }
  1158         }
  1366         }
  1159         
  1367         
  1160         item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
  1368         item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
  1161         item->setToolTip(tr("Games may be played on precreated or randomized maps."));
  1369         item->setToolTip(tr("Games may be played on precreated or randomized maps."));
  1162         roomsList->setItem(r, 4, item);
  1370         roomsList->setItem(r, 4, item);
  1169         item = new QTableWidgetItem(list[i + 7].left(20)); // selected weapon scheme
  1377         item = new QTableWidgetItem(list[i + 7].left(20)); // selected weapon scheme
  1170         item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
  1378         item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
  1171         item->setToolTip(tr("The Weapon Scheme defines available weapons and their ammunition count."));
  1379         item->setToolTip(tr("The Weapon Scheme defines available weapons and their ammunition count."));
  1172         roomsList->setItem(r, 6, item);
  1380         roomsList->setItem(r, 6, item);
  1173 
  1381 
       
  1382         if(!list[i + 1].compare(selection) && !selection.isEmpty())
       
  1383             roomsList->selectionModel()->setCurrentIndex(roomsList->model()->index(r, 0), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
  1174     }
  1384     }
  1175    roomsList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
  1385 
  1176    roomsList->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents);
  1386     roomsList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
  1177    roomsList->horizontalHeader()->setResizeMode(2, QHeaderView::ResizeToContents);
  1387     roomsList->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents);
  1178    roomsList->horizontalHeader()->setResizeMode(3, QHeaderView::ResizeToContents);
  1388     roomsList->horizontalHeader()->setResizeMode(2, QHeaderView::ResizeToContents);
  1179    roomsList->horizontalHeader()->setResizeMode(4, QHeaderView::ResizeToContents);
  1389     roomsList->horizontalHeader()->setResizeMode(3, QHeaderView::ResizeToContents);
  1180    roomsList->horizontalHeader()->setResizeMode(5, QHeaderView::ResizeToContents);
  1390     roomsList->horizontalHeader()->setResizeMode(4, QHeaderView::ResizeToContents);
  1181    roomsList->horizontalHeader()->setResizeMode(6, QHeaderView::ResizeToContents);
  1391     roomsList->horizontalHeader()->setResizeMode(5, QHeaderView::ResizeToContents);
       
  1392     roomsList->horizontalHeader()->setResizeMode(6, QHeaderView::ResizeToContents);
       
  1393 
       
  1394     // TODO: Should NOT be done here
       
  1395     if (gameInLobby) {
       
  1396         gameInLobby = false;
       
  1397         if (gameCanBeJoined) {
       
  1398             emit askForJoinRoom(gameInLobbyName);
       
  1399         } else {
       
  1400             emit askJoinConfirmation(gameInLobbyName);
       
  1401         }
       
  1402     }
  1182 
  1403 
  1183 //  roomsList->resizeColumnsToContents();
  1404 //  roomsList->resizeColumnsToContents();
  1184 }
  1405 }
  1185 
  1406 
  1186 void PageRoomsList::onCreateClick()
  1407 void PageRoomsList::onCreateClick()
  1201     {
  1422     {
  1202         QMessageBox::critical(this,
  1423         QMessageBox::critical(this,
  1203                 tr("Error"),
  1424                 tr("Error"),
  1204                 tr("Please select room from the list"),
  1425                 tr("Please select room from the list"),
  1205                 tr("OK"));
  1426                 tr("OK"));
  1206         return ;
  1427         return;
  1207     }
  1428     }
  1208     emit askForJoinRoom(curritem->data(Qt::DisplayRole).toString());
  1429 
       
  1430     for (int i = 0; i < listFromServer.size(); i += 8) {
       
  1431         if (listFromServer[i + 1] == curritem->data(Qt::DisplayRole).toString()) {
       
  1432             gameInLobby = listFromServer[i].compare("True");
       
  1433             break;
       
  1434         }
       
  1435     }
       
  1436     
       
  1437     if (gameInLobby) {
       
  1438         gameInLobbyName = curritem->data(Qt::DisplayRole).toString();
       
  1439         emit askForRoomList();
       
  1440     } else {
       
  1441         emit askForJoinRoom(curritem->data(Qt::DisplayRole).toString());
       
  1442     }
  1209 }
  1443 }
  1210 
  1444 
  1211 void PageRoomsList::onRefreshClick()
  1445 void PageRoomsList::onRefreshClick()
  1212 {
  1446 {
  1213     emit askForRoomList();
  1447     emit askForRoomList();
  1214 }
  1448 }
  1215 
  1449 
       
  1450 void PageRoomsList::onClearClick()
       
  1451 {
       
  1452     CBState->setCurrentIndex(0);
       
  1453     CBRules->setCurrentIndex(0);
       
  1454     CBWeapons->setCurrentIndex(0);
       
  1455     searchText->clear();
       
  1456 }
       
  1457 
       
  1458 void PageRoomsList::onJoinConfirmation(const QString & room)
       
  1459 {
       
  1460     if (QMessageBox::warning(this,
       
  1461         tr("Warning"),
       
  1462         tr("The game you are trying to join has started.\nDo you still want to join the room?"),
       
  1463         QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
       
  1464     {
       
  1465         emit askForJoinRoom(room);
       
  1466     }
       
  1467 }
  1216 
  1468 
  1217 PageConnecting::PageConnecting(QWidget* parent) :
  1469 PageConnecting::PageConnecting(QWidget* parent) :
  1218     AbstractPage(parent)
  1470     AbstractPage(parent)
  1219 {
  1471 {
  1220     QGridLayout * pageLayout = new QGridLayout(this);
  1472     QGridLayout * pageLayout = new QGridLayout(this);
  1275     TBW_border->setToolTip("<b>" + ToggleButtonWidget::tr("Add Border") + "</b>:<br />" + tr("Add an indestructable border around the terrain"));
  1527     TBW_border->setToolTip("<b>" + ToggleButtonWidget::tr("Add Border") + "</b>:<br />" + tr("Add an indestructable border around the terrain"));
  1276     glGMLayout->addWidget(TBW_border,0,3,1,1);
  1528     glGMLayout->addWidget(TBW_border,0,3,1,1);
  1277 
  1529 
  1278     TBW_lowGravity = new ToggleButtonWidget(gbGameModes, ":/res/btnLowGravity.png");
  1530     TBW_lowGravity = new ToggleButtonWidget(gbGameModes, ":/res/btnLowGravity.png");
  1279     TBW_lowGravity->setToolTip("<b>" + ToggleButtonWidget::tr("Low Gravity") + "</b>:<br />" + tr("Lower gravity"));
  1531     TBW_lowGravity->setToolTip("<b>" + ToggleButtonWidget::tr("Low Gravity") + "</b>:<br />" + tr("Lower gravity"));
  1280     glGMLayout->addWidget(TBW_lowGravity,1,0,1,1);
  1532     glGMLayout->addWidget(TBW_lowGravity,0,4,1,1);
  1281 
  1533 
  1282     TBW_laserSight = new ToggleButtonWidget(gbGameModes, ":/res/btnLaserSight.png");
  1534     TBW_laserSight = new ToggleButtonWidget(gbGameModes, ":/res/btnLaserSight.png");
  1283     TBW_laserSight->setToolTip("<b>" + ToggleButtonWidget::tr("Laser Sight") + "</b>:<br />" + tr("Assisted aiming with laser sight"));
  1535     TBW_laserSight->setToolTip("<b>" + ToggleButtonWidget::tr("Laser Sight") + "</b>:<br />" + tr("Assisted aiming with laser sight"));
  1284     glGMLayout->addWidget(TBW_laserSight,1,1,1,1);
  1536     glGMLayout->addWidget(TBW_laserSight,1,0,1,1);
  1285 
  1537 
  1286     TBW_invulnerable = new ToggleButtonWidget(gbGameModes, ":/res/btnInvulnerable.png");
  1538     TBW_invulnerable = new ToggleButtonWidget(gbGameModes, ":/res/btnInvulnerable.png");
  1287     TBW_invulnerable->setToolTip("<b>" + ToggleButtonWidget::tr("Invulnerable") + "</b>:<br />" + tr("All hogs have a personal forcefield"));
  1539     TBW_invulnerable->setToolTip("<b>" + ToggleButtonWidget::tr("Invulnerable") + "</b>:<br />" + tr("All hogs have a personal forcefield"));
  1288     glGMLayout->addWidget(TBW_invulnerable,1,2,1,1);
  1540     glGMLayout->addWidget(TBW_invulnerable,1,1,1,1);
  1289 
  1541 
  1290     TBW_mines = new ToggleButtonWidget(gbGameModes, ":/res/btnMines.png");
  1542     TBW_mines = new ToggleButtonWidget(gbGameModes, ":/res/btnMines.png");
  1291     TBW_mines->setToolTip("<b>" + ToggleButtonWidget::tr("Add Mines") + "</b>:<br />" + tr("Enable random mines"));
  1543     TBW_mines->setToolTip("<b>" + ToggleButtonWidget::tr("Add Mines") + "</b>:<br />" + tr("Enable random mines"));
  1292     glGMLayout->addWidget(TBW_mines,1,3,1,1);
  1544     glGMLayout->addWidget(TBW_mines,1,2,1,1);
  1293 
  1545 
  1294     TBW_vampiric = new ToggleButtonWidget(gbGameModes, ":/res/btnVampiric.png");
  1546     TBW_vampiric = new ToggleButtonWidget(gbGameModes, ":/res/btnVampiric.png");
  1295     TBW_vampiric->setToolTip("<b>" + ToggleButtonWidget::tr("Vampirism") + "</b>:<br />" + tr("Gain 80% of the damage you do back in health"));
  1547     TBW_vampiric->setToolTip("<b>" + ToggleButtonWidget::tr("Vampirism") + "</b>:<br />" + tr("Gain 80% of the damage you do back in health"));
  1296     glGMLayout->addWidget(TBW_vampiric,2,0,1,1);
  1548     glGMLayout->addWidget(TBW_vampiric,1,3,1,1);
  1297 
  1549 
  1298     TBW_karma = new ToggleButtonWidget(gbGameModes, ":/res/btnKarma.png");
  1550     TBW_karma = new ToggleButtonWidget(gbGameModes, ":/res/btnKarma.png");
  1299     TBW_karma->setToolTip("<b>" + ToggleButtonWidget::tr("Karma") + "</b>:<br />" + tr("Share your opponents pain, share their damage"));
  1551     TBW_karma->setToolTip("<b>" + ToggleButtonWidget::tr("Karma") + "</b>:<br />" + tr("Share your opponents pain, share their damage"));
  1300     glGMLayout->addWidget(TBW_karma,2,1,1,1);
  1552     glGMLayout->addWidget(TBW_karma,1,4,1,1);
  1301 
  1553 
  1302     TBW_artillery = new ToggleButtonWidget(gbGameModes, ":/res/btnArtillery.png");
  1554     TBW_artillery = new ToggleButtonWidget(gbGameModes, ":/res/btnArtillery.png");
  1303     TBW_artillery->setToolTip("<b>" + ToggleButtonWidget::tr("Artillery") + "</b>:<br />" + tr("Your hogs are unable to move, put your artillery skills to the test"));
  1555     TBW_artillery->setToolTip("<b>" + ToggleButtonWidget::tr("Artillery") + "</b>:<br />" + tr("Your hogs are unable to move, put your artillery skills to the test"));
  1304     glGMLayout->addWidget(TBW_artillery,2,2,1,1);
  1556     glGMLayout->addWidget(TBW_artillery,2,0,1,1);
  1305 
  1557 
  1306     TBW_randomorder = new ToggleButtonWidget(gbGameModes, ":/res/btnRandomOrder.png");
  1558     TBW_randomorder = new ToggleButtonWidget(gbGameModes, ":/res/btnRandomOrder.png");
  1307     TBW_randomorder->setToolTip("<b>" + ToggleButtonWidget::tr("Random Order") + "</b>:<br />" + tr("Order of play is random instead of in room order."));
  1559     TBW_randomorder->setToolTip("<b>" + ToggleButtonWidget::tr("Random Order") + "</b>:<br />" + tr("Order of play is random instead of in room order."));
  1308     glGMLayout->addWidget(TBW_randomorder,2,3,1,1);
  1560     glGMLayout->addWidget(TBW_randomorder,2,1,1,1);
  1309 
  1561 
  1310     TBW_king = new ToggleButtonWidget(gbGameModes, ":/res/btnKing.png");
  1562     TBW_king = new ToggleButtonWidget(gbGameModes, ":/res/btnKing.png");
  1311     TBW_king->setToolTip("<b>" + ToggleButtonWidget::tr("King") + "</b>:<br />" + tr("Play with a King. If he dies, your side dies."));
  1563     TBW_king->setToolTip("<b>" + ToggleButtonWidget::tr("King") + "</b>:<br />" + tr("Play with a King. If he dies, your side dies."));
  1312     glGMLayout->addWidget(TBW_king,3,0,1,1);
  1564     glGMLayout->addWidget(TBW_king,2,2,1,1);
  1313 
  1565 
  1314     TBW_placehog = new ToggleButtonWidget(gbGameModes, ":/res/btnPlaceHog.png");
  1566     TBW_placehog = new ToggleButtonWidget(gbGameModes, ":/res/btnPlaceHog.png");
  1315     TBW_placehog->setToolTip("<b>" + ToggleButtonWidget::tr("Place Hedgehogs") + "</b>:<br />" + tr("Take turns placing your hedgehogs before the start of play."));
  1567     TBW_placehog->setToolTip("<b>" + ToggleButtonWidget::tr("Place Hedgehogs") + "</b>:<br />" + tr("Take turns placing your hedgehogs before the start of play."));
  1316     glGMLayout->addWidget(TBW_placehog,3,1,1,1);
  1568     glGMLayout->addWidget(TBW_placehog,2,3,1,1);
  1317 
  1569 
  1318     TBW_sharedammo = new ToggleButtonWidget(gbGameModes, ":/res/btnSharedAmmo.png");
  1570     TBW_sharedammo = new ToggleButtonWidget(gbGameModes, ":/res/btnSharedAmmo.png");
  1319     TBW_sharedammo->setToolTip("<b>" + ToggleButtonWidget::tr("Clan Shares Ammo") + "</b>:<br />" + tr("Ammo is shared between all teams that share a colour."));
  1571     TBW_sharedammo->setToolTip("<b>" + ToggleButtonWidget::tr("Clan Shares Ammo") + "</b>:<br />" + tr("Ammo is shared between all teams that share a colour."));
  1320     glGMLayout->addWidget(TBW_sharedammo,3,2,1,1);
  1572     glGMLayout->addWidget(TBW_sharedammo,2,4,1,1);
  1321 
  1573 
  1322     TBW_disablegirders = new ToggleButtonWidget(gbGameModes, ":/res/btnDisableGirders.png");
  1574     TBW_disablegirders = new ToggleButtonWidget(gbGameModes, ":/res/btnDisableGirders.png");
  1323     TBW_disablegirders->setToolTip("<b>" + ToggleButtonWidget::tr("Disable Girders") + "</b>:<br />" + tr("Disable girders when generating random maps."));
  1575     TBW_disablegirders->setToolTip("<b>" + ToggleButtonWidget::tr("Disable Girders") + "</b>:<br />" + tr("Disable girders when generating random maps."));
  1324     glGMLayout->addWidget(TBW_disablegirders,3,3,1,1);
  1576     glGMLayout->addWidget(TBW_disablegirders,3,0,1,1);
  1325 
  1577 
  1326     TBW_disablelandobjects = new ToggleButtonWidget(gbGameModes, ":/res/btnDisableLandObjects.png");
  1578     TBW_disablelandobjects = new ToggleButtonWidget(gbGameModes, ":/res/btnDisableLandObjects.png");
  1327     TBW_disablelandobjects->setToolTip("<b>" + ToggleButtonWidget::tr("Disable Land Objects") + "</b>:<br />" + tr("Disable land objects when generating random maps."));
  1579     TBW_disablelandobjects->setToolTip("<b>" + ToggleButtonWidget::tr("Disable Land Objects") + "</b>:<br />" + tr("Disable land objects when generating random maps."));
  1328     glGMLayout->addWidget(TBW_disablelandobjects,4,0,1,1);
  1580     glGMLayout->addWidget(TBW_disablelandobjects,3,1,1,1);
       
  1581 
       
  1582     TBW_aisurvival = new ToggleButtonWidget(gbGameModes, ":/res/btnAISurvival.png");
       
  1583     TBW_aisurvival->setToolTip("<b>" + ToggleButtonWidget::tr("AI Survival Mode") + "</b>:<br />" + tr("AI respawns on death."));
       
  1584     glGMLayout->addWidget(TBW_aisurvival,3,2,1,1);
       
  1585 
       
  1586     TBW_infattack = new ToggleButtonWidget(gbGameModes, ":/res/btnInfAttack.png");
       
  1587     TBW_infattack->setToolTip("<b>" + ToggleButtonWidget::tr("Unlimited Attacks") + "</b>:<br />" + tr("Attacking does not end your turn."));
       
  1588     glGMLayout->addWidget(TBW_infattack,3,3,1,1);
       
  1589 
       
  1590     TBW_resetweps = new ToggleButtonWidget(gbGameModes, ":/res/btnResetWeps.png");
       
  1591     TBW_resetweps->setToolTip("<b>" + ToggleButtonWidget::tr("Reset Weapons") + "</b>:<br />" + tr("Weapons are reset to starting values each turn."));
       
  1592     glGMLayout->addWidget(TBW_resetweps,3,4,1,1);
       
  1593 
       
  1594     TBW_perhogammo = new ToggleButtonWidget(gbGameModes, ":/res/btnPerHogAmmo.png");
       
  1595     TBW_perhogammo->setToolTip("<b>" + ToggleButtonWidget::tr("Per Hedgehog Ammo") + "</b>:<br />" + tr("Each hedgehog has its own ammo. It does not share with the team."));
       
  1596     glGMLayout->addWidget(TBW_perhogammo,4,0,1,1);
  1329 
  1597 
  1330     // Right
  1598     // Right
  1331     QLabel * l;
  1599     QLabel * l;
  1332 
  1600 
  1333     l = new QLabel(gbBasicSettings);
  1601     l = new QLabel(gbBasicSettings);
  1353     l->setFixedSize(32,32);
  1621     l->setFixedSize(32,32);
  1354     l->setPixmap(QPixmap(":/res/iconTime.png"));
  1622     l->setPixmap(QPixmap(":/res/iconTime.png"));
  1355     glBSLayout->addWidget(l,1,1,1,1);
  1623     glBSLayout->addWidget(l,1,1,1,1);
  1356 
  1624 
  1357     SB_TurnTime = new QSpinBox(gbBasicSettings);
  1625     SB_TurnTime = new QSpinBox(gbBasicSettings);
  1358     SB_TurnTime->setRange(1, 99);
  1626     SB_TurnTime->setRange(1, 9999);
  1359     SB_TurnTime->setValue(45);
  1627     SB_TurnTime->setValue(45);
  1360     SB_TurnTime->setSingleStep(15);
  1628     SB_TurnTime->setSingleStep(15);
  1361     glBSLayout->addWidget(SB_TurnTime,1,2,1,1);
  1629     glBSLayout->addWidget(SB_TurnTime,1,2,1,1);
  1362 
  1630 
  1363     l = new QLabel(gbBasicSettings);
  1631     l = new QLabel(gbBasicSettings);
  1508     mapper->addMapping(TBW_king, 13);
  1776     mapper->addMapping(TBW_king, 13);
  1509     mapper->addMapping(TBW_placehog, 14);
  1777     mapper->addMapping(TBW_placehog, 14);
  1510     mapper->addMapping(TBW_sharedammo, 15);
  1778     mapper->addMapping(TBW_sharedammo, 15);
  1511     mapper->addMapping(TBW_disablegirders, 16);
  1779     mapper->addMapping(TBW_disablegirders, 16);
  1512     mapper->addMapping(TBW_disablelandobjects, 17);
  1780     mapper->addMapping(TBW_disablelandobjects, 17);
  1513     mapper->addMapping(SB_DamageModifier, 18);
  1781     mapper->addMapping(TBW_aisurvival, 18);
  1514     mapper->addMapping(SB_TurnTime, 19);
  1782     mapper->addMapping(TBW_infattack, 19);
  1515     mapper->addMapping(SB_InitHealth, 20);
  1783     mapper->addMapping(TBW_resetweps, 20);
  1516     mapper->addMapping(SB_SuddenDeath, 21);
  1784     mapper->addMapping(TBW_perhogammo, 21);
  1517     mapper->addMapping(SB_CaseProb, 22);
  1785     mapper->addMapping(SB_DamageModifier, 22);
  1518     mapper->addMapping(SB_MinesTime, 23);
  1786     mapper->addMapping(SB_TurnTime, 23);
  1519     mapper->addMapping(SB_Mines, 24);
  1787     mapper->addMapping(SB_InitHealth, 24);
  1520     mapper->addMapping(SB_MineDuds, 25);
  1788     mapper->addMapping(SB_SuddenDeath, 25);
  1521     mapper->addMapping(SB_Explosives, 26);
  1789     mapper->addMapping(SB_CaseProb, 26);
       
  1790     mapper->addMapping(SB_MinesTime, 27);
       
  1791     mapper->addMapping(SB_Mines, 28);
       
  1792     mapper->addMapping(SB_MineDuds, 29);
       
  1793     mapper->addMapping(SB_Explosives, 30);
  1522 
  1794 
  1523     mapper->toFirst();
  1795     mapper->toFirst();
  1524 }
  1796 }
  1525 
  1797 
  1526 void PageScheme::newRow()
  1798 void PageScheme::newRow()