# HG changeset patch # User unc0rr # Date 1256930924 0 # Node ID 0047e16dbacb780dc861639c308fa249a74481aa # Parent dd995a9c8871cf48058d92aaa23c4f53551600cf Add loading team parameters diff -r dd995a9c8871 -r 0047e16dbacb tools/MissionsEditor/editor.cpp --- a/tools/MissionsEditor/editor.cpp Thu Oct 29 23:59:46 2009 +0000 +++ b/tools/MissionsEditor/editor.cpp Fri Oct 30 19:28:44 2009 +0000 @@ -1,4 +1,5 @@ #include <QtGui> +#include <QObject> #include "editor.h" #include "ui_editor.h" @@ -39,6 +40,8 @@ void editor::load(const QString & fileName) { + int currTeam = -1; + QFile file(fileName); if(!file.open(QIODevice::ReadOnly)) @@ -79,5 +82,35 @@ flags >>= 1; } } + else + if (line.startsWith("addteam") && (currTeam < 5)) + { + ++currTeam; + line = line.mid(8); + int spacePos = line.indexOf('\x20'); + quint32 teamColor = line.left(spacePos).toUInt(); + QString teamName = line.mid(spacePos + 1); + + TeamEdit * te = qobject_cast<TeamEdit *>(ui->twTeams->widget(currTeam)); + te->addTeam(teamName, teamColor); + } + else + if (line.startsWith("fort") && (currTeam >= 0)) + { + TeamEdit * te = qobject_cast<TeamEdit *>(ui->twTeams->widget(currTeam)); + te->setFort(line.mid(5)); + } + else + if (line.startsWith("grave") && (currTeam >= 0)) + { + TeamEdit * te = qobject_cast<TeamEdit *>(ui->twTeams->widget(currTeam)); + te->setGrave(line.mid(6)); + } + else + if (line.startsWith("voicepack") && (currTeam >= 0)) + { + TeamEdit * te = qobject_cast<TeamEdit *>(ui->twTeams->widget(currTeam)); + te->setVoicepack(line.mid(10)); + } } } diff -r dd995a9c8871 -r 0047e16dbacb tools/MissionsEditor/editor.ui --- a/tools/MissionsEditor/editor.ui Thu Oct 29 23:59:46 2009 +0000 +++ b/tools/MissionsEditor/editor.ui Fri Oct 30 19:28:44 2009 +0000 @@ -285,7 +285,61 @@ </attribute> <layout class="QGridLayout" name="gridLayout_4"> <item row="0" column="0"> - <widget class="TeamEdit" name="widget" native="true"/> + <widget class="QPushButton" name="pbAddTeam"> + <property name="text"> + <string>Add Team</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="0" colspan="2"> + <widget class="QTabWidget" name="twTeams"> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="TeamEdit" name="tab_5"> + <attribute name="title"> + <string>Team 1</string> + </attribute> + </widget> + <widget class="TeamEdit" name="tab_6"> + <attribute name="title"> + <string>Team 2</string> + </attribute> + </widget> + <widget class="TeamEdit" name="tab_7"> + <attribute name="title"> + <string>Team 3</string> + </attribute> + </widget> + <widget class="TeamEdit" name="tab_8"> + <attribute name="title"> + <string>Team 4</string> + </attribute> + </widget> + <widget class="TeamEdit" name="tab_9"> + <attribute name="title"> + <string>Team 5</string> + </attribute> + </widget> + <widget class="TeamEdit" name="tab_10"> + <attribute name="title"> + <string>Team 6</string> + </attribute> + </widget> + </widget> </item> </layout> </widget> diff -r dd995a9c8871 -r 0047e16dbacb tools/MissionsEditor/teamedit.cpp --- a/tools/MissionsEditor/teamedit.cpp Thu Oct 29 23:59:46 2009 +0000 +++ b/tools/MissionsEditor/teamedit.cpp Fri Oct 30 19:28:44 2009 +0000 @@ -24,3 +24,24 @@ break; } } + +void TeamEdit::addTeam(const QString & teamName, quint32 color) +{ + m_ui->leTeamName->setText(teamName); +} + +void TeamEdit::setFort(const QString & name) +{ + m_ui->leFort->setText(name); +} + +void TeamEdit::setGrave(const QString & name) +{ + m_ui->leGrave->setText(name); +} + +void TeamEdit::setVoicepack(const QString & name) +{ + m_ui->leVoicepack->setText(name); +} + diff -r dd995a9c8871 -r 0047e16dbacb tools/MissionsEditor/teamedit.h --- a/tools/MissionsEditor/teamedit.h Thu Oct 29 23:59:46 2009 +0000 +++ b/tools/MissionsEditor/teamedit.h Fri Oct 30 19:28:44 2009 +0000 @@ -13,6 +13,10 @@ TeamEdit(QWidget *parent = 0); ~TeamEdit(); + void addTeam(const QString & teamName = QString(), quint32 color = 0xdd0000); + void setFort(const QString & name); + void setGrave(const QString & name); + void setVoicepack(const QString & name); protected: void changeEvent(QEvent *e); diff -r dd995a9c8871 -r 0047e16dbacb tools/MissionsEditor/teamedit.ui --- a/tools/MissionsEditor/teamedit.ui Thu Oct 29 23:59:46 2009 +0000 +++ b/tools/MissionsEditor/teamedit.ui Fri Oct 30 19:28:44 2009 +0000 @@ -6,113 +6,119 @@ <rect> <x>0</x> <y>0</y> - <width>437</width> - <height>354</height> + <width>450</width> + <height>414</height> </rect> </property> <property name="windowTitle"> <string>Form</string> </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QPushButton" name="pbAddTeam"> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0" colspan="2"> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Team name</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="leTeamName"/> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="cbColor"/> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Colour</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Fort</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Grave</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="leFort"/> + </item> + <item row="3" column="1"> + <widget class="QLineEdit" name="leGrave"/> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>Voicepack</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QLineEdit" name="leVoicepack"/> + </item> + </layout> + </item> + <item row="1" column="0" rowspan="4"> + <widget class="QTreeWidget" name="treeWidget"> + <column> + <property name="text"> + <string>Name</string> + </property> + </column> + <column> + <property name="text"> + <string>Health</string> + </property> + </column> + <column> + <property name="text"> + <string>Spawn pos</string> + </property> + </column> + </widget> + </item> + <item row="1" column="1"> + <widget class="QPushButton" name="pbAddHedgehog"> <property name="text"> - <string>Add Team</string> + <string>Add hedgehog</string> </property> </widget> </item> - <item row="0" column="1"> - <spacer name="horizontalSpacer"> + <item row="2" column="1"> + <widget class="QPushButton" name="pbDeleteHedgehog"> + <property name="text"> + <string>Delete hedgehog</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <spacer name="verticalSpacer"> <property name="orientation"> - <enum>Qt::Horizontal</enum> + <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> - <width>331</width> - <height>20</height> + <width>117</width> + <height>125</height> </size> </property> </spacer> </item> - <item row="1" column="0" colspan="2"> - <widget class="QTabWidget" name="tabWidget"> - <property name="currentIndex"> - <number>0</number> + <item row="4" column="1"> + <widget class="QPushButton" name="pbDeleteTeam"> + <property name="text"> + <string>Delete team</string> </property> - <widget class="QWidget" name="tab"> - <attribute name="title"> - <string>Team</string> - </attribute> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0" colspan="2"> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Team name</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="leTeamName"/> - </item> - </layout> - </item> - <item row="1" column="0" rowspan="4"> - <widget class="QTreeWidget" name="treeWidget"> - <column> - <property name="text"> - <string>Name</string> - </property> - </column> - <column> - <property name="text"> - <string>Health</string> - </property> - </column> - <column> - <property name="text"> - <string>Spawn pos</string> - </property> - </column> - </widget> - </item> - <item row="1" column="1"> - <widget class="QPushButton" name="pbAddHedgehog"> - <property name="text"> - <string>Add hedgehog</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QPushButton" name="pbDeleteHedgehog"> - <property name="text"> - <string>Delete hedgehog</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>117</width> - <height>102</height> - </size> - </property> - </spacer> - </item> - <item row="4" column="1"> - <widget class="QPushButton" name="pbDeleteTeam"> - <property name="text"> - <string>Delete team</string> - </property> - </widget> - </item> - </layout> - </widget> </widget> </item> </layout>