128 lines
2.4 KiB
C++
128 lines
2.4 KiB
C++
|
#include "vvod2z.h"
|
|||
|
#include "ui_vvod2z.h"
|
|||
|
|
|||
|
vvod2z::vvod2z(QWidget *parent) :
|
|||
|
QDialog(parent),
|
|||
|
ui(new Ui::vvod2z)
|
|||
|
{
|
|||
|
ui->setupUi(this);
|
|||
|
setAttribute(Qt::WA_DeleteOnClose);
|
|||
|
|
|||
|
setWindowTitle(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2Z"));
|
|||
|
|
|||
|
groundObj *go;
|
|||
|
int n = ((Widget*)parent)->grObj.count();
|
|||
|
for (int i=1; i<n; i++)
|
|||
|
{
|
|||
|
go = ((Widget*)parent)->grObj[i];
|
|||
|
if (go->exist)
|
|||
|
{
|
|||
|
ui->comboBox->addItem(QString::number(i));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (ui->comboBox->count()>=1)
|
|||
|
{
|
|||
|
ui->comboBox->setCurrentIndex(1);
|
|||
|
}
|
|||
|
ui->lineEdit_2->setFocus();
|
|||
|
ui->lineEdit_2->selectAll();
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
vvod2z::~vvod2z()
|
|||
|
{
|
|||
|
delete ui;
|
|||
|
}
|
|||
|
|
|||
|
void vvod2z::on_pushButton_3_clicked()
|
|||
|
{
|
|||
|
close();
|
|||
|
}
|
|||
|
|
|||
|
void vvod2z::on_pushButton_clicked()
|
|||
|
{
|
|||
|
curCode = ui->lineEdit_2->text().toInt();
|
|||
|
int trNum = ui->lineEdit_5->text().toInt();
|
|||
|
int nAb = ui->comboBox->currentIndex();
|
|||
|
qreal x = ui->lineEdit_3->text().toFloat();
|
|||
|
qreal y = ui->lineEdit_4->text().toFloat();
|
|||
|
|
|||
|
|
|||
|
if (trNum) // <20><>
|
|||
|
{
|
|||
|
airObj *ao = ((Widget*)parent())->targets[trNum-1];
|
|||
|
|
|||
|
if (ao->exist)
|
|||
|
{
|
|||
|
((Widget*)parent())->sendCU(nAb, curCode, ao->uid, x, y);
|
|||
|
close();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
QMessageBox msg(this);
|
|||
|
|
|||
|
msg.setWindowTitle(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
|||
|
msg.setIcon(QMessageBox::Information);
|
|||
|
msg.setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %1 <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>").arg(trNum));
|
|||
|
msg.addButton(QString::fromLocal8Bit("<EFBFBD><EFBFBD>"),QMessageBox::AcceptRole);
|
|||
|
msg.exec();
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
else // <20><>
|
|||
|
{
|
|||
|
|
|||
|
((Widget*)parent())->sendCU(nAb, curCode, 0, x, y);
|
|||
|
|
|||
|
close();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void vvod2z::on_pushButton_2_clicked()
|
|||
|
{
|
|||
|
t2z = new table2Z(this);
|
|||
|
t2z->show();
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void vvod2z::msUpdate()
|
|||
|
{
|
|||
|
ui->lineEdit_2->setText(QString::number(curCode));
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void vvod2z::closeEvent(QCloseEvent *event)
|
|||
|
{
|
|||
|
((Widget*)parent())->clearOpenWidget();
|
|||
|
event->accept();
|
|||
|
}
|
|||
|
|
|||
|
void vvod2z::setCoord(int x, int y)
|
|||
|
{
|
|||
|
ui->lineEdit_3->setText(QString::number(x));
|
|||
|
ui->lineEdit_4->setText(QString::number(y));
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void vvod2z::on_lineEdit_2_returnPressed()
|
|||
|
{
|
|||
|
on_pushButton_clicked();
|
|||
|
}
|
|||
|
|
|||
|
void vvod2z::on_lineEdit_5_returnPressed()
|
|||
|
{
|
|||
|
ui->lineEdit_3->setFocus();
|
|||
|
}
|
|||
|
|
|||
|
void vvod2z::on_lineEdit_3_returnPressed()
|
|||
|
{
|
|||
|
ui->lineEdit_4->setFocus();
|
|||
|
}
|
|||
|
|
|||
|
void vvod2z::on_lineEdit_4_returnPressed()
|
|||
|
{
|
|||
|
on_pushButton_clicked();
|
|||
|
}
|