# HG changeset patch # User unc0rr # Date 1153916748 0 # Node ID ff213e443336cf30b7ce19ca6bd5ac1d40cf68ce # Parent 664b536a1c27634732fb82786a479bf3fd50dc0c Convert all pages to classes diff -r 664b536a1c27 -r ff213e443336 QTfrontend/binds.h --- a/QTfrontend/binds.h Tue Jul 25 20:19:46 2006 +0000 +++ b/QTfrontend/binds.h Wed Jul 26 12:25:48 2006 +0000 @@ -34,7 +34,7 @@ #ifndef BINDS_H #define BINDS_H -#include +#include #define BINDS_NUMBER 24 @@ -42,7 +42,7 @@ { QString action; QString strbind; - QString name; + const char * name; bool chwidget; }; diff -r 664b536a1c27 -r ff213e443336 QTfrontend/frameTeam.cpp --- a/QTfrontend/frameTeam.cpp Tue Jul 25 20:19:46 2006 +0000 +++ b/QTfrontend/frameTeam.cpp Wed Jul 26 12:25:48 2006 +0000 @@ -14,7 +14,7 @@ void FrameTeams::addTeam(tmprop team) { TeamShowWidget* pTeamShowWidget =new TeamShowWidget(team, this); - int hght=teamToWidget.empty() ? 0 : teamToWidget.begin()->second->size().height(); +// int hght=teamToWidget.empty() ? 0 : teamToWidget.begin()->second->size().height(); teamToWidget.insert(make_pair(team, pTeamShowWidget)); mainLayout.addWidget(pTeamShowWidget); QResizeEvent* pevent=new QResizeEvent(parentWidget()->size(), parentWidget()->size()); diff -r 664b536a1c27 -r ff213e443336 QTfrontend/game.cpp --- a/QTfrontend/game.cpp Tue Jul 25 20:19:46 2006 +0000 +++ b/QTfrontend/game.cpp Wed Jul 26 12:25:48 2006 +0000 @@ -42,6 +42,7 @@ #include "game.h" #include "hwconsts.h" #include "gameuiconfig.h" +#include "gamecfgwidget.h" HWGame::HWGame(GameUIConfig * config, GameCFGWidget * gamecfg) { diff -r 664b536a1c27 -r ff213e443336 QTfrontend/gamecfgwidget.cpp --- a/QTfrontend/gamecfgwidget.cpp Tue Jul 25 20:19:46 2006 +0000 +++ b/QTfrontend/gamecfgwidget.cpp Wed Jul 26 12:25:48 2006 +0000 @@ -43,11 +43,6 @@ CB_mode_Forts->setText("Forts mode"); } -void GameCFGWidget::resizeEvent(QResizeEvent * event) -{ - resize(event->size()); -} - quint32 GameCFGWidget::getGameFlags() { quint32 result = 0; diff -r 664b536a1c27 -r ff213e443336 QTfrontend/gamecfgwidget.h --- a/QTfrontend/gamecfgwidget.h Tue Jul 25 20:19:46 2006 +0000 +++ b/QTfrontend/gamecfgwidget.h Wed Jul 26 12:25:48 2006 +0000 @@ -50,9 +50,6 @@ private: QCheckBox * CB_mode_Forts; - -protected: - void resizeEvent(QResizeEvent * event); }; #endif // GAMECONFIGWIDGET_H diff -r 664b536a1c27 -r ff213e443336 QTfrontend/gameuiconfig.cpp --- a/QTfrontend/gameuiconfig.cpp Tue Jul 25 20:19:46 2006 +0000 +++ b/QTfrontend/gameuiconfig.cpp Wed Jul 26 12:25:48 2006 +0000 @@ -34,6 +34,8 @@ #include #include #include "gameuiconfig.h" +#include "hwform.h" +#include "pages.h" GameUIConfig::GameUIConfig(HWForm * FormWidgets) : QObject() @@ -67,19 +69,19 @@ if (str.startsWith(";")) continue; if (str.startsWith("resolution ")) { - Form->ui.CBResolution->setCurrentIndex(str.mid(11).toLong()); + Form->ui.pageOptions->CBResolution->setCurrentIndex(str.mid(11).toLong()); } else if (str.startsWith("fullscreen ")) { - Form->ui.CBFullscreen->setChecked(str.mid(11).toLong()); + Form->ui.pageOptions->CBFullscreen->setChecked(str.mid(11).toLong()); } else if (str.startsWith("sound ")) { - Form->ui.CBEnableSound->setChecked(str.mid(6).toLong()); + Form->ui.pageOptions->CBEnableSound->setChecked(str.mid(6).toLong()); } else if (str.startsWith("nick ")) { - Form->ui.editNetNick->setText(str.mid(5)); + Form->ui.pageOptions->editNetNick->setText(str.mid(5)); } } settings.close(); @@ -105,24 +107,24 @@ QTextStream stream(&settings); stream.setCodec("UTF-8"); stream << "; Generated by Hedgewars, do not modify" << endl; - stream << "resolution " << Form->ui.CBResolution->currentIndex() << endl; - stream << "fullscreen " << Form->ui.CBFullscreen->isChecked() << endl; - stream << "sound " << Form->ui.CBEnableSound->isChecked() << endl; - stream << "nick " << Form->ui.editNetNick->text() << endl; + stream << "resolution " << Form->ui.pageOptions->CBResolution->currentIndex() << endl; + stream << "fullscreen " << Form->ui.pageOptions->CBFullscreen->isChecked() << endl; + stream << "sound " << Form->ui.pageOptions->CBEnableSound->isChecked() << endl; + stream << "nick " << Form->ui.pageOptions->editNetNick->text() << endl; settings.close(); } int GameUIConfig::vid_Resolution() { - return Form->ui.CBResolution->currentIndex(); + return Form->ui.pageOptions->CBResolution->currentIndex(); } bool GameUIConfig::vid_Fullscreen() { - return Form->ui.CBFullscreen->isChecked(); + return Form->ui.pageOptions->CBFullscreen->isChecked(); } bool GameUIConfig::isSoundEnabled() { - return Form->ui.CBEnableSound->isChecked(); + return Form->ui.pageOptions->CBEnableSound->isChecked(); } diff -r 664b536a1c27 -r ff213e443336 QTfrontend/gameuiconfig.h --- a/QTfrontend/gameuiconfig.h Tue Jul 25 20:19:46 2006 +0000 +++ b/QTfrontend/gameuiconfig.h Wed Jul 26 12:25:48 2006 +0000 @@ -37,7 +37,8 @@ #include #include #include -#include "hwform.h" + +class HWForm; class GameUIConfig : public QObject { diff -r 664b536a1c27 -r ff213e443336 QTfrontend/hedgewars.pro --- a/QTfrontend/hedgewars.pro Tue Jul 25 20:19:46 2006 +0000 +++ b/QTfrontend/hedgewars.pro Wed Jul 26 12:25:48 2006 +0000 @@ -25,7 +25,8 @@ gameuiconfig.h \ ui_hwform.h \ gamecfgwidget.h \ - predefteams.h + predefteams.h \ + pages.h SOURCES += game.cpp \ main.cpp \ @@ -40,7 +41,8 @@ vertScrollArea.cpp \ gameuiconfig.cpp \ ui_hwform.cpp \ - gamecfgwidget.cpp + gamecfgwidget.cpp \ + pages.cpp TRANSLATIONS += translations/hedgewars_ru.ts diff -r 664b536a1c27 -r ff213e443336 QTfrontend/hwform.cpp --- a/QTfrontend/hwform.cpp Tue Jul 25 20:19:46 2006 +0000 +++ b/QTfrontend/hwform.cpp Wed Jul 26 12:25:48 2006 +0000 @@ -42,63 +42,18 @@ #include #include "hwform.h" -#include "sdlkeys.h" +#include "game.h" +#include "team.h" +#include "netclient.h" +#include "teamselect.h" +#include "gameuiconfig.h" +#include "pages.h" #include "hwconsts.h" -#include "gameuiconfig.h" HWForm::HWForm(QWidget *parent) : QMainWindow(parent) { ui.setupUi(this); - TeamNameEdit = new QLineEdit(ui.GBoxTeam); - TeamNameEdit->setGeometry(QRect(10, 20, 141, 20)); - TeamNameEdit->setMaxLength(15); - for(int i = 0; i < 8; i++) - { - HHNameEdit[i] = new QLineEdit(ui.GBoxHedgehogs); - HHNameEdit[i]->setGeometry(QRect(10, 20 + i * 30, 141, 20)); - HHNameEdit[i]->setMaxLength(15); - } - - QStringList binds; - for(int i = 0; strlen(sdlkeys[i][1]) > 0; i++) - { - binds << sdlkeys[i][1]; - } - - quint16 widind = 0, top = 0; - for(quint8 i = 0; i < BINDS_NUMBER; i++) - { - LBind[i] = new QLabel(ui.BindsBox->widget(widind)); - LBind[i]->setGeometry(QRect(10, top + 3, 70, 20)); - LBind[i]->setText(cbinds[i].name); - LBind[i]->setAlignment(Qt::AlignRight); - CBBind[i] = new QComboBox(ui.BindsBox->widget(widind)); - CBBind[i]->setGeometry(QRect(90, top, 80, 20)); - CBBind[i]->addItems(binds); - if (cbinds[i].chwidget) - { - top = 0; - widind++; - } else - { - top += 28; - } - } - - QDir tmpdir; - tmpdir.cd(DATA_PATH); - tmpdir.cd("Forts"); - tmpdir.setFilter(QDir::Files); - - ui.CBFort->addItems(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L.png"), "\\1")); - - tmpdir.cd("../Graphics/Graves"); - QStringList list = tmpdir.entryList(QStringList("*.png")); - for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) - { - ui.CBGrave->addItem((*it).replace(QRegExp("^(.*).png"), "\\1")); - } config = new GameUIConfig(this); @@ -113,36 +68,44 @@ for (QStringList::Iterator it = teamslist.begin(); it != teamslist.end(); ++it ) { QString tmpTeamStr=(*it).replace(QRegExp("^(.*).cfg$"), "\\1"); - ui.PageLGTeamsSelect->addTeam(tmpTeamStr); - ui.CBTeamName->addItem(tmpTeamStr); + ui.pageMultiplayer->teamsSelect->addTeam(tmpTeamStr); + ui.pageOptions->CBTeamName->addItem(tmpTeamStr); } - connect(ui.BtnSPBack, SIGNAL(clicked()), this, SLOT(GoToMain())); - connect(ui.BtnDemosBack, SIGNAL(clicked()), this, SLOT(GoToMain())); - connect(ui.BtnSetupBack, SIGNAL(clicked()), this, SLOT(GoToMain())); - connect(ui.BtnMPBack, SIGNAL(clicked()), this, SLOT(GoToMain())); - connect(ui.BtnNetBack, SIGNAL(clicked()), this, SLOT(GoToMain())); - connect(ui.BtnSinglePlayer, SIGNAL(clicked()), this, SLOT(GoToSinglePlayer())); - connect(ui.BtnSetup, SIGNAL(clicked()), this, SLOT(GoToSetup())); - connect(ui.BtnMultiplayer, SIGNAL(clicked()), this, SLOT(GoToMultiplayer())); - connect(ui.BtnDemos, SIGNAL(clicked()), this, SLOT(GoToDemos())); - connect(ui.BtnNet, SIGNAL(clicked()), this, SLOT(GoToNet())); - connect(ui.BtnNetCFGBack, SIGNAL(clicked()), this, SLOT(GoToNetChat())); - connect(ui.BtnNewTeam, SIGNAL(clicked()), this, SLOT(NewTeam())); - connect(ui.BtnEditTeam, SIGNAL(clicked()), this, SLOT(EditTeam())); - connect(ui.BtnTeamSave, SIGNAL(clicked()), this, SLOT(TeamSave())); - connect(ui.BtnTeamDiscard, SIGNAL(clicked()), this, SLOT(TeamDiscard())); - connect(ui.BtnSimpleGame, SIGNAL(clicked()), this, SLOT(SimpleGame())); - connect(ui.BtnSaveOptions, SIGNAL(clicked()), config, SLOT(SaveOptions())); - connect(ui.BtnPlayDemo, SIGNAL(clicked()), this, SLOT(PlayDemo())); - connect(ui.BtnNetConnect, SIGNAL(clicked()), this, SLOT(NetConnect())); - connect(ui.BtnNetChatDisconnect, SIGNAL(clicked()), this, SLOT(NetDisconnect())); - connect(ui.BtnNetChatJoin, SIGNAL(clicked()), this, SLOT(NetJoin())); - connect(ui.BtnNetChatCreate, SIGNAL(clicked()), this, SLOT(NetCreate())); - connect(ui.BtnNetCFGAddTeam, SIGNAL(clicked()), this, SLOT(NetAddTeam())); - connect(ui.BtnNetCFGGo, SIGNAL(clicked()), this, SLOT(NetStartGame())); - connect(ui.CBGrave, SIGNAL(activated(const QString &)), this, SLOT(CBGrave_activated(const QString &))); - connect(ui.CBFort, SIGNAL(activated(const QString &)), this, SLOT(CBFort_activated(const QString &))); + connect(ui.pageMain->BtnSinglePlayer, SIGNAL(clicked()), this, SLOT(GoToSinglePlayer())); + connect(ui.pageMain->BtnSetup, SIGNAL(clicked()), this, SLOT(GoToSetup())); + connect(ui.pageMain->BtnMultiplayer, SIGNAL(clicked()), this, SLOT(GoToMultiplayer())); + connect(ui.pageMain->BtnDemos, SIGNAL(clicked()), this, SLOT(GoToDemos())); + connect(ui.pageMain->BtnNet, SIGNAL(clicked()), this, SLOT(GoToNet())); + connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(close())); + + connect(ui.pageLocalGame->BtnBack, SIGNAL(clicked()), this, SLOT(GoToMain())); + connect(ui.pageLocalGame->BtnSimpleGame, SIGNAL(clicked()), this, SLOT(SimpleGame())); + + connect(ui.pageEditTeam->BtnTeamSave, SIGNAL(clicked()), this, SLOT(TeamSave())); + connect(ui.pageEditTeam->BtnTeamDiscard, SIGNAL(clicked()), this, SLOT(TeamDiscard())); + + connect(ui.pageMultiplayer->BtnBack, SIGNAL(clicked()), this, SLOT(GoToMain())); + + connect(ui.pagePlayDemo->BtnBack, SIGNAL(clicked()), this, SLOT(GoToMain())); + connect(ui.pagePlayDemo->BtnPlayDemo, SIGNAL(clicked()), this, SLOT(PlayDemo())); + + connect(ui.pageOptions->BtnBack, SIGNAL(clicked()), this, SLOT(GoToMain())); + connect(ui.pageOptions->BtnNewTeam, SIGNAL(clicked()), this, SLOT(NewTeam())); + connect(ui.pageOptions->BtnEditTeam, SIGNAL(clicked()), this, SLOT(EditTeam())); + connect(ui.pageOptions->BtnSaveOptions, SIGNAL(clicked()), config, SLOT(SaveOptions())); + + connect(ui.pageNet->BtnBack, SIGNAL(clicked()), this, SLOT(GoToMain())); + connect(ui.pageNet->BtnNetConnect, SIGNAL(clicked()), this, SLOT(NetConnect())); + + connect(ui.pageNetGame->BtnBack, SIGNAL(clicked()), this, SLOT(GoToNetChat())); + connect(ui.pageNetGame->BtnAddTeam, SIGNAL(clicked()), this, SLOT(NetAddTeam())); + connect(ui.pageNetGame->BtnGo, SIGNAL(clicked()), this, SLOT(NetStartGame())); + + connect(ui.pageNetChat->BtnDisconnect, SIGNAL(clicked()), this, SLOT(NetDisconnect())); + connect(ui.pageNetChat->BtnJoin, SIGNAL(clicked()), this, SLOT(NetJoin())); + connect(ui.pageNetChat->BtnCreate, SIGNAL(clicked()), this, SLOT(NetCreate())); + ui.Pages->setCurrentIndex(ID_PAGE_MAIN); } @@ -172,8 +135,8 @@ tmpdir.cd(DATA_PATH); tmpdir.cd("Demos"); tmpdir.setFilter(QDir::Files); - ui.DemosList->clear(); - ui.DemosList->addItems(tmpdir.entryList(QStringList("*.hwd_1")).replaceInStrings(QRegExp("^(.*).hwd_1"), "\\1")); + ui.pagePlayDemo->DemosList->clear(); + ui.pagePlayDemo->DemosList->addItems(tmpdir.entryList(QStringList("*.hwd_1")).replaceInStrings(QRegExp("^(.*).hwd_1"), "\\1")); ui.Pages->setCurrentIndex(ID_PAGE_DEMOS); } @@ -196,7 +159,7 @@ void HWForm::EditTeam() { - tmpTeam = new HWTeam(ui.CBTeamName->currentText(), config); + tmpTeam = new HWTeam(ui.pageOptions->CBTeamName->currentText(), config); tmpTeam->LoadFromFile(); tmpTeam->SetToPage(this); ui.Pages->setCurrentIndex(ID_PAGE_SETUP_TEAM); @@ -217,25 +180,13 @@ void HWForm::SimpleGame() { - game = new HWGame(config, ui.pageLGGameCFG); + game = new HWGame(config, ui.pageLocalGame->gameCFG); game->StartQuick(); } -void HWForm::CBGrave_activated(const QString & gravename) -{ - QPixmap pix(QString(DATA_PATH) + "/Graphics/Graves/" + gravename + ".png"); - ui.GravePreview->setPixmap(pix.copy(0, 0, 32, 32)); -} - -void HWForm::CBFort_activated(const QString & fortname) -{ - QPixmap pix(QString(DATA_PATH) + "/Forts/" + fortname + "L.png"); - ui.FortPreview->setPixmap(pix); -} - void HWForm::PlayDemo() { - QListWidgetItem * curritem = ui.DemosList->currentItem(); + QListWidgetItem * curritem = ui.pagePlayDemo->DemosList->currentItem(); if (!curritem) { QMessageBox::critical(this, @@ -255,7 +206,7 @@ connect(hwnet, SIGNAL(AddGame(const QString &)), this, SLOT(AddGame(const QString &))); connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter())); connect(hwnet, SIGNAL(ChangeInTeams(const QStringList &)), this, SLOT(ChangeInNetTeams(const QStringList &))); - hwnet->Connect("172.19.5.168", 6667, ui.editNetNick->text()); + hwnet->Connect("172.19.5.168", 6667, ui.pageOptions->editNetNick->text()); } void HWForm::NetDisconnect() @@ -266,7 +217,7 @@ void HWForm::AddGame(const QString & chan) { - ui.ChannelsList->addItem(chan); + ui.pageNetChat->ChannelsList->addItem(chan); } void HWForm::NetGameEnter() @@ -298,7 +249,7 @@ void HWForm::ChangeInNetTeams(const QStringList & teams) { - ui.listNetTeams->clear(); - ui.listNetTeams->addItems(teams); + ui.pageNetGame->listNetTeams->clear(); + ui.pageNetGame->listNetTeams->addItems(teams); } diff -r 664b536a1c27 -r ff213e443336 QTfrontend/hwform.h --- a/QTfrontend/hwform.h Tue Jul 25 20:19:46 2006 +0000 +++ b/QTfrontend/hwform.h Wed Jul 26 12:25:48 2006 +0000 @@ -39,12 +39,10 @@ #include #include "ui_hwform.h" -#include "binds.h" -#include "game.h" -#include "team.h" -#include "netclient.h" -#include "teamselect.h" +class HWGame; +class HWTeam; +class HWNet; class GameUIConfig; class HWForm : public QMainWindow @@ -53,10 +51,7 @@ public: HWForm(QWidget *parent = 0); - Ui::HWForm ui; - QLineEdit * TeamNameEdit; - QLineEdit * HHNameEdit[8]; - QComboBox * CBBind[BINDS_NUMBER]; + Ui_HWForm ui; private slots: void GoToMain(); @@ -82,12 +77,7 @@ void NetStartGame(); void ChangeInNetTeams(const QStringList & teams); -public slots: - void CBGrave_activated(const QString & gravename); - void CBFort_activated(const QString & gravename); - private: - QLabel * LBind[BINDS_NUMBER]; HWGame * game; HWTeam * tmpTeam; HWNet * hwnet; diff -r 664b536a1c27 -r ff213e443336 QTfrontend/pages.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/pages.cpp Wed Jul 26 12:25:48 2006 +0000 @@ -0,0 +1,376 @@ +/* + * Hedgewars, a worms-like game + * Copyright (c) 2006 Andrey Korotaev + * + * Distributed under the terms of the BSD-modified licence: + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * with the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "pages.h" +#include "sdlkeys.h" +#include "hwconsts.h" +#include "gamecfgwidget.h" +#include "teamselect.h" +#include "gamecfgwidget.h" + +PageMain::PageMain(QWidget* parent) : QWidget(parent) +{ + QFont * font14 = new QFont("MS Shell Dlg", 14); + QGridLayout * pageLayout = new QGridLayout(this); + pageLayout->setMargin(25); + pageLayout->setColumnStretch(0, 1); + pageLayout->setColumnStretch(1, 2); + pageLayout->setColumnStretch(2, 1); + + BtnSinglePlayer = new QPushButton(this); + BtnSinglePlayer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + BtnSinglePlayer->setFont(*font14); + BtnSinglePlayer->setText(QPushButton::tr("Single Player")); + pageLayout->addWidget(BtnSinglePlayer, 1, 1); + + BtnMultiplayer = new QPushButton(this); + BtnMultiplayer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + BtnMultiplayer->setFont(*font14); + BtnMultiplayer->setText(QPushButton::tr("Multiplayer")); + pageLayout->addWidget(BtnMultiplayer, 2, 1); + + BtnNet = new QPushButton(this); + BtnNet->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + BtnNet->setFont(*font14); + BtnNet->setText(QPushButton::tr("Net game")); + pageLayout->addWidget(BtnNet, 3, 1); + + BtnDemos = new QPushButton(this); + BtnDemos->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + BtnDemos->setFont(*font14); + BtnDemos->setText(QPushButton::tr("Demos")); + pageLayout->addWidget(BtnDemos, 4, 1); + + BtnSetup = new QPushButton(this); + BtnSetup->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + BtnSetup->setFont(*font14); + BtnSetup->setText(QPushButton::tr("Setup")); + pageLayout->addWidget(BtnSetup, 5, 1); + + BtnExit = new QPushButton(parent); + BtnExit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + BtnExit->setFont(*font14); + BtnExit->setText(QPushButton::tr("Exit")); + pageLayout->addWidget(BtnExit, 6, 1); +} + +PageLocalGame::PageLocalGame(QWidget* parent) : QWidget(parent) +{ + QFont * font14 = new QFont("MS Shell Dlg", 14); + QGridLayout * pageLayout = new QGridLayout(this); + BtnBack = new QPushButton(this); + BtnBack->setFont(*font14); + BtnBack->setText(QPushButton::tr("Back")); + pageLayout->addWidget(BtnBack, 1, 0); + BtnSimpleGame = new QPushButton(this); + BtnSimpleGame->setFont(*font14); + BtnSimpleGame->setText(QPushButton::tr("Simple Game")); + pageLayout->addWidget(BtnSimpleGame, 1, 3); + gameCFG = new GameCFGWidget(this); + pageLayout->addWidget(gameCFG, 0, 0, 1, 2); +} + +PageEditTeam::PageEditTeam(QWidget* parent) : QWidget(parent) +{ + QFont * font14 = new QFont("MS Shell Dlg", 14); + GBoxHedgehogs = new QGroupBox(this); + GBoxHedgehogs->setGeometry(QRect(20, 70, 161, 261)); + GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members")); + GBoxTeam = new QGroupBox(this); + GBoxTeam->setGeometry(QRect(20, 10, 161, 51)); + GBoxTeam->setTitle(QGroupBox::tr("Team")); + GBoxFort = new QGroupBox(this); + GBoxFort->setGeometry(QRect(420, 110, 181, 221)); + GBoxFort->setTitle(QGroupBox::tr("Fort")); + CBFort = new QComboBox(GBoxFort); + CBFort->setGeometry(QRect(10, 20, 161, 21)); + CBFort->setMaxCount(65535); + FortPreview = new QLabel(GBoxFort); + FortPreview->setGeometry(QRect(10, 50, 161, 161)); + FortPreview->setPixmap(QPixmap()); + FortPreview->setScaledContents(true); + GBoxGrave = new QGroupBox(this); + GBoxGrave->setGeometry(QRect(420, 10, 181, 91)); + GBoxGrave->setTitle(QGroupBox::tr("Grave")); + CBGrave = new QComboBox(GBoxGrave); + CBGrave->setGeometry(QRect(10, 20, 161, 21)); + CBGrave->setMaxCount(65535); + GravePreview = new QLabel(GBoxGrave); + GravePreview->setGeometry(QRect(80, 50, 32, 32)); + GravePreview->setScaledContents(true); + GBoxBinds = new QGroupBox(this); + GBoxBinds->setGeometry(QRect(200, 10, 201, 431)); + GBoxBinds->setTitle(QGroupBox::tr("Key binds")); + BindsBox = new QToolBox(GBoxBinds); + BindsBox->setGeometry(QRect(10, 20, 181, 401)); + BindsBox->setLineWidth(0); + page_A = new QWidget(); + page_A->setGeometry(QRect(0, 0, 96, 26)); + BindsBox->addItem(page_A, QToolBox::tr("Actions")); + page_W = new QWidget(); + BindsBox->addItem(page_W, QToolBox::tr("Weapons")); + page_WP = new QWidget(); + BindsBox->addItem(page_WP, QToolBox::tr("Weapon properties")); + page_O = new QWidget(); + page_O->setGeometry(QRect(0, 0, 96, 26)); + BindsBox->addItem(page_O, QToolBox::tr("Other")); + BtnTeamDiscard = new QPushButton(this); + BtnTeamDiscard->setGeometry(QRect(440, 380, 161, 41)); + BtnTeamDiscard->setFont(*font14); + BtnTeamDiscard->setText(QPushButton::tr("Discard")); + BtnTeamSave = new QPushButton(this); + BtnTeamSave->setGeometry(QRect(20, 380, 161, 41)); + BtnTeamSave->setFont(*font14); + BtnTeamSave->setText(QPushButton::tr("Save")); + + TeamNameEdit = new QLineEdit(GBoxTeam); + TeamNameEdit->setGeometry(QRect(10, 20, 141, 20)); + TeamNameEdit->setMaxLength(15); + for(int i = 0; i < 8; i++) + { + HHNameEdit[i] = new QLineEdit(GBoxHedgehogs); + HHNameEdit[i]->setGeometry(QRect(10, 20 + i * 30, 141, 20)); + HHNameEdit[i]->setMaxLength(15); + } + + QStringList binds; + for(int i = 0; strlen(sdlkeys[i][1]) > 0; i++) + { + binds << sdlkeys[i][1]; + } + + quint16 widind = 0, top = 0; + for(quint8 i = 0; i < BINDS_NUMBER; i++) + { + LBind[i] = new QLabel(BindsBox->widget(widind)); + LBind[i]->setGeometry(QRect(10, top + 3, 70, 20)); + LBind[i]->setText(tr(cbinds[i].name)); + LBind[i]->setAlignment(Qt::AlignRight); + CBBind[i] = new QComboBox(BindsBox->widget(widind)); + CBBind[i]->setGeometry(QRect(90, top, 80, 20)); + CBBind[i]->addItems(binds); + if (cbinds[i].chwidget) + { + top = 0; + widind++; + } else + { + top += 28; + } + } + + QDir tmpdir; + tmpdir.cd(DATA_PATH); + tmpdir.cd("Forts"); + tmpdir.setFilter(QDir::Files); + + CBFort->addItems(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L.png"), "\\1")); + tmpdir.cd("../Graphics/Graves"); + QStringList list = tmpdir.entryList(QStringList("*.png")); + for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) + { + CBGrave->addItem((*it).replace(QRegExp("^(.*).png"), "\\1")); + } + + connect(CBGrave, SIGNAL(activated(const QString &)), this, SLOT(CBGrave_activated(const QString &))); + connect(CBFort, SIGNAL(activated(const QString &)), this, SLOT(CBFort_activated(const QString &))); +} + +void PageEditTeam::CBGrave_activated(const QString & gravename) +{ + QPixmap pix(QString(DATA_PATH) + "/Graphics/Graves/" + gravename + ".png"); + GravePreview->setPixmap(pix.copy(0, 0, 32, 32)); +} + +void PageEditTeam::CBFort_activated(const QString & fortname) +{ + QPixmap pix(QString(DATA_PATH) + "/Forts/" + fortname + "L.png"); + FortPreview->setPixmap(pix); +} + +PageMultiplayer::PageMultiplayer(QWidget* parent) : QWidget(parent) +{ + QFont * font14 = new QFont("MS Shell Dlg", 14); + QGridLayout * pageLayout = new QGridLayout(this); + BtnBack = new QPushButton(this); + BtnBack->setFont(*font14); + BtnBack->setText(QPushButton::tr("Back")); + pageLayout->addWidget(BtnBack, 1, 0); + gameCFG = new GameCFGWidget(this); + pageLayout->addWidget(gameCFG, 0, 0, 1, 2); + teamsSelect = new TeamSelWidget(this); + pageLayout->addWidget(teamsSelect, 0, 2, 1, 2); +} + +PagePlayDemo::PagePlayDemo(QWidget* parent) : QWidget(parent) +{ + QFont * font14 = new QFont("MS Shell Dlg", 14); + QGridLayout * pageLayout = new QGridLayout(this); + pageLayout->setColumnStretch(0, 1); + pageLayout->setColumnStretch(1, 2); + pageLayout->setColumnStretch(2, 1); + + BtnBack = new QPushButton(this); + BtnBack->setFont(*font14); + BtnBack->setText(QPushButton::tr("Back")); + pageLayout->addWidget(BtnBack, 1, 0); + + BtnPlayDemo = new QPushButton(this); + BtnPlayDemo->setGeometry(QRect(240, 330, 161, 41)); + BtnPlayDemo->setFont(*font14); + BtnPlayDemo->setText(QPushButton::tr("Play demo")); + pageLayout->addWidget(BtnPlayDemo, 1, 2); + + DemosList = new QListWidget(this); + DemosList->setGeometry(QRect(170, 10, 311, 311)); + pageLayout->addWidget(DemosList, 0, 1); +} + +PageOptions::PageOptions(QWidget* parent) : QWidget(parent) +{ + QFont * font14 = new QFont("MS Shell Dlg", 14); + groupBox = new QGroupBox(this); + groupBox->setGeometry(QRect(20, 10, 591, 71)); + groupBox->setTitle(QGroupBox::tr("Teams")); + + BtnNewTeam = new QPushButton(groupBox); + BtnNewTeam->setGeometry(QRect(10, 20, 160, 40)); + BtnNewTeam->setFont(*font14); + BtnNewTeam->setText(QPushButton::tr("New team")); + + BtnEditTeam = new QPushButton(groupBox); + BtnEditTeam->setGeometry(QRect(400, 20, 160, 40)); + BtnEditTeam->setFont(*font14); + BtnEditTeam->setText(QPushButton::tr("Edit team")); + + CBTeamName = new QComboBox(groupBox); + CBTeamName->setGeometry(QRect(200, 30, 171, 22)); + CBResolution = new QComboBox(this); + CBResolution->addItem("640x480"); + CBResolution->addItem("800x600"); + CBResolution->addItem("1024x768"); + CBResolution->addItem("1280x1024"); + CBResolution->setGeometry(QRect(20, 120, 151, 22)); + + CBEnableSound = new QCheckBox(this); + CBEnableSound->setGeometry(QRect(20, 180, 101, 18)); + CBEnableSound->setText(QCheckBox::tr("Enable sound")); + + CBFullscreen = new QCheckBox(this); + CBFullscreen->setGeometry(QRect(20, 160, 101, 18)); + CBFullscreen->setText(QCheckBox::tr("Fullscreen")); + + label = new QLabel(this); + label->setGeometry(QRect(10, 233, 47, 13)); + label->setText(QLabel::tr("Net nick")); + + editNetNick = new QLineEdit(this); + editNetNick->setGeometry(QRect(60, 230, 113, 20)); + editNetNick->setMaxLength(30); + editNetNick->setText(QLineEdit::tr("unnamed")); + + BtnSaveOptions = new QPushButton(this); + BtnSaveOptions->setGeometry(QRect(20, 380, 161, 41)); + BtnSaveOptions->setFont(*font14); + BtnSaveOptions->setText(QPushButton::tr("Save")); + + BtnBack = new QPushButton(this); + BtnBack->setGeometry(QRect(440, 380, 161, 41)); + BtnBack->setFont(*font14); + BtnBack->setText(QPushButton::tr("Back")); +} + +PageNet::PageNet(QWidget* parent) : QWidget(parent) +{ + QFont * font14 = new QFont("MS Shell Dlg", 14); + BtnNetConnect = new QPushButton(this); + BtnNetConnect->setGeometry(QRect(250, 140, 161, 41)); + BtnNetConnect->setFont(*font14); + BtnNetConnect->setText(QPushButton::tr("Connect")); + BtnBack = new QPushButton(this); + BtnBack->setGeometry(QRect(250, 390, 161, 41)); + BtnBack->setFont(*font14); + BtnBack->setText(QPushButton::tr("Back")); +} + +PageNetChat::PageNetChat(QWidget* parent) : QWidget(parent) +{ + QFont * font14 = new QFont("MS Shell Dlg", 14); + BtnDisconnect = new QPushButton(this); + BtnDisconnect->setGeometry(QRect(460, 390, 161, 41)); + BtnDisconnect->setFont(*font14); + BtnDisconnect->setText(QPushButton::tr("Disconnect")); + ChannelsList = new QListWidget(this); + ChannelsList->setGeometry(QRect(20, 10, 201, 331)); + BtnJoin = new QPushButton(this); + BtnJoin->setGeometry(QRect(460, 290, 161, 41)); + BtnJoin->setFont(*font14); + BtnJoin->setText(QPushButton::tr("Join")); + BtnCreate = new QPushButton(this); + BtnCreate->setGeometry(QRect(460, 340, 161, 41)); + BtnCreate->setFont(*font14); + BtnCreate->setText(QPushButton::tr("Create")); +} + + +PageNetGame::PageNetGame(QWidget* parent) : QWidget(parent) +{ + QFont * font14 = new QFont("MS Shell Dlg", 14); + BtnBack = new QPushButton(this); + BtnBack->setGeometry(QRect(260, 390, 161, 41)); + BtnBack->setFont(*font14); + BtnBack->setText(QPushButton::tr("Back")); + + BtnAddTeam = new QPushButton(this); + BtnAddTeam->setGeometry(QRect(260, 290, 161, 41)); + BtnAddTeam->setFont(*font14); + BtnAddTeam->setText(QPushButton::tr("Add Team")); + + BtnGo = new QPushButton(this); + BtnGo->setGeometry(QRect(260, 340, 161, 41)); + BtnGo->setFont(*font14); + BtnGo->setText(QPushButton::tr("Go!")); + + listNetTeams = new QListWidget(this); + listNetTeams->setGeometry(QRect(270, 30, 120, 80)); +} diff -r 664b536a1c27 -r ff213e443336 QTfrontend/pages.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/pages.h Wed Jul 26 12:25:48 2006 +0000 @@ -0,0 +1,195 @@ +/* + * Hedgewars, a worms-like game + * Copyright (c) 2006 Andrey Korotaev + * + * Distributed under the terms of the BSD-modified licence: + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * with the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef PAGES_H +#define PAGES_H + +#include + +#include "binds.h" + +class GameCFGWidget; +class QPushButton; +class QGroupBox; +class QComboBox; +class QLabel; +class QToolBox; +class QLineEdit; +class TeamSelWidget; +class DemosList; +class QListWidget; +class QCheckBox; + +class PageMain : public QWidget +{ + Q_OBJECT + +public: + PageMain(QWidget* parent = 0); + + QPushButton *BtnSinglePlayer; + QPushButton *BtnMultiplayer; + QPushButton *BtnNet; + QPushButton *BtnSetup; + QPushButton *BtnDemos; + QPushButton *BtnExit; +}; + +class PageLocalGame : public QWidget +{ + Q_OBJECT + +public: + PageLocalGame(QWidget* parent = 0); + + QPushButton *BtnSimpleGame; + QPushButton *BtnBack; + GameCFGWidget *gameCFG; +}; + +class PageEditTeam : public QWidget +{ + Q_OBJECT + +public: + PageEditTeam(QWidget* parent = 0); + QGroupBox *GBoxHedgehogs; + QGroupBox *GBoxTeam; + QGroupBox *GBoxFort; + QComboBox *CBFort; + QLabel *FortPreview; + QGroupBox *GBoxGrave; + QComboBox *CBGrave; + QLabel *GravePreview; + QGroupBox *GBoxBinds; + QToolBox *BindsBox; + QWidget *page_A; + QWidget *page_W; + QWidget *page_WP; + QWidget *page_O; + QPushButton *BtnTeamDiscard; + QPushButton *BtnTeamSave; + QLineEdit * TeamNameEdit; + QLineEdit * HHNameEdit[8]; + QComboBox * CBBind[BINDS_NUMBER]; + +public slots: + void CBGrave_activated(const QString & gravename); + void CBFort_activated(const QString & gravename); + +private: + QLabel * LBind[BINDS_NUMBER]; +}; + +class PageMultiplayer : public QWidget +{ + Q_OBJECT + +public: + PageMultiplayer(QWidget* parent = 0); + + QPushButton *BtnBack; + GameCFGWidget *gameCFG; + TeamSelWidget *teamsSelect; +}; + +class PagePlayDemo : public QWidget +{ + Q_OBJECT + +public: + PagePlayDemo(QWidget* parent = 0); + + QPushButton *BtnBack; + QPushButton *BtnPlayDemo; + QListWidget *DemosList; +}; + +class PageOptions : public QWidget +{ + Q_OBJECT + +public: + PageOptions(QWidget* parent = 0); + + QPushButton *BtnBack; + QGroupBox *groupBox; + QPushButton *BtnNewTeam; + QPushButton *BtnEditTeam; + QComboBox *CBTeamName; + QComboBox *CBResolution; + QCheckBox *CBEnableSound; + QCheckBox *CBFullscreen; + QLabel *label; + QLineEdit *editNetNick; + QPushButton *BtnSaveOptions; +}; + +class PageNet : public QWidget +{ + Q_OBJECT + +public: + PageNet(QWidget* parent = 0); + + QPushButton *BtnBack; + QPushButton *BtnNetConnect; +}; + +class PageNetChat : public QWidget +{ + Q_OBJECT + +public: + PageNetChat(QWidget* parent = 0); + + QPushButton *BtnDisconnect; + QListWidget *ChannelsList; + QPushButton *BtnJoin; + QPushButton *BtnCreate; +}; + +class PageNetGame : public QWidget +{ + Q_OBJECT + +public: + PageNetGame(QWidget* parent = 0); + + QPushButton *BtnBack; + QPushButton *BtnAddTeam; + QPushButton *BtnGo; + QListWidget *listNetTeams; +}; + +#endif // PAGES_H diff -r 664b536a1c27 -r ff213e443336 QTfrontend/predefteams.h --- a/QTfrontend/predefteams.h Tue Jul 25 20:19:46 2006 +0000 +++ b/QTfrontend/predefteams.h Wed Jul 26 12:25:48 2006 +0000 @@ -40,15 +40,15 @@ struct PredefinedTeam { - QString TeamName; - QString hh0name; - QString hh1name; - QString hh2name; - QString hh3name; - QString hh4name; - QString hh5name; - QString hh6name; - QString hh7name; + const char * TeamName; + const char * hh0name; + const char * hh1name; + const char * hh2name; + const char * hh3name; + const char * hh4name; + const char * hh5name; + const char * hh6name; + const char * hh7name; QString Grave; QString Fort; }; diff -r 664b536a1c27 -r ff213e443336 QTfrontend/team.cpp --- a/QTfrontend/team.cpp Tue Jul 25 20:19:46 2006 +0000 +++ b/QTfrontend/team.cpp Wed Jul 26 12:25:48 2006 +0000 @@ -37,6 +37,7 @@ #include "hwform.h" #include "gameuiconfig.h" #include "predefteams.h" +#include "pages.h" HWTeam::HWTeam(const QString & teamname, GameUIConfig * config) { @@ -56,17 +57,22 @@ { this->config = config; num %= PREDEFTEAMS_COUNT; - TeamName = pteams[num].TeamName; - HHName[0] = pteams[num].hh0name; - HHName[1] = pteams[num].hh1name; - HHName[2] = pteams[num].hh2name; - HHName[3] = pteams[num].hh3name; - HHName[4] = pteams[num].hh4name; - HHName[5] = pteams[num].hh5name; - HHName[6] = pteams[num].hh6name; - HHName[7] = pteams[num].hh7name; + TeamName = QObject::tr(pteams[num].TeamName); + HHName[0] = QObject::tr(pteams[num].hh0name); + HHName[1] = QObject::tr(pteams[num].hh1name); + HHName[2] = QObject::tr(pteams[num].hh2name); + HHName[3] = QObject::tr(pteams[num].hh3name); + HHName[4] = QObject::tr(pteams[num].hh4name); + HHName[5] = QObject::tr(pteams[num].hh5name); + HHName[6] = QObject::tr(pteams[num].hh6name); + HHName[7] = QObject::tr(pteams[num].hh7name); Grave = pteams[num].Grave; Fort = pteams[num].Fort; + for(int i = 0; i < BINDS_NUMBER; i++) + { + binds[i].action = cbinds[i].action; + binds[i].strbind = cbinds[i].strbind; + } } @@ -146,36 +152,36 @@ void HWTeam::SetToPage(HWForm * hwform) { - hwform->TeamNameEdit->setText(TeamName); + hwform->ui.pageEditTeam->TeamNameEdit->setText(TeamName); for(int i = 0; i < 8; i++) { - hwform->HHNameEdit[i]->setText(HHName[i]); + hwform->ui.pageEditTeam->HHNameEdit[i]->setText(HHName[i]); } - hwform->ui.CBGrave->setCurrentIndex(hwform->ui.CBGrave->findText(Grave)); - hwform->CBGrave_activated(Grave); + hwform->ui.pageEditTeam->CBGrave->setCurrentIndex(hwform->ui.pageEditTeam->CBGrave->findText(Grave)); + hwform->ui.pageEditTeam->CBGrave_activated(Grave); - hwform->ui.CBFort->setCurrentIndex(hwform->ui.CBFort->findText(Fort)); - hwform->CBFort_activated(Fort); + hwform->ui.pageEditTeam->CBFort->setCurrentIndex(hwform->ui.pageEditTeam->CBFort->findText(Fort)); + hwform->ui.pageEditTeam->CBFort_activated(Fort); for(int i = 0; i < BINDS_NUMBER; i++) { - hwform->CBBind[i]->setCurrentIndex(hwform->CBBind[i]->findText(binds[i].strbind)); + hwform->ui.pageEditTeam->CBBind[i]->setCurrentIndex(hwform->ui.pageEditTeam->CBBind[i]->findText(binds[i].strbind)); } } void HWTeam::GetFromPage(HWForm * hwform) { - TeamName = hwform->TeamNameEdit->text(); + TeamName = hwform->ui.pageEditTeam->TeamNameEdit->text(); for(int i = 0; i < 8; i++) { - HHName[i] = hwform->HHNameEdit[i]->text(); + HHName[i] = hwform->ui.pageEditTeam->HHNameEdit[i]->text(); } - Grave = hwform->ui.CBGrave->currentText(); - Fort = hwform->ui.CBFort->currentText(); + Grave = hwform->ui.pageEditTeam->CBGrave->currentText(); + Fort = hwform->ui.pageEditTeam->CBFort->currentText(); for(int i = 0; i < 8; i++) { - binds[i].strbind = hwform->CBBind[i]->currentText(); + binds[i].strbind = hwform->ui.pageEditTeam->CBBind[i]->currentText(); } } diff -r 664b536a1c27 -r ff213e443336 QTfrontend/ui_hwform.cpp --- a/QTfrontend/ui_hwform.cpp Tue Jul 25 20:19:46 2006 +0000 +++ b/QTfrontend/ui_hwform.cpp Wed Jul 26 12:25:48 2006 +0000 @@ -1,6 +1,7 @@ -#include "ui_hwform.h" #include #include +#include "ui_hwform.h" +#include "pages.h" void Ui_HWForm::setupUi(QMainWindow *HWForm) { @@ -9,6 +10,9 @@ HWForm->setObjectName(QString::fromUtf8("HWForm")); HWForm->resize(QSize(620, 430).expandedTo(HWForm->minimumSizeHint())); HWForm->setMinimumSize(QSize(620, 430)); + HWForm->setWindowTitle(QMainWindow::tr("-= by unC0Rr =-")); + centralWidget = new QWidget(HWForm); + centralWidget->setObjectName(QString::fromUtf8("centralWidget")); centralWidget = new QWidget(HWForm); centralWidget->setObjectName(QString::fromUtf8("centralWidget")); @@ -16,343 +20,45 @@ SetupPages(centralWidget); HWForm->setCentralWidget(centralWidget); - retranslateUi(HWForm); - QObject::connect(BtnExit, SIGNAL(clicked()), HWForm, SLOT(close())); Pages->setCurrentIndex(0); - CBFort->setCurrentIndex(-1); - CBGrave->setCurrentIndex(-1); - BindsBox->setCurrentIndex(0); - QMetaObject::connectSlotsByName(HWForm); } void Ui_HWForm::SetupFonts() { - font14 = new QFont(); - font14->setFamily(QString::fromUtf8("MS Shell Dlg")); - font14->setPointSize(14); - font14->setBold(false); - font14->setItalic(false); - font14->setUnderline(false); - font14->setWeight(50); - font14->setStrikeOut(false); + font14 = new QFont("MS Shell Dlg", 14); } void Ui_HWForm::SetupPages(QWidget *Parent) { Pages = new QStackedLayout(Parent); - pageLG = new QWidget(); - SetupPageLocalGame(pageLG); - Pages->addWidget(pageLG); + pageLocalGame = new PageLocalGame(); + Pages->addWidget(pageLocalGame); - pageET = new QWidget(); - SetupPageEditTeam(pageET); - Pages->addWidget(pageET); + pageEditTeam = new PageEditTeam(); + Pages->addWidget(pageEditTeam); - pageOpt = new QWidget(); - SetupPageOptions(pageOpt); - Pages->addWidget(pageOpt); + pageOptions = new PageOptions(); + Pages->addWidget(pageOptions); - pageMP = new QWidget(); - SetupPageMultiplayer(pageMP); - Pages->addWidget(pageMP); + pageMultiplayer = new PageMultiplayer(); + Pages->addWidget(pageMultiplayer); - pagePDemo = new QWidget(); - SetupPagePlayDemo(pagePDemo); - Pages->addWidget(pagePDemo); + pagePlayDemo = new PagePlayDemo(); + Pages->addWidget(pagePlayDemo); - pageNet = new QWidget(); - SetupPageNet(pageNet); + pageNet = new PageNet(); Pages->addWidget(pageNet); - pageNetChat = new QWidget(); - SetupPageNetChat(pageNetChat); + pageNetChat = new PageNetChat(); Pages->addWidget(pageNetChat); - pageNetGame = new QWidget(); - SetupPageNetGame(pageNetGame); + pageNetGame = new PageNetGame(); Pages->addWidget(pageNetGame); - pageMain = new QWidget(); - SetupPageMain(pageMain); + pageMain = new PageMain(); Pages->addWidget(pageMain); } - -void Ui_HWForm::SetupPageLocalGame(QWidget *Parent) -{ - QGridLayout * PageLGLayout = new QGridLayout(Parent); - BtnSPBack = new QPushButton(Parent); - BtnSPBack->setFont(*font14); - PageLGLayout->addWidget(BtnSPBack, 1, 0); - BtnSimpleGame = new QPushButton(Parent); - BtnSimpleGame->setFont(*font14); - PageLGLayout->addWidget(BtnSimpleGame, 1, 3); - pageLGGameCFG = new GameCFGWidget(Parent); - PageLGLayout->addWidget(pageLGGameCFG, 0, 0, 1, 2); - PageLGTeamsSelect = new TeamSelWidget(Parent); - PageLGLayout->addWidget(PageLGTeamsSelect, 0, 2, 1, 2); -} - -void Ui_HWForm::SetupPageEditTeam(QWidget *Parent) -{ - GBoxHedgehogs = new QGroupBox(Parent); - GBoxHedgehogs->setGeometry(QRect(20, 70, 161, 261)); - GBoxTeam = new QGroupBox(Parent); - GBoxTeam->setGeometry(QRect(20, 10, 161, 51)); - GBoxFort = new QGroupBox(Parent); - GBoxFort->setGeometry(QRect(420, 110, 181, 221)); - CBFort = new QComboBox(GBoxFort); - CBFort->setGeometry(QRect(10, 20, 161, 21)); - CBFort->setMaxCount(65535); - FortPreview = new QLabel(GBoxFort); - FortPreview->setGeometry(QRect(10, 50, 161, 161)); - FortPreview->setPixmap(QPixmap()); - FortPreview->setScaledContents(true); - GBoxGrave = new QGroupBox(Parent); - GBoxGrave->setGeometry(QRect(420, 10, 181, 91)); - CBGrave = new QComboBox(GBoxGrave); - CBGrave->setGeometry(QRect(10, 20, 161, 21)); - CBGrave->setMaxCount(65535); - GravePreview = new QLabel(GBoxGrave); - GravePreview->setGeometry(QRect(80, 50, 32, 32)); - GravePreview->setScaledContents(true); - GBoxBinds = new QGroupBox(Parent); - GBoxBinds->setGeometry(QRect(200, 10, 201, 431)); - BindsBox = new QToolBox(GBoxBinds); - BindsBox->setGeometry(QRect(10, 20, 181, 401)); - BindsBox->setLineWidth(0); - page_A = new QWidget(); - page_A->setGeometry(QRect(0, 0, 96, 26)); - BindsBox->addItem(page_A, QApplication::translate("HWForm", "Actions", 0, QApplication::UnicodeUTF8)); - page_W = new QWidget(); - page_W->setObjectName(QString::fromUtf8("page_W")); - BindsBox->addItem(page_W, QApplication::translate("HWForm", "Weapons", 0, QApplication::UnicodeUTF8)); - page_WP = new QWidget(); - page_WP->setObjectName(QString::fromUtf8("page_WP")); - BindsBox->addItem(page_WP, QApplication::translate("HWForm", "Weapon properties", 0, QApplication::UnicodeUTF8)); - page_O = new QWidget(); - page_O->setObjectName(QString::fromUtf8("page_O")); - page_O->setGeometry(QRect(0, 0, 96, 26)); - BindsBox->addItem(page_O, QApplication::translate("HWForm", "Other", 0, QApplication::UnicodeUTF8)); - BtnTeamDiscard = new QPushButton(pageET); - BtnTeamDiscard->setGeometry(QRect(440, 380, 161, 41)); - BtnTeamDiscard->setFont(*font14); - BtnTeamDiscard->setCheckable(false); - BtnTeamDiscard->setChecked(false); - BtnTeamSave = new QPushButton(Parent); - BtnTeamSave->setGeometry(QRect(20, 380, 161, 41)); - BtnTeamSave->setFont(*font14); - BtnTeamSave->setCheckable(false); - BtnTeamSave->setChecked(false); -} - -void Ui_HWForm::SetupPageOptions(QWidget *Parent) -{ - groupBox = new QGroupBox(Parent); - groupBox->setGeometry(QRect(20, 10, 591, 71)); - BtnNewTeam = new QPushButton(groupBox); - BtnNewTeam->setGeometry(QRect(10, 20, 160, 40)); - BtnNewTeam->setFont(*font14); - BtnEditTeam = new QPushButton(groupBox); - BtnEditTeam->setGeometry(QRect(400, 20, 160, 40)); - BtnEditTeam->setFont(*font14); - CBTeamName = new QComboBox(groupBox); - CBTeamName->setGeometry(QRect(200, 30, 171, 22)); - CBResolution = new QComboBox(Parent); - CBResolution->setGeometry(QRect(20, 120, 151, 22)); - CBEnableSound = new QCheckBox(Parent); - CBEnableSound->setGeometry(QRect(20, 180, 101, 18)); - CBFullscreen = new QCheckBox(Parent); - CBFullscreen->setGeometry(QRect(20, 160, 101, 18)); - label = new QLabel(Parent); - label->setGeometry(QRect(10, 233, 47, 13)); - editNetNick = new QLineEdit(Parent); - editNetNick->setGeometry(QRect(60, 230, 113, 20)); - editNetNick->setMaxLength(30); - BtnSaveOptions = new QPushButton(Parent); - BtnSaveOptions->setGeometry(QRect(20, 380, 161, 41)); - BtnSaveOptions->setFont(*font14); - BtnSaveOptions->setCheckable(false); - BtnSaveOptions->setChecked(false); - BtnSetupBack = new QPushButton(Parent); - BtnSetupBack->setGeometry(QRect(440, 380, 161, 41)); - BtnSetupBack->setFont(*font14); - BtnSetupBack->setCheckable(false); - BtnSetupBack->setChecked(false); -} - -void Ui_HWForm::SetupPageMultiplayer(QWidget *Parent) -{ - BtnMPBack = new QPushButton(Parent); - BtnMPBack->setGeometry(QRect(240, 340, 161, 41)); - BtnMPBack->setFont(*font14); - BtnMPBack->setCheckable(false); - BtnMPBack->setChecked(false); - listWidget = new QListWidget(Parent); - listWidget->setGeometry(QRect(160, 50, 221, 211)); - listWidget->setModelColumn(0); -} - -void Ui_HWForm::SetupPagePlayDemo(QWidget *Parent) -{ - BtnPlayDemo = new QPushButton(Parent); - BtnPlayDemo->setGeometry(QRect(240, 330, 161, 41)); - BtnPlayDemo->setFont(*font14); - BtnPlayDemo->setCheckable(false); - BtnPlayDemo->setChecked(false); - DemosList = new QListWidget(Parent); - DemosList->setGeometry(QRect(170, 10, 311, 311)); - BtnDemosBack = new QPushButton(Parent); - BtnDemosBack->setGeometry(QRect(240, 380, 161, 41)); - BtnDemosBack->setFont(*font14); - BtnDemosBack->setCheckable(false); - BtnDemosBack->setChecked(false); -} - -void Ui_HWForm::SetupPageNet(QWidget *Parent) -{ - BtnNetConnect = new QPushButton(Parent); - BtnNetConnect->setGeometry(QRect(250, 140, 161, 41)); - BtnNetConnect->setFont(*font14); - BtnNetConnect->setCheckable(false); - BtnNetConnect->setChecked(false); - BtnNetBack = new QPushButton(Parent); - BtnNetBack->setGeometry(QRect(250, 390, 161, 41)); - BtnNetBack->setFont(*font14); - BtnNetBack->setCheckable(false); - BtnNetBack->setChecked(false); -} - -void Ui_HWForm::SetupPageNetChat(QWidget *Parent) -{ - BtnNetChatDisconnect = new QPushButton(Parent); - BtnNetChatDisconnect->setGeometry(QRect(460, 390, 161, 41)); - BtnNetChatDisconnect->setFont(*font14); - BtnNetChatDisconnect->setCheckable(false); - BtnNetChatDisconnect->setChecked(false); - ChannelsList = new QListWidget(Parent); - ChannelsList->setGeometry(QRect(20, 10, 201, 331)); - BtnNetChatJoin = new QPushButton(Parent); - BtnNetChatJoin->setGeometry(QRect(460, 290, 161, 41)); - BtnNetChatJoin->setFont(*font14); - BtnNetChatJoin->setCheckable(false); - BtnNetChatJoin->setChecked(false); - BtnNetChatCreate = new QPushButton(Parent); - BtnNetChatCreate->setGeometry(QRect(460, 340, 161, 41)); - BtnNetChatCreate->setFont(*font14); - BtnNetChatCreate->setCheckable(false); - BtnNetChatCreate->setChecked(false); -} - -void Ui_HWForm::SetupPageNetGame(QWidget *Parent) -{ - BtnNetCFGBack = new QPushButton(Parent); - BtnNetCFGBack->setGeometry(QRect(260, 390, 161, 41)); - BtnNetCFGBack->setFont(*font14); - BtnNetCFGBack->setCheckable(false); - BtnNetCFGBack->setChecked(false); - BtnNetCFGAddTeam = new QPushButton(Parent); - BtnNetCFGAddTeam->setGeometry(QRect(260, 290, 161, 41)); - BtnNetCFGAddTeam->setFont(*font14); - BtnNetCFGAddTeam->setCheckable(false); - BtnNetCFGAddTeam->setChecked(false); - BtnNetCFGGo = new QPushButton(Parent); - BtnNetCFGGo->setGeometry(QRect(260, 340, 161, 41)); - BtnNetCFGGo->setFont(*font14); - BtnNetCFGGo->setCheckable(false); - BtnNetCFGGo->setChecked(false); - listNetTeams = new QListWidget(Parent); - listNetTeams->setGeometry(QRect(270, 30, 120, 80)); -} - -void Ui_HWForm::SetupPageMain(QWidget *Parent) -{ - QGridLayout * PageMainLayout = new QGridLayout(Parent); - PageMainLayout->setMargin(25); - PageMainLayout->setColumnStretch(0, 1); - PageMainLayout->setColumnStretch(1, 2); - PageMainLayout->setColumnStretch(2, 1); - BtnSinglePlayer = new QPushButton(Parent); - BtnSinglePlayer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - BtnSinglePlayer->setFont(*font14); - PageMainLayout->addWidget(BtnSinglePlayer, 1, 1); - - BtnMultiplayer = new QPushButton(Parent); - BtnMultiplayer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - BtnMultiplayer->setFont(*font14); - PageMainLayout->addWidget(BtnMultiplayer, 2, 1); - - BtnNet = new QPushButton(Parent); - BtnNet->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - BtnNet->setFont(*font14); - PageMainLayout->addWidget(BtnNet, 3, 1); - - BtnDemos = new QPushButton(Parent); - BtnDemos->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - BtnDemos->setFont(*font14); - PageMainLayout->addWidget(BtnDemos, 4, 1); - - BtnSetup = new QPushButton(Parent); - BtnSetup->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - BtnSetup->setFont(*font14); - PageMainLayout->addWidget(BtnSetup, 5, 1); - - BtnExit = new QPushButton(Parent); - BtnExit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - BtnExit->setFont(*font14); - PageMainLayout->addWidget(BtnExit, 6, 1); -} - -void Ui_HWForm::retranslateUi(QMainWindow *HWForm) -{ - HWForm->setWindowTitle(QApplication::translate("HWForm", "-= by unC0Rr =-", 0, QApplication::UnicodeUTF8)); - BtnSimpleGame->setText(QApplication::translate("HWForm", "Simple Game", 0, QApplication::UnicodeUTF8)); - BtnSPBack->setText(QApplication::translate("HWForm", "Back", 0, QApplication::UnicodeUTF8)); - GBoxHedgehogs->setTitle(QApplication::translate("HWForm", "Team Members", 0, QApplication::UnicodeUTF8)); - GBoxTeam->setTitle(QApplication::translate("HWForm", "Team", 0, QApplication::UnicodeUTF8)); - GBoxFort->setTitle(QApplication::translate("HWForm", "Fort", 0, QApplication::UnicodeUTF8)); - FortPreview->setText(QApplication::translate("HWForm", "", 0, QApplication::UnicodeUTF8)); - GBoxGrave->setTitle(QApplication::translate("HWForm", "Grave", 0, QApplication::UnicodeUTF8)); - GravePreview->setText(QApplication::translate("HWForm", "", 0, QApplication::UnicodeUTF8)); - GBoxBinds->setTitle(QApplication::translate("HWForm", "Key binds", 0, QApplication::UnicodeUTF8)); - BindsBox->setItemText(BindsBox->indexOf(page_A), QApplication::translate("HWForm", "Actions", 0, QApplication::UnicodeUTF8)); - BindsBox->setItemText(BindsBox->indexOf(page_W), QApplication::translate("HWForm", "Weapons", 0, QApplication::UnicodeUTF8)); - BindsBox->setItemText(BindsBox->indexOf(page_WP), QApplication::translate("HWForm", "Weapon properties", 0, QApplication::UnicodeUTF8)); - BindsBox->setItemText(BindsBox->indexOf(page_O), QApplication::translate("HWForm", "Other", 0, QApplication::UnicodeUTF8)); - BtnTeamDiscard->setText(QApplication::translate("HWForm", "Discard", 0, QApplication::UnicodeUTF8)); - BtnTeamSave->setText(QApplication::translate("HWForm", "Save", 0, QApplication::UnicodeUTF8)); - groupBox->setTitle(QApplication::translate("HWForm", "Teams", 0, QApplication::UnicodeUTF8)); - BtnNewTeam->setText(QApplication::translate("HWForm", "New team", 0, QApplication::UnicodeUTF8)); - BtnEditTeam->setText(QApplication::translate("HWForm", "Edit team", 0, QApplication::UnicodeUTF8)); - CBResolution->addItem(QApplication::translate("HWForm", "640x480", 0, QApplication::UnicodeUTF8)); - CBResolution->addItem(QApplication::translate("HWForm", "800x600", 0, QApplication::UnicodeUTF8)); - CBResolution->addItem(QApplication::translate("HWForm", "1024x768", 0, QApplication::UnicodeUTF8)); - CBResolution->addItem(QApplication::translate("HWForm", "1280x1024", 0, QApplication::UnicodeUTF8)); - CBEnableSound->setText(QApplication::translate("HWForm", "Enable sound", 0, QApplication::UnicodeUTF8)); - CBFullscreen->setText(QApplication::translate("HWForm", "Fullscreen", 0, QApplication::UnicodeUTF8)); - label->setText(QApplication::translate("HWForm", "Net nick", 0, QApplication::UnicodeUTF8)); - editNetNick->setText(QApplication::translate("HWForm", "unnamed", 0, QApplication::UnicodeUTF8)); - BtnSaveOptions->setText(QApplication::translate("HWForm", "Save", 0, QApplication::UnicodeUTF8)); - BtnSetupBack->setText(QApplication::translate("HWForm", "Back", 0, QApplication::UnicodeUTF8)); - BtnMPBack->setText(QApplication::translate("HWForm", "Back", 0, QApplication::UnicodeUTF8)); - BtnPlayDemo->setText(QApplication::translate("HWForm", "Play demo", 0, QApplication::UnicodeUTF8)); - BtnDemosBack->setText(QApplication::translate("HWForm", "Back", 0, QApplication::UnicodeUTF8)); - BtnNetConnect->setText(QApplication::translate("HWForm", "Connect", 0, QApplication::UnicodeUTF8)); - BtnNetBack->setText(QApplication::translate("HWForm", "Back", 0, QApplication::UnicodeUTF8)); - BtnNetChatDisconnect->setText(QApplication::translate("HWForm", "Disconnect", 0, QApplication::UnicodeUTF8)); - BtnNetChatJoin->setText(QApplication::translate("HWForm", "Join", 0, QApplication::UnicodeUTF8)); - BtnNetChatCreate->setText(QApplication::translate("HWForm", "Create", 0, QApplication::UnicodeUTF8)); - BtnNetCFGBack->setText(QApplication::translate("HWForm", "Back", 0, QApplication::UnicodeUTF8)); - BtnNetCFGAddTeam->setText(QApplication::translate("HWForm", "Add Team", 0, QApplication::UnicodeUTF8)); - BtnNetCFGGo->setText(QApplication::translate("HWForm", "Go!", 0, QApplication::UnicodeUTF8)); - BtnSinglePlayer->setText(QApplication::translate("HWForm", "Single Player", 0, QApplication::UnicodeUTF8)); - BtnMultiplayer->setText(QApplication::translate("HWForm", "Multiplayer", 0, QApplication::UnicodeUTF8)); - BtnSetup->setText(QApplication::translate("HWForm", "Setup", 0, QApplication::UnicodeUTF8)); - BtnExit->setText(QApplication::translate("HWForm", "Exit", 0, QApplication::UnicodeUTF8)); - BtnDemos->setText(QApplication::translate("HWForm", "Demos", 0, QApplication::UnicodeUTF8)); - BtnNet->setText(QApplication::translate("HWForm", "Net game", 0, QApplication::UnicodeUTF8)); - Q_UNUSED(HWForm); -} diff -r 664b536a1c27 -r ff213e443336 QTfrontend/ui_hwform.h --- a/QTfrontend/ui_hwform.h Tue Jul 25 20:19:46 2006 +0000 +++ b/QTfrontend/ui_hwform.h Wed Jul 26 12:25:48 2006 +0000 @@ -17,96 +17,40 @@ #include #include #include -#include "teamselect.h" -#include "gamecfgwidget.h" + +class PageMain; +class PageLocalGame; +class PageEditTeam; +class PageMultiplayer; +class PagePlayDemo; +class PageOptions; +class PageNet; +class PageNetChat; +class PageNetGame; class Ui_HWForm { public: QWidget *centralWidget; - QWidget *pageLG; - QPushButton *BtnSimpleGame; - QPushButton *BtnSPBack; - QWidget *pageET; - QGroupBox *GBoxHedgehogs; - QGroupBox *GBoxTeam; - QGroupBox *GBoxFort; - QComboBox *CBFort; - QLabel *FortPreview; - QGroupBox *GBoxGrave; - QComboBox *CBGrave; - QLabel *GravePreview; - QGroupBox *GBoxBinds; - QToolBox *BindsBox; - QWidget *page_A; - QWidget *page_W; - QWidget *page_WP; - QWidget *page_O; - QPushButton *BtnTeamDiscard; - QPushButton *BtnTeamSave; - QWidget *pageOpt; - QGroupBox *groupBox; - QPushButton *BtnNewTeam; - QPushButton *BtnEditTeam; - QComboBox *CBTeamName; - QComboBox *CBResolution; - QCheckBox *CBEnableSound; - QCheckBox *CBFullscreen; - QLabel *label; - QLineEdit *editNetNick; - QPushButton *BtnSaveOptions; - QPushButton *BtnSetupBack; - QWidget *pageMP; - QPushButton *BtnMPBack; - QListWidget *listWidget; - QWidget *pagePDemo; - QPushButton *BtnPlayDemo; - QListWidget *DemosList; - QPushButton *BtnDemosBack; - QWidget *pageNet; - QPushButton *BtnNetConnect; - QPushButton *BtnNetBack; - QWidget *pageNetChat; - QPushButton *BtnNetChatDisconnect; - QListWidget *ChannelsList; - QPushButton *BtnNetChatJoin; - QPushButton *BtnNetChatCreate; - QWidget *pageNetGame; - QPushButton *BtnNetCFGBack; - QPushButton *BtnNetCFGAddTeam; - QPushButton *BtnNetCFGGo; - QListWidget *listNetTeams; - QWidget *pageMain; - QPushButton *BtnSinglePlayer; - QPushButton *BtnMultiplayer; - QPushButton *BtnSetup; - QPushButton *BtnExit; - QPushButton *BtnDemos; - QPushButton *BtnNet; + + PageMain *pageMain; + PageLocalGame *pageLocalGame; + PageEditTeam *pageEditTeam; + PageMultiplayer *pageMultiplayer; + PagePlayDemo *pagePlayDemo; + PageOptions *pageOptions; + PageNet *pageNet; + PageNetChat *pageNetChat; + PageNetGame *pageNetGame; QStackedLayout *Pages; QFont *font14; - TeamSelWidget *PageLGTeamsSelect; - GameCFGWidget *pageLGGameCFG; void setupUi(QMainWindow *HWForm); void SetupFonts(); void SetupPages(QWidget *Parent); - void SetupPageLocalGame(QWidget *Parent); - void SetupPageEditTeam(QWidget *Parent); - void SetupPageOptions(QWidget *Parent); - void SetupPageMultiplayer(QWidget *Parent); - void SetupPagePlayDemo(QWidget *Parent); - void SetupPageNet(QWidget *Parent); void SetupPageNetChat(QWidget *Parent); void SetupPageNetGame(QWidget *Parent); - void SetupPageMain(QWidget *Parent); - - void retranslateUi(QMainWindow *HWForm); }; -namespace Ui { - class HWForm: public Ui_HWForm {}; -} // namespace Ui - #endif // UI_HWFORM_H