# HG changeset patch # User unc0rr # Date 1168280500 0 # Node ID b8905423f19f5f1775cd0c221957f6a5d6194ae6 # Parent b95fd124cb09bf6d1f040fbc02f19bfec63e4793 - Limit list of teams in game with 200 px - 'New team@ button in teams selecting widget - New game options, not yet used diff -r b95fd124cb09 -r b8905423f19f QTfrontend/gamecfgwidget.cpp --- a/QTfrontend/gamecfgwidget.cpp Sun Jan 07 22:54:08 2007 +0000 +++ b/QTfrontend/gamecfgwidget.cpp Mon Jan 08 18:21:40 2007 +0000 @@ -18,7 +18,10 @@ #include #include -#include +#include +#include +#include +#include #include "gamecfgwidget.h" GameCFGWidget::GameCFGWidget(QWidget* parent) : @@ -42,10 +45,26 @@ GBoxOptions->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); mainLayout.addWidget(GBoxOptions); - QVBoxLayout *GBoxOptionsLayout = new QVBoxLayout(GBoxOptions); + QGridLayout *GBoxOptionsLayout = new QGridLayout(GBoxOptions); CB_mode_Forts = new QCheckBox(GBoxOptions); CB_mode_Forts->setText(QCheckBox::tr("Forts mode")); - GBoxOptionsLayout->addWidget(CB_mode_Forts); + GBoxOptionsLayout->addWidget(CB_mode_Forts, 0, 0, 1, 2); + + L_TurnTime = new QLabel(QLabel::tr("Turn time"), GBoxOptions); + L_InitHealth = new QLabel(QLabel::tr("Initial health"), GBoxOptions); + GBoxOptionsLayout->addWidget(L_TurnTime, 1, 0); + GBoxOptionsLayout->addWidget(L_InitHealth, 2, 0); + + SB_TurnTime = new QSpinBox(GBoxOptions); + SB_TurnTime->setRange(15, 90); + SB_TurnTime->setValue(45); + SB_TurnTime->setSingleStep(15); + SB_InitHealth = new QSpinBox(GBoxOptions); + SB_InitHealth->setRange(50, 200); + SB_TurnTime->setValue(100); + SB_InitHealth->setSingleStep(25); + GBoxOptionsLayout->addWidget(SB_TurnTime, 1, 1); + GBoxOptionsLayout->addWidget(SB_InitHealth, 2, 1); mainLayout.addWidget(new QWidget, 100); } diff -r b95fd124cb09 -r b8905423f19f QTfrontend/gamecfgwidget.h --- a/QTfrontend/gamecfgwidget.h Sun Jan 07 22:54:08 2007 +0000 +++ b/QTfrontend/gamecfgwidget.h Mon Jan 08 18:21:40 2007 +0000 @@ -20,11 +20,14 @@ #define GAMECONFIGWIDGET_H #include -#include -#include #include "mapContainer.h" +class QCheckBox; +class QVBoxLayout; +class QSpinBox; +class QLabel; + class GameCFGWidget : public QWidget { Q_OBJECT @@ -42,6 +45,10 @@ QCheckBox * CB_mode_Forts; QVBoxLayout mainLayout; HWMapContainer* pMapContainer; + QSpinBox * SB_TurnTime; + QSpinBox * SB_InitHealth; + QLabel * L_TurnTime; + QLabel * L_InitHealth; }; #endif // GAMECONFIGWIDGET_H diff -r b95fd124cb09 -r b8905423f19f QTfrontend/hwform.cpp --- a/QTfrontend/hwform.cpp Sun Jan 07 22:54:08 2007 +0000 +++ b/QTfrontend/hwform.cpp Mon Jan 08 18:21:40 2007 +0000 @@ -85,6 +85,8 @@ connect(ui.pageGameStats->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); + connect(ui.pageMultiplayer->teamsSelect, SIGNAL(NewTeam()), this, SLOT(NewTeam())); + GoToPage(ID_PAGE_MAIN); } @@ -124,14 +126,6 @@ void HWForm::GoToMultiplayer() { - QStringList tmNames=config->GetTeamsList(); - QList teamsList; - for(QStringList::iterator it=tmNames.begin(); it!=tmNames.end(); it++) { - HWTeam team(*it); - team.LoadFromFile(); - teamsList.push_back(team); - } - ui.pageMultiplayer->teamsSelect->resetPlayingTeams(teamsList); GoToPage(ID_PAGE_MULTIPLAYER); } @@ -157,15 +151,31 @@ GoToPage(ID_PAGE_NETCHAT); } +void HWForm::OnPageShown(quint8 id) +{ + if (id == ID_PAGE_MULTIPLAYER) { + QStringList tmNames=config->GetTeamsList(); + QList teamsList; + for(QStringList::iterator it=tmNames.begin(); it!=tmNames.end(); it++) { + HWTeam team(*it); + team.LoadFromFile(); + teamsList.push_back(team); + } + ui.pageMultiplayer->teamsSelect->resetPlayingTeams(teamsList); + } +} + void HWForm::GoToPage(quint8 id) { PagesStack.push(ui.Pages->currentIndex()); + OnPageShown(id); ui.Pages->setCurrentIndex(id); } void HWForm::GoBack() { quint8 id = PagesStack.isEmpty() ? ID_PAGE_MAIN : PagesStack.pop(); + OnPageShown(id); ui.Pages->setCurrentIndex(id); } diff -r b95fd124cb09 -r b8905423f19f QTfrontend/hwform.h --- a/QTfrontend/hwform.h Sun Jan 07 22:54:08 2007 +0000 +++ b/QTfrontend/hwform.h Mon Jan 08 18:21:40 2007 +0000 @@ -93,6 +93,7 @@ void CreateGame(GameCFGWidget * gamecfg); void AddStatText(const QString & msg); + void OnPageShown(quint8 id); }; #endif diff -r b95fd124cb09 -r b8905423f19f QTfrontend/pages.cpp --- a/QTfrontend/pages.cpp Sun Jan 07 22:54:08 2007 +0000 +++ b/QTfrontend/pages.cpp Mon Jan 08 18:21:40 2007 +0000 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff -r b95fd124cb09 -r b8905423f19f QTfrontend/teamselect.cpp --- a/QTfrontend/teamselect.cpp Sun Jan 07 22:54:08 2007 +0000 +++ b/QTfrontend/teamselect.cpp Mon Jan 08 18:21:40 2007 +0000 @@ -81,11 +81,13 @@ } } -void TeamSelWidget::addScrArea(FrameTeams* pfteams, QColor color) +void TeamSelWidget::addScrArea(FrameTeams* pfteams, QColor color, int maxHeight) { VertScrArea* area=new VertScrArea(color); area->setWidget(pfteams); mainLayout.addWidget(area, 30); + if (maxHeight > 0) + area->setMaximumHeight(maxHeight); } TeamSelWidget::TeamSelWidget(QWidget* parent) : @@ -97,8 +99,12 @@ // addScrArea(framePlaying, QColor("DarkTurquoise")); // addScrArea(frameDontPlaying, QColor("LightGoldenrodYellow")); QPalette p; - addScrArea(framePlaying, p.color(QPalette::Window).light(105)); - addScrArea(frameDontPlaying, p.color(QPalette::Window).dark(105)); + addScrArea(framePlaying, p.color(QPalette::Window).light(105), 200); + addScrArea(frameDontPlaying, p.color(QPalette::Window).dark(105), 0); + newTeam = new QPushButton(this); + newTeam->setText(QPushButton::tr("New team")); + connect(newTeam, SIGNAL(clicked()), this, SLOT(newTeamClicked())); + mainLayout.addWidget(newTeam); } void TeamSelWidget::resetPlayingTeams(const QList& teamslist) @@ -135,3 +141,8 @@ if(!tsw) throw; return tsw->getTeamParams(); } + +void TeamSelWidget::newTeamClicked() +{ + emit NewTeam(); +} diff -r b95fd124cb09 -r b8905423f19f QTfrontend/teamselect.h --- a/QTfrontend/teamselect.h Sun Jan 07 22:54:08 2007 +0000 +++ b/QTfrontend/teamselect.h Mon Jan 08 18:21:40 2007 +0000 @@ -21,7 +21,6 @@ #include #include -class QFrame; #include #include @@ -30,6 +29,8 @@ class TeamSelWidget; class FrameTeams; +class QFrame; +class QPushButton; using namespace std; @@ -46,15 +47,20 @@ HWTeamTempParams getTeamParams(HWTeam team) const; list getPlayingTeams() const; + signals: + void NewTeam(); + private slots: void changeTeamStatus(HWTeam team); + void newTeamClicked(); private: - void addScrArea(FrameTeams* pfteams, QColor color); + void addScrArea(FrameTeams* pfteams, QColor color, int maxHeight); FrameTeams* frameDontPlaying; FrameTeams* framePlaying; QVBoxLayout mainLayout; + QPushButton * newTeam; list curPlayingTeams; list curDontPlayingTeams;