diff --git a/abnticket.cpp b/abnticket.cpp index fa6a10d..14cb6e8 100644 --- a/abnticket.cpp +++ b/abnticket.cpp @@ -42,13 +42,19 @@ void abnticket::fillUi(int n_ab) { Widget *p = (Widget*)this->parentWidget(); if (p) { const int abType = p->grObj[n_ab]->type; - if (abType == 12) { - ui->lineEdit_2->setText(QString::fromLocal8Bit("2A6")); - ui->lineEdit_3->setText(QString::fromLocal8Bit("ÁÌ \"Øèëêà\"")); - } else - { - ui->lineEdit_2->setText(QString::fromLocal8Bit("9A331")); - ui->lineEdit_3->setText(QString::fromLocal8Bit("ÁÌ \"ÒÎÐ\"")); + switch (abType) { + case grSHILKA: + ui->lineEdit_2->setText(QString::fromLocal8Bit("2A6")); + ui->lineEdit_3->setText(QString::fromLocal8Bit("ÁÌ \"Øèëêà\"")); + break; + case grTOR: + ui->lineEdit_2->setText(QString::fromLocal8Bit("9A331")); + ui->lineEdit_3->setText(QString::fromLocal8Bit("ÁÌ \"ÒÎÐ\"")); + break; + case grTUNGUSKA: + ui->lineEdit_2->setText(QString::fromLocal8Bit("2C6Ì")); + ui->lineEdit_3->setText(QString::fromLocal8Bit("Òóíãóñêà")); + break; } } } diff --git a/groundobj.cpp b/groundobj.cpp index 9356364..ecbfaf3 100644 --- a/groundobj.cpp +++ b/groundobj.cpp @@ -6,7 +6,7 @@ groundObj::groundObj( ) x=y=type=0; exist=true; boegotov = false; - type = 0; + type = grBASE; n_Ab = 0; pic = QImage(":/new/pics/ground0.xpm"); @@ -125,18 +125,15 @@ void groundObj::paint(QPainter *p, const QStyleOptionGraphicsItem *option, QWidg QFont f; QString s, s1; - if (exist) - { + if (exist) { p0 = QPointF(x,y); p->setPen(Qt::green); p->drawEllipse(p0, 0.5, 0.5); - if (type==1 || type == 12) // type == 1 is TOR, type == 12 is Shilks - { - if (priznakSektor) - { + if (type==grTOR || type == grSHILKA || type == grTUNGUSKA) { + if (priznakSektor) { br = p->brush(); br.setStyle(Qt::NoBrush); p->setBrush(br); @@ -145,7 +142,20 @@ void groundObj::paint(QPainter *p, const QStyleOptionGraphicsItem *option, QWidg pen.setStyle(Qt::DashLine); p->setPen(pen); - const qreal elRadius = (type==12) ? 25 : 160; + qreal elRadius = 0; + switch (type) { + case grTOR: + elRadius = 160; + break; + case grSHILKA: + elRadius = 25; + break; + case grTUNGUSKA: + elRadius = 100; + break; + default: + elRadius = 0; + } p->drawEllipse(p0, elRadius, elRadius); pen.setColor(Qt::cyan); @@ -245,18 +255,25 @@ void groundObj::setType(int t) prepareGeometryChange(); type=t; - if (t==0) - { + switch (t) { + case grBASE: pic = QImage(":/new/pics/ground0.xpm"); - } - if (t==1) - { + break; + case grTOR: pic = QImage(":/new/pics/tor2.xpm"); initRockets(8, 4); - } - if (t==12) { + break; + case grSHILKA: pic = QImage(":/new/pics/sh.xpm"); initRockets(4, 1); + break; + case grTUNGUSKA: + pic = QImage(":/new/pics/tung.xpm"); + initRockets(4, 1); + break; + default: + pic = QImage(); + break; } } } diff --git a/groundobj.h b/groundobj.h index 9ee1df5..243e3a5 100644 --- a/groundobj.h +++ b/groundobj.h @@ -10,6 +10,13 @@ #include #include +enum grObjType { + grBASE = 0, + grTOR = 1, + grSHILKA = 12, + grTUNGUSKA = 18 +}; + class groundObj : public QGraphicsItem { void initRockets(int _allR, int _activeR); diff --git a/pics.qrc b/pics.qrc index 7963f92..10d7ce9 100644 --- a/pics.qrc +++ b/pics.qrc @@ -24,5 +24,6 @@ pics/alt3.xpm pics/alt00.xpm pics/sh.xpm + pics/tung.xpm diff --git a/pics/tung.xpm b/pics/tung.xpm new file mode 100644 index 0000000..3f862d3 --- /dev/null +++ b/pics/tung.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char * tung_bmp[] = { +"16 16 2 1", +". c #ff0000", +"! c None", +"!!!!!!...!!!!!!!", +"!!!!!.!!!.!!!!!!", +"!!!!.!!!!!.!!!!!", +"!!!.!!!!!!!.!!!!", +"!!.!!!..!!...!!!", +"!.!!!!!!!!!.!.!!", +".!!..!!!!!!.!!.!", +".!..........!!.!", +".!!..!!!!!!.!!.!", +"!.!!!!!!!!!.!.!!", +"!!.!!!..!!...!!!", +"!!!.!!!!!!!.!!!!", +"!!!!.!!!!!.!!!!!", +"!!!!!.!!!.!!!!!!", +"!!!!!!...!!!!!!!", +"!!!!!!!!!!!!!!!!"}; diff --git a/widget.cpp b/widget.cpp index 24c040e..b381b50 100644 --- a/widget.cpp +++ b/widget.cpp @@ -69,17 +69,17 @@ Widget::Widget(QWidget *parent) : grObj[0]->setBoegotov(true); grObj[1]->setPos(QPointF(0, 150)); - grObj[1]->setType(1); + grObj[1]->setType(grTOR); grObj[1]->setBoegotov(false); grObj[2]->setPos(QPointF(150, 0)); - grObj[2]->setType(1); + grObj[2]->setType(grSHILKA); grObj[2]->setBoegotov(false); grObj[3]->setPos(QPointF(0, -100)); - grObj[3]->setType(1); + grObj[3]->setType(grTUNGUSKA); // grObj[3]->setSektor(30,170); grObj[3]->setBoegotov(false);