# HG changeset patch # User unc0rr # Date 1289656060 -10800 # Node ID 3fa9eb4d25b930b72a1e54a86cb47a965fa47612 # Parent cc20f79361d8c08276c63c6ce5a0ed3deb34c913 Useless diff -r cc20f79361d8 -r 3fa9eb4d25b9 tools/MissionsEditor/MissionsEditor.pro --- a/tools/MissionsEditor/MissionsEditor.pro Sat Nov 13 12:07:17 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -# ------------------------------------------------- -# Project created by QtCreator 2009-10-21T19:51:57 -# ------------------------------------------------- -TARGET = MissionsEditor -TEMPLATE = app -SOURCES += main.cpp \ - editor.cpp \ - teamedit.cpp \ - hedgehogedit.cpp -HEADERS += editor.h \ - teamedit.h \ - hedgehogedit.h -FORMS += editor.ui \ - teamedit.ui \ - hedgehogedit.ui diff -r cc20f79361d8 -r 3fa9eb4d25b9 tools/MissionsEditor/editor.cpp --- a/tools/MissionsEditor/editor.cpp Sat Nov 13 12:07:17 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ -#include -#include -#include "editor.h" -#include "ui_editor.h" - -editor::editor(QWidget *parent) - : QMainWindow(parent), ui(new Ui::editor) -{ - ui->setupUi(this); - - reset(); - - cbFlags - << ui->cbForts - << ui->cbMultiWeapon - << ui->cbSolidLand - << ui->cbBorder - << ui->cbDivideTeams - << ui->cbLowGravity - << ui->cbLaserSight - << ui->cbInvulnerable - << ui->cbMines - << ui->cbVampiric - << ui->cbKarma - << ui->cbArtillery - << ui->cbOneClanMode - ; -} - -editor::~editor() -{ - delete ui; -} - -void editor::reset() -{ - for(int i = 0; i < 6; ++i) - { - ui->twTeams->setTabEnabled(i, false); - ui->twTeams->widget(i)->setEnabled(false); - } -} - -void editor::on_actionLoad_triggered() -{ - QString fileName = QFileDialog::getOpenFileName(this, QString(), QString(), "Missions (*.txt)"); - - if(!fileName.isEmpty()) - load(fileName); -} - -void editor::load(const QString & fileName) -{ - int currTeam = -1; - - QFile file(fileName); - - if(!file.open(QIODevice::ReadOnly)) - { - QMessageBox::warning(this, "File error", "No such file"); - return ; - } - - QTextStream stream(&file); - - while(!stream.atEnd()) - { - QString line = stream.readLine(); - if (line.startsWith("seed")) - ui->leSeed->setText(line.mid(5)); - else - if (line.startsWith("map")) - ui->leMap->setText(line.mid(4)); - else - if (line.startsWith("theme")) - ui->leTheme->setText(line.mid(6)); - else - if (line.startsWith("$turntime")) - ui->sbTurnTime->setValue(line.mid(10).toInt()); - else - if (line.startsWith("$casefreq")) - ui->sbCrateDrops->setValue(line.mid(10).toInt()); - else - if (line.startsWith("$damagepct")) - ui->sbDamageModifier->setValue(line.mid(11).toInt()); - else - if (line.startsWith("$gmflags")) - { - quint32 flags = line.mid(9).toInt(); - foreach(QCheckBox * cb, cbFlags) - { - cb->setChecked(flags & 1); - flags >>= 1; - } - } - else - if (line.startsWith("addteam") && (currTeam < 5)) - { - ++currTeam; - ui->twTeams->setTabEnabled(currTeam, true); - ui->twTeams->widget(currTeam)->setEnabled(true); - - 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(ui->twTeams->widget(currTeam)); - te->setTeam(teamName, teamColor); - } - else - if (line.startsWith("addhh") && (currTeam >= 0)) - { - line = line.mid(6); - quint32 level = line.left(1).toUInt(); - line = line.mid(2); - int spacePos = line.indexOf('\x20'); - quint32 health = line.left(spacePos).toUInt(); - QString hhName = line.mid(spacePos + 1); - - TeamEdit * te = qobject_cast(ui->twTeams->widget(currTeam)); - te->addHedgehog(level, health, hhName); - } - else - if (line.startsWith("fort") && (currTeam >= 0)) - { - TeamEdit * te = qobject_cast(ui->twTeams->widget(currTeam)); - te->setFort(line.mid(5)); - } - else - if (line.startsWith("hat") && (currTeam >= 0)) - { - TeamEdit * te = qobject_cast(ui->twTeams->widget(currTeam)); - te->setLastHHHat(line.mid(4)); - } - else - if (line.startsWith("hhcoords") && (currTeam >= 0)) - { - line = line.mid(9); - int spacePos = line.indexOf('\x20'); - int x = line.left(spacePos).toUInt(); - int y = line.mid(spacePos + 1).toInt(); - - TeamEdit * te = qobject_cast(ui->twTeams->widget(currTeam)); - te->setLastHHCoords(x, y); - } - else - if (line.startsWith("grave") && (currTeam >= 0)) - { - TeamEdit * te = qobject_cast(ui->twTeams->widget(currTeam)); - te->setGrave(line.mid(6)); - } - else - if (line.startsWith("voicepack") && (currTeam >= 0)) - { - TeamEdit * te = qobject_cast(ui->twTeams->widget(currTeam)); - te->setVoicepack(line.mid(10)); - } - } -} diff -r cc20f79361d8 -r 3fa9eb4d25b9 tools/MissionsEditor/editor.h --- a/tools/MissionsEditor/editor.h Sat Nov 13 12:07:17 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -#ifndef EDITOR_H -#define EDITOR_H - -#include - -namespace Ui -{ - class editor; -} - -class QCheckBox; - -class editor : public QMainWindow -{ - Q_OBJECT - -public: - editor(QWidget *parent = 0); - ~editor(); - -private: - Ui::editor *ui; - QList cbFlags; - - void load(const QString & fileName); - void reset(); - -private slots: - void on_actionLoad_triggered(); -}; - -#endif // EDITOR_H diff -r cc20f79361d8 -r 3fa9eb4d25b9 tools/MissionsEditor/editor.ui --- a/tools/MissionsEditor/editor.ui Sat Nov 13 12:07:17 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,406 +0,0 @@ - - - editor - - - - 0 - 0 - 419 - 476 - - - - editor - - - - - - - 2 - - - - Mission - - - - - - Name - - - - - - - - - - Description - - - - - - - - - - Map - - - - - - - Theme - - - - - - - - - - - - - - Options - - - - - - - - Invulnerable - - - - - - - Artillery - - - - - - - SolidLand - - - - - - - Vampiric - - - - - - - OneClanMode - - - true - - - - - - - Karma - - - - - - - LaserSight - - - - - - - Border - - - - - - - LowGravity - - - - - - - Mines - - - - - - - DivideTeams - - - - - - - MultiWeapon - - - true - - - - - - - Forts - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - Seed - - - - - - - foobar - - - - - - - Damage Modifier - - - - - - - Turn Time - - - - - - - Crate Drops - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - 10 - - - 300 - - - 15 - - - 100 - - - - - - - 1000 - - - 100000 - - - 5000 - - - 45000 - - - - - - - 3 - - - - - - - - - - Teams - - - - - - Add Team - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - true - - - 0 - - - - Team 1 - - - - - Team 2 - - - - - Team 3 - - - - - Team 4 - - - - - Team 5 - - - - - Team 6 - - - - - - - - - Triggers - - - - - - - - - - 0 - 0 - 419 - 28 - - - - - &File - - - - - - - - - - - - &Load... - - - - - &Save - - - - - &Quit - - - - - - - TeamEdit - QWidget -
teamedit.h
- 1 -
-
- - -
diff -r cc20f79361d8 -r 3fa9eb4d25b9 tools/MissionsEditor/hedgehogedit.cpp --- a/tools/MissionsEditor/hedgehogedit.cpp Sat Nov 13 12:07:17 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -#include "hedgehogedit.h" -#include "ui_hedgehogedit.h" - -HedgehogEdit::HedgehogEdit(QWidget *parent) : - QFrame(parent), - m_ui(new Ui::HedgehogEdit) -{ - m_ui->setupUi(this); -} - -HedgehogEdit::~HedgehogEdit() -{ - delete m_ui; -} - -void HedgehogEdit::changeEvent(QEvent *e) -{ - QWidget::changeEvent(e); - switch (e->type()) { - case QEvent::LanguageChange: - m_ui->retranslateUi(this); - break; - default: - break; - } -} - -void HedgehogEdit::setHedgehog(quint32 level, quint32 health, const QString & name) -{ - m_ui->cbLevel->setCurrentIndex(level); - m_ui->sbHealth->setValue(health); - m_ui->leName->setText(name); -} - -void HedgehogEdit::setHat(const QString & name) -{ - m_ui->leHat->setText(name); -} - -void HedgehogEdit::setCoordinates(int x, int y) -{ - m_ui->pbCoordinates->setText(QString("%1x%2").arg(x).arg(y)); -} diff -r cc20f79361d8 -r 3fa9eb4d25b9 tools/MissionsEditor/hedgehogedit.h --- a/tools/MissionsEditor/hedgehogedit.h Sat Nov 13 12:07:17 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -#ifndef HEDGEHOGEDIT_H -#define HEDGEHOGEDIT_H - -#include - -namespace Ui { - class HedgehogEdit; -} - -class HedgehogEdit : public QFrame { - Q_OBJECT -public: - HedgehogEdit(QWidget *parent = 0); - ~HedgehogEdit(); - - void setHedgehog(quint32 level = 0, quint32 health = 100, const QString & name = QString()); - void setHat(const QString & name); - void setCoordinates(int x, int y); - -protected: - void changeEvent(QEvent *e); - -private: - Ui::HedgehogEdit *m_ui; -}; - -#endif // HEDGEHOGEDIT_H diff -r cc20f79361d8 -r 3fa9eb4d25b9 tools/MissionsEditor/hedgehogedit.ui --- a/tools/MissionsEditor/hedgehogedit.ui Sat Nov 13 12:07:17 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,138 +0,0 @@ - - - HedgehogEdit - - - - 0 - 0 - 400 - 300 - - - - Form - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 3 - - - 3 - - - - - - - - X - - - - - - - 0 - - - - Human - - - - - Level 5 - - - - - Level 4 - - - - - Level 3 - - - - - Level 2 - - - - - Level 1 - - - - - - - - - - - Name - - - - - - - Level - - - - - - - 1 - - - 300 - - - 100 - - - - - - - Health - - - - - - - Hat - - - - - - - Random - - - - - - - Place - - - - - - - - diff -r cc20f79361d8 -r 3fa9eb4d25b9 tools/MissionsEditor/main.cpp --- a/tools/MissionsEditor/main.cpp Sat Nov 13 12:07:17 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -#include -#include "editor.h" - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - editor w; - w.show(); - return a.exec(); -} diff -r cc20f79361d8 -r 3fa9eb4d25b9 tools/MissionsEditor/teamedit.cpp --- a/tools/MissionsEditor/teamedit.cpp Sat Nov 13 12:07:17 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -#include "teamedit.h" -#include "ui_teamedit.h" - -TeamEdit::TeamEdit(QWidget *parent) : - QWidget(parent), - m_ui(new Ui::TeamEdit) -{ - m_ui->setupUi(this); - - reset(); -} - -TeamEdit::~TeamEdit() -{ - delete m_ui; -} - -void TeamEdit::changeEvent(QEvent *e) -{ - QWidget::changeEvent(e); - switch (e->type()) { - case QEvent::LanguageChange: - m_ui->retranslateUi(this); - break; - default: - break; - } -} - -void TeamEdit::reset() -{ - QLayout * l = m_ui->scrollArea->widget()->layout(); - - for(int i = 0; i < 8; ++i) - l->itemAt(i)->widget()->setVisible(false); -} - -void TeamEdit::setTeam(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); -} - -void TeamEdit::addHedgehog(quint32 level, quint32 health, const QString & name) -{ - QLayout * l = m_ui->scrollArea->widget()->layout(); - - int i = 0; - while((i < 8) && (l->itemAt(i)->widget()->isVisible())) ++i; - - if(i < 8) - { - HedgehogEdit * he = qobject_cast(l->itemAt(i)->widget()); - he->setHedgehog(level, health, name); - l->itemAt(i)->widget()->setVisible(true); - } -} - -void TeamEdit::setLastHHHat(const QString & name) -{ - QLayout * l = m_ui->scrollArea->widget()->layout(); - - int i = 0; - while((i < 8) && (l->itemAt(i)->widget()->isVisible())) ++i; - - --i; - - HedgehogEdit * he = qobject_cast(l->itemAt(i)->widget()); - he->setHat(name); -} - -void TeamEdit::setLastHHCoords(int x, int y) -{ - QLayout * l = m_ui->scrollArea->widget()->layout(); - - int i = 0; - while((i < 8) && (l->itemAt(i)->widget()->isVisible())) ++i; - - --i; - - HedgehogEdit * he = qobject_cast(l->itemAt(i)->widget()); - he->setCoordinates(x ,y); -} - diff -r cc20f79361d8 -r 3fa9eb4d25b9 tools/MissionsEditor/teamedit.h --- a/tools/MissionsEditor/teamedit.h Sat Nov 13 12:07:17 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -#ifndef TEAMEDIT_H -#define TEAMEDIT_H - -#include - -namespace Ui { - class TeamEdit; -} - -class TeamEdit : public QWidget { - Q_OBJECT -public: - TeamEdit(QWidget *parent = 0); - ~TeamEdit(); - - void reset(); - void setTeam(const QString & teamName = QString(), quint32 color = 0xdd0000); - void addHedgehog(quint32 level = 0, quint32 health = 100, const QString & name = QString()); - void setFort(const QString & name); - void setGrave(const QString & name); - void setLastHHHat(const QString & name); - void setLastHHCoords(int x, int y); - void setVoicepack(const QString & name); -protected: - void changeEvent(QEvent *e); - -private: - Ui::TeamEdit *m_ui; -}; - -#endif // TEAMEDIT_H diff -r cc20f79361d8 -r 3fa9eb4d25b9 tools/MissionsEditor/teamedit.ui --- a/tools/MissionsEditor/teamedit.ui Sat Nov 13 12:07:17 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,172 +0,0 @@ - - - TeamEdit - - - - 0 - 0 - 450 - 414 - - - - Form - - - - - - - - Team name - - - - - - - - - - - - - Colour - - - - - - - Fort - - - - - - - Grave - - - - - - - - - - - - - Voicepack - - - - - - - - - - - - true - - - - - 0 - 0 - 301 - 235 - - - - - 3 - - - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 120 - - - - - - - - - - - - Add hedgehog - - - - - - - Qt::Vertical - - - - 117 - 125 - - - - - - - - Delete team - - - - - - - - HedgehogEdit - QWidget -
hedgehogedit.h
- 1 -
-
- - -