3310 lines
91 KiB
C++
3310 lines
91 KiB
C++
#include <QtNetwork>
|
||
#include <QProcess>
|
||
#include "widget.h"
|
||
#include "ui_widget.h"
|
||
|
||
#include <qt_windows.h>
|
||
|
||
Widget::Widget(QWidget *parent) :
|
||
QWidget(parent),
|
||
ui(new Ui::Widget)
|
||
{
|
||
ui->setupUi(this);
|
||
|
||
// connect(qApp, SIGNAL(focusChanged(QWidget*, QWidget*)), this, SLOT(focusSS(QWidget*, QWidget*)));
|
||
|
||
ui->btnZone->setStyleSheet("background-color: green");
|
||
|
||
|
||
initParams();
|
||
initBtnUIDs();
|
||
|
||
createActions();
|
||
createMenu();
|
||
|
||
setGraph();
|
||
|
||
ui->comboBox_2->setCurrentIndex(6);
|
||
connect(ui->comboBox_2, SIGNAL(activate1(int)), this, SLOT(activateWindow(int)));
|
||
|
||
QTimer *tmr = new QTimer(this);
|
||
connect(tmr, SIGNAL(timeout()), this, SLOT(msTickGraph()));
|
||
tmr->start(1000);
|
||
|
||
tmr = new QTimer(this);
|
||
connect(tmr, SIGNAL(timeout()), this, SLOT(reCalculate()));
|
||
tmr->start(250);
|
||
|
||
udpSocket = new QUdpSocket(this);
|
||
udpSocket->bind(6619, QUdpSocket::ShareAddress);
|
||
connect(udpSocket, SIGNAL(readyRead()), this, SLOT(processPendingDatagrams()));
|
||
|
||
udpTarget = new QUdpSocket(this);
|
||
udpTarget->bind(6630, QUdpSocket::ShareAddress);
|
||
connect(udpTarget, SIGNAL(readyRead()), this, SLOT(process_TargetKDG()));
|
||
|
||
udpCU = new QUdpSocket(this);
|
||
udpCU->bind(6635, QUdpSocket::ShareAddress);
|
||
connect(udpCU, SIGNAL(readyRead()), this, SLOT(process_CU_KRU_KDG()));
|
||
|
||
udpSend = new QUdpSocket(this);
|
||
|
||
udpOptServer = new QUdpSocket(this);
|
||
udpOptServer->bind(6618, QUdpSocket::ShareAddress);
|
||
connect(udpOptServer, SIGNAL(readyRead()), this, SLOT(newOptServerData()));
|
||
|
||
udpOptServer2 = new QUdpSocket(this);
|
||
udpOptServer2->bind(6621, QUdpSocket::ShareAddress);
|
||
connect(udpOptServer2, SIGNAL(readyRead()), this, SLOT(newOptServerData2()));
|
||
|
||
|
||
udpNewTask = new QUdpSocket(this);
|
||
udpNewTask->bind(6610, QUdpSocket::ShareAddress);
|
||
connect(udpNewTask, SIGNAL(readyRead()), this, SLOT(newTaskReadDatagrams()));
|
||
|
||
QTimer *tmrSyncr = new QTimer();
|
||
connect(tmrSyncr, SIGNAL(timeout()), this, SLOT(synhrTimeout()));
|
||
tmrSyncr->start(1000);
|
||
|
||
QTimer *tmrReport = new QTimer();
|
||
connect(tmrReport, SIGNAL(timeout()), this, SLOT(sendReport()));
|
||
tmrReport->start(55);
|
||
|
||
|
||
|
||
|
||
|
||
showSplash(3);
|
||
|
||
|
||
|
||
// addTargets();
|
||
// ASnumTarget = 1;
|
||
}
|
||
|
||
Widget::~Widget()
|
||
{
|
||
delete ui;
|
||
}
|
||
|
||
void Widget::getFocus()
|
||
{
|
||
// -- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
|
||
HWND id = GetForegroundWindow();
|
||
int iMyTID = GetCurrentThreadId();
|
||
int iCurrTID = GetWindowThreadProcessId(id,0);
|
||
|
||
AttachThreadInput(iMyTID, iCurrTID, TRUE);
|
||
SetForegroundWindow(winId());
|
||
AttachThreadInput(iMyTID, iCurrTID, FALSE);
|
||
// --
|
||
|
||
}
|
||
|
||
void Widget::activateWindow(int c)
|
||
{
|
||
if (c==0x31) ui->pushButton_3->setFocus();
|
||
if (c==0x32) ui->pushButton->setFocus();
|
||
releaseKeyboard();
|
||
}
|
||
|
||
void Widget::process_CU_KRU_KDG() {
|
||
QByteArray datagram;
|
||
|
||
qint16 i16;
|
||
qint32 i32;
|
||
qint8 ZZ;
|
||
float grX, grY;
|
||
int id;
|
||
bool KO;
|
||
|
||
qint8 zoneType;
|
||
float anglStart, anglEnd;
|
||
|
||
// float tFloat;
|
||
while (udpCU->hasPendingDatagrams()) {
|
||
QDataStream d(&datagram, QIODevice::ReadOnly);
|
||
d.setByteOrder(QDataStream::LittleEndian);
|
||
d.setFloatingPointPrecision(QDataStream::SinglePrecision);
|
||
datagram.clear();
|
||
datagram.resize(udpCU->pendingDatagramSize());
|
||
udpCU->readDatagram(datagram.data(), datagram.size());
|
||
|
||
d >> i16; size_t sizeOfPkg = i16;
|
||
if (sizeOfPkg == 25) { // CU
|
||
d >> i16 >> i16;
|
||
Q_ASSERT(i16==7);
|
||
d >> i16;
|
||
Q_ASSERT(i16==1);
|
||
d >> i32;
|
||
// Nab
|
||
d >> i16;
|
||
|
||
// targetID
|
||
d >> i16; id = i16;
|
||
KO = (id==0);
|
||
id += 6; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
// x, y, ZZ
|
||
d >> grX >> grY;
|
||
d >> ZZ;
|
||
|
||
if (KO) {
|
||
|
||
}
|
||
else {
|
||
if (ZZ==11)
|
||
setVCU(id);
|
||
else if (ZZ==22) {
|
||
int trgtNum = findTargetFromId(id);
|
||
if (trgtNum>=0)
|
||
msVvodCU_N2(-(trgtNum+1), ZZ);
|
||
}
|
||
else
|
||
clearVCU();
|
||
}
|
||
QString strZZ = QString::number(ZZ);
|
||
if (ZZ<10) strZZ.prepend(QChar('0'));
|
||
ui->lineEdit_28->setText(strZZ);
|
||
}
|
||
|
||
if (sizeOfPkg == 63) { // KRU
|
||
d >> i16 >> i16;
|
||
Q_ASSERT(i16 == 8);
|
||
d >> i16;
|
||
Q_ASSERT(i16 == 1);
|
||
d >> i32 >> i16;
|
||
d >> zoneType;
|
||
d >> anglStart >> anglEnd;
|
||
anglStart -= anglEnd/2;
|
||
anglEnd = anglStart+anglEnd;
|
||
setSector(zoneType, anglStart, anglEnd);
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
void Widget::setSector(qint8 zoneType, float anglStart, float anglEnd) {
|
||
T_sectOtv p;
|
||
p.left = anglStart;
|
||
p.right = anglEnd;
|
||
|
||
switch (zoneType) {
|
||
case 1:
|
||
ownSect = p;
|
||
break;
|
||
case 2:
|
||
kzsSect = p;
|
||
break;
|
||
case 0:
|
||
default:
|
||
p.right=0;
|
||
p.left=0;
|
||
ownSect=p;
|
||
kzsSect=p;
|
||
break;
|
||
}
|
||
}
|
||
|
||
void Widget::newOptServerData()
|
||
{
|
||
QByteArray datagram;
|
||
QDataStream d(&datagram, QIODevice::ReadOnly);
|
||
d.setByteOrder(QDataStream::LittleEndian);
|
||
qint16 len;
|
||
qint8 tByte;
|
||
// qint16 tWord;
|
||
bool tBool;
|
||
// qreal tReal;
|
||
float tFloat;
|
||
|
||
QString dbgStr;
|
||
QByteArray dbgBuf;
|
||
|
||
|
||
|
||
while (udpOptServer->hasPendingDatagrams())
|
||
{
|
||
datagram.clear();
|
||
len = udpOptServer->pendingDatagramSize();
|
||
datagram.resize(len);
|
||
udpOptServer->readDatagram(datagram.data(), datagram.size());
|
||
|
||
if (len==828)
|
||
{
|
||
d >> tBool;
|
||
d.setFloatingPointPrecision(QDataStream::SinglePrecision);
|
||
d >> tFloat;
|
||
ugolGUN = tFloat*180/M_PI;
|
||
|
||
// dbgStr = QString("ugolGUN = ")+QString::number(tFloat, 'f', 4);
|
||
// dbgBuf = dbgStr.toLocal8Bit();
|
||
// processSendingDatagrams(dbgBuf, 45011);
|
||
|
||
|
||
d >> tFloat;
|
||
azimutGUN = azimutKurs + tFloat*180/M_PI;
|
||
|
||
// dbgStr = QString("azimutGUN = ")+QString::number(tFloat, 'f', 4);
|
||
// dbgBuf = dbgStr.toLocal8Bit();
|
||
// processSendingDatagrams(dbgBuf, 45011);
|
||
d >> tFloat; // azAntRLS
|
||
d >> tFloat; // umAntRLS
|
||
d >> tBool; // Poxod
|
||
if (tBool) basePoxod = 1;
|
||
d >> tByte; // drive
|
||
d >> tByte; // fire
|
||
d >> tByte; // vizir
|
||
d >> tByte; // setka
|
||
d >> tByte; // filter
|
||
d >> tBool; // KPN_on
|
||
d >> tFloat; // umKPN
|
||
d >> tFloat; // azKPN
|
||
|
||
d >> tFloat; // umMissTur
|
||
|
||
if (basePoxod==1)
|
||
umMissTur = -162;
|
||
else
|
||
umMissTur = int (tFloat*3000/M_PI);
|
||
// qDebug("%d umMissTur = %d", basePoxod, umMissTur);
|
||
}
|
||
}
|
||
}
|
||
|
||
void Widget::newOptServerData2()
|
||
{
|
||
QByteArray datagram;
|
||
QDataStream d(&datagram, QIODevice::ReadOnly);
|
||
d.setByteOrder(QDataStream::LittleEndian);
|
||
qint16 len;
|
||
// qint8 tByte;
|
||
// qint16 tWord;
|
||
// bool tBool;
|
||
// qreal tReal;
|
||
float tFloat;
|
||
|
||
QString dbgStr;
|
||
QByteArray dbgBuf;
|
||
|
||
|
||
|
||
while (udpOptServer2->hasPendingDatagrams())
|
||
{
|
||
datagram.clear();
|
||
len = udpOptServer2->pendingDatagramSize();
|
||
datagram.resize(len);
|
||
udpOptServer2->readDatagram(datagram.data(), datagram.size());
|
||
|
||
if (len==812)
|
||
{
|
||
d.setFloatingPointPrecision(QDataStream::SinglePrecision);
|
||
d >> tFloat; // x <20><><EFBFBD><EFBFBD>
|
||
d >> tFloat; // y <20><><EFBFBD><EFBFBD>
|
||
d >> tFloat; // z <20><><EFBFBD><EFBFBD>
|
||
d >> tFloat; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
d >> tFloat; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
|
||
d >> tFloat; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
azimutKurs = 90-tFloat;
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
void Widget::sendReport()
|
||
{
|
||
|
||
|
||
int i;
|
||
qint8 tByte;
|
||
qint16 tWord;
|
||
qreal tReal;
|
||
float tFloat;
|
||
bool tBool;
|
||
|
||
|
||
|
||
QByteArray buf;
|
||
QDataStream d(&buf, QIODevice::WriteOnly);
|
||
d.setByteOrder(QDataStream::LittleEndian);
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
d << (qint8)currentTaskNum;
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
d << (qint16)metAv.temp << (qint8)metAv.wind << (qint16)metAv.azim << (qint16)metAv.pressure;
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||
if (meteoSred) tByte=1; else tByte = 0;
|
||
d << tByte;
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
QByteArray tmpMetSr = metSr.toLocal8Bit();
|
||
tmpMetSr.resize(182);
|
||
|
||
for (i=0; i<182; i++)
|
||
{
|
||
tByte=tmpMetSr[i];
|
||
d << tByte;
|
||
}
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
d << (qint16)ZAnastrel << (qint16)ZAtempZar;
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>, <20><><EFBFBD><EFBFBD> <20> <20><>
|
||
|
||
for (i=0; i<9; i++)
|
||
{
|
||
d << (qint16)errZAgor[i];
|
||
}
|
||
|
||
for (i=0; i<7; i++)
|
||
{
|
||
d << (qint16)errZAver[i];
|
||
}
|
||
|
||
d << (qint16)errZAdB;
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
|
||
d << (qint8)rezhimZerk;
|
||
|
||
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
|
||
tReal = ts.x; d << tReal;
|
||
tReal = ts.y; d << tReal;
|
||
tReal = ts.h; d << tReal;
|
||
tReal = azimutKurs; d << tReal;
|
||
|
||
d.setFloatingPointPrecision(QDataStream::SinglePrecision);
|
||
tFloat = ugolGUN; d << tFloat;
|
||
tFloat = azimutGUN; d << tFloat;
|
||
d.setFloatingPointPrecision(QDataStream::DoublePrecision);
|
||
|
||
|
||
|
||
for (i=0; i<4; i++)
|
||
{
|
||
tByte=0;
|
||
d << tByte;
|
||
}
|
||
|
||
tBool = true;
|
||
d << tBool;
|
||
|
||
// d<<tBool; // <<-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><> <20><> <20><><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
|
||
d << (qint8)0 << (qint16)0;
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> + <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
tWord = BK[0]+BK[1]+BK[2]+BK[3];
|
||
d << tWord;
|
||
for (i=0; i<4; i++)
|
||
{
|
||
d << (qint16)BK[i];
|
||
}
|
||
d << (qint8)BK[4];
|
||
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
tByte = (splashIsOn==0);
|
||
d << tByte;
|
||
// qDebug("++ %d", tByte);
|
||
|
||
tBool = ((ui->radioButton_set5->isChecked())||(ui->radioButton_set6->isChecked()));
|
||
d << tBool;
|
||
|
||
if (VCUnumTarget!=-1)
|
||
tWord = qint16(targetsIds[VCUnumTarget]);
|
||
else
|
||
tWord = 0;
|
||
d << tWord;
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 4x <20><><EFBFBD><EFBFBD> <20> 9 <20> <20><><EFBFBD><EFBFBD>
|
||
|
||
for (i=0; i<4; i++)
|
||
{
|
||
tByte = i*10+i;
|
||
d << tByte;
|
||
}
|
||
|
||
for (i=1; i<10; i++)
|
||
{
|
||
tReal = (qreal)i;
|
||
d << tReal;
|
||
}
|
||
|
||
if (!silentMode)
|
||
udpSend->writeDatagram(buf.data(), buf.size(), QHostAddress("192.168.0.255"), 6617);
|
||
|
||
}
|
||
|
||
void Widget::synhrTimeout()
|
||
{
|
||
QByteArray buf;
|
||
buf.resize(2);
|
||
buf[0] = 35;
|
||
buf[1] = currentTaskNum;
|
||
|
||
|
||
//QString dbgStr;
|
||
//QByteArray dbgBuf;
|
||
//dbgStr = QString(" +++++++++++++ writed to udp = ")+QString::number(currentTaskNum);
|
||
//dbgBuf = dbgStr.toLocal8Bit();
|
||
//processSendingDatagrams(dbgBuf, 45011);
|
||
|
||
|
||
// udpSend->writeDatagram(buf.data(), buf.size(), QHostAddress("127.0.0.1"), 6600);
|
||
if (!silentMode)
|
||
udpSend->writeDatagram(buf.data(), buf.size(), QHostAddress("192.168.0.255"), 6600);
|
||
}
|
||
|
||
void Widget::newTaskReadDatagrams()
|
||
{
|
||
int len;
|
||
QByteArray datagram;
|
||
QByteArray tmpMetSr;
|
||
|
||
QDataStream d(&datagram, QIODevice::ReadOnly);
|
||
d.setByteOrder(QDataStream::LittleEndian);
|
||
|
||
qint8 tByte;
|
||
qint16 tWord;
|
||
bool tBool, flAutoFill;
|
||
qreal tReal;
|
||
float tFloat;
|
||
int i;
|
||
|
||
QString dbgStr;
|
||
QByteArray dbgBuf;
|
||
|
||
tmpMetSr.resize(182);
|
||
tmpMetSr.fill(0, 182);
|
||
|
||
while (udpNewTask->hasPendingDatagrams())
|
||
{
|
||
datagram.clear();
|
||
len = udpNewTask->pendingDatagramSize();
|
||
datagram.resize(len);
|
||
udpNewTask->readDatagram(datagram.data(), datagram.size());
|
||
if (len == 2)
|
||
{
|
||
d >> tByte;
|
||
if (tByte==2)
|
||
{
|
||
d >> tByte;
|
||
if (tByte==0) {QTimer::singleShot(100, this, SLOT(close()));}
|
||
if (tByte==1) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
{
|
||
QString program = "c:/Shilka_exe/shutdown.exe";
|
||
QStringList arguments;
|
||
QProcess *myProcess = new QProcess(this);
|
||
myProcess->startDetached(program, arguments);
|
||
QTimer::singleShot(100, this, SLOT(close()));
|
||
}
|
||
if (tByte==2) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
{
|
||
QString program = "c:/Shilka_exe/reboot.exe";
|
||
QStringList arguments;
|
||
QProcess *myProcess = new QProcess(this);
|
||
myProcess->startDetached(program, arguments);
|
||
QTimer::singleShot(100, this, SLOT(close()));
|
||
}
|
||
}
|
||
if (tByte==1)
|
||
{
|
||
// qDebug("-1");
|
||
d >> tByte;
|
||
// qDebug("---%d", tByte);
|
||
if (tByte==2)
|
||
{
|
||
|
||
currentNum = 0;
|
||
VCUnumTarget=-1;
|
||
ASnumTarget=-1;
|
||
for (i=0; i<100; i++)
|
||
{
|
||
targetsIds[i]=0;
|
||
grAir[i]->setNull();
|
||
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
if (len==308)
|
||
{
|
||
d >> tByte;
|
||
currentTaskNum = tByte;
|
||
|
||
//dbgStr = QString("read from udp = ")+QString::number(tByte)+QString(" ---- curTaskNum = ")+QString::number(currentTaskNum);
|
||
//dbgBuf = dbgStr.toLocal8Bit();
|
||
//processSendingDatagrams(dbgBuf, 45011);
|
||
|
||
d >> tWord >> tByte >> tByte;
|
||
|
||
d >> flAutoFill; // autoFill !!!!!!!
|
||
|
||
if (flAutoFill)
|
||
{
|
||
|
||
|
||
d >> tWord; // temp Vozduh
|
||
metAv.temp = tWord;
|
||
d >> tByte; // skor Vetra
|
||
metAv.wind = tByte;
|
||
d >> tWord; // azim Vetra v DU
|
||
metAv.azim = tWord;
|
||
d >> tWord; // davl vozduh v mm.rt.st.
|
||
metAv.pressure = tWord;
|
||
d >> tByte; // 0 - meteoAvtonom
|
||
|
||
setMeteo(!tByte, tByte);
|
||
|
||
|
||
for (i=0; i<182; i++) // meteoSred
|
||
{
|
||
d >> tByte;
|
||
tmpMetSr[i] = tByte;
|
||
}
|
||
metSr = QString(tmpMetSr);
|
||
|
||
d >> tWord; // Nastrel stvolov
|
||
ZAnastrel = tWord;
|
||
d >> tWord; // temp zaryad
|
||
ZAtempZar = tWord;
|
||
|
||
|
||
for (i=0; i<9; i++) // oshibki ZU goriz
|
||
{
|
||
d >> tWord;
|
||
errZAgor[i]=tWord;
|
||
}
|
||
|
||
for (i=0; i<7; i++) // oshibki ZU vert
|
||
{
|
||
d >> tWord;
|
||
errZAver[i]=tWord;
|
||
}
|
||
|
||
d >> tWord; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><>
|
||
errZAdB = tWord;
|
||
|
||
d >> tByte; // byte - zerk strelba [0 - vikl, 1 - x, 2 - y]
|
||
rezhimZerk = tByte;
|
||
|
||
|
||
for (i=0; i<5; i++) d>>tByte;
|
||
|
||
// pos <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
d >> tReal; // x
|
||
ts.x = (int)tReal;
|
||
d >> tReal; // y
|
||
ts.y = (int)tReal;
|
||
d >> tReal; // h
|
||
ts.h = (int)tReal;
|
||
d >> tReal; // Azim kurs
|
||
azimutKurs = tReal;
|
||
|
||
d.setFloatingPointPrecision(QDataStream::SinglePrecision);
|
||
d >> tFloat; // UgolM Gun
|
||
// if (fabs(tFloat-ugolGUNprev)<1)
|
||
ugolGUN = tFloat;
|
||
// ugolGUNprev = tFloat;
|
||
// dbgStr = QString("ugolGUN = ")+QString::number(tFloat, 'f', 4);
|
||
// dbgBuf = dbgStr.toLocal8Bit();
|
||
// processSendingDatagrams(dbgBuf, 45011);
|
||
|
||
d >> tFloat; // Azim Gun
|
||
// if (fabs(tFloat-azimutGUNprev)<1)
|
||
azimutGUN = tFloat;
|
||
// azimutGUNprev = tFloat;
|
||
// dbgStr = QString("azimutGUN = ")+QString::number(tFloat, 'f', 4);
|
||
// dbgBuf = dbgStr.toLocal8Bit();
|
||
// processSendingDatagrams(dbgBuf, 45011);
|
||
|
||
|
||
d.setFloatingPointPrecision(QDataStream::DoublePrecision);
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0 - <20><><EFBFBD>, 1 - <20><><EFBFBD><EFBFBD>, 2 - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||
for (i=0; i<4; i++)
|
||
{
|
||
d>>tByte;
|
||
}
|
||
d>>tBool;
|
||
|
||
|
||
d>>tBool; // <<-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><> <20><> <20><><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
d>>tWord;// <<-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><> <20><> <20><><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
// pos <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
|
||
d >> tWord; // <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>
|
||
for (i=0; i<4; i++) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
{
|
||
d >> tWord;
|
||
BK[i] = tWord;
|
||
}
|
||
|
||
d >> tByte;
|
||
BK[4] = tByte; // <20><><EFBFBD>-<2D><> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
d >> tBool;
|
||
MRUmode = tBool;
|
||
|
||
} // if flAutoFill
|
||
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
void Widget::keybReadDatagrams(int d1, int d2, int d3, int d4, int d5)
|
||
{
|
||
qint8 key=0;
|
||
|
||
|
||
int i;
|
||
|
||
int winCode[29]={0, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
|
||
VK_DIVIDE, VK_ADD, VK_SUBTRACT, VK_MULTIPLY, VK_DECIMAL,
|
||
VK_RETURN, VK_F11, VK_F12, VK_CONTROL, VK_MENU, VK_DELETE,
|
||
VK_BACK, VK_ESCAPE, VK_TAB, VK_RIGHT, VK_LEFT, VK_DOWN, VK_UP};
|
||
|
||
static int pressedKey[29] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||
|
||
static bool flAlt=false;
|
||
static bool flCtrl=false;
|
||
static bool flNum=true;
|
||
|
||
|
||
|
||
|
||
int buf1[4];
|
||
buf1[0]=d2; buf1[1]=d3; buf1[2]=d4; buf1[3]=d5;
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NumLock
|
||
key = d1;
|
||
if (((key==0)&&(flNum))||((key==1)&&(!flNum)))
|
||
{
|
||
flNum = (key==1);
|
||
keybd_event(VK_NUMLOCK, 0,0,0);
|
||
keybd_event(VK_NUMLOCK, 0, KEYEVENTF_KEYUP, 0);
|
||
|
||
|
||
key=0;
|
||
//
|
||
}
|
||
|
||
|
||
//
|
||
for (i=0; i<4; i++)
|
||
{
|
||
if ( (buf1[i]<0) || (buf1[i]>29) ) buf1[i]=0;
|
||
|
||
}
|
||
|
||
|
||
// <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> Alt <20><><EFBFBD> Ctrl <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
// <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> Alt <20><><EFBFBD> Ctrl 1<> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
|
||
|
||
int s=0;
|
||
for (i=0; i<4; i++) {if (buf1[i]!=19) {s++;}}
|
||
if (s==4)
|
||
{
|
||
if (flCtrl) keybd_event(VK_CONTROL, 0,KEYEVENTF_KEYUP,0);
|
||
flCtrl = false;
|
||
}
|
||
|
||
s=0;
|
||
for (i=0; i<4; i++) {if (buf1[i]!=20) { s++;}}
|
||
if (s==4)
|
||
{
|
||
|
||
if (flAlt) keybd_event(VK_MENU, 0,KEYEVENTF_KEYUP,0);
|
||
flAlt = false;
|
||
}
|
||
|
||
|
||
for (i=0; i<4; i++)
|
||
{
|
||
if (buf1[i]==19)
|
||
{
|
||
if (!flCtrl) keybd_event(VK_CONTROL, 0,0,0);
|
||
flCtrl = true;
|
||
buf1[i]=0;
|
||
}
|
||
if (buf1[i]==20)
|
||
{
|
||
if (!flAlt) keybd_event(VK_MENU, 0,0,0);
|
||
flAlt = true;
|
||
buf1[i]=0;
|
||
}
|
||
|
||
|
||
}
|
||
|
||
|
||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 0
|
||
if (buf1[0]+buf1[1]+buf1[2]+buf1[3])
|
||
{
|
||
// if (splashIsOn==0)
|
||
{
|
||
for (i=0; i<4; i++)
|
||
{
|
||
if (buf1[i]!=0)
|
||
{
|
||
//qDebug("----- %d [17]=%d [18]=%d ", buf1[0], pressedKey[17], pressedKey[18]);
|
||
if ((pressedKey[buf1[i]]==0)||(pressedKey[buf1[i]]>keybMaxDelay))
|
||
keybd_event(winCode[buf1[i]],0,0,0);
|
||
}
|
||
}
|
||
//qDebug("[][][] %d %d %d %d ", buf1[0], buf1[1], buf1[2], buf1[3]);
|
||
for (i=1; i<29; i++)
|
||
{
|
||
if ((buf1[0]!=i)&&(buf1[1]!=i)&&(buf1[2]!=i)&&(buf1[3]!=i))
|
||
{
|
||
pressedKey[i]=0;
|
||
}
|
||
else
|
||
{
|
||
pressedKey[i]++;
|
||
}
|
||
|
||
}
|
||
|
||
|
||
// for (i=0; i<4; i++)
|
||
// if (buf1[i]!=0) keybd_event(winCode[buf1[i]],0,KEYEVENTF_KEYUP,0);
|
||
|
||
// if (flCtrl) keybd_event(VK_CONTROL, 0,KEYEVENTF_KEYUP,0);
|
||
// if (flAlt) keybd_event(VK_MENU, 0,KEYEVENTF_KEYUP,0);
|
||
}
|
||
|
||
// if (splashIsOn==4)
|
||
// for (i=0; i<4; i++)
|
||
// if (buf1[i]==16)
|
||
// {
|
||
// hideSplash();
|
||
// ui->graphicsView->centerOn(0,0);
|
||
// }
|
||
|
||
} // if (buf1[0]+buf1[1]+buf1[2]+buf1[3])
|
||
else
|
||
{
|
||
for (i=0; i<29; i++) pressedKey[i]=0;
|
||
}
|
||
|
||
// ----- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD>
|
||
// keybd_event(keyWin, 0,0,0);
|
||
// keybd_event(keyWin, 0, KEYEVENTF_KEYUP, 0);
|
||
|
||
// }
|
||
}
|
||
|
||
void Widget::processPendingDatagrams() // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||
{
|
||
QByteArray datagram, buf;
|
||
QDataStream d(&datagram, QIODevice::ReadOnly);
|
||
d.setByteOrder(QDataStream::LittleEndian);
|
||
int id, i;
|
||
int aType;
|
||
int gType;
|
||
bool tBool;
|
||
qint8 tByte;
|
||
qint16 tWord;
|
||
qreal tReal; //, tReal1;
|
||
float tFloat;
|
||
qreal cX, cY, cH, vX, vY;
|
||
qreal azim, ugol, daln, dist;
|
||
|
||
while (udpSocket->hasPendingDatagrams()) {
|
||
datagram.clear();
|
||
datagram.resize(udpSocket->pendingDatagramSize());
|
||
udpSocket->readDatagram(datagram.data(), datagram.size());
|
||
|
||
// qDebug("size=%d", datagram.size());
|
||
if (datagram.size()==1460)
|
||
{
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
|
||
d >> tBool ; // pwrRLS
|
||
d >> tBool ; // rotationRLS
|
||
d >> tBool ; // destrRLS
|
||
d >> tByte ; // lightRLS
|
||
d >> tByte ; // focusRLS
|
||
d >> tByte; // modeRLS
|
||
|
||
switch (tByte)
|
||
{
|
||
case 1:
|
||
ui->lineEdit_3->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1"));
|
||
break;
|
||
case 2:
|
||
ui->lineEdit_3->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2"));
|
||
break;
|
||
case 3:
|
||
ui->lineEdit_3->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 3"));
|
||
break;
|
||
case 4:
|
||
ui->lineEdit_3->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 4"));
|
||
break;
|
||
case 5:
|
||
ui->lineEdit_3->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
break;
|
||
case 6:
|
||
ui->lineEdit_3->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
break;
|
||
case 7:
|
||
ui->lineEdit_3->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
break;
|
||
default:
|
||
break;
|
||
|
||
|
||
}
|
||
|
||
d.setFloatingPointPrecision(QDataStream::SinglePrecision);
|
||
d >> tFloat ; // azimRLS
|
||
azimutRLS= tFloat;
|
||
|
||
//qDebug("azimutRLS: %f", azimutRLS);
|
||
grAzimutRLS->setAngle(-azimutRLS+90);
|
||
if (VCUnumTarget!=-1)
|
||
{
|
||
|
||
grVCU->setPos1(grAir[VCUnumTarget]->coordsL());
|
||
qreal zoom = zoomKoef[ui->comboBox_2->currentIndex()];
|
||
|
||
QPointF p1 = grAzimutRLS->pos1();
|
||
QLineF lf(0,0,p1.x(),p1.y());
|
||
QLineF lfn = lf.normalVector();
|
||
lfn.setLength(51/zoom);
|
||
QLineF lfT = QLineF(grVCU->pos0(), grVCU->pos1());
|
||
|
||
lf.setLength(lfT.length());
|
||
lfn.translate(lf.p2().x(),lf.p2().y());
|
||
lfn.setAngle(lfn.angle()+180);
|
||
// grAzimutRLSnormal->setPos0(lfn.p1());
|
||
// grAzimutRLSnormal->setPos1(lfn.p2());
|
||
|
||
|
||
|
||
}
|
||
|
||
d >> tFloat ; // ugolMestaRLS
|
||
//qDebug(" ugolRLS: %f", tFloat);
|
||
d.setFloatingPointPrecision(QDataStream::DoublePrecision);
|
||
|
||
d>>tByte>>tByte>>tByte;
|
||
|
||
|
||
d >> tReal; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2 <20><><EFBFBD><EFBFBD><EFBFBD> azMetkaCURLS <20> dalnMetkaCURLS
|
||
|
||
d >> tByte; // urovenUsilenRLS
|
||
|
||
for (i=0; i<10; i++)
|
||
d >> tByte;
|
||
for (i=0;i<3; i++) // rez1-3
|
||
d >> tReal;
|
||
|
||
|
||
d.setFloatingPointPrecision(QDataStream::SinglePrecision);
|
||
|
||
for (i=0; i<3; i++)
|
||
d >> tFloat;
|
||
for (i=0; i<5; i++)
|
||
d >> tByte;
|
||
for (i=0; i<8; i++)
|
||
d >> tFloat;
|
||
d.setFloatingPointPrecision(QDataStream::DoublePrecision);
|
||
|
||
d >> tByte; // powerCVS
|
||
|
||
pwrCVS[0] = tByte;
|
||
|
||
//QString dbgStr = QString("powerCVS = ")+QString::number(tByte);
|
||
//QByteArray dbgBuf = dbgStr.toLocal8Bit();
|
||
//processSendingDatagrams(dbgBuf, 45011);
|
||
|
||
|
||
|
||
if (pwrCVS[0]==1)
|
||
{
|
||
if (openWidget) openWidget->close();
|
||
showSplash(1);
|
||
}
|
||
else
|
||
{
|
||
if ((pwrCVS[0]==2)&&(splashIsOn==1))
|
||
{
|
||
|
||
showSplash(3);
|
||
tmpGS->clear();
|
||
tmpGS->addPixmap(QPixmap(":/fon/pics/loading.png"));
|
||
|
||
// qDebug("power");
|
||
}
|
||
}
|
||
//*/
|
||
|
||
|
||
d >> tBool; // power909
|
||
ui->checkBox_ctrl0->setChecked(!tBool);
|
||
|
||
|
||
d >> tBool; // Reset CVS;
|
||
resetCVS[1]=resetCVS[0];
|
||
resetCVS[0]=tBool;
|
||
tByte = resetCVS[0]+resetCVS[1];
|
||
//--
|
||
if (tByte==2)
|
||
{
|
||
showSplash(3);
|
||
tmpGS->clear();
|
||
tmpGS->addPixmap(QPixmap(":/fon/pics/loading.png"));
|
||
|
||
// qDebug("reboot");
|
||
}
|
||
|
||
d >> tBool; // powerMonitor;
|
||
pwrMonPrev = pwrMon;
|
||
pwrMon = tBool;
|
||
//--
|
||
if (pwrMon || pwrMonPrev) ui->graphicsView_2->hide(); else ui->graphicsView_2->show();
|
||
|
||
|
||
buf.clear();
|
||
buf.resize(5);
|
||
|
||
d >> tBool; // NumLock
|
||
if (tBool) {buf[0]=1;} else {buf[0]=0;}
|
||
|
||
|
||
for (i=1;i<5;i++)
|
||
{
|
||
d >> tByte;
|
||
buf[i] = (quint8)tByte;
|
||
}
|
||
|
||
keybReadDatagrams(buf[0], buf[1], buf[2], buf[3], buf[4]);
|
||
|
||
d >> tWord; // <20><> <20><><EFBFBD><EFBFBD>
|
||
if (tWord==0) ASnumTarget=-1; else ASnumTarget = findTargetFromId(tWord);
|
||
// if (tWord!=8) qDebug("-- %d", tWord);
|
||
|
||
d >> tByte; // inZone
|
||
if (tByte==2)
|
||
{
|
||
if (basePoxod==1)
|
||
{
|
||
ui->radioButton_Z0->setChecked(1);
|
||
ui->btnZone->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>-2"));
|
||
ui->btnZone->show();
|
||
grAzimutGUN->setColor(Qt::yellow);
|
||
ui->radioButton_Z1->setChecked(0);
|
||
}
|
||
}
|
||
else
|
||
if (tByte == 1)
|
||
{
|
||
if (basePoxod==1)
|
||
{
|
||
ui->radioButton_Z0->setChecked(0);
|
||
ui->radioButton_Z1->setChecked(1);
|
||
ui->btnZone->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
ui->btnZone->show();
|
||
grAzimutGUN->setColor(Qt::green);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ui->radioButton_Z0->setChecked(0);
|
||
ui->radioButton_Z1->setChecked(0);
|
||
grAzimutGUN->setColor(Qt::white);
|
||
ui->btnZone->hide();
|
||
}
|
||
|
||
if (basePoxod!=1)
|
||
{
|
||
ui->radioButton_Z0->setChecked(0);
|
||
ui->radioButton_Z1->setChecked(0);
|
||
grAzimutGUN->setColor(Qt::white);
|
||
ui->btnZone->hide();
|
||
|
||
}
|
||
|
||
|
||
d >> tBool; //<2F><><EFBFBD><EFBFBD><EFBFBD>
|
||
ui->radioButton_Z2->setChecked(tBool);
|
||
|
||
|
||
|
||
d >> tByte; // <20><><EFBFBD><EFBFBD><EFBFBD>
|
||
switch (tByte)
|
||
{
|
||
case 0:
|
||
ui->lineEdit_2->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
umMissTur = -162;
|
||
basePoxod = 1;
|
||
|
||
break;
|
||
case 1:
|
||
ui->lineEdit_2->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
ui->radioButton_Z0->setChecked(0);
|
||
ui->radioButton_Z1->setChecked(0);
|
||
ui->btnZone->hide();
|
||
|
||
// ui->lineEdit_6->setText("0");
|
||
// ui->lineEdit_7->setText("0");
|
||
basePoxod = 2;
|
||
break;
|
||
case 2:
|
||
ui->lineEdit_2->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
basePoxod = 3;
|
||
break;
|
||
default:
|
||
basePoxod = 0;
|
||
// qDebug("%d", tByte);
|
||
break;
|
||
}
|
||
|
||
d.setFloatingPointPrecision(QDataStream::SinglePrecision);
|
||
d >> AS_t1 >> AS_t2 >> VCU_t1 >> VCU_t2;
|
||
d >> R_N_t1 >> R_N_t2 >> R_V_t1 >> R_V_t2;
|
||
d >> tFloat >> tFloat;
|
||
d >> AS_par;
|
||
ui->lineEdit_5->setText(QString::number(AS_par));
|
||
d >> tFloat;
|
||
d.setFloatingPointPrecision(QDataStream::DoublePrecision);
|
||
|
||
d >> tByte; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
d >> tWord; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
|
||
|
||
for (i=0; i<2; i++) d >> tReal; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
|
||
|
||
|
||
d >> tByte; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||
// if (tByte) qDebug("[%d]", tByte);
|
||
|
||
QBitArray subAr(100, 0);
|
||
bool fl_target;
|
||
for (i=0; i<47; i++)
|
||
{
|
||
d >> tWord;
|
||
if (tWord==0) break;
|
||
id = tWord;
|
||
|
||
// qDebug("{%d %d}", i, id);
|
||
aType = 0;
|
||
|
||
d >> tWord; // Type_ID <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 100 <20><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20>.<2E>.
|
||
fl_target = (tWord<100);
|
||
d >> tByte;
|
||
if (tByte==0) gType = 3; else if (tByte==1) gType = 1; else gType = 0;
|
||
d >> tBool;
|
||
|
||
// azim, umesta, daln
|
||
d.setFloatingPointPrecision(QDataStream::SinglePrecision);
|
||
|
||
d >> tFloat;
|
||
azim = tFloat;
|
||
d >> tFloat;
|
||
ugol = tFloat;
|
||
d >> tFloat;
|
||
daln = tFloat;
|
||
d >> tByte;
|
||
|
||
dist = daln*cos(ugol/180*M_PI);
|
||
cH = daln*sin(ugol/180*M_PI);
|
||
|
||
cX = dist*cos(azim/180*M_PI);
|
||
cY = dist*sin(azim/180*M_PI);
|
||
|
||
d >> tFloat;
|
||
vX = tFloat;
|
||
d >> tFloat;
|
||
vY = tFloat;
|
||
|
||
d.setFloatingPointPrecision(QDataStream::DoublePrecision);
|
||
|
||
if (fl_target)
|
||
{
|
||
if (!MRUmode) addTarget(id, aType, gType, cX, cY, cH, vX, vY);
|
||
if (!MRUmode) subAr[findTargetFromId(id)]=true;
|
||
}
|
||
}
|
||
if (!MRUmode) clearOldTarget(subAr);
|
||
}
|
||
}
|
||
}
|
||
|
||
void Widget::clearOldTarget(QBitArray &subAr) {
|
||
for (int i=0;i<100;i++)
|
||
{
|
||
if ((grAir[i]->exist==true) && !subAr[i])
|
||
{
|
||
if (VCUnumTarget == i) clearVCU();
|
||
grAir[i]->setNull();
|
||
targetsIds[i]=0;
|
||
}
|
||
}
|
||
subAr.fill(false);
|
||
|
||
}
|
||
|
||
void Widget::process_TargetKDG() { // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
static int lastId = 0;
|
||
int id;
|
||
int targetType;
|
||
int aType = 1;
|
||
int gType = targetEnemy;
|
||
bool tBool;
|
||
qint8 tByte;
|
||
qint16 tWord;
|
||
qint32 tDWord;
|
||
// qreal tReal;
|
||
float tFloat;
|
||
qreal cX, cY, cH, vX, vY;
|
||
// qreal azim, ugol, daln, dist;
|
||
QByteArray datagram;
|
||
|
||
static QBitArray seenTargets(100);
|
||
|
||
while (udpTarget->hasPendingDatagrams()) {
|
||
datagram.clear();
|
||
datagram.resize(udpTarget->pendingDatagramSize());
|
||
udpTarget->readDatagram(datagram.data(), datagram.size());
|
||
|
||
QDataStream d(&datagram, QIODevice::ReadOnly);
|
||
d.setByteOrder(QDataStream::LittleEndian);
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> TNetHead
|
||
for (int i=0; i<3; ++i) {
|
||
d >> tWord;
|
||
}
|
||
Q_ASSERT(tWord == 3);
|
||
d >> tWord;
|
||
int CNT = tWord;
|
||
|
||
d >> tDWord;
|
||
for (int i=0; i<CNT; ++i) {
|
||
// ID <20><><EFBFBD><EFBFBD>
|
||
d >> tWord; id = tWord;
|
||
if (id==1 && MRUmode) clearOldTarget(seenTargets);
|
||
if (id!=0) lastId = id;
|
||
// TypeId
|
||
d >> tWord; targetType = tWord;
|
||
// timeOut
|
||
d >> tWord;
|
||
// PCinput_id
|
||
d >> tByte;
|
||
// Input_id
|
||
d >> tByte;
|
||
// CommonData
|
||
{
|
||
d.setFloatingPointPrecision(QDataStream::SinglePrecision);
|
||
//xTek: single; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> x
|
||
//yTek: single; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> y
|
||
//hTek: single; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> h
|
||
d >> tFloat; cY = tFloat;
|
||
d >> tFloat; cX = tFloat;
|
||
d >> tFloat; cH = tFloat;
|
||
//aX: single; // <20><><EFBFBD><EFBFBD>
|
||
//aY: single; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
//aH: single; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
for (int i=0; i<3; ++i) d >> tFloat;
|
||
//vxTek: single; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>
|
||
//vyTek: single; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>
|
||
//vhTek: single; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> h
|
||
d >> tFloat; vY = tFloat;
|
||
d >> tFloat; vX = tFloat;
|
||
d >> tFloat;
|
||
//akt: longword; //<2F><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
//OnVisLine: boolean;
|
||
d >> tDWord >> tBool;
|
||
d >> tWord >> tByte; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
}
|
||
// CustomDataType: byte;
|
||
d >> tByte; int CDType = tByte;
|
||
// CustomDataSize: byte;
|
||
d >> tByte;
|
||
switch (CDType) {
|
||
case 1:
|
||
d >> tByte;
|
||
d >> tWord;
|
||
if (tByte==0) gType = targetEnemy;
|
||
else if (tByte==1) gType = targetOwn;
|
||
else gType = targetUnknown;
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> id, <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if (MRUmode) {
|
||
addTarget(id, aType, gType, cX, cY, cH, vX, vY);
|
||
seenTargets[findTargetFromId(id)]=true;
|
||
}
|
||
break;
|
||
case 2:
|
||
d >> tFloat;
|
||
d >> tWord;
|
||
d >> tByte;
|
||
d >> tByte;
|
||
break;
|
||
case 3:
|
||
d >> tFloat;
|
||
d >> tFloat;
|
||
d >> tWord ;
|
||
d >> tWord;
|
||
d >> tWord ;
|
||
d >> tWord;
|
||
d >> tByte;
|
||
d >> tByte;
|
||
|
||
d >> tWord ;
|
||
d >> tWord; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
break;
|
||
case 0:
|
||
break;
|
||
default:
|
||
Q_ASSERT(false);
|
||
}
|
||
|
||
}
|
||
// Q_ASSERT(d.atEnd());
|
||
} // while hasPendingDatagram
|
||
}
|
||
|
||
void Widget::processSendingDatagrams(QByteArray buf, int port)
|
||
{
|
||
udpSend->writeDatagram(buf.data(), buf.size(), QHostAddress::LocalHost, port);
|
||
}
|
||
|
||
void Widget::msTickGraph()
|
||
{
|
||
qreal zoom = zoomKoef[ui->comboBox_2->currentIndex()];
|
||
QString str;
|
||
|
||
|
||
|
||
gV->setMissUg(umMissTur, umMissTur);
|
||
gV->setNumTarg(targetsCount);
|
||
|
||
|
||
while (azimutGUN>360) azimutGUN-=360;
|
||
while (azimutGUN<0) azimutGUN+=360;
|
||
while (azimutKurs>360) azimutKurs -=360;
|
||
while (azimutKurs<0) azimutKurs +=360;
|
||
while (azimutRLS>360) azimutRLS -=360;
|
||
while (azimutRLS<0) azimutRLS +=360;
|
||
|
||
if (ownSect.left>ownSect.right) ownSect.right+=360;
|
||
if (kzsSect.left>kzsSect.right) kzsSect.right+=360;
|
||
|
||
if (ownSect.left<0) {ownSect.left+=360; ownSect.right+=360;}
|
||
if (ownSect.right>720) {ownSect.left-=360; ownSect.right-=360;}
|
||
|
||
grAzimutGUN->setAngle(-azimutGUN+90);
|
||
int aRLSmdu = int((azimutGUN)*6000/360) % 6000;
|
||
if (aRLSmdu<0) aRLSmdu+=6000;
|
||
int aRLSdu = aRLSmdu / 100;
|
||
aRLSmdu %= 100;
|
||
|
||
str.clear();
|
||
if (aRLSdu<10) str = QString("0");
|
||
str.append(QString::number(aRLSdu)+"-");
|
||
if (aRLSmdu<10) str.append("0");
|
||
str.append(QString::number(aRLSmdu));
|
||
grAzimutGUN->setText(str);
|
||
|
||
|
||
aRLSmdu = int((ugolGUN)*6000/360) % 6000;
|
||
str.clear();
|
||
if (ugolGUN<0) { str = QString("-"); aRLSmdu = -aRLSmdu;}
|
||
|
||
|
||
aRLSdu = aRLSmdu / 100;
|
||
aRLSmdu %= 100;
|
||
if (aRLSdu<10) str.append(QString("0"));
|
||
str.append(QString::number(aRLSdu)+"-");
|
||
if (aRLSmdu<10) str.append("0");
|
||
str.append(QString::number(aRLSmdu));
|
||
grAzimutGUN->setText(str,1);
|
||
|
||
qreal tDU = (qreal((GAGdu-GAGdu0)*100+(GAGmdu-GAGmdu0))) *6/100;
|
||
// qDebug("%f ", tDU);
|
||
grAzimutKurs->setGlobalAngle(90-azimutKurs-tDU);
|
||
grAzimutKurs->setTextPos(QPointF((185*sin((azimutKurs+tDU)*M_PI/180)-10)/zoom, -185*cos((azimutKurs+tDU)*M_PI/180)/zoom));
|
||
|
||
aRLSmdu = int((azimutKurs+tDU)*6000/360) % 6000;
|
||
if (aRLSmdu<0) aRLSmdu+=6000;
|
||
aRLSdu = aRLSmdu / 100;
|
||
aRLSmdu %= 100;
|
||
str.clear();
|
||
if (aRLSdu<10) str = QString("0");
|
||
str.append(QString::number(aRLSdu)+"-");
|
||
if (aRLSmdu<10) str.append("0");
|
||
str.append(QString::number(aRLSmdu));
|
||
grAzimutKurs->setText(str);
|
||
|
||
//qDebug("azimRLS: %f", azimutRLS);
|
||
grAzimutRLS->setAngle(-azimutRLS+90);
|
||
|
||
grOwnSect->setAngles(-ownSect.left+90, -ownSect.right+90);
|
||
grKzsSect->setAngles(-kzsSect.left+90, -kzsSect.right+90);
|
||
|
||
|
||
// grAir[0]->setCoord(grAir[0]->cX+0.20, grAir[0]->cY+0.15);
|
||
// grAir[2]->setCoord(grAir[2]->cX-0.30, grAir[2]->cY+0.15);
|
||
// for (int i=0; i<100; i++)
|
||
// if (grAir[i]->exist)
|
||
// grAir[i]->moveByTime(1);
|
||
|
||
if (VCUnumTarget!=-1)
|
||
{
|
||
grVCU->setPos1(grAir[VCUnumTarget]->coordsL());
|
||
}
|
||
else
|
||
{
|
||
grVCU->setPos1(QPointF(0,0));
|
||
}
|
||
|
||
|
||
if (ASnumTarget!=-1)
|
||
{
|
||
|
||
// grVCU->setPos1(grAir[ASnumTarget]->coordsL());
|
||
|
||
|
||
QPointF p1 = grAzimutRLS->pos1();
|
||
QPointF p0 = QPointF(0,0);
|
||
QLineF lf(p0,p1);
|
||
QLineF lfn = lf.normalVector();
|
||
lfn.setLength(grAir[ASnumTarget]->v0*10/zoom);
|
||
|
||
QLineF lfT = QLineF(p0, grAir[ASnumTarget]->coordsL());
|
||
|
||
lf.setLength(lfT.length());
|
||
lfn.translate(lf.p2().x(),lf.p2().y());
|
||
|
||
lfT = QLineF(0,0, grAir[ASnumTarget]->vY, -grAir[ASnumTarget]->vX);
|
||
lfn.setAngle(lfT.angle());
|
||
|
||
grAzimutRLSnormal->setPos0(lfn.p1());
|
||
grAzimutRLSnormal->setPos1(lfn.p2());
|
||
|
||
|
||
|
||
}
|
||
else
|
||
{
|
||
// grVCU->setPos1(0,0);
|
||
grAzimutRLSnormal->setPos0(0,0);
|
||
grAzimutRLSnormal->setLength(0);
|
||
|
||
}
|
||
// reCalculate();
|
||
|
||
}
|
||
|
||
void Widget::setGraph()
|
||
{
|
||
|
||
ui->btnZone->hide();
|
||
|
||
gsc = new QGraphicsScene(this);
|
||
gsc->setSceneRect(-11310,-11310,22610, 22610); // <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
|
||
// QGraphicsRectItem *ri;
|
||
// ri = gsc->addRect(-8000,-8185,16000,16370);
|
||
// ri->setPen(QPen(Qt::white));
|
||
// ri = gsc->addRect(-4000,-4090,8000,8180);
|
||
// ri->setPen(QPen(Qt::white));
|
||
// ri = gsc->addRect(-2000,-2045,4000,4090);
|
||
// ri->setPen(QPen(Qt::white));
|
||
// ri = gsc->addRect(-900,-920,1800,1840);
|
||
// ri->setPen(QPen(Qt::white));
|
||
// ri = gsc->addRect(-450,-460,900,920);
|
||
// ri->setPen(QPen(Qt::white));
|
||
// ri = gsc->addRect(-350,-360,700,720);
|
||
// ri->setPen(QPen(Qt::white));
|
||
// ri = gsc->addRect(-250,-255,500,510);
|
||
// ri->setPen(QPen(Qt::white));
|
||
// ri = gsc->addRect(-120,-125,240,250);
|
||
// ri->setPen(QPen(Qt::white));
|
||
// ri = gsc->addRect(-60,-60,120,120);
|
||
// ri->setPen(QPen(Qt::white));
|
||
|
||
|
||
grOwnSect = new graphicsArcItem(0,0, 1, ownSect.left, ownSect.right);
|
||
grOwnSect->setColor(Qt::cyan);
|
||
gsc->addItem((QGraphicsItem*)grOwnSect);
|
||
|
||
grKzsSect = new graphicsArcItem(0,0,1,kzsSect.left, kzsSect.right);
|
||
grKzsSect->setColor(Qt::red);
|
||
grKzsSect->setTextVisible(true);
|
||
gsc->addItem((QGraphicsItem*)grKzsSect);
|
||
|
||
grAzimutGUN = new graphicsLineItem();
|
||
grAzimutGUN->setPos0(QPointF(0, 0));
|
||
grAzimutGUN->setPos1(QPointF(28, 0));
|
||
grAzimutGUN->setAngle(-azimutGUN+90);
|
||
grAzimutGUN->setWidth(5);
|
||
grAzimutGUN->setZValue(100);
|
||
grAzimutGUN->setColor(Qt::green);
|
||
grAzimutGUN->setText("0-00");
|
||
grAzimutGUN->setTextColor(Qt::gray);
|
||
grAzimutGUN->setText("1-10", 1);
|
||
grAzimutGUN->setTextColor(Qt::gray, 1);
|
||
|
||
gsc->addItem((QGraphicsItem*)grAzimutGUN);
|
||
|
||
|
||
// qreal tDU = ((GAGdu-GAGdu0)*100+(GAGmdu-GAGmdu0)) *6/100;
|
||
|
||
grAzimutKurs = new graphicsLineItem();
|
||
grAzimutKurs->setPos0(QPointF(0,0));
|
||
grAzimutKurs->setPos1(QPointF(0,20));
|
||
grAzimutKurs->setAngle(90);
|
||
grAzimutKurs->setWidth(3);
|
||
grAzimutKurs->setColor(Qt::yellow);
|
||
grAzimutKurs->setText("0-00");
|
||
grAzimutKurs->setTextColor(Qt::yellow);
|
||
|
||
gsc->addItem((QGraphicsItem*)grAzimutKurs);
|
||
|
||
grAzimutRLS = new graphicsLineItem();
|
||
grAzimutRLS->setPos0(QPointF(0,0));
|
||
grAzimutRLS->setPos1(QPointF(20,0));
|
||
grAzimutRLS->setAngle(-azimutRLS+90);
|
||
grAzimutRLS->setWidth(1);
|
||
grAzimutRLS->setColor(Qt::blue);
|
||
gsc->addItem((QGraphicsItem*)grAzimutRLS);
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
gV = new GraphicsViewMod(ui->lupa);
|
||
gV->setFocusPolicy(Qt::NoFocus);
|
||
gV->setGeometry(0,37,520,520);
|
||
|
||
gV->setScene(gsc);
|
||
gV->setSceneRect(-70, -70, 140, 140);
|
||
gV->centerOn(0,0);
|
||
|
||
grVCU = new graphicsLineItem();
|
||
grVCU->setPos0(QPointF(0,0));
|
||
grVCU->setPos1(QPointF(0,0));
|
||
grVCU->setColor(Qt::green);
|
||
grVCU->setWidth(1);
|
||
gsc->addItem((QGraphicsItem*)grVCU);
|
||
|
||
grAzimutRLSnormal = new graphicsLineItem();
|
||
grAzimutRLSnormal->setPos0(QPointF(0,0));
|
||
grAzimutRLSnormal->setPos1(QPointF(1,0));
|
||
grAzimutRLSnormal->setColor(Qt::red);
|
||
grAzimutRLSnormal->setWidth(1);
|
||
grAzimutRLSnormal->setCircles(true, false);
|
||
grAzimutRLSnormal->setZValue(1500);
|
||
|
||
gsc->addItem((QGraphicsItem*)grAzimutRLSnormal);
|
||
// slider
|
||
gscRckt = new QGraphicsScene(this);
|
||
gscRckt->setSceneRect(-10000, -10000, 20000, 20000);
|
||
|
||
gvRckt = ui->gvRckt;
|
||
|
||
gvRckt->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
||
gvRckt->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||
gvRckt->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||
|
||
gvRckt->setScene(gscRckt);
|
||
gvRckt->setSceneRect(0, 0, 500, 30);
|
||
gvRckt->setAlignment(Qt::AlignLeft|Qt::AlignTop);
|
||
|
||
grRckt1 = new QGraphicsRectItem();
|
||
gscRckt->addItem(grRckt1);
|
||
|
||
grRckt1->setRect(520, 0, 2*4*10, 30);
|
||
grRckt1->setPen(QPen(Qt::white));
|
||
grRckt1->setBrush(QBrush(Qt::SolidPattern));
|
||
grRckt1->setBrush(QBrush(QColor(0,150,0)));
|
||
|
||
|
||
grRckt2 = new QGraphicsRectItem();
|
||
gscRckt->addItem(grRckt2);
|
||
grRckt2->setRect(720, 0, 10*4*10, 30);
|
||
grRckt2->setPen(QPen(Qt::white));
|
||
grRckt2->setBrush(QBrush(Qt::SolidPattern));
|
||
grRckt2->setBrush(QBrush(QColor(0,0,200)));
|
||
// --! slider
|
||
// addTargets();
|
||
|
||
tmpGS = new QGraphicsScene(this);
|
||
ui->graphicsView->setScene(tmpGS);
|
||
ui->graphicsView->setGeometry(0,0,800,600);
|
||
ui->graphicsView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
||
|
||
tmpGS->addPixmap(QPixmap(":/fon/pics/loading.png"));
|
||
ui->graphicsView->hide();
|
||
curPosition = 3012;
|
||
|
||
|
||
|
||
QGraphicsScene *tmpGS1 = new QGraphicsScene(this);
|
||
tmpGS1->setSceneRect(0,0,1000,1000);
|
||
ui->graphicsView_2->setScene(tmpGS1);
|
||
ui->graphicsView_2->setGeometry(0,0,800,600);
|
||
ui->graphicsView_2->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
||
ui->graphicsView_2->hide();
|
||
}
|
||
|
||
void Widget::putDate()
|
||
{
|
||
QFont font("Consolas", 11, QFont::DemiBold);
|
||
|
||
grLoadDate = new QGraphicsTextItem();
|
||
tmpGS->addItem(grLoadDate);
|
||
grLoadDate->setDefaultTextColor(QColor(193, 193, 193));
|
||
|
||
|
||
grLoadDate->setZValue(1000);
|
||
grLoadDate->setFont(QFont("Consolas", 11));
|
||
strLoadDate.clear();
|
||
grLoadDate->setPlainText(strLoadDate);
|
||
|
||
QGraphicsTextItem *gti = tmpGS->addText("DDMMYY hhmmss");
|
||
gti->setDefaultTextColor(QColor(193, 193, 193, 200));
|
||
gti->setFont(font);
|
||
gti->setZValue(1000);
|
||
curPosition+=12;
|
||
gti->setPos(-3, curPosition);
|
||
|
||
curPosition+=12;
|
||
grLoadDate->setPos(-3, curPosition);
|
||
|
||
ui->graphicsView->centerOn(0, curPosition-24-113);
|
||
|
||
getFocus();
|
||
|
||
|
||
}
|
||
|
||
void Widget::putLogin()
|
||
{
|
||
curPosition = 3350;
|
||
ui->graphicsView->centerOn(0, curPosition+293);
|
||
|
||
QFont font("Consolas", 11, QFont::DemiBold);
|
||
grLoadLogin = new QGraphicsTextItem();
|
||
tmpGS->addItem(grLoadLogin);
|
||
grLoadLogin->setDefaultTextColor(QColor(193, 193, 193));
|
||
grLoadLogin->setZValue(1000);
|
||
grLoadLogin->setFont(font);
|
||
strLoadLogin = "login: ";
|
||
grLoadLogin->setPlainText(strLoadLogin);
|
||
grLoadLogin->setPos(-3, curPosition);
|
||
getFocus();
|
||
}
|
||
|
||
int Widget::findTargetFromId(int id)
|
||
{
|
||
int ret=-1;
|
||
for (int i=0; i<100; i++)
|
||
{
|
||
if (targetsIds[i]==id) {ret = i; break;}
|
||
}
|
||
return ret;
|
||
}
|
||
|
||
void Widget::setVCU(int id)
|
||
{
|
||
VCUnumTarget = findTargetFromId(id);
|
||
if (VCUnumTarget>=0)
|
||
msVvodCU_N2(VCUnumTarget+1, 11);
|
||
}
|
||
|
||
void Widget::clearVCU() {
|
||
VCUnumTarget = -1;
|
||
}
|
||
|
||
int Widget::findNextNum(int n)
|
||
{
|
||
int i;
|
||
for (i=n; i<100; i++)
|
||
if (!grAir[i]->exist) {
|
||
currentNum=i;
|
||
return i;
|
||
};
|
||
|
||
for (i=0; i<n; i++)
|
||
if (!grAir[i]->exist) {
|
||
currentNum=i;
|
||
return i;
|
||
};
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
// delete grAir[currentNum];
|
||
i=currentNum;
|
||
grAir[i]->setNull();
|
||
grAir[i]->exist=true;
|
||
grAir[i]->numb=i;
|
||
currentNum = (i+1)%100;
|
||
return i;
|
||
}
|
||
|
||
void Widget::addTarget(int id, int aType, int gType, qreal cX, qreal cY, qreal cH, qreal vX, qreal vY)
|
||
{
|
||
int num;
|
||
num = findTargetFromId(id);
|
||
if (num<0) {
|
||
num=findNextNum(currentNum);
|
||
targetsIds[num]=id;
|
||
grAir[num]->exist=true;
|
||
grAir[num]->numb=num+1;
|
||
grAir[num]->setGType(gType);
|
||
grAir[num]->setAType(aType);
|
||
grAir[num]->setSpeed(vX/100, vY/100);
|
||
grAir[num]->setCoord(cX/100, cY/100, cH/100);
|
||
grAir[num]->count = 1;
|
||
grAir[num]->setGraphicsEffect((QGraphicsEffect*)grAir[num]->coler);
|
||
grAir[num]->setInfoForRocket(cX/100, cY/100, cH/100, vX/100, vY/100);
|
||
gsc->addItem((QGraphicsItem*)grAir[num]);
|
||
|
||
}
|
||
else
|
||
{
|
||
grAir[num]->count = (grAir[num]->count+1)%18; // <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if (grAir[num]->count==0)
|
||
{
|
||
grAir[num]->setGType(gType);
|
||
grAir[num]->setAType(aType);
|
||
grAir[num]->setSpeed(vX/100, vY/100);
|
||
grAir[num]->setCoord(cX/100, cY/100, cH/100);
|
||
grAir[num]->setGraphicsEffect((QGraphicsEffect*)grAir[num]->coler);
|
||
}
|
||
grAir[num]->setInfoForRocket(cX/100, cY/100, cH/100, vX/100, vY/100);
|
||
}
|
||
}
|
||
|
||
void Widget::addTargets()
|
||
{
|
||
int num;
|
||
|
||
num = findNextNum(currentNum);
|
||
grAir[num]->exist = true;
|
||
grAir[num]->numb = num+1;
|
||
grAir[num]->setAType(1);
|
||
grAir[num]->setGType(0);
|
||
grAir[num]->setCoord(-100, -10, 2);
|
||
grAir[num]->setSpeed(0.1, 1);
|
||
grAir[num]->setGraphicsEffect((QGraphicsEffect*)grAir[num]->coler);
|
||
grAir[num]->setInfoForRocket(-100, -10, 2, 0.1, 1);
|
||
gsc->addItem((QGraphicsItem*)grAir[num]);
|
||
|
||
num = findNextNum(currentNum);
|
||
grAir[num]->exist = true;
|
||
grAir[num]->numb = num+1;
|
||
grAir[num]->setAType(8);
|
||
grAir[num]->setGType(2);
|
||
grAir[num]->setCoord(-200, 150, 1.5);
|
||
grAir[num]->setSpeed(2.03, -1.005);
|
||
grAir[num]->setInfoForRocket(-200, 150, 1.5, 2.03, -1.005);
|
||
grAir[num]->setGraphicsEffect((QGraphicsEffect*)grAir[num]->coler);
|
||
gsc->addItem((QGraphicsItem*)grAir[num]);
|
||
|
||
// targetsCount = 2;
|
||
}
|
||
|
||
bool Widget::readFile()
|
||
{
|
||
QFile f("c:/Shilka_exe/settings.txt");
|
||
QString str;
|
||
int c=0, i;
|
||
|
||
if (!f.open(QIODevice::ReadOnly |QIODevice::Text ))
|
||
return false;
|
||
|
||
while (!f.atEnd())
|
||
{
|
||
c++;
|
||
str = QString(f.readLine());
|
||
switch (c)
|
||
{
|
||
case 1:
|
||
meteoSred = (bool) str.toInt();
|
||
break;
|
||
case 2:
|
||
meteoAvtonom = (bool) str.toInt();
|
||
break;
|
||
case 3:
|
||
metAv.azim = str.section(' ',0, 0).toInt();
|
||
metAv.pressure = str.section(' ', 1, 1).toInt();
|
||
metAv.temp = str.section(' ', 2, 2).toInt();
|
||
metAv.wind = str.section(' ', 3, 3).toInt();
|
||
break;
|
||
case 4:
|
||
metSr = str;
|
||
break;
|
||
case 5:
|
||
ZAtempZar = str.toInt();
|
||
break;
|
||
case 6:
|
||
ZAnastrel = str.toInt();
|
||
break;
|
||
case 7:
|
||
rezhimGAG = str.toInt();
|
||
break;
|
||
case 8:
|
||
rezhimZerk = str.toInt();
|
||
break;
|
||
case 9:
|
||
ts.nZone = str.section(' ',0, 0).toInt();
|
||
ts.south = (bool)str.section(' ', 1, 1).toInt();
|
||
ts.x = str.section(' ', 2, 2).toInt();
|
||
ts.y = str.section(' ', 3, 3).toInt();
|
||
ts.h = str.section(' ', 4, 4).toInt();
|
||
break;
|
||
case 10:
|
||
reper.nZone = str.section(' ',0, 0).toInt();
|
||
reper.south = (bool)str.section(' ', 1, 1).toInt();
|
||
reper.x = str.section(' ', 2, 2).toInt();
|
||
reper.y = str.section(' ', 3, 3).toInt();
|
||
reper.h = str.section(' ', 4, 4).toInt();
|
||
break;
|
||
case 11:
|
||
for (i=0; i<5; i++)
|
||
BK[i] = str.section(' ', i, i).toInt();
|
||
break;
|
||
case 12:
|
||
azimutKurs = str.toInt();
|
||
break;
|
||
case 13:
|
||
sectAzLow1 = str.section(' ',0, 0).toInt();
|
||
sectAzLow2 = str.section(' ', 1, 1).toInt();
|
||
sectAzHigh1 = str.section(' ', 2, 2).toInt();
|
||
sectAzHigh2 = str.section(' ', 3, 3).toInt();
|
||
break;
|
||
case 14:
|
||
sectUgLow1 = str.section(' ',0, 0).toInt();
|
||
sectUgLow2 = str.section(' ', 1, 1).toInt();
|
||
sectUgHigh1 = str.section(' ', 2, 2).toInt();
|
||
sectUgHigh2 = str.section(' ', 3, 3).toInt();
|
||
break;
|
||
case 15:
|
||
azimutGUN = str.toInt();
|
||
break;
|
||
case 16:
|
||
azimutRLS = str.toInt();
|
||
break;
|
||
case 17:
|
||
errZAdB = str.toInt();
|
||
case 18:
|
||
for (i=0; i<9; i++)
|
||
errZAgor[i] = str.section(' ', i,i).toInt();
|
||
break;
|
||
case 19:
|
||
for (i=0; i<7; i++)
|
||
errZAver[i] = str.section(' ', i,i).toInt();
|
||
break;
|
||
case 20:
|
||
autoZAdefault = (bool)str.toInt();
|
||
break;
|
||
case 21:
|
||
readyBoegotov = (bool)str.toInt();
|
||
break;
|
||
case 22:
|
||
ownSect.left = str.section(' ', 0, 0).toDouble();
|
||
ownSect.right = str.section(' ', 1,1).toDouble();
|
||
ownSect.height = str.section(' ', 2,2).toDouble();
|
||
break;
|
||
case 23:
|
||
GAGdu = str.section(' ', 0, 0).toInt();
|
||
GAGmdu = str.section(' ', 1, 1).toInt();
|
||
GAGdu0 = str.section(' ', 2, 2).toInt();
|
||
GAGmdu0 = str.section(' ', 3, 3).toInt();
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
|
||
}
|
||
f.close();
|
||
return true;
|
||
}
|
||
|
||
void Widget::writeFile()
|
||
{
|
||
QFile f("c:/Shilka_exe/settings.txt");
|
||
int i;
|
||
|
||
if (f.open(QIODevice::WriteOnly | QIODevice::Text))
|
||
{
|
||
QTextStream out(&f);
|
||
|
||
if (meteoSred) out << "1"; else out << "0";
|
||
out << "\n";
|
||
|
||
if (meteoAvtonom) out << "1"; else out << "0";
|
||
out << "\n";
|
||
|
||
out << metAv.azim <<" "<< metAv.pressure<<" "<<metAv.temp<<" "<<metAv.wind<<"\n";
|
||
|
||
out << metSr;
|
||
|
||
out << ZAtempZar << "\n";
|
||
out << ZAnastrel << "\n";
|
||
out << rezhimGAG << "\n";
|
||
out << rezhimZerk << "\n";
|
||
|
||
out << ts.nZone <<" "<< (int)ts.south<<" " << ts.x <<" "<< ts.y <<" "<< ts.h << "\n";
|
||
|
||
out << reper.nZone<<" " << (int)reper.south<<" " << reper.x<<" " << reper.y<<" " << reper.h << "\n";
|
||
|
||
for (i=0; i<5; i++)
|
||
out << BK[i] << " ";
|
||
out << "\n";
|
||
|
||
out << azimutKurs << "\n";
|
||
out << sectAzLow1 << " " << sectAzLow2 <<" "<<sectAzHigh1<<" "<<sectAzHigh2<<"\n";
|
||
out << sectUgLow1<<" "<<sectUgLow2<<" "<<sectUgHigh1<<" "<<sectUgHigh2<<"\n";
|
||
out << azimutGUN << "\n" << azimutRLS << "\n";
|
||
out << errZAdB<<"\n";
|
||
|
||
for (i=0; i<9; i++)
|
||
out << errZAgor[i]<<" ";
|
||
out << "\n";
|
||
for (i=0; i<7; i++)
|
||
out << errZAver[i]<<" ";
|
||
out << "\n";
|
||
|
||
out << (int)autoZAdefault<<"\n"<<(int)readyBoegotov<<"\n";
|
||
|
||
out << ownSect.left<<" "<<ownSect.right<<" "<<ownSect.height<<"\n";
|
||
|
||
out << GAGdu << " " << GAGmdu << " " << GAGdu0 << " " << GAGmdu0 << "\n";
|
||
|
||
f.close();
|
||
}
|
||
|
||
}
|
||
|
||
void Widget::initParams()
|
||
{
|
||
int i;
|
||
|
||
// quickLoad = true;
|
||
|
||
for (i=0; i<100; i++)
|
||
{
|
||
grAir[i] = new grAirObject(this);
|
||
grAir[i]->exist=false;
|
||
grAir[i]->setViewSettings(0);
|
||
grAir[i]->count=0;
|
||
}
|
||
loadScreenTmr = new QTimer();
|
||
connect(loadScreenTmr, SIGNAL(timeout()), this, SLOT(loadScreenTick()));
|
||
|
||
umMissTur = 0;
|
||
basePoxod = 0;
|
||
targetsCount = 0;
|
||
|
||
AS_t1 = AS_t2 = VCU_t1 = VCU_t2 = R_N_t1 = R_N_t2 = R_V_t1 = R_V_t2 = 0;
|
||
|
||
rezhimGAGtxt[0] = QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||
rezhimGAGtxt[1] = QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD>");
|
||
rezhimGAGtxt[2] = QString::fromLocal8Bit("0<EFBFBD><EFBFBD><EFBFBD>");
|
||
rezhimGAGtxt[3] = QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||
|
||
currentTaskNum = 0;
|
||
metSr.resize(260);
|
||
metSr.clear();
|
||
|
||
|
||
|
||
// splashIsOn=1;
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
openWidget = 0;
|
||
|
||
rckV0 = 0;
|
||
rckV = 60; // 600 <20>/<2F>
|
||
rckT0 = 1; // 1 <20>
|
||
|
||
rckD0 = (rckV0+rckV)/2*rckT0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
rckHmin = 0.1;
|
||
rckHmax = 35;
|
||
|
||
rckDmin = 5;
|
||
rckDmax = 60;
|
||
|
||
rckAngle = 80; // 80 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
|
||
//
|
||
zoomKoef[8] = 4.16;
|
||
zoomKoef[7] = 2.06;
|
||
zoomKoef[6] = 1.00;
|
||
zoomKoef[5] = 0.71;
|
||
zoomKoef[4] = 0.55;
|
||
zoomKoef[3] = 0.27;
|
||
zoomKoef[2] = 0.12;
|
||
zoomKoef[1] = 0.06;
|
||
zoomKoef[0] = 0.03;
|
||
|
||
currentNum = 0;
|
||
VCUnumTarget = -1;
|
||
ASnumTarget = -1;
|
||
|
||
for (i=0; i<100; i++) targetsIds[i]=0;
|
||
|
||
//
|
||
|
||
if (!readFile())
|
||
{
|
||
|
||
|
||
for (i=0; i<9; i++) errZAgor[i]=0;
|
||
for (i=0; i<7; i++) errZAver[i]=0;
|
||
errZAdB = 0;
|
||
|
||
|
||
meteoSred = false;
|
||
meteoAvtonom = true;
|
||
|
||
metAv.azim = 0;
|
||
metAv.pressure = 0;
|
||
metAv.temp = 0;
|
||
metAv.wind = 0;
|
||
|
||
// metSr = QString::fromLocal8Bit("<22><><EFBFBD><EFBFBD><EFBFBD>-1107-12081-0160-51266-0201-661208-0402-651410-0802-671612-1203-691814-1604-712016-2003-732319-2402-742521-3001-742521-4001-742521-5001-742521-6001-742521-8001-742521-1001-742521-1201-742521-1401-742521-1801-742521-2201-742521-2401-742521-3001-762822-2325");
|
||
// metSr = QString::fromLocal8Bit(" 07 12081 0160 51266 01 661208 02 651410 02 671612 03 691814 04 712016 03 732319 02 742521 01 742521 01 742521 01 742521 01 742521 01 742521 01 742521 742521 742521 742521 742521 742521 762822 2325");
|
||
metSr = QString::fromLocal8Bit("0712081016051266016612080265141002671612036918140471201603732319027425210174252101742521017425210174252101742521017425217425217425217425217425217425217628222325");
|
||
|
||
|
||
ZAtempZar = 0;
|
||
ZAnastrel = 0;
|
||
|
||
rezhimGAG = 0;
|
||
GAGmdu = GAGdu = GAGmdu0 = GAGdu0 = 0;
|
||
rezhimZerk = 0;
|
||
|
||
ts.nZone = 6;
|
||
ts.south = false;
|
||
ts.x = 500000;
|
||
ts.y = 600000;
|
||
ts.h = 100;
|
||
|
||
reper.nZone = 6;
|
||
reper.south = false;
|
||
reper.x = 450000;
|
||
reper.y = 650000;
|
||
reper.h = 0;
|
||
|
||
for (i=0; i<5; i++) BK[i]=0;
|
||
|
||
|
||
|
||
sectAzLow1 = sectAzLow2 = sectAzHigh1 = sectAzHigh2 = 0;
|
||
sectUgLow1 = sectUgLow2 = sectUgHigh1 = sectUgHigh2 = 0;
|
||
|
||
ownSect.left = 15;
|
||
ownSect.right = 65;
|
||
ownSect.height = 0;
|
||
|
||
kzsSect.left = 70;
|
||
kzsSect.right = 10;
|
||
kzsSect.height = 0;
|
||
kzsSect.bottom = 0;
|
||
|
||
|
||
|
||
autoZAdefault = false;
|
||
|
||
readyBoegotov = false;
|
||
|
||
|
||
|
||
azimutGUN = 30;
|
||
azimutRLS = 60;
|
||
|
||
}
|
||
|
||
azimutKurs = 0;
|
||
|
||
}
|
||
|
||
void Widget::initBtnUIDs()
|
||
{
|
||
ui->pushButton->uid = 0x11;
|
||
// ui->pushButton_2->uid = 0x12;
|
||
ui->pushButton_3->uid = 0x13;
|
||
ui->pushButton_4->uid = 0x14;
|
||
ui->pushButton_5->uid = 0x15;
|
||
ui->pushButton_6->uid = 0x16;
|
||
ui->pushButton_7->uid = 0x17;
|
||
ui->pushButton_8->uid = 0x18;
|
||
ui->pushButton_9->uid = 0x19;
|
||
ui->pushButton_10->uid = 0x1a;
|
||
ui->pushButton_11->uid = 0x1b;
|
||
ui->pushButton_12->uid = 0x1c;
|
||
ui->pushButton_13->uid = 0x1d;
|
||
ui->pushButton_14->uid = 0x1e;
|
||
|
||
ui->comboBox->uid = 0x31;
|
||
ui->comboBox_2->uid = 0x32;
|
||
}
|
||
|
||
|
||
void Widget::closeSlot()
|
||
{
|
||
Texit *l=new Texit(this) ;
|
||
l->show();
|
||
}
|
||
|
||
|
||
void Widget::switchWidget(int c)
|
||
{
|
||
switch (c)
|
||
{
|
||
case 0x31:
|
||
ui->pushButton_4->setFocus();
|
||
break;
|
||
case 0x32:
|
||
ui->lupa->setFocus();
|
||
ui->pushButton->setFocus();
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
void Widget::keyPressEvent ( QKeyEvent *e )
|
||
{
|
||
|
||
int c = e->key();
|
||
static int cOld=0;
|
||
int res = 0;
|
||
bool fl;
|
||
|
||
fl = true;
|
||
|
||
if (e->modifiers() & Qt::ControlModifier)
|
||
{
|
||
if ((c>=0x30) && (c<=0x39))
|
||
{
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> Crtl+1x, Crtl+2x, Crtl+5x <20> Crtl+9x
|
||
if ((cOld==0x31)||(cOld==0x32)||(cOld==0x35)||(cOld==0x39))
|
||
{
|
||
res = (cOld-0x30)*10+c-0x30;
|
||
// ui->lineEdit->setText(QString::number(res, 10));
|
||
|
||
switch (res)
|
||
{
|
||
case 21:
|
||
msVvodReper();
|
||
break;
|
||
case 22:
|
||
msVvodTS();
|
||
break;
|
||
case 23:
|
||
msGeoToGK();
|
||
break;
|
||
case 24:
|
||
msGKToGeo();
|
||
break;
|
||
case 25:
|
||
msGKToGK();
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
|
||
|
||
}
|
||
cOld = c;
|
||
}
|
||
else
|
||
cOld = 0;
|
||
|
||
|
||
|
||
|
||
|
||
}
|
||
|
||
if (e->modifiers() & Qt::AltModifier)
|
||
{
|
||
switch (c) {
|
||
case 0x31:
|
||
// ui->lineEdit->setText("Alt+1");
|
||
ui->pushButton_3->setFocus();
|
||
releaseKeyboard();
|
||
break;
|
||
case 0x32:
|
||
// ui->lineEdit->setText("Alt+2");
|
||
ui->pushButton->setFocus();
|
||
releaseKeyboard();
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (splashIsOn==4)
|
||
{
|
||
if ((c == Qt::Key_Backspace)&&(strLoadDate.length()>0))
|
||
strLoadDate = strLoadDate.left(strLoadDate.length()-1);
|
||
if ((c>=Qt::Key_0)&&(c<=Qt::Key_9))
|
||
strLoadDate.append(QChar(c));
|
||
if (c==Qt::Key_F11)
|
||
strLoadDate.append(" ");
|
||
|
||
grLoadDate->setPlainText(strLoadDate);
|
||
|
||
if ((c==Qt::Key_Enter)||(c==Qt::Key_Return))
|
||
{
|
||
QDateTime dt = QDateTime::fromString(strLoadDate, "ddMMyy HHmmss");
|
||
if (dt.isValid())
|
||
{
|
||
QGraphicsTextItem *ti = tmpGS->addText(dt.toString("ddd d MMM yyyy h:mm:ss"), QFont("Consolas", 11));
|
||
ti->setDefaultTextColor(QColor(193, 193, 193));
|
||
curPosition+=12;
|
||
|
||
ti->setPos(-3, curPosition);
|
||
ui->graphicsView->centerOn(0, curPosition-12-113);
|
||
|
||
|
||
ti = tmpGS->addText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>"), QFont("Consolas", 11));
|
||
ti->setDefaultTextColor(QColor(193, 193, 193));
|
||
curPosition+=24;
|
||
ti->setPos(-3, curPosition);
|
||
ui->graphicsView->centerOn(0, curPosition-24-113);
|
||
|
||
splashIsOn = 5;
|
||
QTimer::singleShot(1000, this, SLOT(loadScreenTick()));
|
||
|
||
|
||
}
|
||
else
|
||
{
|
||
putDate();
|
||
}
|
||
}
|
||
|
||
fl = false;
|
||
|
||
}
|
||
|
||
|
||
if (splashIsOn==7)
|
||
{
|
||
if (c == Qt::Key_NumLock) strLoadLogin.append("n");
|
||
if ((c==Qt::Key_Backspace)&&(strLoadLogin.length()>7))
|
||
strLoadLogin = strLoadLogin.left(strLoadLogin.length()-1);
|
||
if ((c>=Qt::Key_0)&&(c<=Qt::Key_9))
|
||
strLoadLogin.append(QChar(c));
|
||
if ((c==Qt::Key_Enter)||(c==Qt::Key_Return))
|
||
{
|
||
splashIsOn = 8;
|
||
grLoadPass = new QGraphicsTextItem();
|
||
tmpGS->addItem(grLoadPass);
|
||
grLoadPass->setDefaultTextColor(QColor(193, 193, 193));
|
||
grLoadPass->setZValue(1000);
|
||
grLoadPass->setFont(QFont("Consolas", 11));
|
||
grLoadPass->setPlainText("pass: ");
|
||
curPosition+=12;
|
||
grLoadPass->setPos(-3, curPosition);
|
||
strLoadPass.clear();
|
||
|
||
}
|
||
grLoadLogin->setPlainText(strLoadLogin);
|
||
fl = false;
|
||
} else
|
||
|
||
if (splashIsOn == 8)
|
||
{
|
||
if ((c==Qt::Key_Backspace)&&(strLoadPass.length()>0))
|
||
strLoadPass = strLoadPass.left(strLoadPass.length()-1);
|
||
if ((c>=Qt::Key_0)&&(c<=Qt::Key_9))
|
||
strLoadPass.append(QChar(c));
|
||
if ((c==Qt::Key_Enter)||(c==Qt::Key_Return))
|
||
{
|
||
if ((strLoadLogin==QString("login: n"))&&(strLoadPass==QString("7")))
|
||
{
|
||
hideSplash();
|
||
strLoadLogin.clear();
|
||
strLoadPass.clear();
|
||
}
|
||
else
|
||
{
|
||
strLoadLogin.clear();
|
||
strLoadPass.clear();
|
||
if (grLoadLogin) delete grLoadLogin;
|
||
if (grLoadPass) delete grLoadPass;
|
||
splashIsOn = 7;
|
||
putLogin();
|
||
}
|
||
|
||
}
|
||
fl = false;
|
||
|
||
}
|
||
|
||
|
||
if ((c==Qt::Key_Left)&&(ui->pushButton_4->hasFocus())) fl = false;
|
||
if ((c==Qt::Key_Right)&&(ui->pushButton_14->hasFocus())) fl = false;
|
||
|
||
if (fl) QWidget::keyPressEvent(e);
|
||
|
||
}
|
||
|
||
|
||
void Widget::createActions()
|
||
{
|
||
m1Source = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ctrl+11"), this);
|
||
// connect
|
||
m1Trace = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ctrl+12"), this);
|
||
// connect
|
||
|
||
m1RazvorotL = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
m1RazvorotR = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
m1Barrazh = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
m1Pikir = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
m1Kabrir = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
m1Speed = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
m1JumpHeli = new QAction(QString::fromLocal8Bit("'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
|
||
m1Reset = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ctrl+13"), this);
|
||
m1Load = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ctrl+14"), this);
|
||
m1Save = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ctrl+15"), this);
|
||
m1Start = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ctrl+16"), this);
|
||
m1Stop = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ctrl+17"), this);
|
||
m1SectorVvod = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
m1SectorEnable = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
m1SectorReset = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
|
||
m1Rezhim = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
m1ShowMark = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
m1ResetCourse = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
m1ResetMark = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
m1Timer = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
|
||
|
||
m2Reper = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ctrl+21"), this);
|
||
connect(m2Reper, SIGNAL(triggered()), this, SLOT(msVvodReper()));
|
||
m2Mestopol = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ctrl+22"), this);
|
||
connect(m2Mestopol, SIGNAL(triggered()), this, SLOT(msVvodTS()));
|
||
m2Geo_GK = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><> Ctrl+23"), this);
|
||
connect(m2Geo_GK, SIGNAL(triggered()), this, SLOT(msGeoToGK()));
|
||
m2GK_Geo = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ctrl+24"), this);
|
||
connect(m2GK_Geo, SIGNAL(triggered()), this, SLOT(msGKToGeo()));
|
||
m2GK_GK = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD>-<2D><> Ctrl+25"), this);
|
||
connect(m2GK_GK, SIGNAL(triggered()), this, SLOT(msGKToGK()));
|
||
|
||
|
||
m3GAG = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>"), this);
|
||
connect(m3GAG, SIGNAL(triggered()), this, SLOT(msGAG()));
|
||
|
||
m4RezhimMA = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>/<2F><>"), this);
|
||
connect(m4RezhimMA, SIGNAL(triggered()), this, SLOT(msMeteoSredShow()));
|
||
m4Bulletin = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>"), this);
|
||
connect(m4Bulletin, SIGNAL(triggered()), this, SLOT(msBulletinShow()));
|
||
m4Nastrel = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
connect(m4Nastrel, SIGNAL(triggered()), this, SLOT(msNastrel()));
|
||
m4Temperature = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
connect(m4Temperature, SIGNAL(triggered()), this, SLOT(msTempZar()));
|
||
m4Errors = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>"), this);
|
||
connect(m4Errors, SIGNAL(triggered()), this, SLOT(msErrorZA()));
|
||
m4Data = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><>"), this);
|
||
connect(m4Data, SIGNAL(triggered()), this, SLOT(msVvodMA()));
|
||
m4RezhimZerk = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>"), this);
|
||
connect(m4RezhimZerk, SIGNAL(triggered()), this, SLOT(msZerkuS()));
|
||
m4Adress = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
connect(m4Adress, SIGNAL(triggered()), this, SLOT(msOwnAdr()));
|
||
|
||
m5VvodBK = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>"), this);
|
||
connect(m5VvodBK, SIGNAL(triggered()), this, SLOT(msVvodBK()));
|
||
m5Ready = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><> <20><><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
connect(m5Ready, SIGNAL(triggered()), this, SLOT(msVvodReady()));
|
||
m5TargDestr = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
connect(m5TargDestr, SIGNAL(triggered()), this, SLOT(msVvodKKill()));
|
||
m5TargMissed = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
connect(m5TargMissed, SIGNAL(triggered()), this, SLOT(msVvodKMiss()));
|
||
m5DKO = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
connect(m5DKO, SIGNAL(triggered()), this, SLOT(msVvodDKO()));
|
||
|
||
m5PeriodicFK = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
m5CtrlSum = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
connect(m5CtrlSum, SIGNAL(triggered()), this, SLOT(msShowCRC()));
|
||
|
||
m6SectAzim = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
connect(m6SectAzim, SIGNAL(triggered()), this, SLOT(msVvodSectAzim()));
|
||
m6SectUgol = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
connect(m6SectUgol, SIGNAL(triggered()), this, SLOT(msVvodSectUgol()));
|
||
m6SectOtv = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
connect(m6SectOtv, SIGNAL(triggered()), this, SLOT(msVvodSectOtvet()));
|
||
m6ManualZA = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD>. <20><> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
connect(m6ManualZA, SIGNAL(triggered()), this, SLOT(msVvodManualZA()));
|
||
m6AutoZA = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>."), this);
|
||
connect(m6AutoZA, SIGNAL(triggered()), this, SLOT(msVvodAutoZA()));
|
||
|
||
m7Default = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>"), this);
|
||
m7BR = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD>"), this);
|
||
m7FK = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD>"), this);
|
||
m7TRU = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
m7CU = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD>_N/<2F><>_B"), this);
|
||
connect(m7CU, SIGNAL(triggered()), this, SLOT(msVvodCU_N()));
|
||
m7CUDenied = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD>"), this);
|
||
connect(m7CUDenied, SIGNAL(triggered()), this, SLOT(msVvodKCancel()));
|
||
|
||
m8Reset = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ctrl+51"), this);
|
||
m8Param = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ctrl+53"), this);
|
||
|
||
m9Oscil = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), this);
|
||
m9View = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>/<2F><><EFBFBD>"), this);
|
||
|
||
m0Reboot = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> Ctrl+91"), this);
|
||
m0Shutdown = new QAction(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ctrl+92"), this);
|
||
connect(m0Shutdown, SIGNAL(triggered()), this, SLOT(closeSlot()));
|
||
}
|
||
|
||
void Widget::createMenu()
|
||
{
|
||
|
||
|
||
|
||
QList<QAction*> la;
|
||
|
||
|
||
menu = new MenuBarMod(ui->dialMenu);
|
||
menu->setGeometry(-5,0,280,24);
|
||
|
||
QFont lf = menu->font();
|
||
lf.setPointSizeF(8);
|
||
menu->setFont(lf);
|
||
|
||
menu->uid=1;
|
||
mTrenag = menu->addMenu(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
mTrenag->addAction(m1Source);
|
||
mTrenag->addAction(m1Trace);
|
||
|
||
m1Manevr=mTrenag->addMenu(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
la.clear();
|
||
la<<m1RazvorotL<<m1RazvorotR<<m1Barrazh<<m1Pikir<<m1Kabrir<<m1Speed<<m1JumpHeli;
|
||
m1Manevr->addActions(la);
|
||
|
||
la.clear();
|
||
la<<m1Reset<<m1Load<<m1Save<<m1Start<<m1Stop<<m1SectorVvod<<m1SectorEnable<<m1SectorReset;
|
||
mTrenag->addActions(la);
|
||
|
||
m1OperatorTren = mTrenag->addMenu(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
la.clear();
|
||
la << m1Rezhim
|
||
// << m1ShowMark
|
||
<< m1ResetCourse
|
||
// << m1ResetMark
|
||
// << m1Timer
|
||
;
|
||
m1OperatorTren->addActions(la);
|
||
|
||
|
||
|
||
|
||
mTopo = menu->addMenu(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
|
||
mTopo->addAction(m2Reper);
|
||
mTopo->addAction(m2Mestopol);
|
||
m2Pereschet=mTopo->addMenu(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
|
||
la.clear();
|
||
la << m2Geo_GK << m2GK_Geo << m2GK_GK;
|
||
m2Pereschet->addActions(la);
|
||
|
||
|
||
|
||
|
||
|
||
mGAG = menu->addMenu(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD>"));
|
||
mGAG->addAction(m3GAG);
|
||
|
||
mPodgotovka = menu->addMenu(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
la.clear();
|
||
la<<m4RezhimMA<<m4Bulletin<<m4Nastrel<<m4Temperature<<m4Errors<<m4Data<<m4RezhimZerk<<m4Adress;
|
||
mPodgotovka->addActions(la);
|
||
|
||
|
||
|
||
|
||
mSost = menu->addMenu(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>."));
|
||
mSost->addAction(m5VvodBK);
|
||
|
||
m5Reports = mSost->addMenu(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
la.clear();
|
||
la<<m5Ready<<m5TargDestr<<m5TargMissed<<m5DKO;
|
||
m5Reports->addActions(la);
|
||
|
||
mSost->addAction(m5PeriodicFK);
|
||
mSost->addAction(m5CtrlSum);
|
||
|
||
|
||
|
||
menu->show();
|
||
|
||
connect(menu, SIGNAL(rightPressed(int)), this, SLOT(catcher(int)));
|
||
connect(menu, SIGNAL(leftPressed(int)), this, SLOT(catchel(int)));
|
||
|
||
|
||
|
||
menu1 = new MenuBarMod(ui->dialMenu);
|
||
menu1->setGeometry(0,menu->height(),270, 24);
|
||
|
||
menu1->setFont(lf);
|
||
menu1->uid=2;
|
||
|
||
|
||
mStrelba = menu1->addMenu(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
la.clear();
|
||
la<<m6SectAzim<<m6SectUgol<<m6SectOtv<<m6ManualZA<<m6AutoZA;
|
||
mStrelba->addActions(la);
|
||
|
||
|
||
mCVS = menu1->addMenu(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD>"));
|
||
la.clear();
|
||
la<<m7Default<<m7BR<<m7FK<<m7TRU<<m7CU<<m7CUDenied;
|
||
mCVS->addActions(la);
|
||
|
||
mOtogd = menu1->addMenu(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
mOtogd->addAction(m8Reset);
|
||
mOtogd->addAction(m8Param);
|
||
|
||
|
||
mReg = menu1->addMenu(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD>"));
|
||
mReg->addAction(m9Oscil);
|
||
mReg->addAction(m9View);
|
||
|
||
|
||
mExit = menu1->addMenu(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
mExit->addAction(m0Reboot);
|
||
mExit->addAction(m0Shutdown);
|
||
|
||
|
||
connect(menu1, SIGNAL(rightPressed(int)), this, SLOT(catcher(int)));
|
||
connect(menu1, SIGNAL(leftPressed(int)), this, SLOT(catchel(int)));
|
||
|
||
}
|
||
|
||
|
||
void Widget::catcher(int p)
|
||
{
|
||
QList<QAction*> la;
|
||
QMenu *m;
|
||
switch (p) {
|
||
|
||
case 1:
|
||
|
||
la = menu1->actions();
|
||
menu1->setActiveAction(la.at(0));
|
||
m = la.at(0)->menu();
|
||
la = m->actions();
|
||
m->setActiveAction(la.at(0));
|
||
m->setFocus();
|
||
|
||
break;
|
||
case 2:
|
||
la = menu->actions();
|
||
menu->setActiveAction(la.at(0));
|
||
m = la.at(0)->menu();
|
||
la = m->actions();
|
||
m->setActiveAction(la.at(0));
|
||
m->setFocus();
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
void Widget::catchel(int p)
|
||
{
|
||
QList<QAction*> la;
|
||
QMenu *m;
|
||
|
||
switch (p) {
|
||
|
||
case 1:
|
||
|
||
la = menu1->actions();
|
||
menu1->setActiveAction(la.last());
|
||
|
||
m = la.last()->menu();
|
||
la = m->actions();
|
||
m->setActiveAction(la.at(0));
|
||
m->setFocus();
|
||
break;
|
||
case 2:
|
||
la = menu->actions();
|
||
menu->setActiveAction(la.last());
|
||
m = la.last()->menu();
|
||
la = m->actions();
|
||
m->setActiveAction(la.at(0));
|
||
m->setFocus();
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
void Widget::msMeteoSredShow()
|
||
{
|
||
meteosred *l = new meteosred(this);
|
||
l->show();
|
||
}
|
||
|
||
void Widget::setMeteo(bool m1, bool m2)
|
||
{
|
||
meteoAvtonom = m1;
|
||
meteoSred = m2;
|
||
|
||
if (meteoSred)
|
||
ui->lineEdit_30->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD>"));
|
||
else
|
||
ui->lineEdit_30->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD>"));
|
||
}
|
||
|
||
void Widget::msVvodMA()
|
||
{
|
||
vvodMA *l = new vvodMA(this);
|
||
l->show();
|
||
}
|
||
|
||
void Widget::msBulletinShow()
|
||
{
|
||
vvodMs *l = new vvodMs(this);
|
||
l->show();
|
||
}
|
||
|
||
void Widget::msNastrel()
|
||
{
|
||
nastrel *l = new nastrel(this);
|
||
l->show();
|
||
}
|
||
|
||
void Widget::msTempZar()
|
||
{
|
||
tempZar *l = new tempZar(this);
|
||
l->show();
|
||
}
|
||
|
||
void Widget::msErrorZA()
|
||
{
|
||
errorsZA *l = new errorsZA(this);
|
||
l->show();
|
||
}
|
||
|
||
void Widget::msZerkuS()
|
||
{
|
||
zerkus *l = new zerkus(this);
|
||
l->show();
|
||
}
|
||
|
||
void Widget::msOwnAdr()
|
||
{
|
||
ownAdr *l=new ownAdr(this);
|
||
l->show();
|
||
}
|
||
|
||
void Widget::msGAG()
|
||
{
|
||
GAG *l = new GAG(this);
|
||
l->show();
|
||
}
|
||
|
||
void Widget::setRezhimGAG(int pos)
|
||
{
|
||
rezhimGAG = pos;
|
||
ui->lineEdit_29->setText(rezhimGAGtxt[pos]);
|
||
|
||
}
|
||
|
||
void Widget::msVvodTS()
|
||
{
|
||
vvodTS *l = new vvodTS(this);
|
||
l->show();
|
||
}
|
||
|
||
void Widget::msVvodReper()
|
||
{
|
||
vvodReper *l = new vvodReper(this);
|
||
l->show();
|
||
}
|
||
|
||
void Widget::msGeoToGK()
|
||
{
|
||
GEOtoGK *l = new GEOtoGK(this);
|
||
l->show();
|
||
}
|
||
|
||
void Widget::msGKToGeo()
|
||
{
|
||
GKtoGEO *l=new GKtoGEO(this);
|
||
l->show();
|
||
|
||
}
|
||
|
||
void Widget::msGKToGK()
|
||
{
|
||
GKtoGK *l=new GKtoGK(this);
|
||
l->show();
|
||
}
|
||
|
||
void Widget::msVvodSectAzim()
|
||
{
|
||
vvodSectAzim *l=new vvodSectAzim(this);
|
||
l->show();
|
||
}
|
||
|
||
void Widget::msVvodSectUgol()
|
||
{
|
||
vvodSectUgol *l = new vvodSectUgol(this);
|
||
l->show();
|
||
}
|
||
|
||
void Widget::msVvodSectOtvet()
|
||
{
|
||
vvodSectOtvet *l=new vvodSectOtvet(this);
|
||
l->show();
|
||
}
|
||
|
||
void Widget::msVvodManualZA()
|
||
{
|
||
autoZAdefault = false;
|
||
}
|
||
|
||
void Widget::msVvodAutoZA()
|
||
{
|
||
vvodAutoZAdef *l=new vvodAutoZAdef(this);
|
||
l->show();
|
||
}
|
||
|
||
void Widget::msVvodBK()
|
||
{
|
||
VvodBK *l = new VvodBK(this);
|
||
l->show();
|
||
}
|
||
|
||
void Widget::msVvodDKO()
|
||
{
|
||
vvodDKO *l=new vvodDKO(this);
|
||
l->show();
|
||
}
|
||
|
||
void Widget::msVvod2z()
|
||
{
|
||
vvod2z *l=new vvod2z(this);
|
||
l->show();
|
||
}
|
||
|
||
void Widget::msVvodKCancel()
|
||
{
|
||
// send Otkaz
|
||
|
||
VCUnumTarget = -1;
|
||
|
||
ui->lineEdit_27->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
ui->lineEdit_26->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
QTimer::singleShot(500, ui->lineEdit_27, SLOT(clear()));
|
||
QTimer::singleShot(500, ui->lineEdit_26, SLOT(clear()));
|
||
|
||
}
|
||
|
||
void Widget::msVvodKZapret()
|
||
{
|
||
// send Zapret
|
||
|
||
ui->lineEdit_27->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
ui->lineEdit_26->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
QTimer::singleShot(500, ui->lineEdit_27, SLOT(clear()));
|
||
QTimer::singleShot(500, ui->lineEdit_26, SLOT(clear()));
|
||
}
|
||
|
||
void Widget::msVvodKKill()
|
||
{
|
||
// send Kill
|
||
ui->lineEdit_27->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
ui->lineEdit_26->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
QTimer::singleShot(500, ui->lineEdit_27, SLOT(clear()));
|
||
QTimer::singleShot(500, ui->lineEdit_26, SLOT(clear()));
|
||
|
||
}
|
||
|
||
void Widget::msVvodKMiss()
|
||
{
|
||
//send Missed
|
||
ui->lineEdit_27->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
ui->lineEdit_26->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
QTimer::singleShot(500, ui->lineEdit_27, SLOT(clear()));
|
||
QTimer::singleShot(500, ui->lineEdit_26, SLOT(clear()));
|
||
|
||
}
|
||
|
||
void Widget::msVvodCU_N()
|
||
{
|
||
vvodKCU *l=new vvodKCU(this);
|
||
l->show();
|
||
}
|
||
|
||
void Widget::msVvodCU_N2(int NC, int z2Z) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> (<28><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>)
|
||
{
|
||
if ((NC)&&(grAir[abs(NC)-1]->exist))
|
||
{
|
||
lastKO = z2Z;
|
||
ui->lineEdit_27->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>"));
|
||
ui->lineEdit_26->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD>"));
|
||
|
||
QClipboard *clipboard = QApplication::clipboard();
|
||
clipboard->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>."));
|
||
|
||
QTimer::singleShot(1000, ui->lineEdit_27, SLOT(clear()));
|
||
QTimer::singleShot(1500, ui->lineEdit_27, SLOT(paste()));
|
||
QTimer::singleShot(500, ui->lineEdit_26, SLOT(clear()));
|
||
|
||
|
||
|
||
VCUnumTarget = abs(NC)-1;
|
||
ui->lineEdit_8->setText(QString::number(NC));
|
||
if (NC>0) ui->lineEdit_16->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD>"));
|
||
else ui->lineEdit_16->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD>"));
|
||
|
||
|
||
// reCalculate();
|
||
|
||
// <20> <20><><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
}
|
||
}
|
||
|
||
|
||
void Widget::msVvodReady()
|
||
{
|
||
vvodReady *l=new vvodReady(this);
|
||
l->show();
|
||
}
|
||
|
||
void Widget::msShowCRC()
|
||
{
|
||
showCRC *l = new showCRC(this);
|
||
l->show();
|
||
}
|
||
|
||
|
||
void Widget::reCalculate()
|
||
{
|
||
int cnt=0;
|
||
for (int i=0; i<100; i++) if (grAir[i]->exist) cnt++;
|
||
targetsCount = cnt;
|
||
|
||
|
||
|
||
QString str;
|
||
int mdu, du;
|
||
qreal angle;
|
||
qreal x,y,h, d;
|
||
|
||
int td, tl, tr, tt;
|
||
|
||
|
||
kzsSect.left = (qreal(sectAzLow1*100+sectAzLow2))*6/100;
|
||
kzsSect.right = (qreal(sectAzHigh1*100+sectAzHigh2))*6/100;
|
||
|
||
kzsSect.bottom = (qreal(sectUgLow1*100+sectUgLow2))*6/100;
|
||
kzsSect.height = (qreal(sectUgHigh1*100+sectUgHigh2))*6/100;
|
||
|
||
|
||
if ((kzsSect.bottom)||(kzsSect.height))
|
||
{
|
||
if (sectUgLow2<10)
|
||
grKzsSect->setText1(QString::number(sectUgLow1)+"-0"+QString::number(sectUgLow2));
|
||
else
|
||
grKzsSect->setText1(QString::number(sectUgLow1)+"-"+QString::number(sectUgLow2));
|
||
|
||
|
||
|
||
if (sectUgHigh2<10)
|
||
grKzsSect->setText2(QString::number(sectUgHigh1)+"-0"+QString::number(sectUgHigh2));
|
||
else
|
||
grKzsSect->setText2(QString::number(sectUgHigh1)+"-"+QString::number(sectUgHigh2));
|
||
|
||
}
|
||
else
|
||
{
|
||
grKzsSect->setText(" "," ");
|
||
}
|
||
|
||
|
||
ui->radioButton_set2->setChecked((sectAzLow1)||(sectAzLow2)||(sectAzHigh1)||(sectAzHigh2));
|
||
ui->radioButton_set3->setChecked((sectUgLow1)||(sectUgLow2)||(sectUgHigh1)||(sectUgHigh2));
|
||
|
||
ui->radioButton_set4->setChecked(rezhimZerk);
|
||
|
||
|
||
|
||
|
||
|
||
|
||
// ASnumTarget = 0;
|
||
|
||
if (ASnumTarget!=-1)
|
||
{
|
||
ui->lineEdit_4->setText(QString::number(ASnumTarget+1));
|
||
QLineF la = QLineF(QPointF(0,0), grAir[ASnumTarget]->coords(1));
|
||
angle = -la.angle();
|
||
if (angle<0) angle+=360;
|
||
mdu = int((angle)*6000/360) % 6000;
|
||
if (mdu<0) mdu+=6000;
|
||
du = mdu / 100; mdu %= 100;
|
||
ui->lineEdit_12->setText(QString::number(du));
|
||
ui->lineEdit_13->setText(QString::number(mdu));
|
||
|
||
td = du*100+mdu;
|
||
tl = sectAzLow1*100+sectAzLow2;
|
||
tr = sectAzHigh1*100+sectAzHigh2;
|
||
|
||
if (tl||tr)
|
||
{
|
||
if (tl<tr)
|
||
ui->radioButton_set5->setChecked(((td>tl)&&(td<tr)));
|
||
else
|
||
ui->radioButton_set5->setChecked(((td<tr)||(td>tl)));
|
||
}
|
||
else
|
||
ui->radioButton_set5->setChecked(0);
|
||
|
||
|
||
|
||
|
||
ui->lineEdit_10->setText(QString::number(la.length()*100, 'f', 0));
|
||
ui->lineEdit_9->setText(QString::number(grAir[ASnumTarget]->rH*100, 'f', 0));
|
||
ui->lineEdit_11->setText(QString::number(grAir[ASnumTarget]->rV0*100, 'f', 0));
|
||
|
||
|
||
x=grAir[ASnumTarget]->rX;
|
||
y=grAir[ASnumTarget]->rY;
|
||
h=grAir[ASnumTarget]->rH;
|
||
|
||
|
||
|
||
d = sqrt(x*x+y*y);
|
||
angle=atan(h/d)/M_PI;
|
||
mdu = int((angle)*3000) % 6000;
|
||
if (mdu<0) mdu+=6000;
|
||
du = mdu / 100; mdu %= 100;
|
||
ui->lineEdit_14->setText(QString::number(du));
|
||
ui->lineEdit_15->setText(QString::number(mdu));
|
||
|
||
td = du*100+mdu;
|
||
tl = sectUgLow1*100+sectUgLow2;
|
||
tr = sectUgHigh1*100+sectUgHigh2;
|
||
if (tr<tl)
|
||
{
|
||
tt = tl;
|
||
tl = tr;
|
||
tr = tt;
|
||
}
|
||
|
||
if (tl||tr)
|
||
ui->radioButton_set6->setChecked(((td<tl)||(td>tr)));
|
||
else
|
||
ui->radioButton_set6->setChecked(0);
|
||
|
||
|
||
|
||
grRckt1->setRect(R_N_t1*40, 0, R_N_t2*40, 30);
|
||
grRckt2->setRect(R_V_t1*40, 0, R_V_t2*40, 30);
|
||
|
||
// ui->lineEdit_5->setText(QString::number(AS_par));
|
||
|
||
// if (basePoxod==2)
|
||
// {
|
||
// ui->lineEdit_7->setText("0");
|
||
// ui->lineEdit_6->setText("0");
|
||
// }
|
||
// else
|
||
// if (basePoxod==1)
|
||
{
|
||
ui->lineEdit_7->setText(QString::number(AS_t1, 'f', 1));
|
||
ui->lineEdit_6->setText(QString::number(AS_t2, 'f', 1));
|
||
}
|
||
|
||
}
|
||
else
|
||
{
|
||
ui->lineEdit_4->setText("0");
|
||
// ui->lineEdit_5->setText("0");
|
||
ui->lineEdit_6->setText("0");
|
||
ui->lineEdit_7->setText("0");
|
||
|
||
ui->lineEdit_9->setText("0");
|
||
ui->lineEdit_10->setText("0");
|
||
ui->lineEdit_11->setText("0");
|
||
|
||
ui->lineEdit_12->setText("0");
|
||
ui->lineEdit_13->setText("0");
|
||
ui->lineEdit_14->setText("0");
|
||
ui->lineEdit_15->setText("0");
|
||
}
|
||
|
||
|
||
|
||
if (VCUnumTarget!=-1)
|
||
{
|
||
|
||
QLineF lf = QLineF(QPointF(0,0), grAir[VCUnumTarget]->coords(1));
|
||
|
||
angle = -lf.angle();
|
||
if (angle<0) angle+=360;
|
||
mdu = int((angle)*6000/360) % 6000;
|
||
if (mdu<0) mdu+=6000;
|
||
du = mdu / 100; mdu %= 100;
|
||
ui->lineEdit_22->setText(QString::number(du));
|
||
ui->lineEdit_23->setText(QString::number(mdu));
|
||
|
||
str.clear();
|
||
if (lastKO<10) str.append("0");
|
||
str.append(QString::number(lastKO));
|
||
|
||
ui->lineEdit_20->setText(QString::number(lf.length()*100, 'f', 0));
|
||
ui->lineEdit_19->setText(QString::number(grAir[VCUnumTarget]->rH*100, 'f', 0));
|
||
ui->lineEdit_21->setText(QString::number(grAir[VCUnumTarget]->rV0*100, 'f', 0));
|
||
|
||
|
||
x=grAir[VCUnumTarget]->rX;
|
||
y=grAir[VCUnumTarget]->rY;
|
||
h=grAir[VCUnumTarget]->rH;
|
||
|
||
d = sqrt(x*x+y*y);
|
||
angle=atan(h/d)/M_PI;
|
||
mdu = int((angle)*3000) % 6000;
|
||
if (mdu<0) mdu+=6000;
|
||
du = mdu / 100; mdu %= 100;
|
||
ui->lineEdit_24->setText(QString::number(du));
|
||
ui->lineEdit_25->setText(QString::number(mdu));
|
||
|
||
ui->lineEdit_18->setText(QString::number(VCU_t1, 'f', 1));
|
||
ui->lineEdit_17->setText(QString::number(VCU_t2, 'f', 1));
|
||
|
||
}
|
||
else
|
||
{
|
||
ui->lineEdit_16->clear();
|
||
ui->lineEdit_22->setText("0");
|
||
ui->lineEdit_23->setText("0");
|
||
ui->lineEdit_20->setText("0");
|
||
ui->lineEdit_19->setText("0");
|
||
ui->lineEdit_21->setText("0");
|
||
ui->lineEdit_24->setText("0");
|
||
ui->lineEdit_25->setText("0");
|
||
|
||
ui->lineEdit_17->setText("0");
|
||
ui->lineEdit_18->setText("0");
|
||
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
|
||
|
||
void Widget::on_pushButton_8_clicked()
|
||
{
|
||
msVvodKCancel();
|
||
}
|
||
|
||
void Widget::on_pushButton_10_clicked()
|
||
{
|
||
msVvodBK();
|
||
}
|
||
|
||
void Widget::on_pushButton_14_clicked()
|
||
{
|
||
msVvodKZapret();
|
||
}
|
||
|
||
void Widget::on_pushButton_12_clicked()
|
||
{
|
||
msVvodKKill();
|
||
}
|
||
|
||
void Widget::on_pushButton_13_clicked()
|
||
{
|
||
msVvodKMiss();
|
||
}
|
||
|
||
|
||
void Widget::on_pushButton_7_clicked()
|
||
{
|
||
msVvodCU_N();
|
||
}
|
||
|
||
|
||
void Widget::on_pushButton_11_clicked()
|
||
{
|
||
msVvod2z();
|
||
}
|
||
|
||
|
||
void Widget::on_pushButton_4_clicked()
|
||
{
|
||
|
||
}
|
||
|
||
void Widget::on_comboBox_2_currentIndexChanged(int index)
|
||
{
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD> Zoom
|
||
QString str;
|
||
switch(index)
|
||
{
|
||
case 0:
|
||
str = QString("1600x1637");
|
||
break;
|
||
case 1:
|
||
str = QString("800x818");
|
||
break;
|
||
case 2:
|
||
str = QString("400x409");
|
||
break;
|
||
case 3:
|
||
str = QString("180x184");
|
||
break;
|
||
case 4:
|
||
str = QString("90x92");
|
||
break;
|
||
case 5:
|
||
str = QString("70x72");
|
||
break;
|
||
case 6:
|
||
str = QString("50x51");
|
||
break;
|
||
case 7:
|
||
str = QString("24x25");
|
||
break;
|
||
case 8:
|
||
str = QString("12x12");
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
ui->label->setText(str);
|
||
|
||
qreal t = 1/(gV->scMeter)*zoomKoef[index];
|
||
globalScale = t;
|
||
gV->scale(t, t);
|
||
gV->scMeter = zoomKoef[index];
|
||
|
||
grOwnSect->setRadius(223/zoomKoef[index]);
|
||
|
||
grKzsSect->setRadius(223/zoomKoef[index]);
|
||
|
||
grAzimutGUN->setLength(28/zoomKoef[index]);
|
||
grAzimutGUN->setWidth(5/zoomKoef[index]);
|
||
grAzimutGUN->setTextSize(10/zoomKoef[index]);
|
||
grAzimutGUN->setTextSize(10/zoomKoef[index], 1);
|
||
grAzimutGUN->setTextPos(QPointF(-10/zoomKoef[index], -20/zoomKoef[index]));
|
||
grAzimutGUN->setTextPos(QPointF(-10/zoomKoef[index], -9/zoomKoef[index]), 1);
|
||
|
||
|
||
qreal tDU = (qreal((GAGdu-GAGdu0)*100+(GAGmdu-GAGmdu0))) *6/100;
|
||
|
||
grAzimutKurs->setPos0(QPointF(-200*sin((azimutKurs+tDU)*M_PI/180)/zoomKoef[index], -200*cos((azimutKurs+tDU)*M_PI/180)/zoomKoef[index]));
|
||
grAzimutKurs->setAngle(-azimutKurs-tDU+90);
|
||
grAzimutKurs->setWidth(3/zoomKoef[index]);
|
||
grAzimutKurs->setLength(20/zoomKoef[index]);
|
||
grAzimutKurs->setTextPos(QPointF((-185*sin((azimutKurs+tDU)*M_PI/180)+10)/zoomKoef[index], -185*cos((azimutKurs+tDU)*M_PI/180)/zoomKoef[index]));
|
||
grAzimutKurs->setTextSize(10/zoomKoef[index]);
|
||
|
||
grAzimutRLS->setLength(219/zoomKoef[index]);
|
||
grAzimutRLS->setWidth(2/zoomKoef[index]);
|
||
|
||
for (int i=0; i<100; i++)
|
||
{
|
||
// if (grAir[i]->exist)
|
||
{
|
||
grAir[i]->setScaleIndex(1/zoomKoef[index]);
|
||
grAir[i]->scale(1/t,1/t);
|
||
}
|
||
}
|
||
|
||
grVCU->setWidth(1/zoomKoef[index]);
|
||
grAzimutRLSnormal->setWidth(1/zoomKoef[index]);
|
||
}
|
||
|
||
|
||
void Widget::on_comboBox_currentIndexChanged(int index)
|
||
{
|
||
for (int i=0; i<100; i++)
|
||
{
|
||
grAir[i]->setViewSettings(index);
|
||
}
|
||
}
|
||
|
||
void Widget::showSplash(int d)
|
||
{
|
||
|
||
|
||
|
||
if (d==1)
|
||
{
|
||
loadingPos = 0;
|
||
ui->graphicsView->centerOn(0,loadingPos);
|
||
ui->graphicsView->show();
|
||
}
|
||
if (d==0)
|
||
{
|
||
if (loadScreenTmr->isActive()) loadScreenTmr->stop();
|
||
loadingPos=0;
|
||
ui->graphicsView->hide();
|
||
|
||
getFocus();
|
||
ui->pushButton_4->setFocus();
|
||
}
|
||
|
||
if (d == 3) //<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||
{
|
||
if (loadScreenTmr->isActive()) loadScreenTmr->stop();
|
||
ui->graphicsView->show();
|
||
loadingPos = 1100;
|
||
loadScreenTmr->start(300);
|
||
// d=0;
|
||
// ui->graphicsView->hide();
|
||
}
|
||
|
||
splashIsOn = d;
|
||
}
|
||
|
||
void Widget::loadScreenTick()
|
||
{
|
||
QString strTab;
|
||
QGraphicsTextItem *ti;
|
||
|
||
if (quickLoad)
|
||
{
|
||
showSplash(0);
|
||
}
|
||
|
||
if (splashIsOn==3)
|
||
{
|
||
ui->graphicsView->centerOn(0, loadingPos);
|
||
loadingPos+=loadingShift;
|
||
// qDebug("%d\n", loadingPos);
|
||
if (loadingPos>=2900)
|
||
{
|
||
loadScreenTmr->stop();
|
||
ui->graphicsView->centerOn(0,2900);
|
||
splashIsOn = 4;
|
||
curPosition = 3012;
|
||
putDate();
|
||
}
|
||
}
|
||
if (splashIsOn==5)
|
||
{
|
||
ti = tmpGS->addText(QString::fromLocal8Bit(" <20><>23-206 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), QFont("Consolas", 11));
|
||
ti->setDefaultTextColor(QColor(193, 193, 193));
|
||
curPosition+=12;
|
||
ti->setPos(-3, curPosition);
|
||
ui->graphicsView->centerOn(0, curPosition-12-113);
|
||
|
||
ti = tmpGS->addText(QString::fromLocal8Bit(" <20><>23-206<30> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), QFont("Consolas", 11));
|
||
ti->setDefaultTextColor(QColor(193, 193, 193));
|
||
curPosition+=12;
|
||
ti->setPos(-3, curPosition);
|
||
ui->graphicsView->centerOn(0, curPosition-12-113);
|
||
|
||
ti = tmpGS->addText(QString::fromLocal8Bit(" <20><><EFBFBD>23-421 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), QFont("Consolas", 11));
|
||
ti->setDefaultTextColor(QColor(193, 193, 193));
|
||
curPosition+=12;
|
||
ti->setPos(-3, curPosition);
|
||
ui->graphicsView->centerOn(0, curPosition-12-113);
|
||
|
||
strTab = QString::fromLocal8Bit(" <20>909 ");
|
||
if (ui->checkBox_ctrl0->isChecked()==true) strTab.append(QString::fromLocal8Bit("<EFBFBD><EFBFBD> "));
|
||
strTab.append(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
ti = tmpGS->addText(strTab, QFont("Consolas", 11));
|
||
ti->setDefaultTextColor(QColor(193, 193, 193));
|
||
curPosition+=12;
|
||
ti->setPos(-3, curPosition);
|
||
ui->graphicsView->centerOn(0, curPosition-12-113);
|
||
|
||
ti = tmpGS->addText(QString::fromLocal8Bit(" <20><>21-403 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), QFont("Consolas", 11));
|
||
ti->setDefaultTextColor(QColor(193, 193, 193));
|
||
curPosition+=12;
|
||
ti->setPos(-3, curPosition);
|
||
ui->graphicsView->centerOn(0, curPosition-12-113);
|
||
|
||
ti = tmpGS->addText(QString::fromLocal8Bit(" <20><>23-401 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), QFont("Consolas", 11));
|
||
ti->setDefaultTextColor(QColor(193, 193, 193));
|
||
curPosition+=12;
|
||
ti->setPos(-3, curPosition);
|
||
ui->graphicsView->centerOn(0, curPosition-12-113);
|
||
|
||
strTab.clear();
|
||
if (ui->checkBox_ctrl0->isChecked()==false)
|
||
strTab.append(QString::fromLocal8Bit(" <20><><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
else
|
||
strTab.append(QString::fromLocal8Bit(" <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
ti = tmpGS->addText(strTab, QFont("Consolas", 11));
|
||
ti->setDefaultTextColor(QColor(193, 193, 193));
|
||
curPosition+=12;
|
||
ti->setPos(-3, curPosition);
|
||
ui->graphicsView->centerOn(0, curPosition-12-113);
|
||
|
||
|
||
splashIsOn = 6;
|
||
QTimer::singleShot(1000, this, SLOT(loadScreenTick()));
|
||
} else
|
||
if (splashIsOn==6)
|
||
{
|
||
// if (loadScreenTmr->isActive()) loadScreenTmr->stop();
|
||
curPosition+=36;
|
||
|
||
ti = tmpGS->addText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), QFont("Consolas", 11));
|
||
ti->setDefaultTextColor(QColor(193, 193, 193));
|
||
curPosition+=12;
|
||
ti->setPos(-3, curPosition);
|
||
ui->graphicsView->centerOn(0, curPosition-12-113);
|
||
ti = tmpGS->addText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> = <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), QFont("Consolas", 11));
|
||
ti->setDefaultTextColor(QColor(193, 193, 193));
|
||
curPosition+=12;
|
||
ti->setPos(-3, curPosition);
|
||
ui->graphicsView->centerOn(0, curPosition-12-113);
|
||
splashIsOn = 7;
|
||
QTimer::singleShot(5000, this, SLOT(loadScreenTick()));
|
||
|
||
|
||
} else
|
||
if (splashIsOn==7)
|
||
{
|
||
|
||
putLogin();
|
||
}
|
||
|
||
}
|
||
|
||
void Widget::changeOpenWidget(QObject *p)
|
||
{
|
||
openWidget = (QWidget*)p;
|
||
}
|
||
|
||
void Widget::clearOpenWidget()
|
||
{
|
||
openWidget = 0;
|
||
}
|
||
|
||
void Widget::focusSS(QWidget *old, QWidget *now)
|
||
{
|
||
if (now) qDebug((now->objectName()).toLocal8Bit());
|
||
}
|
||
|
||
void Widget::on_pushButton_9_clicked()
|
||
{
|
||
|
||
ui->radioButton_set1->setChecked(ui->pushButton_9->isChecked());
|
||
|
||
}
|