tools/MissionsEditor/hedgehogedit.cpp
author koda
Sat, 28 Aug 2010 02:35:26 +0200
changeset 3780 7c704e69242e
parent 2596 41b46f83d088
permissions -rw-r--r--
fade in when returning from game, labels rewritten so that they are drawn at runtime (more flexibility with i18n and iphone support)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2596
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
     1
#include "hedgehogedit.h"
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
     2
#include "ui_hedgehogedit.h"
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
     3
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
     4
HedgehogEdit::HedgehogEdit(QWidget *parent) :
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
     5
    QFrame(parent),
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
     6
    m_ui(new Ui::HedgehogEdit)
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
     7
{
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
     8
    m_ui->setupUi(this);
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
     9
}
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    10
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    11
HedgehogEdit::~HedgehogEdit()
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    12
{
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    13
    delete m_ui;
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    14
}
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    15
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    16
void HedgehogEdit::changeEvent(QEvent *e)
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    17
{
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    18
    QWidget::changeEvent(e);
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    19
    switch (e->type()) {
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    20
    case QEvent::LanguageChange:
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    21
        m_ui->retranslateUi(this);
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    22
        break;
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    23
    default:
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    24
        break;
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    25
    }
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    26
}
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    27
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    28
void HedgehogEdit::setHedgehog(quint32 level, quint32 health, const QString & name)
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    29
{
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    30
    m_ui->cbLevel->setCurrentIndex(level);
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    31
    m_ui->sbHealth->setValue(health);
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    32
    m_ui->leName->setText(name);
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    33
}
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    34
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    35
void HedgehogEdit::setHat(const QString & name)
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    36
{
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    37
    m_ui->leHat->setText(name);
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    38
}
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    39
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    40
void HedgehogEdit::setCoordinates(int x, int y)
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    41
{
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    42
    m_ui->pbCoordinates->setText(QString("%1x%2").arg(x).arg(y));
41b46f83d088 Compete loading teams/hedgehogs part from mission config
unc0rr
parents:
diff changeset
    43
}