diff --git a/Sh3.pro b/Sh3.pro new file mode 100644 index 0000000..762cf49 --- /dev/null +++ b/Sh3.pro @@ -0,0 +1,120 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2016-08-31T18:05:21 +# +#------------------------------------------------- + +QT += core gui network + +TARGET = Sh3 +TEMPLATE = app + + +SOURCES += main.cpp\ + widget.cpp \ + zerkus.cpp \ + vvodts.cpp \ + vvodsectugol.cpp \ + vvodsectotvet.cpp \ + vvodsectazim.cpp \ + vvodreper.cpp \ + vvodready.cpp \ + vvodms.cpp \ + vvodma.cpp \ + vvodkcu.cpp \ + vvoddko.cpp \ + vvodbk.cpp \ + vvodautozadef.cpp \ + texit.cpp \ + tempzar.cpp \ + showcrc.cpp \ + pushbuttonmod.cpp \ + ownadr.cpp \ + nastrel.cpp \ + meteosred.cpp \ + menubarmod.cpp \ + graphicsviewmod.cpp \ + graphicslineitem.cpp \ + graphicsarcitem.cpp \ + gktogk.cpp \ + gktogeo.cpp \ + geotogk.cpp \ + gag.cpp \ + errorsza.cpp \ + comboboxmod.cpp \ + checkboxmod.cpp \ + grairobject.cpp \ + vvod2z.cpp \ + table2z.cpp + +HEADERS += widget.h \ + zerkus.h \ + vvodts.h \ + vvodsectugol.h \ + vvodsectotvet.h \ + vvodsectazim.h \ + vvodreper.h \ + vvodready.h \ + vvodms.h \ + vvodma.h \ + vvodkcu.h \ + vvoddko.h \ + vvodbk.h \ + vvodautozadef.h \ + texit.h \ + tempzar.h \ + showcrc.h \ + pushbuttonmod.h \ + ownadr.h \ + nastrel.h \ + meteosred.h \ + menubarmod.h \ + graphicsviewmod.h \ + graphicslineitem.h \ + graphicsarcitem.h \ + gktogk.h \ + gktogeo.h \ + geotogk.h \ + geo.h \ + gag.h \ + errorsza.h \ + comboboxmod.h \ + checkboxmod.h \ + grairobject.h \ + vvod2z.h \ + table2z.h + +FORMS += widget.ui \ + zerkus.ui \ + vvodts.ui \ + vvodsectugol.ui \ + vvodsectotvet.ui \ + vvodsectazim.ui \ + vvodreper.ui \ + vvodready.ui \ + vvodms.ui \ + vvodma.ui \ + vvodkcu.ui \ + vvoddko.ui \ + vvodbk.ui \ + vvodautozadef.ui \ + texit.ui \ + tempzar.ui \ + showcrc.ui \ + ownadr.ui \ + nastrel.ui \ + meteosred.ui \ + gktogk.ui \ + gktogeo.ui \ + geotogk.ui \ + gag.ui \ + errorsza.ui \ + vvod2z.ui \ + table2z.ui + +OTHER_FILES += \ + Sh3.pro + +RESOURCES += \ + pics.qrc \ + table2z.qrc diff --git a/checkboxmod.cpp b/checkboxmod.cpp new file mode 100644 index 0000000..e97f2c4 --- /dev/null +++ b/checkboxmod.cpp @@ -0,0 +1,31 @@ +#include "checkboxmod.h" +#include + +checkboxmod::checkboxmod(QWidget *parent) : + QCheckBox(parent) +{ + F11disabled = false; +} + +void checkboxmod::keyPressEvent(QKeyEvent *e) +{ + + int c = e->key(); + + if ((c==Qt::Key_F11)&& !F11disabled) + { + this->animateClick(); + } + + QCheckBox::keyPressEvent(e); +} + +bool checkboxmod::isF11disabled() +{ + return F11disabled; +} + +void checkboxmod::setF11disabled(bool fl) +{ + F11disabled = fl; +} diff --git a/checkboxmod.h b/checkboxmod.h new file mode 100644 index 0000000..348aade --- /dev/null +++ b/checkboxmod.h @@ -0,0 +1,25 @@ +#ifndef CHECKBOXMOD_H +#define CHECKBOXMOD_H + +#include + +class checkboxmod : public QCheckBox +{ + Q_OBJECT +public: + explicit checkboxmod(QWidget *parent = 0); + bool isF11disabled(); + void setF11disabled(bool fl); + int uid; + +signals: + void activate1(int); +public slots: + +private: + virtual void keyPressEvent(QKeyEvent *e); + bool F11disabled; + +}; + +#endif // CHECKBOXMOD_H diff --git a/comboboxmod.cpp b/comboboxmod.cpp new file mode 100644 index 0000000..3f10f21 --- /dev/null +++ b/comboboxmod.cpp @@ -0,0 +1,32 @@ +#include "comboboxmod.h" + +comboboxmod::comboboxmod(QWidget *parent) : + QComboBox(parent) +{ + uid =0; +} + +void comboboxmod::keyPressEvent(QKeyEvent *e) +{ + int c=e->key(); + bool fl = true; + + if (e->modifiers() & Qt::AltModifier) + { + switch (c) { + case 0x31: + case 0x32: + emit activate1(c); + fl = false; + break; + default: + break; + } + + } + + if ((uid==0x32)&&(c==Qt::Key_Right)) fl = false; + if ((uid==0x32)&&(c==Qt::Key_Tab)) fl = false; + + if (fl) QComboBox::keyPressEvent(e); +} diff --git a/comboboxmod.h b/comboboxmod.h new file mode 100644 index 0000000..5db875e --- /dev/null +++ b/comboboxmod.h @@ -0,0 +1,23 @@ +#ifndef COMBOBOXMOD_H +#define COMBOBOXMOD_H + +#include +#include + +class comboboxmod : public QComboBox +{ + Q_OBJECT +public: + explicit comboboxmod(QWidget *parent = 0); + int uid; +signals: + void activate1(int); +public slots: + + +private: + virtual void keyPressEvent(QKeyEvent *e); + +}; + +#endif // COMBOBOXMOD_H diff --git a/errorsza.cpp b/errorsza.cpp new file mode 100644 index 0000000..eb1a643 --- /dev/null +++ b/errorsza.cpp @@ -0,0 +1,104 @@ +#include "errorsza.h" +#include "ui_errorsza.h" + +errorsZA::errorsZA(QWidget *parent) : + QDialog(parent), + ui(new Ui::errorsZA) +{ + ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + + ((Widget*)parent)->changeOpenWidget(this); + + int i=0; + for (i=0;i<9;i++) + { + errZAhor[i] = (((Widget*)parent)->errZAgor[i]); + } + for (i=0; i<7; i++) + { + errZAver[i] = (((Widget*)parent)->errZAver[i]); + } + errZAdB = ((Widget*)parent)->errZAdB; + + ui->lineEdit->setText(QString::number(errZAhor[0])); + ui->lineEdit_2->setText(QString::number(errZAhor[1])); + ui->lineEdit_3->setText(QString::number(errZAhor[2])); + ui->lineEdit_4->setText(QString::number(errZAhor[3])); + ui->lineEdit_5->setText(QString::number(errZAhor[4])); + ui->lineEdit_6->setText(QString::number(errZAhor[5])); + ui->lineEdit_7->setText(QString::number(errZAhor[6])); + ui->lineEdit_8->setText(QString::number(errZAhor[7])); + ui->lineEdit_9->setText(QString::number(errZAhor[8])); + + ui->lineEdit_10->setText(QString::number(errZAver[0])); + ui->lineEdit_11->setText(QString::number(errZAver[1])); + ui->lineEdit_12->setText(QString::number(errZAver[2])); + ui->lineEdit_13->setText(QString::number(errZAver[3])); + ui->lineEdit_14->setText(QString::number(errZAver[4])); + ui->lineEdit_15->setText(QString::number(errZAver[5])); + ui->lineEdit_16->setText(QString::number(errZAver[6])); + + int du = errZAdB / 100; + ui->lineEdit_17->setText(QString::number(du)); + du = errZAdB % 100; + ui->lineEdit_18->setText(QString::number(du)); + +} + +errorsZA::~errorsZA() +{ + delete ui; +} + +void errorsZA::on_pushButton_2_clicked() +{ + + close(); +} + +void errorsZA::closeEvent(QCloseEvent *event) +{ + ((Widget*)parent())->clearOpenWidget(); + event->accept(); +} + +void errorsZA::on_pushButton_clicked() +{ + int i; + + errZAhor[0] = ui->lineEdit->text().toInt(); + errZAhor[1] = ui->lineEdit_2->text().toInt(); + errZAhor[2] = ui->lineEdit_3->text().toInt(); + errZAhor[3] = ui->lineEdit_4->text().toInt(); + errZAhor[4] = ui->lineEdit_5->text().toInt(); + errZAhor[5] = ui->lineEdit_6->text().toInt(); + errZAhor[6] = ui->lineEdit_7->text().toInt(); + errZAhor[7] = ui->lineEdit_8->text().toInt(); + errZAhor[8] = ui->lineEdit_9->text().toInt(); + + errZAver[0] = ui->lineEdit_10->text().toInt(); + errZAver[1] = ui->lineEdit_11->text().toInt(); + errZAver[2] = ui->lineEdit_12->text().toInt(); + errZAver[3] = ui->lineEdit_13->text().toInt(); + errZAver[4] = ui->lineEdit_14->text().toInt(); + errZAver[5] = ui->lineEdit_15->text().toInt(); + errZAver[6] = ui->lineEdit_16->text().toInt(); + + errZAdB = ui->lineEdit_17->text().toInt()*100 + ui->lineEdit_18->text().toInt(); + + + ((Widget*)parent())->errZAdB = errZAdB; + + for (i=0; i<9; i++) + { + ((Widget*)parent())->errZAgor[i] = errZAhor[i]; + } + for (i=0;i<7;i++) + { + ((Widget*)parent())->errZAver[i] = errZAver[i]; + } + + ((Widget*)parent())->writeFile(); + close(); +} diff --git a/errorsza.h b/errorsza.h new file mode 100644 index 0000000..505f112 --- /dev/null +++ b/errorsza.h @@ -0,0 +1,32 @@ +#ifndef ERRORSZA_H +#define ERRORSZA_H + +#include +#include "widget.h" + +namespace Ui { +class errorsZA; +} + +class errorsZA : public QDialog +{ + Q_OBJECT + +public: + explicit errorsZA(QWidget *parent = 0); + ~errorsZA(); + +private slots: + void on_pushButton_2_clicked(); + + void on_pushButton_clicked(); + +private: + void closeEvent(QCloseEvent *event); + Ui::errorsZA *ui; + int errZAhor[9]; + int errZAver[7]; + int errZAdB; +}; + +#endif // ERRORSZA_H diff --git a/errorsza.ui b/errorsza.ui new file mode 100644 index 0000000..ef681e5 --- /dev/null +++ b/errorsza.ui @@ -0,0 +1,395 @@ + + + errorsZA + + + + 0 + 0 + 322 + 363 + + + + Ввод ошибки ЗА + + + + + 20 + 20 + 141 + 291 + + + + Ошибка Δ Q (мин.) + + + + + 0 + 40 + 111 + 231 + + + + + QFormLayout::AllNonFixedFieldsGrow + + + 23 + + + + + + + + Qt::AlignCenter + + + + + + + 0 + + + + + + + 45° + + + + + + + 0 + + + + + + + 90° + + + + + + + 135° + + + + + + + 180° + + + + + + + 225° + + + + + + + 270° + + + + + + + 315° + + + + + + + 360° + + + + + + + 0 + + + + + + + 0 + + + + + + + 0 + + + + + + + 0 + + + + + + + 0 + + + + + + + 0 + + + + + + + 0 + + + + + + + + + + 170 + 20 + 131 + 221 + + + + Ошибка Δ Ф (мин.) + + + + + 0 + 40 + 101 + 181 + + + + + QFormLayout::AllNonFixedFieldsGrow + + + 23 + + + + + -5° + + + Qt::AlignCenter + + + + + + + 0 + + + + + + + 10° + + + + + + + 0 + + + + + + + 25° + + + + + + + 0 + + + + + + + 40° + + + + + + + 0 + + + + + + + 55° + + + + + + + 0 + + + + + + + 70° + + + + + + + 0 + + + + + + + 85° + + + + + + + 0 + + + + + + + + + + 170 + 250 + 131 + 61 + + + + Поправка Δ β + + + + + 10 + 20 + 31 + 20 + + + + + + + 70 + 20 + 31 + 20 + + + + + + + 50 + 20 + 16 + 16 + + + + + 12 + + + + - + + + + + + + 70 + 320 + 75 + 23 + + + + Ввод + + + + + + 200 + 320 + 75 + 23 + + + + Отказ + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+
+ + +
diff --git a/gag.cpp b/gag.cpp new file mode 100644 index 0000000..b57fcec --- /dev/null +++ b/gag.cpp @@ -0,0 +1,67 @@ +#include "gag.h" +#include "ui_gag.h" + +GAG::GAG(QWidget *parent) : + QDialog(parent), + ui(new Ui::GAG) +{ + ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + Widget *w = (Widget*)parent; + w->changeOpenWidget(this); + + + ui->comboBox->setCurrentIndex(w->rezhimGAG); + ui->lineEdit->setText(QString::number(w->GAGdu)); + ui->lineEdit_2->setText(QString::number(w->GAGmdu)); + ui->lineEdit_3->setText(QString::number(w->GAGdu0)); + ui->lineEdit_4->setText(QString::number(w->GAGmdu0)); + + + +} + +GAG::~GAG() +{ + delete ui; +} + +void GAG::closeEvent(QCloseEvent *event) +{ + ((Widget*)parent())->clearOpenWidget(); + event->accept(); +} + +void GAG::on_pushButton_2_clicked() +{ + close(); +} + +void GAG::on_pushButton_clicked() +{ + Widget *w = (Widget*)parent(); + int i = ui->comboBox->currentIndex(); + w->setRezhimGAG(i); + + + if (i!=2) + { + + + w->GAGdu = ui->lineEdit->text().toInt(); + w->GAGmdu = ui->lineEdit_2->text().toInt(); + w->GAGdu0 = ui->lineEdit_3->text().toInt(); + w->GAGmdu0 = ui->lineEdit_4->text().toInt(); + + + } + else + { + w->GAGdu = 0; + w->GAGmdu = 0; + w->GAGdu0 = 0; + w->GAGmdu0 = 0; + } + ((Widget*)parent())->writeFile(); + close(); +} diff --git a/gag.h b/gag.h new file mode 100644 index 0000000..3fbc433 --- /dev/null +++ b/gag.h @@ -0,0 +1,28 @@ +#ifndef GAG_H +#define GAG_H + +#include +#include "widget.h" + +namespace Ui { +class GAG; +} + +class GAG : public QDialog +{ + Q_OBJECT + +public: + explicit GAG(QWidget *parent = 0); + ~GAG(); + +private slots: + void on_pushButton_2_clicked(); + void closeEvent(QCloseEvent *event); + void on_pushButton_clicked(); + +private: + Ui::GAG *ui; +}; + +#endif // GAG_H diff --git a/gag.ui b/gag.ui new file mode 100644 index 0000000..1862a0d --- /dev/null +++ b/gag.ui @@ -0,0 +1,262 @@ + + + GAG + + + + 0 + 0 + 227 + 207 + + + + Режимы стабилизирования + + + + + 10 + 10 + 211 + 151 + + + + + + + + + 20 + 15 + 81 + 16 + + + + Режим ГАГ + + + + + + 100 + 10 + 91 + 22 + + + + + ГАГдв + + + + + Квв + + + + + 0гаг + + + + + ГАГст + + + + + + + 23 + 59 + 81 + 16 + + + + К исх + + + + + + 20 + 100 + 81 + 16 + + + + гаг + + + + + + 20 + 90 + 46 + 13 + + + + исх + + + + + + 137 + 63 + 46 + 13 + + + + + 12 + + + + - + + + + + + 100 + 60 + 31 + 20 + + + + 0 + + + + + + 150 + 60 + 31 + 20 + + + + 0 + + + + + + 150 + 97 + 31 + 20 + + + + 0 + + + + + + 100 + 97 + 31 + 20 + + + + 0 + + + + + + 137 + 100 + 16 + 16 + + + + + 12 + + + + - + + + + + + 22 + 97 + 46 + 13 + + + + K + + + + + + + 20 + 170 + 75 + 23 + + + + Ввод + + + + + + 130 + 170 + 75 + 23 + + + + Отказ + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+ + comboboxmod + QComboBox +
comboboxmod.h
+
+
+ + pushButton + pushButton_2 + comboBox + lineEdit + lineEdit_2 + lineEdit_3 + lineEdit_4 + + + +
diff --git a/geo.h b/geo.h new file mode 100644 index 0000000..848a11a --- /dev/null +++ b/geo.h @@ -0,0 +1,42 @@ +#ifndef GEO_H +#define GEO_H + +#include + +struct T_geoPoint +{ + int nZone; + bool south; + int x; + int y; + int h; +}; + +struct T_metAv +{ + int temp; + int wind; + int azim; + int pressure; +}; + +struct T_sectOtv +{ + qreal left; + qreal right; + qreal height; + qreal bottom; +}; + +//struct T_ugolDU +//{ +// int DU; +// int mDU; +//}; + +//T_ugolDU deg_v_DU(qreal deg) +//{ + +//} + +#endif // GEO_H diff --git a/geotogk.cpp b/geotogk.cpp new file mode 100644 index 0000000..46f8df8 --- /dev/null +++ b/geotogk.cpp @@ -0,0 +1,94 @@ +#include "geotogk.h" +#include "ui_geotogk.h" + +GEOtoGK::GEOtoGK(QWidget *parent) : + QDialog(parent), + ui(new Ui::GEOtoGK) +{ + ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + ((Widget*)parent)->changeOpenWidget(this); +} + +GEOtoGK::~GEOtoGK() +{ + delete ui; +} +void GEOtoGK::closeEvent(QCloseEvent *event) +{ + ((Widget*)parent())->clearOpenWidget(); + event->accept(); +} + +void GEOtoGK::on_pushButton_2_clicked() +{ + close(); +} + +void GEOtoGK::on_pushButton_clicked() +{ + int nZone, b1, b2, b3, l1, l2, l3; + bool south; + + int XL, YL; + + double CA2=5333.5419; + double CA4=4.84339; + double CA6=0.007622; + double A1,A2,A3,B1,B2,B3,C1,C2,C3,D1,D2,D3, + E,EL,FI,L0,TGE,THP,P; + + + + nZone = ui->lineEdit->text().toInt(); + south = ui->checkBox->isChecked(); + b1 = ui->lineEdit_2->text().toInt(); + b2 = ui->lineEdit_3->text().toInt(); + b3 = ui->lineEdit_4->text().toInt(); + l1 = ui->lineEdit_5->text().toInt(); + l2 = ui->lineEdit_6->text().toInt(); + l3 = ui->lineEdit_7->text().toInt(); + + + + // + + + B = (((b3/60)+b2) /60 + b1)/180*M_PI; + if (south) B=-B; + L = (((l3/60)+l2)/60+l1)/180*M_PI; + + L0=double(nZone)*6.0-3.0; + L0=L0*M_PI/180.0; + EL=L-L0; + FI=(2624.0*sin(B)*sin(B)+372834.0)*sin(B)*sin(B); + FI=B-((FI+66934216.0)*sin(B)*cos(B)*0.0000000001); + TGE=tan(FI)/cos(EL); + E=atan(TGE); + THP=cos(FI)*sin(EL); + P=0.5*log((1.0+THP)/(1.0-THP)); + A1=sin(2.0*E); + B1=cos(2.0*E); + C1=sinh(2.0*P); + D1=cosh(2.0*P); + A2=2.0*A1*B1; + B2=1.0-2.0*A1*A1; + C2=2.0*C1*D1; + D2=1.0+2.0*C1*C1; + A3=A1*B2+A2*B1; + B3=B1*B2-A1*A2; + C3=C1*D2+C2*D1; + D3=D1*D2+C1*C2; + + XL = 6367558.497*E+CA2*A1*D1+CA4*A2*D2+CA6*A3*D3; + if (XL<0) XL=-XL; + + YL = 6367558.497*P+CA2*B1*C1+CA4*B2*C2+CA6*B3*C3 + 500000.0; + + ui->lineEdit_8->setText(QString::number(XL)); + ui->lineEdit_9->setText(QString::number(YL)); + + + +} + diff --git a/geotogk.h b/geotogk.h new file mode 100644 index 0000000..a8707a7 --- /dev/null +++ b/geotogk.h @@ -0,0 +1,31 @@ +#ifndef GEOTOGK_H +#define GEOTOGK_H + +#include +#include "widget.h" +#include "geo.h" + +namespace Ui { +class GEOtoGK; +} + +class GEOtoGK : public QDialog +{ + Q_OBJECT + +public: + explicit GEOtoGK(QWidget *parent = 0); + ~GEOtoGK(); + +private slots: + void on_pushButton_2_clicked(); + void closeEvent(QCloseEvent *event); + void on_pushButton_clicked(); + + +private: + Ui::GEOtoGK *ui; + double B, L, l; +}; + +#endif // GEOTOGK_H diff --git a/geotogk.ui b/geotogk.ui new file mode 100644 index 0000000..215029d --- /dev/null +++ b/geotogk.ui @@ -0,0 +1,395 @@ + + + GEOtoGK + + + + 0 + 0 + 269 + 367 + + + + Геодезические в Гаусса-Крюгера + + + + + 10 + 10 + 251 + 241 + + + + + + + + + 20 + 10 + 111 + 16 + + + + Номер зоны + + + + + + 140 + 10 + 51 + 20 + + + + 0 + + + + + + 20 + 37 + 111 + 16 + + + + Южное полушарие + + + + + + 140 + 37 + 70 + 17 + + + + + + + + + + 140 + 60 + 51 + 20 + + + + 0 + + + + + + 20 + 60 + 111 + 16 + + + + В (широта) + + + + + + 210 + 60 + 41 + 20 + + + + град + + + + + + 210 + 90 + 41 + 20 + + + + мин + + + + + + 140 + 90 + 51 + 20 + + + + 0 + + + + + + 210 + 120 + 41 + 20 + + + + сек + + + + + + 140 + 120 + 51 + 20 + + + + 0 + + + + + + 210 + 150 + 41 + 20 + + + + град + + + + + + 140 + 150 + 51 + 20 + + + + 0 + + + + + + 210 + 180 + 41 + 20 + + + + мин + + + + + + 140 + 180 + 51 + 20 + + + + 0 + + + + + + 210 + 210 + 41 + 20 + + + + сек + + + + + + 140 + 210 + 51 + 20 + + + + 0 + + + + + + 20 + 150 + 111 + 16 + + + + L (долгота) + + + + + + + 10 + 250 + 251 + 71 + + + + + + + + + 210 + 10 + 41 + 20 + + + + м + + + + + + 140 + 10 + 51 + 21 + + + + 0 + + + + + + 20 + 10 + 111 + 16 + + + + XL + + + + + + 210 + 40 + 41 + 20 + + + + м + + + + + + 140 + 40 + 51 + 20 + + + + 0 + + + + + + 20 + 40 + 111 + 16 + + + + YL + + + + + + + 20 + 330 + 75 + 23 + + + + Запрос + + + + + + 170 + 330 + 75 + 23 + + + + Отказ + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+ + checkboxmod + QCheckBox +
checkboxmod.h
+
+
+ + +
diff --git a/gktogeo.cpp b/gktogeo.cpp new file mode 100644 index 0000000..b08d0d1 --- /dev/null +++ b/gktogeo.cpp @@ -0,0 +1,119 @@ +#include "gktogeo.h" +#include "ui_gktogeo.h" + +GKtoGEO::GKtoGEO(QWidget *parent) : + QDialog(parent), + ui(new Ui::GKtoGEO) +{ + ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + + ((Widget*)parent)->changeOpenWidget(this); +} + +GKtoGEO::~GKtoGEO() +{ + delete ui; +} + +void GKtoGEO::on_pushButton_2_clicked() +{ + close(); +} + +void GKtoGEO::closeEvent(QCloseEvent *event) +{ + ((Widget*)parent())->clearOpenWidget(); + event->accept(); +} + +void GKtoGEO::on_pushButton_clicked() +{ + int nZone, b1, b2, b3, l1, l2, l3; + bool south; + + int XL, YL; + + + double CB2=8376121.0; + double CB4=590.42; + double CB6=1.68; + double A1,A2,A3,B1,B2,B3,C1,C2,C3,D1,D2,D3, + P,PU,G,E,EU,FI,L0,TGA,TGL,U,V,TG,SFI; + + + + nZone = ui->lineEdit->text().toInt(); + south = ui->checkBox->isChecked(); + + XL = ui->lineEdit_8->text().toInt(); + YL = ui->lineEdit_9->text().toInt(); + + // + + V=YL-500000.0; + U=XL/6367558.497; + V=V/6367558.497; + A1=sin(2.0*U); + B1=cos(2.0*U); + A2=2.0*A1*B1; + B2=1.0-2.0*A1*A1; + A3=A1*B2+A2*B1; + B3=B1*B2-A1*A2; + C1=sinh(2.0*V); + D1=sqrt(1.0+C1*C1); + C2=2.0*C1*D1; + D2=1.0+2.0*C1*C1; + C3=C1*D2+C2*D1; + D3=C1*C2+D1*D2; + E=U-(CB2*A1*D1+CB4*A2*D2+CB6*A3*D3)*0.0000000001; + P=V-(CB2*B1*C1+CB4*B2*C2+CB6*B3*C3)*0.0000000001; + EU=10000000000.0-(2.0*CB2*B1*D1+4.0*CB4*B2*D2+ + 6.0*CB6*B3*D3); + PU=(2.0*CB2*A1*C1+4.0*CB4*A2*C2+6.0*CB6*A3*C3); + SFI=sin(E)/cosh(P); + TGL=sinh(P)/cos(E); + TGA=SFI*TGL; + FI=asin(SFI); + B=(5645.0*SFI*SFI-531245.0)*SFI*SFI; + B=(B+67385254.0)*SFI*cos(FI)*0.0000000001; + B=B+FI; + TG=PU/EU; + G=atan(TGA)+atan(TG); + L=atan(TGL); + L0=double(nZone)*6.0-3.0; + L0=L0*M_PI/180.0; + L=L+L0; + if (L<0.0) L=L+(2.0*M_PI); + else if (L>(2.0*M_PI)) L=L-(2.0*M_PI); + + + double X=180.0/M_PI*B; + south = (X<0); + if (south) X= -X; + + b1 = (int)floor(X); + X = (X-b1)*60; + b2 = (int)floor(X); + X = (X-b2)*60; + b3 = (int)floor(X); + + + X = 180.0/M_PI*L; + l1 = (int)floor(X); + X = (X-l1)*60; + l2 = (int)floor(X); + X = (X-l2)*60; + l3 = (int)floor(X); + + + ui->lineEdit_2->setText(QString::number(b1)); + ui->lineEdit_3->setText(QString::number(b2)); + ui->lineEdit_4->setText(QString::number(b3)); + ui->lineEdit_5->setText(QString::number(l1)); + ui->lineEdit_6->setText(QString::number(l2)); + ui->lineEdit_7->setText(QString::number(l3)); + + + +} diff --git a/gktogeo.h b/gktogeo.h new file mode 100644 index 0000000..22ce65f --- /dev/null +++ b/gktogeo.h @@ -0,0 +1,30 @@ +#ifndef GKTOGEO_H +#define GKTOGEO_H + +#include +#include "widget.h" +#include "geo.h" + +namespace Ui { +class GKtoGEO; +} + +class GKtoGEO : public QDialog +{ + Q_OBJECT + +public: + explicit GKtoGEO(QWidget *parent = 0); + ~GKtoGEO(); + +private slots: + void on_pushButton_2_clicked(); + void closeEvent(QCloseEvent *event); + void on_pushButton_clicked(); + +private: + Ui::GKtoGEO *ui; + double B, L, l; +}; + +#endif // GKTOGEO_H diff --git a/gktogeo.ui b/gktogeo.ui new file mode 100644 index 0000000..e6acef0 --- /dev/null +++ b/gktogeo.ui @@ -0,0 +1,395 @@ + + + GKtoGEO + + + + 0 + 0 + 273 + 372 + + + + Гаусса-Крюгера в геодезические + + + + + 20 + 330 + 75 + 23 + + + + Запрос + + + + + + 10 + 10 + 251 + 121 + + + + + + + + + 20 + 10 + 111 + 16 + + + + Номер зоны + + + + + + 140 + 10 + 51 + 20 + + + + 0 + + + + + + 20 + 37 + 111 + 16 + + + + Южное полушарие + + + + + + 140 + 37 + 70 + 17 + + + + + + + + + + 210 + 90 + 41 + 20 + + + + м + + + + + + 20 + 60 + 111 + 16 + + + + XL + + + + + + 140 + 90 + 51 + 20 + + + + 0 + + + + + + 140 + 60 + 51 + 21 + + + + 0 + + + + + + 210 + 60 + 41 + 20 + + + + м + + + + + + 20 + 90 + 111 + 16 + + + + YL + + + + + + + 170 + 330 + 75 + 23 + + + + Отказ + + + + + + 10 + 130 + 251 + 191 + + + + + + + + + 140 + 130 + 51 + 20 + + + + 0 + + + + + + 140 + 70 + 51 + 20 + + + + 0 + + + + + + 210 + 70 + 41 + 20 + + + + сек + + + + + + 140 + 40 + 51 + 20 + + + + 0 + + + + + + 210 + 160 + 41 + 20 + + + + сек + + + + + + 20 + 100 + 111 + 16 + + + + L (долгота) + + + + + + 210 + 40 + 41 + 20 + + + + мин + + + + + + 140 + 100 + 51 + 20 + + + + 0 + + + + + + 210 + 130 + 41 + 20 + + + + мин + + + + + + 20 + 10 + 111 + 16 + + + + В (широта) + + + + + + 140 + 160 + 51 + 20 + + + + 0 + + + + + + 210 + 100 + 41 + 20 + + + + град + + + + + + 140 + 10 + 51 + 20 + + + + 0 + + + + + + 210 + 10 + 41 + 20 + + + + град + + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+ + checkboxmod + QCheckBox +
checkboxmod.h
+
+
+ + +
diff --git a/gktogk.cpp b/gktogk.cpp new file mode 100644 index 0000000..c8855d8 --- /dev/null +++ b/gktogk.cpp @@ -0,0 +1,129 @@ +#include "gktogk.h" +#include "ui_gktogk.h" + +GKtoGK::GKtoGK(QWidget *parent) : + QDialog(parent), + ui(new Ui::GKtoGK) +{ + ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + + ((Widget*)parent)->changeOpenWidget(this); +} + +GKtoGK::~GKtoGK() +{ + delete ui; +} + +void GKtoGK::on_pushButton_2_clicked() +{ + close(); +} + +void GKtoGK::closeEvent(QCloseEvent *event) +{ + ((Widget*)parent())->clearOpenWidget(); + event->accept(); +} + +void GKtoGK::on_pushButton_clicked() +{ + int nZone1, nZone2; + bool south; + + int XL, YL; + int XL1, YL1; + + + double CB2=8376121.0; + double CB4=590.42; + double CB6=1.68; + + double CA2=5333.5419; + double CA4=4.84339; + double CA6=0.007622; + + double A1,A2,A3,B1,B2,B3,C1,C2,C3,D1,D2,D3, + P,PU,G,E,EU,FI,L0,TGA,TGL,U,V,TG,SFI, + EL,TGE,THP; + + + nZone1 = ui->lineEdit->text().toInt(); + south = ui->checkBox->isChecked(); + + XL = ui->lineEdit_2->text().toInt(); + YL = ui->lineEdit_3->text().toInt(); + + nZone2 = ui->lineEdit_4->text().toInt(); + // + + V=YL-500000.0; + U=XL/6367558.497; + V=V/6367558.497; + A1=sin(2.0*U); + B1=cos(2.0*U); + A2=2.0*A1*B1; + B2=1.0-2.0*A1*A1; + A3=A1*B2+A2*B1; + B3=B1*B2-A1*A2; + C1=sinh(2.0*V); + D1=sqrt(1.0+C1*C1); + C2=2.0*C1*D1; + D2=1.0+2.0*C1*C1; + C3=C1*D2+C2*D1; + D3=C1*C2+D1*D2; + E=U-(CB2*A1*D1+CB4*A2*D2+CB6*A3*D3)*0.0000000001; + P=V-(CB2*B1*C1+CB4*B2*C2+CB6*B3*C3)*0.0000000001; + EU=10000000000.0-(2.0*CB2*B1*D1+4.0*CB4*B2*D2+ + 6.0*CB6*B3*D3); + PU=(2.0*CB2*A1*C1+4.0*CB4*A2*C2+6.0*CB6*A3*C3); + SFI=sin(E)/cosh(P); + TGL=sinh(P)/cos(E); + TGA=SFI*TGL; + FI=asin(SFI); + B=(5645.0*SFI*SFI-531245.0)*SFI*SFI; + B=(B+67385254.0)*SFI*cos(FI)*0.0000000001; + B=B+FI; + TG=PU/EU; + G=atan(TGA)+atan(TG); + L=atan(TGL); + L0=double(nZone1)*6.0-3.0; + L0=L0*M_PI/180.0; + L=L+L0; + if (L<0.0) L=L+(2.0*M_PI); + else if (L>(2.0*M_PI)) L=L-(2.0*M_PI); + + + + L0=double(nZone2)*6.0-3.0; + L0=L0*M_PI/180.0; + EL=L-L0; + FI=(2624.0*sin(B)*sin(B)+372834.0)*sin(B)*sin(B); + FI=B-((FI+66934216.0)*sin(B)*cos(B)*0.0000000001); + TGE=tan(FI)/cos(EL); + E=atan(TGE); + THP=cos(FI)*sin(EL); + P=0.5*log((1.0+THP)/(1.0-THP)); + A1=sin(2.0*E); + B1=cos(2.0*E); + C1=sinh(2.0*P); + D1=cosh(2.0*P); + A2=2.0*A1*B1; + B2=1.0-2.0*A1*A1; + C2=2.0*C1*D1; + D2=1.0+2.0*C1*C1; + A3=A1*B2+A2*B1; + B3=B1*B2-A1*A2; + C3=C1*D2+C2*D1; + D3=D1*D2+C1*C2; + + XL1 = (int)(6367558.497*E+CA2*A1*D1+CA4*A2*D2+CA6*A3*D3); + if (XL1<0) XL1=-XL1; + + YL1 = (int)(6367558.497*P+CA2*B1*C1+CA4*B2*C2+CA6*B3*C3 + 500000.0); + + + ui->lineEdit_5->setText(QString::number(XL1)); + ui->lineEdit_6->setText(QString::number(YL1)); +} diff --git a/gktogk.h b/gktogk.h new file mode 100644 index 0000000..29a9b0a --- /dev/null +++ b/gktogk.h @@ -0,0 +1,30 @@ +#ifndef GKTOGK_H +#define GKTOGK_H + +#include +#include "widget.h" +#include "geo.h" + +namespace Ui { +class GKtoGK; +} + +class GKtoGK : public QDialog +{ + Q_OBJECT + +public: + explicit GKtoGK(QWidget *parent = 0); + ~GKtoGK(); + +private slots: + void on_pushButton_2_clicked(); + void closeEvent(QCloseEvent *event); + void on_pushButton_clicked(); + +private: + Ui::GKtoGK *ui; + double B, L, l; +}; + +#endif // GKTOGK_H diff --git a/gktogk.ui b/gktogk.ui new file mode 100644 index 0000000..3d804e9 --- /dev/null +++ b/gktogk.ui @@ -0,0 +1,317 @@ + + + GKtoGK + + + + 0 + 0 + 250 + 307 + + + + Гаусса-Крюгера (зона1-зона2) + + + + + 10 + 10 + 231 + 171 + + + + + + + + + 20 + 20 + 201 + 16 + + + + Номер зоны 1 + + + + + + 140 + 20 + 51 + 20 + + + + 0 + + + + + + 140 + 50 + 70 + 17 + + + + + + + + + + 20 + 50 + 111 + 16 + + + + Южное полушарие + + + + + + 140 + 80 + 51 + 20 + + + + 0 + + + + + + 20 + 80 + 41 + 16 + + + + XL1 + + + + + + 20 + 110 + 41 + 16 + + + + YL1 + + + + + + 140 + 110 + 51 + 20 + + + + 0 + + + + + + 20 + 140 + 81 + 16 + + + + Номер зоны 2 + + + + + + 140 + 140 + 51 + 20 + + + + 0 + + + + + + 195 + 82 + 41 + 16 + + + + м + + + + + + 195 + 112 + 41 + 16 + + + + м + + + + + + + 10 + 180 + 231 + 80 + + + + + + + + + 195 + 50 + 41 + 16 + + + + м + + + + + + 140 + 18 + 51 + 20 + + + + 0 + + + + + + 20 + 48 + 41 + 16 + + + + YL1 + + + + + + 20 + 18 + 41 + 16 + + + + XL1 + + + + + + 140 + 48 + 51 + 20 + + + + 0 + + + + + + 195 + 20 + 41 + 16 + + + + м + + + + + + + 10 + 270 + 75 + 23 + + + + Запрос + + + + + + 160 + 270 + 75 + 23 + + + + Отказ + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+ + checkboxmod + QCheckBox +
checkboxmod.h
+
+
+ + +
diff --git a/grairobject.cpp b/grairobject.cpp new file mode 100644 index 0000000..82d719d --- /dev/null +++ b/grairobject.cpp @@ -0,0 +1,253 @@ +#include "grairobject.h" +#include "widget.h" + +grAirObject::grAirObject(QWidget *parent) +{ + aType = gType = 0; + lX = lY = oldLX = oldLY = 0; + pic.load(":new/pics/type_0e.xpm"); + wid = hei = 15; + scIndex = 1; + coler = new QGraphicsColorizeEffect(); + coler->setColor(Qt::yellow); + + for (int i=0; i<4; i++) altPoly[i].clear(); + altPoly[0].setPoints(3, 31,15, 40,15, 35,20); + altPoly[1].setPoints(4, 31,20, 40,20, 40,23, 31,23); + altPoly[2].setPoints(4, 31,22, 40,22, 40,15, 31,15); + altPoly[3].setPoints(3, 31,20, 40,20, 35,15); +} + +QRectF grAirObject::boundingRect() const +{ + qreal d = 250/scIndex; + if (d<250) d=250; + + return QRectF(-50+lX/scIndex,-50+lY/scIndex,d,d); +} + +void grAirObject::setInfoForRocket(qreal cX, qreal cY, qreal cH, qreal vx, qreal vy) +{ + rX = cX; + rY = cY; + rH = cH; + rVx = vx; + rVy = vy; + rV0 = sqrt(vx*vx+vy*vy); +} + +void grAirObject::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +{ + + if (exist) + { + QPen locPen; + qreal an = 0; + locPen.setWidthF(1.3); + painter->setPen(locPen); +// + if (v0) { + QLineF lf(0, 0, vY, -vX); +// QLineF lf(oldLX, oldLY, lX, lY); + an = lf.angle(); + lf = QLineF(lX/scIndex, lY/scIndex, 0, 0); + lf.setAngle(an); + lf.setLength(v0*10); + painter->drawLine(lf); + painter->drawEllipse(lX/scIndex, lY/scIndex, 1, 1); + + + + } + + + QImage im(50,50,QImage::Format_ARGB32); + im.fill(Qt::transparent); + + QPainter *p = new QPainter(&im); + p->setBrush(Qt::SolidPattern); + +// + if ((viewSettings==0)||(viewSettings==2)) + p->drawPixmap(15, 15, pic); +// + if ((viewSettings!=1)&&(viewSettings!=3)) + p->drawPolygon(altPoly[alt]); +// + if ((viewSettings!=1)&&(viewSettings!=2)) + { + QFont f = p->font(); + f.setPointSizeF(7); + p->setFont(f); + p->drawText(32, 33, QString::number(numb)); + } + p->end(); + + if ((an>45)&&(an<210)) + painter->drawImage(lX/scIndex-10, lY/scIndex-15, im); + else + painter->drawImage(lX/scIndex-35, lY/scIndex-45, im); + + } + else + { + painter->setBrush(Qt::NoBrush); + painter->setPen(Qt::NoPen); + painter->drawPoint(0,0); + + } + + + +} + +void grAirObject::setScaleIndex(qreal s) +{ + if (scIndex!=s){ + prepareGeometryChange(); + scIndex=s; + } + +} + +void grAirObject::setCoord(qreal cx, qreal cy, qreal ch) +{ + + cX = cx; cY= cy; cH = ch; + + prepareGeometryChange(); + oldLX = lX; + oldLY = lY; + + + + lX=cy; + lY=-cx; + + if (ch>=60) alt = 3; + else if ((ch>=30)&&(ch<60)) alt=2; + else if ((ch>=10)&&(ch<30)) alt=1; + else alt = 0; + +} + +void grAirObject::setCoord(qreal cx, qreal cy) +{ + setCoord(cx, cy, cH); +} + +void grAirObject::setSpeed(qreal vx, qreal vy) +{ + vX = vx; + vY = vy; + v0=sqrt(vX*vX+vY*vY); +} + +void grAirObject::moveByTime(qreal time) +{ + cX += vX*time; + cY += vY*time; + setCoord(cX, cY); +} + +void grAirObject::setAType(int d) +{ + switch (d) { + case 0: + case 1: + case 6: + case 7: + case 8: + case 10: + case 11: + + if (aType!=d) + { + prepareGeometryChange(); + aType = d; + }; + break; + default: + prepareGeometryChange(); + aType = 0; + break; + } + + setPic(); + +} + +void grAirObject::setGType(int d) +{ + if ((d>=0)&&(d<4)){ + if (gType!=d) + { + prepareGeometryChange(); + gType = d; + } + else + { +// prepareGeometryChange(); +// gType = 0; + } + } + setPic(); + + switch (gType) + { + case 3: + coler->setColor(Qt::magenta); + break; + case 2: + coler->setColor(Qt::red); + break; + case 1: + coler->setColor(Qt::green); + break; + default: + coler->setColor(Qt::yellow); + + } +} + +void grAirObject::setPic() +{ + QString s; + s=":/new/pics/type_"+QString::number(aType); + switch (gType) { + case 2: + case 3: + s+="o.xpm"; + break; + case 0: + case 1: + default: + s+="e.xpm"; + break; + } + + pic.load(s); + +} + +void grAirObject::setViewSettings(int d) +{ + if (viewSettings!=d) + { + prepareGeometryChange(); + viewSettings = d; + } +} + +void grAirObject::setNull() +{ + prepareGeometryChange(); + exist = false; + count = 0; + setCoord(10000, 10000, 0); + setAType(0); + setGType(0); + setSpeed(0, 0); + setInfoForRocket(10000,10000,0,0,0); + +} diff --git a/grairobject.h b/grairobject.h new file mode 100644 index 0000000..dd27148 --- /dev/null +++ b/grairobject.h @@ -0,0 +1,69 @@ +#ifndef GRAIROBJECT_H +#define GRAIROBJECT_H + +#include +#include +#include +#include +#include +#include + +enum grAirObjType { + targetUnknown=0, + targetEnemy, + targetOwn, + targetSpecial +}; + +class grAirObject : public QGraphicsItem +{ +public: + grAirObject(QWidget *parent = 0); + QRectF boundingRect() const; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + + qreal cX, cY, cH; + qreal lX, lY; + qreal v0, vX, vY; + + + qreal rX,rY,rH,rVx,rVy, rV0; + + qreal oldLX, oldLY; + int alt, aType, gType; + QPixmap pic; + qreal scIndex; + qreal wid, hei; + bool exist; + int numb; + QGraphicsColorizeEffect *coler; + QPolygon altPoly[4]; + int viewSettings; + int count; + + void setCoord(qreal cx, qreal cy, qreal ch); + void setCoord(qreal cx, qreal cy); + void setSpeed(qreal vx, qreal vy); + void moveByTime(qreal time); + QPointF speeds(int d=0) { if (d) return QPointF(rVx, rVy); else return QPointF(vX, vY);} + QPointF coords(int d=0) { if (d) return QPointF(rX, rY); else return QPointF(cX, cY);} + QPointF coordsL() {return QPointF(lX, lY);} // + + void setInfoForRocket(qreal cX, qreal cY, qreal cH, qreal vx, qreal vy); + + void setAType(int d); + void setGType(int d); +// void setWidth(qreal w) { if (wid!=w) {prepareGeometryChange();wid=w;}} +// void setHeight(qreal h) { if (hei!=h) {prepareGeometryChange();hei=h;}} + void setScaleIndex(qreal s); + + void setNull(); +public slots: + void setViewSettings(int d); + +protected: + void setPic(); + +}; + +#endif // GRAIROBJECT_H diff --git a/graphicsarcitem.cpp b/graphicsarcitem.cpp new file mode 100644 index 0000000..b32b29b --- /dev/null +++ b/graphicsarcitem.cpp @@ -0,0 +1,93 @@ +#include "graphicsarcitem.h" + +graphicsArcItem::graphicsArcItem(qreal x, qreal y, qreal r, qreal a1, qreal a2) +{ + this->x = x; + this->y = y; + this->r = r; + this->a1 = a1; + this->a2 = a2; + this->col = QColor(Qt::black); + this->textLeft=""; + this->textRight=""; + this->textVisible=false; +} + +QRectF graphicsArcItem::boundingRect() const +{ + return QRectF(x-r, y-r, 2*r, 2*r); +} + +//QPainterPath graphicsArcItem::shape() const +//{ +// QPainterPath path; +// path.moveTo(x+r, y+r); +// path.arcTo(boundingRect(), a2, a1); +// return path; +//} + +void graphicsArcItem::setColor(QColor c) +{ + if (col!=c) { + prepareGeometryChange(); + col = c; + } +} +void graphicsArcItem::setRadius(qreal rr) +{ + if (r!=rr) { + prepareGeometryChange(); + r = rr; + } +} + +void graphicsArcItem::setAngle1(qreal a) +{ + if (a1 != a) { + prepareGeometryChange(); + a1=a; + } +} +void graphicsArcItem::setAngle2(qreal a) +{ + if (a2 != a) { + prepareGeometryChange(); + a2=a; + } +} +void graphicsArcItem::setAngles(qreal aa, qreal ab) +{ + setAngle1(aa); + setAngle2(ab); +} + +void graphicsArcItem::setText(QString str1, QString str2) +{ + if ((textLeft!=str1)||(textRight!=str2)) + { + prepareGeometryChange(); + textLeft = str1; + textRight = str2; + } +} + +void graphicsArcItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +{ + painter->setPen(QPen(col)); + painter->drawPie(boundingRect(), a1*16, (a2-a1)*16); + + if (textVisible) + { + + qreal fs = r/223; + + + painter->setPen(QPen(Qt::white)); + QFont f = painter->font(); + f.setPointSizeF(fs*7); + painter->setFont(f); + + painter->drawText(x+0.95*r*cos(a1/180*M_PI), y-0.95*r*sin(a1/180*M_PI), textLeft); + painter->drawText(x+0.95*r*cos(a2/180*M_PI), y-0.95*r*sin(a2/180*M_PI), textRight); + } +} diff --git a/graphicsarcitem.h b/graphicsarcitem.h new file mode 100644 index 0000000..cdf41e8 --- /dev/null +++ b/graphicsarcitem.h @@ -0,0 +1,48 @@ +#ifndef GRAPHICSARCITEM_H +#define GRAPHICSARCITEM_H + +#include +#include +#include +#include "math.h" + +class graphicsArcItem : public QGraphicsItem +{ +public: + graphicsArcItem(qreal x=0, qreal y=0, qreal r=0, qreal a1=0, qreal a2=0); + QRectF boundingRect() const; +// QPainterPath shape() const; + + + + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + + qreal radius() {return r;} + QColor color() {return col;} + qreal angle1() {return a1;} + qreal angle2() {return a2;} + void setColor(QColor c); + void setRadius(qreal rr); + void setAngle1(qreal a); + void setAngle2(qreal a); + void setAngles(qreal aa, qreal ab); + bool isTextVisible() {return textVisible;} + void setTextVisible(bool fl) {textVisible=fl;} + + void setText(QString str1="", QString str2=""); + void setText1(QString str) {prepareGeometryChange();textLeft=str;} + void setText2(QString str) {prepareGeometryChange();textRight=str;} + + + +private: + qreal x, y, r, a1, a2; + QColor col; + bool textVisible; + QString textLeft, textRight; +}; + +#endif // GRAPHICSARCITEM_H + + diff --git a/graphicscrossitem.cpp b/graphicscrossitem.cpp new file mode 100644 index 0000000..f367f39 --- /dev/null +++ b/graphicscrossitem.cpp @@ -0,0 +1,73 @@ +#include "graphicscrossitem.h" + +graphicsCrossItem::graphicsCrossItem(qreal px, qreal py) +{ + x = px; + y = py; + dim=3; + col = QColor(Qt::lightGray); + scIndex=1; + +} + +QRectF graphicsCrossItem::boundingRect() const +{ + qreal d = dim*scIndex; + + return QRectF(x-d, y-d, 2*d, 2*d); +} + + +void graphicsCrossItem::setColor(QColor c) +{ + if (col!=c) { + prepareGeometryChange(); + col = c; + } +} + +void graphicsCrossItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +{ + qreal d = dim*scIndex; + painter->setPen(QPen(col)); + QPointF p1(x-d, y-d); + QPointF p2(x+d, y+d); + QPointF p3(x-d, y+d); + QPointF p4(x+d, y-d); + + painter->drawLine(p1, p2); + painter->drawLine(p3, p4); + +} + +void graphicsCrossItem::setPos(QPointF p) +{ + qreal px, py; + px= p.x(); py= p.y(); + + if ((x!=px)||(y!=py) ) { + prepareGeometryChange(); + x=px; y=py; + } +} + +void graphicsCrossItem::setPosPolar(qreal d, qreal a) +{ + if (d>0) + { + setPos(cos((90-a)/180*M_PI)*d, -sin((90-a)/180*M_PI)*d); + } + else + { + setPos(0,0); + } +} + +void graphicsCrossItem::setScaleIndex(qreal s) +{ + if (scIndex!=s){ + prepareGeometryChange(); + scIndex=s; + } + +} diff --git a/graphicscrossitem.h b/graphicscrossitem.h new file mode 100644 index 0000000..68d3c40 --- /dev/null +++ b/graphicscrossitem.h @@ -0,0 +1,39 @@ +#ifndef GRAPHICSCROSSITEM_H +#define GRAPHICSCROSSITEM_H + +#include +#include +#include +#include "math.h" + +class graphicsCrossItem : public QGraphicsItem +{ +public: + graphicsCrossItem(qreal x=0, qreal y=0); + QRectF boundingRect() const; +// QPainterPath shape() const; + + + + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + + QColor color() {return col;} + void setColor(QColor c); + void setPos(QPointF p); + void setPos(qreal x, qreal y) {setPos(QPointF(x, y));} + + void setPosPolar(qreal d, qreal a); + + void setScaleIndex(qreal s); + +private: + qreal x, y, dim, scIndex; + QColor col; + +}; + + +#endif // GRAPHICSARCITEM_H + + diff --git a/graphicslineitem.cpp b/graphicslineitem.cpp new file mode 100644 index 0000000..ef4aa26 --- /dev/null +++ b/graphicslineitem.cpp @@ -0,0 +1,239 @@ +#include "graphicslineitem.h" + +graphicsLineItem::graphicsLineItem(QObject *parent) + +{ + x0 = x1 = y0 = y1 = wid = 0; + drawCircles = 0; + col = QColor(Qt::black); +} + +QRectF graphicsLineItem::boundingRect() const +{ + QPointF p1; + if (x0>x1) { + if (y0>y1) p1 = QPointF(x1, y1); + else p1 = QPointF(x1, y0); + } + else + { + if (y0>y1) p1 = QPointF(x0, y1); + else p1 = QPointF(x0, y0); + } + + QSizeF s = QSizeF(fabs(x0-x1), fabs(y0-y1)); + + return QRectF(p1, s); +} + +void graphicsLineItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +{ + + QPen p; + QFont f = painter->font(); + + + + p.setColor(col); + p.setWidthF(wid); + p.setCapStyle(Qt::FlatCap); + + painter->setPen(p); + painter->setBrush(QBrush(Qt::SolidPattern)); + painter->drawLine(QPointF(x0,y0), QPointF(x1, y1)); + if (drawCircles&0x1) painter->drawEllipse(QPointF(x0,y0), wid*1.5, wid*1.5); + if (drawCircles&0x2) painter->drawEllipse(QPointF(x1,y1), wid*1.5, wid*1.5); + + + painter->save(); + for (int i=0; i<2; i++) + { + if (! str[i].txt.isEmpty()) + { + p.setColor(str[i].col); + f.setPointSizeF(str[i].size); + + painter->setFont(f); + painter->setPen(p); + painter->drawText(str[i].pos, str[i].txt); + } + } + painter->restore(); + +} + +void graphicsLineItem::setCircles(bool f1, bool f2) +{ + int ret = 0x0; + if (f1) ret+=0x1; + if (f2) ret+=0x2; + drawCircles=ret; +} + +void graphicsLineItem::setColor(QColor c) +{ + if (col!=c) + { + prepareGeometryChange(); + col = c; + } +} + +QPointF graphicsLineItem::pos0() {return QPointF(x0,y0);} +QPointF graphicsLineItem::pos1() {return QPointF(x1,y1);} + +void graphicsLineItem::setPos0(QPointF p) +{ + qreal x, y; + x= p.x(); y= p.y(); + + if ((x0!=x)||(y0!=y) ) { + prepareGeometryChange(); + x0=x; y0=y; + } +} + + + + + + + +void graphicsLineItem::setPos1(QPointF p) +{ + qreal x, y; + x= p.x(); y= p.y(); + + if ((x1!=x)||(y1!=y) ) { + prepareGeometryChange(); + x1=x; y1=y; + } +} + +qreal graphicsLineItem::length() +{ + QLineF lf = QLineF(x0,y0,x1,y1); + return lf.length(); +} + +void graphicsLineItem::setLength(qreal l) +{ + QLineF lf = QLineF(x0,y0,x1,y1); + lf.setLength(l); + + QPointF p = lf.p2(); + + if ((x1!=p.x())||(y1!=p.y())) { + prepareGeometryChange(); + x1=p.x(); y1=p.y(); + } +} + +void graphicsLineItem::setAngle(qreal a) +{ + QLineF lf = QLineF(x0,y0,x1,y1); + lf.setAngle(a); + + QPointF p = lf.p2(); + + if ((x1!=p.x())||(y1!=p.y())) { + prepareGeometryChange(); + x1=p.x(); y1=p.y(); + } + +} + +void graphicsLineItem::setGlobalAngle(qreal a) // 0,0 +{ + QLineF lf, lf1; + + lf = QLineF(0,0,x0,y0); + lf.setAngle(a); + QPointF p = lf.p2(); + lf1 = QLineF(0,0,x1,y1); + lf1.setAngle(a); + QPointF p1 = lf1.p2(); + + if ((x0!=p.x())||(y0!=p.y())||(x1!=p1.x())||(y1!=p1.y())) { + prepareGeometryChange(); + x0=p.x(); y0=p.y(); + x1=p1.x(); y1=p1.y(); + } + +} + +void graphicsLineItem::setWidth(qreal w) +{ + if (wid!=w) { + prepareGeometryChange(); + wid = w; + } +} + + + +void graphicsLineItem::setText(QString s, int d) +{ + if ((d==0)||(d==1)) + if (str[d].txt!=s) + { + prepareGeometryChange(); + str[d].txt = s; + } +} + +void graphicsLineItem::setTextPos(QPointF p, int d) +{ + if ((d==0)||(d==1)) + if (str[d].pos!=p) { + prepareGeometryChange(); + str[d].pos = p; + } +} + +void graphicsLineItem::setTextColor(QColor c, int d) +{ + if ((d==0)||(d==1)) + if (str[d].col!=c) { + prepareGeometryChange(); + str[d].col = c; + } +} + +QString graphicsLineItem::getText(int d) +{ + if ((d==0)||(d==1)) return str[d].txt; + else return 0; + +} + +QColor graphicsLineItem::getTextColor(int d) +{ + if ((d==0)||(d==1)) return str[d].col; + else return QColor(Qt::black); + +} + +QPointF graphicsLineItem::getTextPos(int d) +{ + if ((d==0)||(d==1)) return str[d].pos; + else return QPointF(0,0); +} + +qreal graphicsLineItem::getTextSize(int d) +{ + if ((d==0)||(d==1)) + return str[d].size; + else return 0; +} + +void graphicsLineItem::setTextSize(qreal s, int d) +{ + if ((d==0)||(d==1)) + if (str[d].size!=s) { + prepareGeometryChange(); + str[d].size = s; + } +} + + diff --git a/graphicslineitem.h b/graphicslineitem.h new file mode 100644 index 0000000..a6c630f --- /dev/null +++ b/graphicslineitem.h @@ -0,0 +1,68 @@ +#ifndef GRAPHICSLINEITEM_H +#define GRAPHICSLINEITEM_H + +#include +#include +#include + +struct T_txtAttr +{ + QString txt; + QColor col; + QPointF pos; + qreal size; +}; + +class graphicsLineItem : public QGraphicsLineItem +{ + +public: + graphicsLineItem(QObject *parent = 0); + + QRectF boundingRect() const; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + + void setColor(QColor c); + QColor color() {return col;} + QPointF pos0(); + QPointF pos1(); + void setPos0(QPointF p); + void setPos0(qreal a, qreal b) {setPos0(QPointF(a, b));} + void setPos0(int a, int b) {setPos0(qreal(a), qreal(b));} + + void setPos1(QPointF p); + void setPos1(qreal a, qreal b) {setPos1(QPointF(a, b));} + void setPos1(int a, int b) {setPos1(qreal(a), qreal(b));} + + qreal length(); + void setLength(qreal l); + void setAngle(qreal a); + void setGlobalAngle(qreal a); + void setWidth(qreal w); + + QString getText(int d=0) ; + QPointF getTextPos(int d=0); + QColor getTextColor(int d=0); + qreal getTextSize(int d=0); + + void setText(QString s, int d=0); + void setTextPos(QPointF p, int d=0); + void setTextColor(QColor c, int d =0); + void setTextSize(qreal s, int d = 0); + + void setCircles(bool f1, bool f2); + + +private: + qreal x0,x1,y0,y1; + QColor col; + qreal wid; + + T_txtAttr str[2]; + + int drawCircles; + + +}; + +#endif // GRAPHICSLINEITEM_H diff --git a/graphicsviewmod.cpp b/graphicsviewmod.cpp new file mode 100644 index 0000000..c0290fc --- /dev/null +++ b/graphicsviewmod.cpp @@ -0,0 +1,129 @@ +#include "graphicsviewmod.h" + + +GraphicsViewMod::GraphicsViewMod(QWidget *parent):QGraphicsView(parent) +{ + setViewportUpdateMode(QGraphicsView::FullViewportUpdate); + setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + scMeter = 1; + ugR = ugL = numT = 0; + +} + + +void GraphicsViewMod::drawBackground(QPainter *painter, const QRectF &rect) +{ + + painter->save(); + painter->setBrush(QBrush(Qt::black)); + painter->drawRect(rect); + painter->restore(); + + painter->setBackground(QBrush(Qt::black)); + painter->setBackground(QBrush(Qt::SolidPattern)); + + QPen p = painter->pen(); + painter->setPen(QColor(Qt::lightGray)); + + + qreal d = 30; + qreal rad = height()/2 - d; + QPointF cent=QPointF(width()/2, height()/2); + QRect cr = QRect(cent.x()-rad, cent.y()-rad, rad*2, rad*2); + + + + painter->drawEllipse(mapToScene(QPolygon(cr)).boundingRect()); + + qreal lx1, lx2, ly1, ly2; + qreal phi; + qreal lin = 2; + QPolygonF poly; + QString str; + QFont f = painter->font(); + + cr.setSize(QSize(1,1)); + qreal fs = mapToScene(cr).boundingRect().height(); + + f.setPointSizeF(fs*10); + painter->setFont(f); + + + for (int i=0; i<60; i++) + { + phi = 2*M_PI/60*i; + + lx1=(rad-lin)*sin(phi)+cent.x(); + ly1=-(rad-lin)*cos(phi)+cent.y(); + + lx2 = lx1+2*lin*sin(phi); + ly2 = ly1-2*lin*cos(phi); + + poly.clear(); + poly << mapToScene(QPoint(lx1, ly1)) << mapToScene(QPoint(lx2, ly2)); + painter->drawPolygon(poly); + + lx2 = lx1+6*lin*sin(phi)-4; + ly2 = ly1-6*lin*cos(phi)+4; + + + str = QString::number(i); + + + painter->drawText(mapToScene(QPoint(lx2, ly2)), str); + + } + + + int du, mdu; + str.clear(); + if (ugL<0){ str.append("-");} + + du = abs(ugL)/100; mdu = abs(ugL)%100; + if (du<10) str.append("0"); + str.append(QString::number(du)); + str.append("-"); + if (mdu<10) str.append("0"); + str.append(QString::number(mdu)); + + painter->drawText(mapToScene(QPoint(width()-45, 22)), str); + + str.clear(); + if (ugR<0) { str.append("-");} + + du = abs(ugR)/100; mdu = abs(ugR)%100; + if (du<10) str.append("0"); + str.append(QString::number(du)); + str.append("-"); + if (mdu<10) str.append("0"); + str.append(QString::number(mdu)); + + painter->drawText(mapToScene(QPoint(width()-45, 33)), str); + + if (numT<0) numT = 0; + str.setNum(numT); + painter->drawText(mapToScene(QPoint(width()-45, 44)), str); + +// str.setNum(scMeter); +// painter->drawText(mapToScene(QPoint(cent.x()+40,cent.y()+40)), str); + + +} + + + + +void GraphicsViewMod::wheelEvent(QWheelEvent *e) +{ + int num = e->delta()/120; + if (num!=0) + { + + + } + + e->accept(); + centerOn(0,0); + +} diff --git a/graphicsviewmod.h b/graphicsviewmod.h new file mode 100644 index 0000000..a9666aa --- /dev/null +++ b/graphicsviewmod.h @@ -0,0 +1,28 @@ +#ifndef GRAPHICSVIEWMOD_H +#define GRAPHICSVIEWMOD_H + +#include +#include +#include +#include +#include "math.h" + +class GraphicsViewMod : public QGraphicsView +{ +public: + GraphicsViewMod(QWidget *parent); + qreal scMeter; + int ugL, ugR, numT; + + void setMissUgL(int ug) {ugL = ug;} + void setMissUgR(int ug) {ugR = ug;} + void setMissUg(int ugL, int ugR) {setMissUgL(ugL); setMissUgR(ugR);} + void setNumTarg(int num) {numT = num;} +protected: + void drawBackground(QPainter *painter, const QRectF &rect); + +private: + virtual void wheelEvent(QWheelEvent *event); +}; + +#endif // GRAPHICSVIEWMOD_H diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..42ebad6 --- /dev/null +++ b/main.cpp @@ -0,0 +1,68 @@ +#include +#include "widget.h" + +#include + + + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + + + Widget w; + QString str; + + QFile f("c:/Shilka_exe/global.ini"); + int c=0; + + + + if (f.open(QIODevice::ReadOnly |QIODevice::Text )) + { + while (!f.atEnd()) + { + c++; + str = QString(f.readLine()); + switch (c) + { + case 1: + if (str.section('=', 1, 1).toInt()) + w.setWindowState(Qt::WindowFullScreen); + break; + case 2: + // silentMode + w.silentMode = str.section('=',1,1).toInt(); + break; + case 3: + // quickLoad + w.quickLoad = str.section('=', 1, 1).toInt(); + + break; + case 4: + w.keybMaxDelay = str.section('=', 1, 1).toInt(); + if (w.keybMaxDelay<10) w.keybMaxDelay = 10; + break; + case 5: + w.loadingShift = str.section('=',1,1).toInt(); + break; + } + + } + } + else + { + w.loadingShift=50; + w.keybMaxDelay=20; +// w.setWindowState(Qt::WindowFullScreen); + w.quickLoad = true; + w.silentMode = false; + + } + + + + w.show(); + + return a.exec(); +} diff --git a/menubarmod.cpp b/menubarmod.cpp new file mode 100644 index 0000000..e69ee50 --- /dev/null +++ b/menubarmod.cpp @@ -0,0 +1,38 @@ +#include "menubarmod.h" + +#include + +MenuBarMod::MenuBarMod(QWidget *parent) : + QMenuBar(parent) +{ + setNativeMenuBar(false); + setStyleSheet("QMenuBar::item:selected { background: #a8a8a8;}"); + +} + +void MenuBarMod::keyPressEvent(QKeyEvent *e) +{ + + QList al = this->actions(); + bool fl=true; + + if (!al.isEmpty()) + { + + + if ((e->key()==Qt::Key_Right)&&(al.last()==activeAction())) { + setActiveAction(0); + emit rightPressed(uid); + fl=false; + } + + if ((e->key()==Qt::Key_Left)&&(al.at(0)==activeAction())) { + setActiveAction(0); + emit leftPressed(uid); + fl=false; + } + } + + + if (fl) QMenuBar::keyPressEvent(e); +} diff --git a/menubarmod.h b/menubarmod.h new file mode 100644 index 0000000..2d58321 --- /dev/null +++ b/menubarmod.h @@ -0,0 +1,24 @@ +#ifndef MENUBARMOD_H +#define MENUBARMOD_H + +#include +#include +#include +#include + +class MenuBarMod : public QMenuBar +{ + Q_OBJECT +public: + explicit MenuBarMod(QWidget *parent = 0); + + int uid; +signals: + void rightPressed(int); + void leftPressed(int); +public slots: + +private: + virtual void keyPressEvent ( QKeyEvent * e ); +}; +#endif // MENUBARMOD_H diff --git a/meteosred.cpp b/meteosred.cpp new file mode 100644 index 0000000..5c26660 --- /dev/null +++ b/meteosred.cpp @@ -0,0 +1,73 @@ +#include "meteosred.h" +#include "ui_meteosred.h" + + +meteosred::meteosred(QWidget *parent) : + QDialog(parent), + ui(new Ui::meteosred) +{ + ui->setupUi(this); + + this->setAttribute(Qt::WA_DeleteOnClose); + Widget *w = (Widget*)parent; + w->changeOpenWidget(this); + + ui->checkBox->setChecked(w->meteoAvtonom); + ui->checkBox->uid=1; + + ui->checkBox_2->setChecked(w->meteoSred); + ui->checkBox_2->uid=2; + + connect(ui->checkBox, SIGNAL(clicked()), this, SLOT(changeItems())); + connect(ui->checkBox_2, SIGNAL(clicked()), this, SLOT(changeItems())); + +} + +void meteosred::closeEvent(QCloseEvent *event) +{ + ((Widget*)parent())->clearOpenWidget(); + event->accept(); +} + +meteosred::~meteosred() +{ + delete ui; +} + +void meteosred::changeItems() +{ + switch (((checkboxmod*)sender())->uid) + { + case 1: + ui->checkBox_2->setChecked(!(ui->checkBox->isChecked())); + break; + case 2: + ui->checkBox->setChecked(!(ui->checkBox_2->isChecked())); + break; + default: + break; + } +} + + +void meteosred::on_pushButton_2_clicked() +{ + close(); +} + +void meteosred::on_pushButton_clicked() +{ + bool l, l1; + Widget *w = (Widget*)parent(); + + + l = ui->checkBox->isChecked(); + l1 = ui->checkBox_2->isChecked(); + + w->setMeteo(l, l1); + + ((Widget*)parent())->writeFile(); + + + close(); +} diff --git a/meteosred.h b/meteosred.h new file mode 100644 index 0000000..355af69 --- /dev/null +++ b/meteosred.h @@ -0,0 +1,31 @@ +#ifndef METEOSRED_H +#define METEOSRED_H + +#include +#include "widget.h" +namespace Ui { +class meteosred; +} + +class meteosred : public QDialog +{ + Q_OBJECT + +public: + explicit meteosred(QWidget *parent = 0); + ~meteosred(); + + +private slots: + void on_pushButton_2_clicked(); + + void on_pushButton_clicked(); + + void changeItems(); + + void closeEvent(QCloseEvent *event); +private: + Ui::meteosred *ui; +}; + +#endif // METEOSRED_H diff --git a/meteosred.ui b/meteosred.ui new file mode 100644 index 0000000..d41ad1d --- /dev/null +++ b/meteosred.ui @@ -0,0 +1,146 @@ + + + meteosred + + + + 0 + 0 + 218 + 129 + + + + + 218 + 129 + + + + + 218 + 129 + + + + Режимы метео + + + + + 10 + 10 + 201 + 71 + + + + + + + + + 120 + 10 + 70 + 17 + + + + Qt::RightToLeft + + + + + + false + + + + + + 120 + 40 + 70 + 17 + + + + Qt::RightToLeft + + + + + + false + + + + + + 10 + 10 + 111 + 16 + + + + Метеоавтономный + + + + + + 10 + 40 + 111 + 16 + + + + Метеосредний + + + + + + + 20 + 90 + 75 + 23 + + + + Ввод + + + + + + 130 + 90 + 75 + 23 + + + + Отмена + + + + + + checkboxmod + QCheckBox +
checkboxmod.h
+
+ + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+
+ + +
diff --git a/nastrel.cpp b/nastrel.cpp new file mode 100644 index 0000000..f62c858 --- /dev/null +++ b/nastrel.cpp @@ -0,0 +1,42 @@ +#include "nastrel.h" +#include "ui_nastrel.h" + +nastrel::nastrel(QWidget *parent) : + QDialog(parent), + ui(new Ui::nastrel) +{ + ui->setupUi(this); + this->setAttribute(Qt::WA_DeleteOnClose); + + ((Widget*)parent)->changeOpenWidget(this); + + + ZAnastrel = 0; + ZAnastrel = (((Widget*)parent)->ZAnastrel); + ui->lineEdit->setText(QString::number(ZAnastrel)); +} + +nastrel::~nastrel() +{ + delete ui; +} + +void nastrel::closeEvent(QCloseEvent *event) +{ + ((Widget*)parent())->clearOpenWidget(); + event->accept(); +} + +void nastrel::on_pushButton_2_clicked() +{ + + close(); +} + +void nastrel::on_pushButton_clicked() +{ + ZAnastrel = ui->lineEdit->text().toInt(); + ((Widget*)parent())->ZAnastrel = ZAnastrel; + ((Widget*)parent())->writeFile(); + close(); +} diff --git a/nastrel.h b/nastrel.h new file mode 100644 index 0000000..f8e886f --- /dev/null +++ b/nastrel.h @@ -0,0 +1,29 @@ +#ifndef NASTREL_H +#define NASTREL_H + +#include +#include "widget.h" + +namespace Ui { +class nastrel; +} + +class nastrel : public QDialog +{ + Q_OBJECT + +public: + explicit nastrel(QWidget *parent = 0); + ~nastrel(); + +private slots: + void on_pushButton_2_clicked(); + void closeEvent(QCloseEvent *event); + void on_pushButton_clicked(); + +private: + Ui::nastrel *ui; + int ZAnastrel; +}; + +#endif // NASTREL_H diff --git a/nastrel.ui b/nastrel.ui new file mode 100644 index 0000000..12b293a --- /dev/null +++ b/nastrel.ui @@ -0,0 +1,88 @@ + + + nastrel + + + + 0 + 0 + 222 + 150 + + + + Ввод настрела стволов + + + + + 10 + 10 + 201 + 81 + + + + + + + + + 17 + 20 + 101 + 31 + + + + Настрел стволов + + + + + + 127 + 27 + 51 + 20 + + + + + + + + 20 + 110 + 75 + 23 + + + + Ввод + + + + + + 120 + 110 + 75 + 23 + + + + Отказ + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+
+ + +
diff --git a/ownadr.cpp b/ownadr.cpp new file mode 100644 index 0000000..9373c3b --- /dev/null +++ b/ownadr.cpp @@ -0,0 +1,33 @@ +#include "ownadr.h" +#include "ui_ownadr.h" + +ownAdr::ownAdr(QWidget *parent) : + QDialog(parent), + ui(new Ui::ownAdr) +{ + ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + + ((Widget*)parent)->changeOpenWidget(this); +} + +ownAdr::~ownAdr() +{ + delete ui; +} + +void ownAdr::closeEvent(QCloseEvent *event) +{ + ((Widget*)parent())->clearOpenWidget(); + event->accept(); +} + +void ownAdr::on_pushButton_2_clicked() +{ + close(); +} + +void ownAdr::on_pushButton_clicked() +{ + close(); +} diff --git a/ownadr.h b/ownadr.h new file mode 100644 index 0000000..01ce127 --- /dev/null +++ b/ownadr.h @@ -0,0 +1,28 @@ +#ifndef OWNADR_H +#define OWNADR_H + +#include +#include "widget.h" + +namespace Ui { +class ownAdr; +} + +class ownAdr : public QDialog +{ + Q_OBJECT + +public: + explicit ownAdr(QWidget *parent = 0); + ~ownAdr(); + +private slots: + void on_pushButton_2_clicked(); + void closeEvent(QCloseEvent *event); + void on_pushButton_clicked(); + +private: + Ui::ownAdr *ui; +}; + +#endif // OWNADR_H diff --git a/ownadr.ui b/ownadr.ui new file mode 100644 index 0000000..1e56f8b --- /dev/null +++ b/ownadr.ui @@ -0,0 +1,91 @@ + + + ownAdr + + + + 0 + 0 + 220 + 139 + + + + Собственный адрес + + + + + 130 + 100 + 75 + 23 + + + + Отказ + + + + + + 20 + 100 + 75 + 23 + + + + Ввод + + + + + + 10 + 10 + 201 + 81 + + + + + + + + + 17 + 20 + 101 + 31 + + + + Собственный адрес + + + + + + 135 + 25 + 51 + 20 + + + + 0 + + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+
+ + +
diff --git a/pics.qrc b/pics.qrc new file mode 100644 index 0000000..800cc85 --- /dev/null +++ b/pics.qrc @@ -0,0 +1,21 @@ + + + pics/type_0e.xpm + pics/type_0o.xpm + pics/type_1e.xpm + pics/type_1o.xpm + pics/type_6e.xpm + pics/type_6o.xpm + pics/type_7e.xpm + pics/type_7o.xpm + pics/type_8e.xpm + pics/type_8o.xpm + pics/type_10e.xpm + pics/type_10o.xpm + pics/type_11e.xpm + pics/type_11o.xpm + + + pics/loading.png + + diff --git a/pics/loading.png b/pics/loading.png new file mode 100644 index 0000000..b77676a Binary files /dev/null and b/pics/loading.png differ diff --git a/pics/type_0e.xpm b/pics/type_0e.xpm new file mode 100644 index 0000000..a64f68a --- /dev/null +++ b/pics/type_0e.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char *flier[]={ +"16 16 2 1", +"# c #000000", +". c none", +"................", +"................", +"................", +"................", +"................", +"................", +".......###......", +".....#######....", +".....#######....", +".....#######....", +".......###......", +"................", +"................", +"................", +"................", +"................"}; diff --git a/pics/type_0o.xpm b/pics/type_0o.xpm new file mode 100644 index 0000000..a64f68a --- /dev/null +++ b/pics/type_0o.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char *flier[]={ +"16 16 2 1", +"# c #000000", +". c none", +"................", +"................", +"................", +"................", +"................", +"................", +".......###......", +".....#######....", +".....#######....", +".....#######....", +".......###......", +"................", +"................", +"................", +"................", +"................"}; diff --git a/pics/type_10e.xpm b/pics/type_10e.xpm new file mode 100644 index 0000000..f1e79dc --- /dev/null +++ b/pics/type_10e.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char *flier[]={ +"16 16 2 1", +"# c #000000", +". c none", +"................", +"................", +"................", +"....#.....###...", +"....##...####...", +"....###.####....", +"....#######.....", +"....######......", +"....#######.....", +"...#########....", +"..####..........", +".####...........", +".###............", +".##.............", +"................", +"................"}; diff --git a/pics/type_10o.xpm b/pics/type_10o.xpm new file mode 100644 index 0000000..f1e79dc --- /dev/null +++ b/pics/type_10o.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char *flier[]={ +"16 16 2 1", +"# c #000000", +". c none", +"................", +"................", +"................", +"....#.....###...", +"....##...####...", +"....###.####....", +"....#######.....", +"....######......", +"....#######.....", +"...#########....", +"..####..........", +".####...........", +".###............", +".##.............", +"................", +"................"}; diff --git a/pics/type_11e.xpm b/pics/type_11e.xpm new file mode 100644 index 0000000..f1e79dc --- /dev/null +++ b/pics/type_11e.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char *flier[]={ +"16 16 2 1", +"# c #000000", +". c none", +"................", +"................", +"................", +"....#.....###...", +"....##...####...", +"....###.####....", +"....#######.....", +"....######......", +"....#######.....", +"...#########....", +"..####..........", +".####...........", +".###............", +".##.............", +"................", +"................"}; diff --git a/pics/type_11o.xpm b/pics/type_11o.xpm new file mode 100644 index 0000000..f1e79dc --- /dev/null +++ b/pics/type_11o.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char *flier[]={ +"16 16 2 1", +"# c #000000", +". c none", +"................", +"................", +"................", +"....#.....###...", +"....##...####...", +"....###.####....", +"....#######.....", +"....######......", +"....#######.....", +"...#########....", +"..####..........", +".####...........", +".###............", +".##.............", +"................", +"................"}; diff --git a/pics/type_1e.xpm b/pics/type_1e.xpm new file mode 100644 index 0000000..c3e2093 --- /dev/null +++ b/pics/type_1e.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char *flier[]={ +"16 16 2 1", +"# c #000000", +". c none", +"...........#....", +"....#.....##....", +"....##....###...", +"....##....###...", +"....##...###....", +"....##..###.....", +"....##.###......", +"....#####.......", +"....##########..", +"....###########.", +"...###..........", +"..###...........", +".###............", +"###.............", +"##..............", +"................"}; diff --git a/pics/type_1o.xpm b/pics/type_1o.xpm new file mode 100644 index 0000000..e2b7e1b --- /dev/null +++ b/pics/type_1o.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char *flier[]={ +"16 16 2 1", +"# c #000000", +". c none", +"...........#....", +"....#.....##....", +"....##....###...", +"....##....###...", +"....##...###....", +"...###..###.....", +"..####.###......", +".##.#####.......", +"##..##########..", +"....###########.", +"...###...##.....", +"..###...##......", +".###...##.......", +"###...##........", +"##..............", +"................"}; diff --git a/pics/type_6e.xpm b/pics/type_6e.xpm new file mode 100644 index 0000000..9f3401c --- /dev/null +++ b/pics/type_6e.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char *flier[]={ +"16 16 2 1", +"# c #000000", +". c none", +"................", +"................", +"................", +"................", +"...........##...", +"..........###...", +"....#....##.....", +"....######......", +"....#####.......", +"....#####.......", +"....#######.....", +"................", +"................", +"................", +"................", +"................"}; diff --git a/pics/type_6o.xpm b/pics/type_6o.xpm new file mode 100644 index 0000000..9f3401c --- /dev/null +++ b/pics/type_6o.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char *flier[]={ +"16 16 2 1", +"# c #000000", +". c none", +"................", +"................", +"................", +"................", +"...........##...", +"..........###...", +"....#....##.....", +"....######......", +"....#####.......", +"....#####.......", +"....#######.....", +"................", +"................", +"................", +"................", +"................"}; diff --git a/pics/type_7e.xpm b/pics/type_7e.xpm new file mode 100644 index 0000000..e16c144 --- /dev/null +++ b/pics/type_7e.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char *flier[]={ +"16 16 2 1", +"# c #000000", +". c none", +"................", +"................", +".........#......", +".........##.....", +"...#.....#####..", +"...#.....#####..", +"...##...########", +"...########.....", +"...#######......", +"...######.......", +"..#########.....", +".#############..", +"#####...........", +"###.............", +"................", +"................"}; diff --git a/pics/type_7o.xpm b/pics/type_7o.xpm new file mode 100644 index 0000000..e16c144 --- /dev/null +++ b/pics/type_7o.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char *flier[]={ +"16 16 2 1", +"# c #000000", +". c none", +"................", +"................", +".........#......", +".........##.....", +"...#.....#####..", +"...#.....#####..", +"...##...########", +"...########.....", +"...#######......", +"...######.......", +"..#########.....", +".#############..", +"#####...........", +"###.............", +"................", +"................"}; diff --git a/pics/type_8e.xpm b/pics/type_8e.xpm new file mode 100644 index 0000000..36afec0 --- /dev/null +++ b/pics/type_8e.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char *flier[]={ +"16 16 2 1", +"# c #000000", +". c none", +"................", +"................", +"..............##", +".............###", +".....##.....####", +"....##......##..", +"...##.......##..", +"..##...######...", +".##.#########...", +"##.###..####....", +"...#...#######..", +"...#..####......", +"...######.......", +"...####.##......", +"........#.......", +"................"}; diff --git a/pics/type_8o.xpm b/pics/type_8o.xpm new file mode 100644 index 0000000..36afec0 --- /dev/null +++ b/pics/type_8o.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char *flier[]={ +"16 16 2 1", +"# c #000000", +". c none", +"................", +"................", +"..............##", +".............###", +".....##.....####", +"....##......##..", +"...##.......##..", +"..##...######...", +".##.#########...", +"##.###..####....", +"...#...#######..", +"...#..####......", +"...######.......", +"...####.##......", +"........#.......", +"................"}; diff --git a/pushbuttonmod.cpp b/pushbuttonmod.cpp new file mode 100644 index 0000000..4267bda --- /dev/null +++ b/pushbuttonmod.cpp @@ -0,0 +1,51 @@ +#include "pushbuttonmod.h" + +pushbuttonmod::pushbuttonmod(QWidget *parent) : + QPushButton(parent) +{ + F11disabled = false; +} + +bool pushbuttonmod::isF11disabled() +{ + return F11disabled; +} + +void pushbuttonmod::setF11disabled(bool fl) +{ + F11disabled = fl; +} + +void pushbuttonmod::keyPressEvent(QKeyEvent *e) +{ + int c = e->key(); + bool fl = true; + + // qDebug("%x", c); + + if ((c==Qt::Key_F11)&& !F11disabled) + { + this->animateClick(); + } + + if ((uid==0x13)&&(c==Qt::Key_Left)) fl = false; + if ((uid==0x13)&&(c==Qt::Key_Up)) fl = false; + + if ((uid==0x1e)&&(c==Qt::Key_Right)) fl = false; + if ((uid==0x1e)&&(c==Qt::Key_Down)) fl = false; + // if ((c==Qt::Key_Tab)) fl = false; + + + if ((uid==0x11)&&(c==Qt::Key_Left)) fl = false; + if ((uid==0x11)&&(c==Qt::Key_Right)) fl = false; + + + + if (fl) QPushButton::keyPressEvent(e); +} + +void pushbuttonmod::focusOutEvent(QFocusEvent *e) +{ + + QPushButton::focusOutEvent(e); +} diff --git a/pushbuttonmod.h b/pushbuttonmod.h new file mode 100644 index 0000000..ee440fe --- /dev/null +++ b/pushbuttonmod.h @@ -0,0 +1,31 @@ +#ifndef PUSHBUTTONMOD_H +#define PUSHBUTTONMOD_H + +#include +#include + +class pushbuttonmod : public QPushButton +{ + Q_OBJECT +public: + explicit pushbuttonmod(QWidget *parent = 0); + + int uid; + + bool isF11disabled(); + void setF11disabled(bool fl); + + + +private: + void keyPressEvent(QKeyEvent *e); +// void focusInEvent(QFocusEvent *e); + virtual void focusOutEvent(QFocusEvent *e); + bool F11disabled; +signals: + +public slots: + +}; + +#endif // PUSHBUTTONMOD_H diff --git a/settings.txt b/settings.txt new file mode 100644 index 0000000..af54359 --- /dev/null +++ b/settings.txt @@ -0,0 +1,22 @@ +1 +0 +15 760 20 5 +0712081016051266016612080265141002671612036918140471201603732319027425210174252101742521017425210174252101742521017425217425217425217425217425217425217628222325 +0 +0 +0 +0 +6 0 500000 600000 100 +6 0 450000 650000 0 +0 250 0 0 3 +0 +29 0 21 0 +0 0 0 0 +30 +60 +0 +0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 +0 +0 +130 170 0 diff --git a/showcrc.cpp b/showcrc.cpp new file mode 100644 index 0000000..d0e0c29 --- /dev/null +++ b/showcrc.cpp @@ -0,0 +1,28 @@ +#include "showcrc.h" +#include "ui_showcrc.h" + +showCRC::showCRC(QWidget *parent) : + QDialog(parent), + ui(new Ui::showCRC) +{ + ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + + ((Widget*)parent)->changeOpenWidget(this); +} + +showCRC::~showCRC() +{ + delete ui; +} + +void showCRC::on_pushButton_clicked() +{ + close(); +} + +void showCRC::closeEvent(QCloseEvent *event) +{ + ((Widget*)parent())->clearOpenWidget(); + event->accept(); +} diff --git a/showcrc.h b/showcrc.h new file mode 100644 index 0000000..ab1c2f2 --- /dev/null +++ b/showcrc.h @@ -0,0 +1,26 @@ +#ifndef SHOWCRC_H +#define SHOWCRC_H + +#include +#include "widget.h" + +namespace Ui { +class showCRC; +} + +class showCRC : public QDialog +{ + Q_OBJECT + +public: + explicit showCRC(QWidget *parent = 0); + ~showCRC(); + +private slots: + void on_pushButton_clicked(); + void closeEvent(QCloseEvent *event); +private: + Ui::showCRC *ui; +}; + +#endif // SHOWCRC_H diff --git a/showcrc.ui b/showcrc.ui new file mode 100644 index 0000000..275e8ea --- /dev/null +++ b/showcrc.ui @@ -0,0 +1,52 @@ + + + showCRC + + + + 0 + 0 + 255 + 116 + + + + Контрольная сумма + + + + + 90 + 70 + 75 + 23 + + + + ОК + + + + + + 30 + 30 + 201 + 16 + + + + Контрольная сумма ПО: ХХХХХХХХ + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+
+ + +
diff --git a/table2z.cpp b/table2z.cpp new file mode 100644 index 0000000..097ec73 --- /dev/null +++ b/table2z.cpp @@ -0,0 +1,51 @@ +#include "table2z.h" +#include "ui_table2z.h" + +#include "vvod2z.h" + +table2Z::table2Z(QWidget *parent) : + QDialog(parent), + ui(new Ui::table2Z) +{ + ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + +// - + ui->tableWidget->setColumnCount(10); + ui->tableWidget->setRowCount(10); + QStringList nums; + for (int i=0; i<10; i++) nums << QString::number(i); + ui->tableWidget->setHorizontalHeaderLabels(nums); + + ui->tableWidget->setVerticalHeaderLabels(nums); + + char buf[1024]; + QFile file(":/new/table2z/text.txt"); + if (file.open(QFile::ReadOnly)) + { + for (int i=0; i<10; i++) + for (int j=0; j<10; j++) + { + file.readLine(buf, sizeof(buf)); + QTableWidgetItem *newItem = new QTableWidgetItem(QString::fromLocal8Bit(buf)); + ui->tableWidget->setItem(i,j, newItem); + } + + } +// + ui->lineEdit->setFocus(); +} + +table2Z::~table2Z() +{ + delete ui; +} + + +void table2Z::on_lineEdit_returnPressed() +{ + QString st = ui->lineEdit->text(); + if (!st.isEmpty()) ((vvod2z*)parent())->curCode = st.toInt(); + ((vvod2z*)parent())->msUpdate(); + close(); +} diff --git a/table2z.h b/table2z.h new file mode 100644 index 0000000..a0a14ed --- /dev/null +++ b/table2z.h @@ -0,0 +1,26 @@ +#ifndef TABLE2Z_H +#define TABLE2Z_H + +#include + +namespace Ui { +class table2Z; +} + +class table2Z : public QDialog +{ + Q_OBJECT + +public: + explicit table2Z(QWidget *parent = 0); + ~table2Z(); + + +private slots: + void on_lineEdit_returnPressed(); + +private: + Ui::table2Z *ui; +}; + +#endif // TABLE2Z_H diff --git a/table2z.qrc b/table2z.qrc new file mode 100644 index 0000000..308c3d1 --- /dev/null +++ b/table2z.qrc @@ -0,0 +1,5 @@ + + + table2z/text.txt + + diff --git a/table2z.ui b/table2z.ui new file mode 100644 index 0000000..28c59c9 --- /dev/null +++ b/table2z.ui @@ -0,0 +1,73 @@ + + + table2Z + + + + 0 + 0 + 667 + 482 + + + + Ввод команды 2Z + + + + + 2 + 2 + 663 + 453 + + + + + Arial + 6 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + Qt::ElideNone + + + 64 + + + 42 + + + + + + 570 + 460 + 51 + 20 + + + + + + + 520 + 464 + 46 + 13 + + + + Команда + + + + + + diff --git a/table2z/text.txt b/table2z/text.txt new file mode 100644 index 0000000..128e399 --- /dev/null +++ b/table2z/text.txt @@ -0,0 +1,100 @@ + + + + + + + + + + + + + . . + + + . + . + + + + + + + + +. +. + . . + + + + + +. + + + +. +. + 3 + + + + + + + + + . . + 4 + + N1 + N2 + N3 + N4 + + . + + + 5 + . + N1 + N2 + N3 + N4 + +( ) . + + . + + + N1 . + N2 . + N3 . + N4 . + . + . . . +() . + + + . + N1 + N2 + N3 + N4 + + N1 . . + +() . + + + N1 + N2 + N3 + N4 + + + + + diff --git a/tempzar.cpp b/tempzar.cpp new file mode 100644 index 0000000..c3d47bf --- /dev/null +++ b/tempzar.cpp @@ -0,0 +1,38 @@ +#include "tempzar.h" +#include "ui_tempzar.h" + +tempZar::tempZar(QWidget *parent) : + QDialog(parent), + ui(new Ui::tempZar) +{ + ui->setupUi(this); + this->setAttribute(Qt::WA_DeleteOnClose); + ((Widget*)parent)->changeOpenWidget(this); + ZAtempZar = 0; + ZAtempZar = (((Widget*)parent)->ZAtempZar); + ui->lineEdit->setText(QString::number(ZAtempZar)); +} + +tempZar::~tempZar() +{ + delete ui; +} + +void tempZar::on_pushButton_clicked() +{ + ZAtempZar = ui->lineEdit->text().toInt(); + ((Widget*)parent())->ZAtempZar = ZAtempZar; + ((Widget*)parent())->writeFile(); + close(); +} + +void tempZar::on_pushButton_2_clicked() +{ + close(); +} + +void tempZar::closeEvent(QCloseEvent *e) +{ + ((Widget*)parent())->clearOpenWidget(); + e->accept(); +} diff --git a/tempzar.h b/tempzar.h new file mode 100644 index 0000000..8e02ff5 --- /dev/null +++ b/tempzar.h @@ -0,0 +1,29 @@ +#ifndef TEMPZAR_H +#define TEMPZAR_H + +#include +#include "widget.h" + +namespace Ui { +class tempZar; +} + +class tempZar : public QDialog +{ + Q_OBJECT + +public: + explicit tempZar(QWidget *parent = 0); + ~tempZar(); + +private slots: + void on_pushButton_clicked(); + void closeEvent(QCloseEvent *e); + void on_pushButton_2_clicked(); + +private: + Ui::tempZar *ui; + int ZAtempZar; +}; + +#endif // TEMPZAR_H diff --git a/tempzar.ui b/tempzar.ui new file mode 100644 index 0000000..0d92480 --- /dev/null +++ b/tempzar.ui @@ -0,0 +1,104 @@ + + + tempZar + + + + 0 + 0 + 221 + 154 + + + + Ввод температуры заряда + + + + + 20 + 110 + 75 + 23 + + + + Ввод + + + + + + 10 + 10 + 201 + 81 + + + + + + + + + 17 + 20 + 101 + 31 + + + + Температура + + + + + + 100 + 26 + 51 + 20 + + + + 0 + + + + + + 158 + 27 + 21 + 16 + + + + °С + + + + + + + 120 + 110 + 75 + 23 + + + + Отказ + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+
+ + +
diff --git a/texit.cpp b/texit.cpp new file mode 100644 index 0000000..90de733 --- /dev/null +++ b/texit.cpp @@ -0,0 +1,37 @@ +#include "texit.h" +#include "ui_texit.h" +#include "widget.h" +#include + +Texit::Texit(QWidget *parent) : + QDialog(parent), + ui(new Ui::Texit) +{ + ui->setupUi(this); + ((Widget*)parent)->changeOpenWidget(this); + setAttribute(Qt::WA_DeleteOnClose); +} + +Texit::~Texit() +{ + delete ui; +} + +void Texit::on_pushButton_2_clicked() +{ + + close(); +} + +void Texit::on_pushButton_clicked() +{ + ((Widget*)parent())->writeFile(); + QTimer::singleShot(500, (Widget*)parent(), SLOT(MyClose())); + close(); +} + +void Texit::closeEvent(QCloseEvent *e) +{ + ((Widget*)parent())->clearOpenWidget(); + e->accept(); +} diff --git a/texit.h b/texit.h new file mode 100644 index 0000000..8c63e55 --- /dev/null +++ b/texit.h @@ -0,0 +1,27 @@ +#ifndef TEXIT_H +#define TEXIT_H + +#include + +namespace Ui { +class Texit; +} + +class Texit : public QDialog +{ + Q_OBJECT + +public: + explicit Texit(QWidget *parent = 0); + ~Texit(); + +private slots: + void on_pushButton_2_clicked(); + void closeEvent(QCloseEvent *e); + void on_pushButton_clicked(); + +private: + Ui::Texit *ui; +}; + +#endif // TEXIT_H diff --git a/texit.ui b/texit.ui new file mode 100644 index 0000000..9afb4f8 --- /dev/null +++ b/texit.ui @@ -0,0 +1,65 @@ + + + Texit + + + + 0 + 0 + 262 + 138 + + + + Завершение работы + + + + + 70 + 40 + 221 + 16 + + + + Выгрузить систему? + + + + + + 30 + 90 + 75 + 23 + + + + Да + + + + + + 150 + 90 + 75 + 23 + + + + Нет + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+
+ + +
diff --git a/vvod2z.cpp b/vvod2z.cpp new file mode 100644 index 0000000..624cef0 --- /dev/null +++ b/vvod2z.cpp @@ -0,0 +1,52 @@ +#include "vvod2z.h" +#include "ui_vvod2z.h" + +vvod2z::vvod2z(QWidget *parent) : + QDialog(parent), + ui(new Ui::vvod2z) +{ + ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + + ((Widget*)parent)->changeOpenWidget(this); + + ui->lineEdit_2->setFocus(); + +} + +vvod2z::~vvod2z() +{ + delete ui; +} + +void vvod2z::on_pushButton_3_clicked() +{ + close(); +} + +void vvod2z::on_pushButton_clicked() +{ + curCode = ui->lineEdit_2->text().toInt(); + + + close(); +} + +void vvod2z::on_pushButton_2_clicked() +{ + t2z = new table2Z(this); + t2z->show(); + +} + +void vvod2z::msUpdate() +{ + ui->lineEdit_2->setText(QString::number(curCode)); + +} + +void vvod2z::closeEvent(QCloseEvent *event) +{ + ((Widget*)parent())->clearOpenWidget(); + event->accept(); +} diff --git a/vvod2z.h b/vvod2z.h new file mode 100644 index 0000000..36570d3 --- /dev/null +++ b/vvod2z.h @@ -0,0 +1,38 @@ +#ifndef VVOD2Z_H +#define VVOD2Z_H + +#include + +#include "widget.h" +#include "table2z.h" + +namespace Ui { +class vvod2z; +} + +class vvod2z : public QDialog +{ + Q_OBJECT + +public: + explicit vvod2z(QWidget *parent = 0); + ~vvod2z(); + + int curCode; + table2Z *t2z; +public slots: + void msUpdate(); +private slots: + void on_pushButton_3_clicked(); + + void on_pushButton_clicked(); + + void on_pushButton_2_clicked(); + + void closeEvent(QCloseEvent *event); + +private: + Ui::vvod2z *ui; +}; + +#endif // VVOD2Z_H diff --git a/vvod2z.ui b/vvod2z.ui new file mode 100644 index 0000000..44e6964 --- /dev/null +++ b/vvod2z.ui @@ -0,0 +1,221 @@ + + + vvod2z + + + + 0 + 0 + 238 + 232 + + + + Ввод ДКО + + + + + 85 + 190 + 61 + 23 + + + + Текст + + + + + + 10 + 10 + 211 + 56 + + + + + + + + + 10 + 24 + 111 + 16 + + + + Код абонента + + + + + + 100 + 20 + 61 + 20 + + + + 9 + + + + + + + 10 + 190 + 61 + 23 + + + + Ввод + + + + + + 10 + 60 + 211 + 121 + + + + Ввод координат точки высветки + + + + + 100 + 20 + 61 + 20 + + + + 0 + + + + + + 10 + 24 + 111 + 16 + + + + Команда + + + + + + 100 + 50 + 61 + 20 + + + + 0 + + + + + + 10 + 54 + 111 + 16 + + + + Xтв + + + + + + 100 + 80 + 61 + 20 + + + + 0 + + + + + + 10 + 84 + 111 + 16 + + + + Yтв + + + + + + 168 + 54 + 16 + 16 + + + + м + + + + + + 168 + 84 + 21 + 16 + + + + м + + + + + + + 160 + 190 + 61 + 23 + + + + Отказ + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+
+ + +
diff --git a/vvodautozadef.cpp b/vvodautozadef.cpp new file mode 100644 index 0000000..6438fc5 --- /dev/null +++ b/vvodautozadef.cpp @@ -0,0 +1,37 @@ +#include "vvodautozadef.h" +#include "ui_vvodautozadef.h" + +vvodAutoZAdef::vvodAutoZAdef(QWidget *parent) : + QDialog(parent), + ui(new Ui::vvodAutoZAdef) +{ + ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + + ((Widget*)parent)->changeOpenWidget(this); + + ui->checkBox->setChecked(((Widget*)parent)->autoZAdefault); +} + +vvodAutoZAdef::~vvodAutoZAdef() +{ + delete ui; +} + +void vvodAutoZAdef::on_pushButton_2_clicked() +{ + close(); +} + +void vvodAutoZAdef::on_pushButton_clicked() +{ + ((Widget*)parent())->autoZAdefault= ui->checkBox->isChecked(); + ((Widget*)parent())->writeFile(); + close(); +} + +void vvodAutoZAdef::closeEvent(QCloseEvent *event) +{ + ((Widget*)parent())->clearOpenWidget(); + event->accept(); +} diff --git a/vvodautozadef.h b/vvodautozadef.h new file mode 100644 index 0000000..3d33cb2 --- /dev/null +++ b/vvodautozadef.h @@ -0,0 +1,28 @@ +#ifndef VVODAUTOZADEF_H +#define VVODAUTOZADEF_H + +#include +#include "widget.h" + +namespace Ui { +class vvodAutoZAdef; +} + +class vvodAutoZAdef : public QDialog +{ + Q_OBJECT + +public: + explicit vvodAutoZAdef(QWidget *parent = 0); + ~vvodAutoZAdef(); + +private slots: + void on_pushButton_2_clicked(); + void closeEvent(QCloseEvent *event); + void on_pushButton_clicked(); + +private: + Ui::vvodAutoZAdef *ui; +}; + +#endif // VVODAUTOZADEF_H diff --git a/vvodautozadef.ui b/vvodautozadef.ui new file mode 100644 index 0000000..5f2fbb4 --- /dev/null +++ b/vvodautozadef.ui @@ -0,0 +1,122 @@ + + + vvodAutoZAdef + + + + 0 + 0 + 237 + 129 + + + + Установка ЗА в исходное + + + + + 10 + 10 + 221 + 81 + + + + + + + + + 180 + 30 + 21 + 20 + + + + Qt::RightToLeft + + + + + + + + + 10 + 10 + 161 + 51 + + + + + 3 + + + + + Включение режима + + + + + + + автоматической + + + + + + + установки ЗА в исходное + + + + + + + + + + 20 + 100 + 75 + 23 + + + + Ввод + + + + + + 150 + 100 + 75 + 23 + + + + Отказ + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+ + checkboxmod + QCheckBox +
checkboxmod.h
+
+
+ + +
diff --git a/vvodbk.cpp b/vvodbk.cpp new file mode 100644 index 0000000..700fd9e --- /dev/null +++ b/vvodbk.cpp @@ -0,0 +1,59 @@ +#include "vvodbk.h" +#include "ui_vvodbk.h" + + +VvodBK::VvodBK(QWidget *parent) : + QDialog(parent), + ui(new Ui::VvodBK) +{ + ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + + ((Widget*)parent)->changeOpenWidget(this); + + int t[5]; + for (int i=0;i<5; i++) t[i]=(((Widget*)parent)->BK[i]); + + ui->lineEdit->setText(QString::number(t[0])); + ui->lineEdit_2->setText(QString::number(t[1])); + ui->lineEdit_3->setText(QString::number(t[2])); + ui->lineEdit_4->setText(QString::number(t[3])); + ui->lineEdit_5->setText(QString::number(t[4])); + +} + +VvodBK::~VvodBK() +{ + delete ui; +} + +void VvodBK::on_pushButton_2_clicked() +{ + + + close(); +} + + + +void VvodBK::on_pushButton_clicked() +{ + int t[5]; + t[0] = ui->lineEdit->text().toInt(); + t[1] = ui->lineEdit_2->text().toInt(); + t[2] = ui->lineEdit_3->text().toInt(); + t[3] = ui->lineEdit_4->text().toInt(); + t[4] = ui->lineEdit_5->text().toInt(); + + for (int i=0;i<5; i++) ((Widget*)parent())->BK[i]=t[i]; + + ((Widget*)parent())->writeFile(); + close(); + +} + +void VvodBK::closeEvent(QCloseEvent *event) +{ + ((Widget*)parent())->clearOpenWidget(); + event->accept(); +} diff --git a/vvodbk.h b/vvodbk.h new file mode 100644 index 0000000..cfbc389 --- /dev/null +++ b/vvodbk.h @@ -0,0 +1,33 @@ +#ifndef VVODBK_H +#define VVODBK_H + +#include +#include "widget.h" + +namespace Ui { +class VvodBK; +} + +class VvodBK : public QDialog +{ + Q_OBJECT + +public: + explicit VvodBK(QWidget *parent = 0); + ~VvodBK(); + +private slots: + void on_pushButton_2_clicked(); + void closeEvent(QCloseEvent *event); + void on_pushButton_clicked(); + + + +private: + + Ui::VvodBK *ui; + + +}; + +#endif // VVODBK_H diff --git a/vvodbk.ui b/vvodbk.ui new file mode 100644 index 0000000..3039b07 --- /dev/null +++ b/vvodbk.ui @@ -0,0 +1,147 @@ + + + VvodBK + + + + 0 + 0 + 200 + 219 + + + + Ввод БК + + + + + 10 + 10 + 181 + 161 + + + + + + + + + 10 + 20 + 164 + 126 + + + + + + + 1 ствол (нижн.лев.) + + + + + + + 0 + + + + + + + 2 ствол (верх.лев.) + + + + + + + 0 + + + + + + + 3 ствол (нижн.прав.) + + + + + + + 0 + + + + + + + 0 + + + + + + + 4 ствол (верх.лев.) + + + + + + + Количество ракет + + + + + + + 0 + + + + + + + + + + 10 + 180 + 75 + 23 + + + + Ввод + + + + + + 110 + 180 + 75 + 23 + + + + Отказ + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+
+ + +
diff --git a/vvoddko.cpp b/vvoddko.cpp new file mode 100644 index 0000000..1b0e24d --- /dev/null +++ b/vvoddko.cpp @@ -0,0 +1,37 @@ +#include "vvoddko.h" +#include "ui_vvoddko.h" + +vvodDKO::vvodDKO(QWidget *parent) : + QDialog(parent), + ui(new Ui::vvodDKO) +{ + ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + + ((Widget*)parent)->changeOpenWidget(this); + + ui->lineEdit_2->setFocus(); +} + +vvodDKO::~vvodDKO() +{ + delete ui; +} + +void vvodDKO::on_pushButton_2_clicked() +{ + close(); +} + +void vvodDKO::on_pushButton_clicked() +{ + // send + + close(); +} + +void vvodDKO::closeEvent(QCloseEvent *event) +{ + ((Widget*)parent())->clearOpenWidget(); + event->accept(); +} diff --git a/vvoddko.h b/vvoddko.h new file mode 100644 index 0000000..e3af636 --- /dev/null +++ b/vvoddko.h @@ -0,0 +1,28 @@ +#ifndef VVODDKO_H +#define VVODDKO_H + +#include +#include "widget.h" + +namespace Ui { +class vvodDKO; +} + +class vvodDKO : public QDialog +{ + Q_OBJECT + +public: + explicit vvodDKO(QWidget *parent = 0); + ~vvodDKO(); + +private slots: + void on_pushButton_2_clicked(); + void closeEvent(QCloseEvent *event); + void on_pushButton_clicked(); + +private: + Ui::vvodDKO *ui; +}; + +#endif // VVODDKO_H diff --git a/vvoddko.ui b/vvoddko.ui new file mode 100644 index 0000000..99e61cb --- /dev/null +++ b/vvoddko.ui @@ -0,0 +1,208 @@ + + + vvodDKO + + + + 0 + 0 + 230 + 223 + + + + Ввод ДКО + + + + + 10 + 10 + 211 + 56 + + + + + + + + + 10 + 24 + 111 + 16 + + + + Код абонента + + + + + + 100 + 20 + 61 + 20 + + + + 9 + + + + + + + 10 + 60 + 211 + 121 + + + + Ввод координат точки высветки + + + + + 100 + 20 + 61 + 20 + + + + 0 + + + + + + 10 + 24 + 111 + 16 + + + + Команда + + + + + + 100 + 50 + 61 + 20 + + + + 0 + + + + + + 10 + 54 + 111 + 16 + + + + Xтв + + + + + + 100 + 80 + 61 + 20 + + + + 0 + + + + + + 10 + 84 + 111 + 16 + + + + Yтв + + + + + + 168 + 54 + 16 + 16 + + + + м + + + + + + 168 + 84 + 21 + 16 + + + + м + + + + + + + 10 + 190 + 75 + 23 + + + + Ввод + + + + + + 140 + 190 + 75 + 23 + + + + Отказ + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+
+ + +
diff --git a/vvodkcu.cpp b/vvodkcu.cpp new file mode 100644 index 0000000..2093af7 --- /dev/null +++ b/vvodkcu.cpp @@ -0,0 +1,39 @@ +#include "vvodkcu.h" +#include "ui_vvodkcu.h" + +vvodKCU::vvodKCU(QWidget *parent) : + QDialog(parent), + ui(new Ui::vvodKCU) +{ + ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + + ((Widget*)parent)->changeOpenWidget(this); +} + +vvodKCU::~vvodKCU() +{ + delete ui; +} + +void vvodKCU::on_pushButton_2_clicked() +{ + close(); +} + +void vvodKCU::on_pushButton_clicked() +{ + int NC = ui->lineEdit->text().toInt(); + // send DCU + Widget *w = (Widget *)parent(); + + w->msVvodCU_N2(NC); + + close(); +} + +void vvodKCU::closeEvent(QCloseEvent *event) +{ + ((Widget*)parent())->clearOpenWidget(); + event->accept(); +} diff --git a/vvodkcu.h b/vvodkcu.h new file mode 100644 index 0000000..829ce2a --- /dev/null +++ b/vvodkcu.h @@ -0,0 +1,28 @@ +#ifndef VVODKCU_H +#define VVODKCU_H + +#include +#include "widget.h" + +namespace Ui { +class vvodKCU; +} + +class vvodKCU : public QDialog +{ + Q_OBJECT + +public: + explicit vvodKCU(QWidget *parent = 0); + ~vvodKCU(); + +private slots: + void on_pushButton_2_clicked(); + void closeEvent(QCloseEvent *event); + void on_pushButton_clicked(); + +private: + Ui::vvodKCU *ui; +}; + +#endif // VVODKCU_H diff --git a/vvodkcu.ui b/vvodkcu.ui new file mode 100644 index 0000000..b695e24 --- /dev/null +++ b/vvodkcu.ui @@ -0,0 +1,91 @@ + + + vvodKCU + + + + 0 + 0 + 228 + 108 + + + + ЦУ_N + + + + + 10 + 10 + 201 + 51 + + + + + + + + + 20 + 18 + 91 + 16 + + + + Номер цели + + + + + + 106 + 15 + 61 + 20 + + + + 0 + + + + + + + 20 + 70 + 75 + 23 + + + + Ввод + + + + + + 130 + 70 + 75 + 23 + + + + Отмена + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+
+ + +
diff --git a/vvodma.cpp b/vvodma.cpp new file mode 100644 index 0000000..751d7b0 --- /dev/null +++ b/vvodma.cpp @@ -0,0 +1,54 @@ +#include "vvodma.h" +#include "ui_vvodma.h" + +vvodMA::vvodMA(QWidget *parent) : + QDialog(parent), + ui(new Ui::vvodMA) +{ + ui->setupUi(this); + this->setAttribute(Qt::WA_DeleteOnClose); + + ((Widget*)parent)->changeOpenWidget(this); + + + metAv = ((Widget*)parent)->metAv; + + ui->lineEdit->setText(QString::number(metAv.temp)); + ui->lineEdit_2->setText(QString::number(metAv.pressure)); + ui->lineEdit_3->setText(QString::number(metAv.wind)); + int du = metAv.azim / 100; + ui->lineEdit_6->setText(QString::number(du)); + du = metAv.azim % 100; + ui->lineEdit_7->setText(QString::number(du)); + +} + +vvodMA::~vvodMA() +{ + delete ui; +} + +void vvodMA::on_pushButton_2_clicked() +{ + close(); +} + +void vvodMA::on_pushButton_clicked() +{ + metAv.temp = ui->lineEdit->text().toInt(); + metAv.pressure = ui->lineEdit_2->text().toInt(); + metAv.wind = ui->lineEdit_3->text().toInt(); + int du = ui->lineEdit_6->text().toInt(); + metAv.azim = du*100 + ui->lineEdit_7->text().toInt(); + + ((Widget*)parent())->metAv = metAv; + ((Widget*)parent())->writeFile(); + close(); +} + +void vvodMA::closeEvent(QCloseEvent *event) +{ + ((Widget*)parent())->clearOpenWidget(); + event->accept(); +} + diff --git a/vvodma.h b/vvodma.h new file mode 100644 index 0000000..5fc12a6 --- /dev/null +++ b/vvodma.h @@ -0,0 +1,30 @@ +#ifndef VVODMA_H +#define VVODMA_H + +#include +#include "widget.h" +#include "geo.h" + +namespace Ui { +class vvodMA; +} + +class vvodMA : public QDialog +{ + Q_OBJECT + +public: + explicit vvodMA(QWidget *parent = 0); + ~vvodMA(); + +private slots: + void on_pushButton_2_clicked(); + void closeEvent(QCloseEvent *event); + void on_pushButton_clicked(); + +private: + Ui::vvodMA *ui; + T_metAv metAv; +}; + +#endif // VVODMA_H diff --git a/vvodma.ui b/vvodma.ui new file mode 100644 index 0000000..a23282d --- /dev/null +++ b/vvodma.ui @@ -0,0 +1,251 @@ + + + vvodMA + + + + 0 + 0 + 261 + 185 + + + + + 261 + 185 + + + + + 286 + 213 + + + + Ввод данных по МА + + + + + 10 + 10 + 241 + 111 + + + + + + + + + 130 + 10 + 51 + 16 + + + + 0 + + + + + + 10 + 10 + 111 + 16 + + + + Температура воздуха + + + + + + 190 + 10 + 41 + 16 + + + + °С + + + + + + 190 + 30 + 51 + 16 + + + + мм рт.ст. + + + + + + 10 + 30 + 141 + 16 + + + + Давление + + + + + + 130 + 30 + 51 + 16 + + + + 0 + + + + + + 190 + 50 + 51 + 16 + + + + м/с + + + + + + 10 + 50 + 141 + 16 + + + + Скорость ветра + + + + + + 130 + 50 + 51 + 16 + + + + 0 + + + + + + 10 + 74 + 111 + 16 + + + + Направление ветра + + + + + + 130 + 74 + 31 + 16 + + + + 0 + + + + + + 170 + 74 + 16 + 16 + + + + + 10 + + + + - + + + + + + 180 + 74 + 31 + 16 + + + + 0 + + + + + + + 30 + 140 + 75 + 23 + + + + Ввод + + + + + + 160 + 140 + 75 + 23 + + + + Отмена + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+
+ + +
diff --git a/vvodms.cpp b/vvodms.cpp new file mode 100644 index 0000000..75c118d --- /dev/null +++ b/vvodms.cpp @@ -0,0 +1,244 @@ +#include "vvodms.h" +#include "ui_vvodms.h" + +vvodMs::vvodMs(QWidget *parent) : + QDialog(parent), + ui(new Ui::vvodMs) +{ + ui->setupUi(this); + + this->setAttribute(Qt::WA_DeleteOnClose); + + ((Widget*)parent)->changeOpenWidget(this); + + int i; + + for (i=0; i<80; i++) localLE[i] = new QLineEdit(this); + for (i=0; i<6; i++) + { + localLE[i*8] ->setGeometry(30, 140+20*i, 31, 20); + localLE[i*8+1]->setGeometry(90, 140+20*i, 31, 20); + localLE[i*8+2]->setGeometry(160, 140+20*i, 31, 20); + localLE[i*8+3]->setGeometry(220, 140+20*i, 31, 20); + localLE[i*8+4]->setGeometry(320, 140+20*i, 31, 20); + localLE[i*8+5]->setGeometry(380, 140+20*i, 31, 20); + localLE[i*8+6]->setGeometry(440, 140+20*i, 31, 20); + localLE[i*8+7]->setGeometry(500, 140+20*i, 31, 20); + } + for (i=0; i<4; i++) + { + localLE[i*8+48] ->setGeometry(30, 280+20*i, 31, 20); + localLE[i*8+48+1]->setGeometry(90, 280+20*i, 31, 20); + localLE[i*8+48+2]->setGeometry(160, 280+20*i, 31, 20); + localLE[i*8+48+3]->setGeometry(220, 280+20*i, 31, 20); + localLE[i*8+48+4]->setGeometry(320, 280+20*i, 31, 20); + localLE[i*8+48+5]->setGeometry(380, 280+20*i, 31, 20); + localLE[i*8+48+6]->setGeometry(440, 280+20*i, 31, 20); + localLE[i*8+48+7]->setGeometry(500, 280+20*i, 31, 20); + } + for (i=76; i<80; i++) localLE[i]->hide(); + localLE[52]->setEnabled(false); + localLE[56]->setEnabled(false); + localLE[60]->setEnabled(false); + localLE[64]->setEnabled(false); + localLE[68]->setEnabled(false); + localLE[72]->setEnabled(false); + + + setTabOrder(ui->lineEdit_6, localLE[0]); + for (i=1;i<76;i++) setTabOrder(localLE[i-1], localLE[i]); + setTabOrder(localLE[75], ui->lineEdit_103); + setTabOrder(ui->lineEdit_103, ui->lineEdit_98); + + int n=0; + + meteoSr = ((Widget*)parent)->metSr; +// "-11" , + ui->lineEdit->setText(meteoSr.mid(0, 2)); +// + ui->lineEdit_2->setText(meteoSr.mid(2,2)); +// + n = meteoSr.mid(4, 3).toInt(); + ui->lineEdit_3->setText(QString::number(n)+"0"); +// + n = meteoSr.mid(7, 4).toInt(); + ui->lineEdit_4->setText(QString::number(n)); +// . + n = meteoSr.mid(11, 3).toInt(); + if ( n>499) n = 500 - n; + ui->lineEdit_5->setText(QString::number(n)); +// . + n = meteoSr.mid(14,2).toInt(); + if (n>49) n = 50-n; + ui->lineEdit_6->setText(QString::number(n)); +// : . , , , . + for (i=0; i<13; i++) + { + localLE[i*4]->setText(meteoSr.mid(16+i*8, 2)); + n = meteoSr.mid(18+i*8, 2).toInt(); + if (n>49) n = 50-n; + localLE[i*4+1]->setText(QString::number(n)); + localLE[i*4+2]->setText(meteoSr.mid(20+i*8, 2)); + localLE[i*4+3]->setText(meteoSr.mid(22+i*8, 2)); + } +// . - 1% + for (int i=13; i<19; i++) + { + n = meteoSr.mid(120+(i-13)*6, 2).toInt(); + if (n>49) n = 50-n; + localLE[i*4+1]->setText(QString::number(n)); + localLE[i*4+2]->setText(meteoSr.mid(122+(i-13)*6, 2)); + localLE[i*4+3]->setText(meteoSr.mid(124+(i-13)*6, 2)); + + } +// . + ui->lineEdit_103->setText(meteoSr.right(4).left(2)+"00"); + ui->lineEdit_98->setText(meteoSr.right(2)+"00"); + + + + + +} + +vvodMs::~vvodMs() +{ + delete ui; +} + +void vvodMs::on_pushButton_2_clicked() +{ + close(); +} + +void vvodMs::on_pushButton_clicked() +{ + QString str; + meteoSr.clear(); + int tmp, tmp1; + +// str.append(QString::fromLocal8Bit("-11")); + // + tmp = ui->lineEdit->text().toInt(); + if (tmp<0) tmp=0; else if (tmp>99) tmp=99; + if (tmp<10) str.append(QString("0")); + str.append(QString::number(tmp)); +// str.append(QString("-")); + // + tmp = ui->lineEdit_2->text().toInt(); + if (tmp<0) tmp =0; else if (tmp>31) tmp=31; + str.append(QString::number(tmp)); + tmp = ui->lineEdit_3->text().toInt(); + if (tmp<0) tmp =0 ; else if (tmp>2359) tmp = 2359; + tmp1 = tmp / 100; + if (tmp1<10) str.append(QString("0")); + tmp1 = tmp / 10; + str.append(QString::number(tmp1)); +// str.append(QString("-")); + // 3 + tmp = ui->lineEdit_4->text().toInt(); + if (tmp<0) tmp =0 ; else if (tmp>9999) tmp = 9999; + if (tmp<1000) str.append(QString("0")); + if (tmp<100) str.append(QString("0")); + if (tmp<10) str.append(QString("0")); + str.append(QString::number(tmp)); +// str.append(QString("-")); + //4 + // + tmp = ui->lineEdit_5->text().toInt(); + if (tmp<-99) tmp=-99; else if ( tmp>99) tmp = 99; + if (tmp<0) str.append(QString("5")); else str.append(QString("0")); + tmp = abs(tmp); + if (tmp<10) str.append(QString("0")); + str.append(QString::number(tmp)); + // + tmp = ui->lineEdit_6->text().toInt(); + if (tmp<-49) tmp = -49; else if (tmp>49) tmp = 49; + if (tmp<0) tmp = abs(tmp)+50; + if (tmp<10) str.append(QString("0")); + str.append(QString::number(tmp)); +// str.append(QString("-")); + // 5,6 + +// QString nS[19] = {"02", "04", "08", "12", "16", "20", "24", "30", "40", "50", "60", "80", +// "10", "12", "14", "18", "22", "26", "30"}; + + + for (int i=0; i<13; i++) + { +// str.append(nS[i]); + + tmp = localLE[i*4]->text().toInt(); + if (tmp<0) tmp = 0; else if (tmp>99) tmp = 99; + if (tmp<10) str.append(QString("0")); + str.append(QString::number(tmp)); +// str.append(QString("-")); + + tmp = localLE[i*4+1]->text().toInt(); + if (tmp<-49) tmp = -49; else if (tmp>49) tmp = 49; + if (tmp<0) tmp = abs(tmp)+50; + if (tmp<10) str.append(QString("0")); + str.append(QString::number(tmp)); + + tmp = localLE[i*4+2]->text().toInt(); + if (tmp<0) tmp =0; else if (tmp>59) tmp = 59; + if (tmp<10) str.append(QString("0")); + str.append(QString::number(tmp)); + + tmp = localLE[i*4+3]->text().toInt(); + if (tmp<0) tmp = 0; else if (tmp>99) tmp = 99; + if (tmp<10) str.append(QString("0")); + str.append(QString::number(tmp)); +// str.append(QString("-")); + + + } + + for (int i=13; i<19; i++) + { +// str.append(nS[i]); +// str.append(QString("01")); +// str.append(QString("-")); + tmp = localLE[i*4+1]->text().toInt(); + if (tmp<-49) tmp = -49; else if (tmp>49) tmp = 49; + if (tmp<0) tmp = abs(tmp)+50; + if (tmp<10) str.append(QString("0")); + str.append(QString::number(tmp)); + + tmp = localLE[i*4+2]->text().toInt(); + if (tmp<0) tmp =0; else if (tmp>59) tmp = 59; + if (tmp<10) str.append(QString("0")); + str.append(QString::number(tmp)); + + tmp = localLE[i*4+3]->text().toInt(); + if (tmp<0) tmp = 0; else if (tmp>99) tmp = 99; + if (tmp<10) str.append(QString("0")); + str.append(QString::number(tmp)); +// str.append(QString("-")); + + } + +// 103 98 , 103 , 98 - + + tmp = ui->lineEdit_103->text().toInt(); + if (tmp<0) tmp = 0; else if (tmp>9999) tmp = 9999; + tmp = tmp/100; + str.append(QString::number(tmp)); + + tmp = ui->lineEdit_98->text().toInt(); + if (tmp<0) tmp = 0; else if (tmp>9999) tmp = 9999; + tmp = tmp/100; + str.append(QString::number(tmp)); + + tmp = str.length(); + + ((Widget*)parent())->metSr = str; + ((Widget*)parent())->writeFile(); + close(); +} + +void vvodMs::closeEvent(QCloseEvent *event) +{ + ((Widget*)parent())->clearOpenWidget(); + event->accept(); +} diff --git a/vvodms.h b/vvodms.h new file mode 100644 index 0000000..b9f6523 --- /dev/null +++ b/vvodms.h @@ -0,0 +1,32 @@ +#ifndef VVODMS_H +#define VVODMS_H + +#include +#include +#include "widget.h" + +namespace Ui { +class vvodMs; +} + +class vvodMs : public QDialog +{ + Q_OBJECT + +public: + explicit vvodMs(QWidget *parent = 0); + ~vvodMs(); + +private slots: + void on_pushButton_2_clicked(); + void closeEvent(QCloseEvent *event); + void on_pushButton_clicked(); + +private: + Ui::vvodMs *ui; + QString meteoSr; + QLineEdit *localLE[80]; + +}; + +#endif // VVODMS_H diff --git a/vvodms.ui b/vvodms.ui new file mode 100644 index 0000000..c414e59 --- /dev/null +++ b/vvodms.ui @@ -0,0 +1,1069 @@ + + + vvodMs + + + + 0 + 0 + 567 + 449 + + + + Ввод метеосреднего бюллетеня + + + + + 20 + 20 + 431 + 41 + + + + + + + + + 10 + 0 + 46 + 20 + + + + Номер ст. + + + + + + 75 + 0 + 46 + 20 + + + + Дата + + + + + + 75 + 20 + 46 + 20 + + + + ДД + + + + + + 10 + 20 + 46 + 20 + + + + №№ + + + + + + 130 + 20 + 46 + 20 + + + + ЧЧММ + + + + + + 130 + 0 + 46 + 20 + + + + Время + + + + + + 190 + 20 + 46 + 20 + + + + ВВВВ + + + + + + 190 + 0 + 46 + 20 + + + + Высота + + + + + + 260 + 20 + 46 + 20 + + + + dБdБ + + + + + + 260 + 0 + 61 + 20 + + + + Давление + + + + + + 340 + 20 + 46 + 20 + + + + dTdT + + + + + + 340 + 0 + 71 + 20 + + + + Температура + + + + + + + 32 + 66 + 41 + 20 + + + + 1 + + + + + + 92 + 66 + 31 + 20 + + + + 25 + + + + + + 152 + 66 + 31 + 20 + + + + 11 + + + + + + 212 + 66 + 51 + 20 + + + + 2500 + + + + + + 282 + 66 + 41 + 20 + + + + 50 + + + + + + 362 + 66 + 31 + 20 + + + + 13 + + + + + + 20 + 90 + 251 + 45 + + + + + + + + + 4 + 0 + 61 + 20 + + + + Плотность + + + + + + 70 + 0 + 61 + 20 + + + + Температ. + + + + + + 70 + 20 + 46 + 20 + + + + dТdТ + + + + + + 4 + 20 + 46 + 20 + + + + dПdП + + + + + + 140 + 20 + 46 + 20 + + + + НН + + + + + + 140 + 0 + 46 + 20 + + + + Угол + + + + + + 190 + 20 + 46 + 20 + + + + СС + + + + + + 190 + 0 + 51 + 20 + + + + Скорость + + + + + + + 0 + 140 + 22 + 122 + + + + + 2 + + + 3 + + + + + QFrame::Panel + + + QFrame::Sunken + + + 02 + + + true + + + Qt::AlignCenter + + + + + + + QFrame::Panel + + + QFrame::Sunken + + + 08 + + + true + + + Qt::AlignCenter + + + + + + + QFrame::Panel + + + QFrame::Sunken + + + 16 + + + true + + + Qt::AlignCenter + + + + + + + QFrame::Panel + + + QFrame::Sunken + + + 24 + + + true + + + Qt::AlignCenter + + + + + + + QFrame::Panel + + + QFrame::Sunken + + + 40 + + + true + + + Qt::AlignCenter + + + + + + + QFrame::Panel + + + QFrame::Sunken + + + 60 + + + true + + + Qt::AlignCenter + + + + + + + + + 0 + 280 + 24 + 81 + + + + + 2 + + + 3 + + + + + QFrame::Panel + + + QFrame::Sunken + + + 10 + + + true + + + Qt::AlignCenter + + + + + + + QFrame::Panel + + + QFrame::Sunken + + + 14 + + + true + + + Qt::AlignCenter + + + + + + + QFrame::Panel + + + QFrame::Sunken + + + 22 + + + true + + + Qt::AlignCenter + + + + + + + QFrame::Panel + + + QFrame::Sunken + + + 30 + + + true + + + Qt::AlignCenter + + + + + + + + + 280 + 140 + 22 + 122 + + + + + 2 + + + 3 + + + + + QFrame::Panel + + + QFrame::Sunken + + + 04 + + + true + + + Qt::AlignCenter + + + + + + + QFrame::Panel + + + QFrame::Sunken + + + 12 + + + true + + + Qt::AlignCenter + + + + + + + QFrame::Panel + + + QFrame::Sunken + + + 20 + + + true + + + Qt::AlignCenter + + + + + + + QFrame::Panel + + + QFrame::Sunken + + + 30 + + + true + + + Qt::AlignCenter + + + + + + + QFrame::Panel + + + QFrame::Sunken + + + 50 + + + true + + + Qt::AlignCenter + + + + + + + QFrame::Panel + + + QFrame::Sunken + + + 80 + + + true + + + Qt::AlignCenter + + + + + + + + + 300 + 90 + 251 + 45 + + + + + + + + + 4 + 0 + 61 + 20 + + + + Плотность + + + + + + 70 + 0 + 61 + 20 + + + + Температ. + + + + + + 70 + 20 + 46 + 20 + + + + dТdТ + + + + + + 4 + 20 + 46 + 20 + + + + dПdП + + + + + + 140 + 20 + 46 + 20 + + + + НН + + + + + + 140 + 0 + 46 + 20 + + + + Угол + + + + + + 190 + 20 + 46 + 20 + + + + СС + + + + + + 190 + 0 + 51 + 20 + + + + Скорость + + + + + + + 280 + 280 + 24 + 61 + + + + + 2 + + + 3 + + + + + QFrame::Panel + + + QFrame::Sunken + + + 12 + + + true + + + Qt::AlignCenter + + + + + + + QFrame::Panel + + + QFrame::Sunken + + + 18 + + + true + + + Qt::AlignCenter + + + + + + + QFrame::Panel + + + QFrame::Sunken + + + 26 + + + true + + + Qt::AlignCenter + + + + + + + + + 20 + 370 + 111 + 41 + + + + + + + + + 60 + 20 + 46 + 20 + + + + ВвВв + + + + + + 4 + 20 + 46 + 20 + + + + ВтВт + + + + + + 4 + 0 + 61 + 20 + + + + Высота + + + + + + 60 + 0 + 61 + 20 + + + + Высота + + + + + + + 80 + 420 + 41 + 20 + + + + 2500 + + + + + + 30 + 420 + 41 + 20 + + + + 2300 + + + + + + 300 + 410 + 75 + 23 + + + + Ввод + + + + + + 450 + 410 + 75 + 23 + + + + Отказ + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+
+ + lineEdit + lineEdit_2 + lineEdit_3 + lineEdit_4 + lineEdit_5 + lineEdit_6 + lineEdit_103 + lineEdit_98 + pushButton + pushButton_2 + + + +
diff --git a/vvodready.cpp b/vvodready.cpp new file mode 100644 index 0000000..dd495d8 --- /dev/null +++ b/vvodready.cpp @@ -0,0 +1,36 @@ +#include "vvodready.h" +#include "ui_vvodready.h" + +vvodReady::vvodReady(QWidget *parent) : + QDialog(parent), + ui(new Ui::vvodReady) +{ + ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + + ((Widget*)parent)->changeOpenWidget(this); + + ui->checkBox->setChecked(((Widget*)parent)->readyBoegotov); +} + +vvodReady::~vvodReady() +{ + delete ui; +} + +void vvodReady::on_pushButton_2_clicked() +{ + close(); +} + +void vvodReady::on_pushButton_clicked() +{ + ((Widget*)parent())->readyBoegotov = ui->checkBox->isChecked(); + close(); +} + +void vvodReady::closeEvent(QCloseEvent *event) +{ + ((Widget*)parent())->clearOpenWidget(); + event->accept(); +} diff --git a/vvodready.h b/vvodready.h new file mode 100644 index 0000000..f8c8ebe --- /dev/null +++ b/vvodready.h @@ -0,0 +1,28 @@ +#ifndef VVODREADY_H +#define VVODREADY_H + +#include +#include "widget.h" + +namespace Ui { +class vvodReady; +} + +class vvodReady : public QDialog +{ + Q_OBJECT + +public: + explicit vvodReady(QWidget *parent = 0); + ~vvodReady(); + +private slots: + void on_pushButton_2_clicked(); + void closeEvent(QCloseEvent *event); + void on_pushButton_clicked(); + +private: + Ui::vvodReady *ui; +}; + +#endif // VVODREADY_H diff --git a/vvodready.ui b/vvodready.ui new file mode 100644 index 0000000..e8449b3 --- /dev/null +++ b/vvodready.ui @@ -0,0 +1,96 @@ + + + vvodReady + + + + 0 + 0 + 208 + 115 + + + + Техническое состояние + + + + + 10 + 10 + 181 + 61 + + + + + + + + + 30 + 20 + 61 + 16 + + + + Боеготов + + + + + + 140 + 20 + 16 + 17 + + + + + + + + + + + 20 + 80 + 75 + 23 + + + + Ввод + + + + + + 120 + 80 + 75 + 23 + + + + Отказ + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+ + checkboxmod + QCheckBox +
checkboxmod.h
+
+
+ + +
diff --git a/vvodreper.cpp b/vvodreper.cpp new file mode 100644 index 0000000..30d56b6 --- /dev/null +++ b/vvodreper.cpp @@ -0,0 +1,50 @@ +#include "vvodreper.h" +#include "ui_vvodreper.h" + +vvodReper::vvodReper(QWidget *parent) : + QDialog(parent), + ui(new Ui::vvodReper) +{ + ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + + ((Widget*)parent)->changeOpenWidget(this); + + ts = ((Widget*)parent)->reper; + ui->lineEdit->setText(QString::number(ts.nZone)); + ui->checkBox->setChecked(ts.south); + ui->lineEdit_3->setText(QString::number(ts.x)); + ui->lineEdit_4->setText(QString::number(ts.y)); + ui->lineEdit_5->setText(QString::number(ts.h)); + +} + +vvodReper::~vvodReper() +{ + delete ui; +} + +void vvodReper::on_pushButton_2_clicked() +{ + close(); +} + +void vvodReper::on_pushButton_clicked() +{ + ts.nZone = ui->lineEdit->text().toInt(); + ts.south = ui->checkBox->isChecked(); + ts.x = ui->lineEdit_3->text().toInt(); + ts.y = ui->lineEdit_4->text().toInt(); + ts.h = ui->lineEdit_5->text().toInt(); + + ((Widget*)parent())->reper = ts; + + ((Widget*)parent())->writeFile(); + close(); +} + +void vvodReper::closeEvent(QCloseEvent *event) +{ + ((Widget*)parent())->clearOpenWidget(); + event->accept(); +} diff --git a/vvodreper.h b/vvodreper.h new file mode 100644 index 0000000..8a5eb59 --- /dev/null +++ b/vvodreper.h @@ -0,0 +1,30 @@ +#ifndef VVODREPER_H +#define VVODREPER_H + +#include +#include "widget.h" +#include "geo.h" + +namespace Ui { +class vvodReper; +} + +class vvodReper : public QDialog +{ + Q_OBJECT + +public: + explicit vvodReper(QWidget *parent = 0); + ~vvodReper(); + +private slots: + void on_pushButton_2_clicked(); + void closeEvent(QCloseEvent *event); + void on_pushButton_clicked(); + +private: + Ui::vvodReper *ui; + T_geoPoint ts; +}; + +#endif // VVODREPER_H diff --git a/vvodreper.ui b/vvodreper.ui new file mode 100644 index 0000000..dec84d5 --- /dev/null +++ b/vvodreper.ui @@ -0,0 +1,239 @@ + + + vvodReper + + + + 0 + 0 + 288 + 300 + + + + Ввод репера + + + + + 20 + 10 + 261 + 221 + + + + + + + + + 20 + 50 + 91 + 16 + + + + Номер зоны + + + + + + 150 + 50 + 61 + 20 + + + + 6 + + + + + + 20 + 81 + 131 + 16 + + + + Южное Полушарие + + + + + + 20 + 110 + 91 + 16 + + + + XL + + + + + + 150 + 110 + 61 + 20 + + + + 0 + + + + + + 150 + 140 + 61 + 20 + + + + 0 + + + + + + 20 + 140 + 91 + 16 + + + + YL + + + + + + 20 + 170 + 91 + 16 + + + + HL + + + + + + 150 + 170 + 61 + 20 + + + + 0 + + + + + + 150 + 81 + 70 + 17 + + + + + + + + + + 220 + 110 + 16 + 16 + + + + м + + + + + + 220 + 140 + 16 + 16 + + + + м + + + + + + 220 + 170 + 16 + 16 + + + + м + + + + + + + 30 + 250 + 75 + 23 + + + + Ввод + + + + + + 200 + 250 + 75 + 23 + + + + Отказ + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+ + checkboxmod + QCheckBox +
checkboxmod.h
+
+
+ + +
diff --git a/vvodsectazim.cpp b/vvodsectazim.cpp new file mode 100644 index 0000000..d538776 --- /dev/null +++ b/vvodsectazim.cpp @@ -0,0 +1,72 @@ +#include "vvodsectazim.h" +#include "ui_vvodsectazim.h" + +vvodSectAzim::vvodSectAzim(QWidget *parent) : + QDialog(parent), + ui(new Ui::vvodSectAzim) +{ + ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + + Widget* w =(Widget*) parent; + w->changeOpenWidget(this); + + ui->lineEdit->setText(QString::number(w->sectAzLow1)); + ui->lineEdit_2->setText(QString::number(w->sectAzLow2)); + ui->lineEdit_3->setText(QString::number(w->sectAzHigh1)); + ui->lineEdit_4->setText(QString::number(w->sectAzHigh2)); + + +} + +vvodSectAzim::~vvodSectAzim() +{ + delete ui; +} + +void vvodSectAzim::on_pushButton_3_clicked() +{ + close(); +} + +void vvodSectAzim::on_pushButton_2_clicked() +{ + Widget *w = (Widget*)parent(); + w->sectAzLow1 = 0; + w->sectAzLow2 = 0; + w->sectAzHigh1 = 0; + w->sectAzHigh2 = 0; +// w->kzsSect.left= 0; +// w->kzsSect.right=0; + close(); +} + +void vvodSectAzim::on_pushButton_clicked() +{ + int sl1, sl2, sh1, sh2; + Widget *w = (Widget*)parent(); + + sl1 = ui->lineEdit->text().toInt(); + sl2 = ui->lineEdit_2->text().toInt(); + sh1 = ui->lineEdit_3->text().toInt(); + sh2 = ui->lineEdit_4->text().toInt(); + // + + /// + w->sectAzLow1 = sl1; + w->sectAzLow2 = sl2; + w->sectAzHigh1 = sh1; + w->sectAzHigh2 = sh2; + + +// w->kzsSect.left= (sl1*100+sl2)/100*6; +// w->kzsSect.right=(sh1*100+sh2)/100*6; + w->writeFile(); + close(); +} + +void vvodSectAzim::closeEvent(QCloseEvent *event) +{ + ((Widget*)parent())->clearOpenWidget(); + event->accept(); +} diff --git a/vvodsectazim.h b/vvodsectazim.h new file mode 100644 index 0000000..c650ef1 --- /dev/null +++ b/vvodsectazim.h @@ -0,0 +1,32 @@ +#ifndef VVODSECTAZIM_H +#define VVODSECTAZIM_H + +#include +#include "widget.h" + +namespace Ui { +class vvodSectAzim; +} + +class vvodSectAzim : public QDialog +{ + Q_OBJECT + +public: + explicit vvodSectAzim(QWidget *parent = 0); + ~vvodSectAzim(); + +private slots: + void on_pushButton_3_clicked(); + + void on_pushButton_2_clicked(); + + void on_pushButton_clicked(); + + void closeEvent(QCloseEvent *event); + +private: + Ui::vvodSectAzim *ui; +}; + +#endif // VVODSECTAZIM_H diff --git a/vvodsectazim.ui b/vvodsectazim.ui new file mode 100644 index 0000000..fb0e507 --- /dev/null +++ b/vvodsectazim.ui @@ -0,0 +1,244 @@ + + + vvodSectAzim + + + + 0 + 0 + 330 + 162 + + + + Сектор по азимуту + + + + + 10 + 10 + 311 + 111 + + + + + + + + + 10 + 20 + 131 + 16 + + + + Левая граница b + + + + + + 10 + 80 + 131 + 16 + + + + Правая граница b + + + + + + 150 + 12 + 46 + 13 + + + + лев. + + + + + + 150 + 28 + 46 + 13 + + + + сект. + + + + + + 150 + 70 + 46 + 13 + + + + прав. + + + + + + 150 + 86 + 46 + 13 + + + + сект. + + + + + + 190 + 20 + 41 + 20 + + + + 0 + + + + + + 250 + 20 + 41 + 20 + + + + 0 + + + + + + 190 + 70 + 41 + 20 + + + + 0 + + + + + + 250 + 70 + 41 + 20 + + + + 0 + + + + + + 232 + 21 + 16 + 16 + + + + + 12 + + + + - + + + + + + 232 + 72 + 16 + 16 + + + + + 12 + + + + - + + + + + + + 20 + 130 + 75 + 23 + + + + Ввод + + + + + + 130 + 130 + 75 + 23 + + + + Сброс + + + + + + 240 + 130 + 75 + 23 + + + + Отказ + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+
+ + +
diff --git a/vvodsectotvet.cpp b/vvodsectotvet.cpp new file mode 100644 index 0000000..fd17c0f --- /dev/null +++ b/vvodsectotvet.cpp @@ -0,0 +1,62 @@ +#include "vvodsectotvet.h" +#include "ui_vvodsectotvet.h" + +vvodSectOtvet::vvodSectOtvet(QWidget *parent) : + QDialog(parent), + ui(new Ui::vvodSectOtvet) +{ + ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + + Widget *w = (Widget*)parent; + + w->changeOpenWidget(this); + + int h = w->ownSect.height; + int l = w->ownSect.left; + int r = w->ownSect.right; + if ((h>=0)&&(h<3)) ui->comboBox->setCurrentIndex(h); + if ((l>=0)&&(l<360)) ui->lineEdit->setText(QString::number(l)); + if ((r>=0)&&(r<360)) ui->lineEdit_2->setText(QString::number(r)); + +} + +vvodSectOtvet::~vvodSectOtvet() +{ + delete ui; +} + +void vvodSectOtvet::on_pushButton_2_clicked() +{ + close(); +} + +void vvodSectOtvet::on_pushButton_clicked() +{ + T_sectOtv p; + + if (ui->checkBox->isChecked()) + { + p.height=0; + p.left=0; + p.right=0; + p.bottom=0; + } + else + { + p.height=ui->comboBox->currentIndex(); + p.left =ui->lineEdit->text().toInt(); + p.right =ui->lineEdit_2->text().toInt(); + p.bottom=0; + } + ((Widget*)parent())->ownSect=p; + + ((Widget*)parent())->writeFile(); + close(); +} + +void vvodSectOtvet::closeEvent(QCloseEvent *event) +{ + ((Widget*)parent())->clearOpenWidget(); + event->accept(); +} diff --git a/vvodsectotvet.h b/vvodsectotvet.h new file mode 100644 index 0000000..5436abe --- /dev/null +++ b/vvodsectotvet.h @@ -0,0 +1,28 @@ +#ifndef VVODSECTOTVET_H +#define VVODSECTOTVET_H + +#include +#include "widget.h" + +namespace Ui { +class vvodSectOtvet; +} + +class vvodSectOtvet : public QDialog +{ + Q_OBJECT + +public: + explicit vvodSectOtvet(QWidget *parent = 0); + ~vvodSectOtvet(); + +private slots: + void on_pushButton_2_clicked(); + void closeEvent(QCloseEvent *event); + void on_pushButton_clicked(); + +private: + Ui::vvodSectOtvet *ui; +}; + +#endif // VVODSECTOTVET_H diff --git a/vvodsectotvet.ui b/vvodsectotvet.ui new file mode 100644 index 0000000..64b53e1 --- /dev/null +++ b/vvodsectotvet.ui @@ -0,0 +1,220 @@ + + + vvodSectOtvet + + + + 0 + 0 + 269 + 192 + + + + Ввод сектора ответственности + + + + + 10 + 10 + 251 + 141 + + + + + + + + + 20 + 20 + 131 + 16 + + + + Левая граница сектора + + + + + + 170 + 20 + 41 + 20 + + + + 0 + + + + + + 220 + 20 + 31 + 16 + + + + град + + + + + + 220 + 50 + 31 + 16 + + + + град + + + + + + 170 + 50 + 41 + 20 + + + + 0 + + + + + + 20 + 50 + 131 + 16 + + + + Правая граница сектора + + + + + + 20 + 82 + 81 + 16 + + + + Эшелон + + + + + false + + + + 130 + 80 + 81 + 22 + + + + + 0 - без огр + + + + + 1 - нижний + + + + + 2 - верхний + + + + + + + 20 + 110 + 81 + 16 + + + + Сброс сектора + + + + + + 180 + 110 + 21 + 17 + + + + + + + + + + + 40 + 160 + 75 + 23 + + + + Ввод + + + + + + 150 + 160 + 75 + 23 + + + + Отказ + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+ + comboboxmod + QComboBox +
comboboxmod.h
+
+ + checkboxmod + QCheckBox +
checkboxmod.h
+
+
+ + +
diff --git a/vvodsectugol.cpp b/vvodsectugol.cpp new file mode 100644 index 0000000..6810536 --- /dev/null +++ b/vvodsectugol.cpp @@ -0,0 +1,77 @@ +#include "vvodsectugol.h" +#include "ui_vvodsectugol.h" + +vvodSectUgol::vvodSectUgol(QWidget *parent) : + QDialog(parent), + ui(new Ui::vvodSectUgol) +{ + ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + + Widget* w =(Widget*) parent; + w->changeOpenWidget(this); + + ui->lineEdit->setText(QString::number(w->sectUgLow1)); + ui->lineEdit_2->setText(QString::number(w->sectUgLow2)); + ui->lineEdit_3->setText(QString::number(w->sectUgHigh1)); + ui->lineEdit_4->setText(QString::number(w->sectUgHigh2)); + + + +} + +vvodSectUgol::~vvodSectUgol() +{ + delete ui; +} + +void vvodSectUgol::on_pushButton_3_clicked() +{ + close(); +} + +void vvodSectUgol::on_pushButton_2_clicked() +{ + Widget *w = (Widget*)parent(); + w->sectUgLow1 = 0; + w->sectUgLow2 = 0; + w->sectUgHigh1 = 0; + w->sectUgHigh2 = 0; + + w->kzsSect.height = 0; + w->kzsSect.bottom = 0; + close(); +} + + +void vvodSectUgol::on_pushButton_clicked() +{ + int sl1, sl2, sh1, sh2; + Widget *w = (Widget*)parent(); + + sl1 = ui->lineEdit->text().toInt(); + sl2 = ui->lineEdit_2->text().toInt(); + sh1 = ui->lineEdit_3->text().toInt(); + sh2 = ui->lineEdit_4->text().toInt(); + // + + /// + w->sectUgLow1 = sl1; + w->sectUgLow2 = sl2; + w->sectUgHigh1 = sh1; + w->sectUgHigh2 = sh2; + + + w->kzsSect.height=(sh1*100+sh2)/100*6; + w->kzsSect.bottom=(sl1*100+sl2)/100*6; + + w->writeFile(); + + close(); +} + +void vvodSectUgol::closeEvent(QCloseEvent *event) +{ + ((Widget*)parent())->clearOpenWidget(); + event->accept(); +} diff --git a/vvodsectugol.h b/vvodsectugol.h new file mode 100644 index 0000000..b67ac84 --- /dev/null +++ b/vvodsectugol.h @@ -0,0 +1,31 @@ +#ifndef VVODSECTUGOL_H +#define VVODSECTUGOL_H + +#include +#include "widget.h" + +namespace Ui { +class vvodSectUgol; +} + +class vvodSectUgol : public QDialog +{ + Q_OBJECT + +public: + explicit vvodSectUgol(QWidget *parent = 0); + ~vvodSectUgol(); + +private slots: + void on_pushButton_3_clicked(); + + void on_pushButton_2_clicked(); + + void on_pushButton_clicked(); + + void closeEvent(QCloseEvent *event); +private: + Ui::vvodSectUgol *ui; +}; + +#endif // VVODSECTUGOL_H diff --git a/vvodsectugol.ui b/vvodsectugol.ui new file mode 100644 index 0000000..15b5d95 --- /dev/null +++ b/vvodsectugol.ui @@ -0,0 +1,244 @@ + + + vvodSectUgol + + + + 0 + 0 + 329 + 166 + + + + Сектор по углу места + + + + + 20 + 130 + 75 + 23 + + + + Ввод + + + + + + 130 + 130 + 75 + 23 + + + + Сброс + + + + + + 10 + 10 + 311 + 111 + + + + + + + + + 10 + 20 + 131 + 16 + + + + Нижняя граница е + + + + + + 10 + 80 + 131 + 16 + + + + Верхняя граница е + + + + + + 150 + 12 + 46 + 13 + + + + низ. + + + + + + 150 + 28 + 46 + 13 + + + + сект. + + + + + + 150 + 70 + 46 + 13 + + + + верх. + + + + + + 150 + 86 + 46 + 13 + + + + сект. + + + + + + 190 + 20 + 41 + 20 + + + + 0 + + + + + + 250 + 20 + 41 + 20 + + + + 0 + + + + + + 190 + 70 + 41 + 20 + + + + 0 + + + + + + 250 + 70 + 41 + 20 + + + + 0 + + + + + + 232 + 21 + 16 + 16 + + + + + 12 + + + + - + + + + + + 232 + 72 + 16 + 16 + + + + + 12 + + + + - + + + + + + + 240 + 130 + 75 + 23 + + + + Отказ + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+
+ + +
diff --git a/vvodts.cpp b/vvodts.cpp new file mode 100644 index 0000000..61c1e2c --- /dev/null +++ b/vvodts.cpp @@ -0,0 +1,48 @@ +#include "vvodts.h" +#include "ui_vvodts.h" + +vvodTS::vvodTS(QWidget *parent) : + QDialog(parent), + ui(new Ui::vvodTS) +{ + ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + + ((Widget*)parent)->changeOpenWidget(this); + + ts = ((Widget*)parent)->ts; + ui->lineEdit->setText(QString::number(ts.nZone)); + ui->checkBox->setChecked(ts.south); + ui->lineEdit_3->setText(QString::number(ts.x)); + ui->lineEdit_4->setText(QString::number(ts.y)); + ui->lineEdit_5->setText(QString::number(ts.h)); +} + +vvodTS::~vvodTS() +{ + delete ui; +} + +void vvodTS::closeEvent(QCloseEvent *event) +{ + ((Widget*)parent())->clearOpenWidget(); + event->accept(); +} + +void vvodTS::on_pushButton_2_clicked() +{ + close(); +} + +void vvodTS::on_pushButton_clicked() +{ + ts.nZone = ui->lineEdit->text().toInt(); + ts.south = ui->checkBox->isChecked(); + ts.x = ui->lineEdit_3->text().toInt(); + ts.y = ui->lineEdit_4->text().toInt(); + ts.h = ui->lineEdit_5->text().toInt(); + + ((Widget*)parent())->ts = ts; + ((Widget*)parent())->writeFile(); + close(); +} diff --git a/vvodts.h b/vvodts.h new file mode 100644 index 0000000..0c62945 --- /dev/null +++ b/vvodts.h @@ -0,0 +1,31 @@ +#ifndef VVODTS_H +#define VVODTS_H + +#include +#include "widget.h" +#include "geo.h" + +namespace Ui { +class vvodTS; +} + +class vvodTS : public QDialog +{ + Q_OBJECT + +public: + explicit vvodTS(QWidget *parent = 0); + ~vvodTS(); + +private slots: + void on_pushButton_2_clicked(); + void closeEvent(QCloseEvent *event); + void on_pushButton_clicked(); + +private: + Ui::vvodTS *ui; + T_geoPoint ts; + +}; + +#endif // VVODTS_H diff --git a/vvodts.ui b/vvodts.ui new file mode 100644 index 0000000..9388dd9 --- /dev/null +++ b/vvodts.ui @@ -0,0 +1,239 @@ + + + vvodTS + + + + 0 + 0 + 267 + 281 + + + + Ввод точки стояния + + + + + 180 + 240 + 75 + 23 + + + + Отказ + + + + + + 20 + 240 + 75 + 23 + + + + Ввод + + + + + + 0 + 0 + 261 + 221 + + + + + + + + + 20 + 50 + 91 + 16 + + + + Номер зоны + + + + + + 150 + 50 + 61 + 20 + + + + 6 + + + + + + 20 + 81 + 131 + 16 + + + + Южное Полушарие + + + + + + 20 + 110 + 91 + 16 + + + + XL + + + + + + 150 + 110 + 61 + 20 + + + + 0 + + + + + + 150 + 140 + 61 + 20 + + + + 0 + + + + + + 20 + 140 + 91 + 16 + + + + YL + + + + + + 20 + 170 + 91 + 16 + + + + HL + + + + + + 150 + 170 + 61 + 20 + + + + 0 + + + + + + 150 + 81 + 70 + 17 + + + + + + + + + + 220 + 110 + 16 + 16 + + + + м + + + + + + 220 + 140 + 16 + 16 + + + + м + + + + + + 220 + 170 + 16 + 16 + + + + м + + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+ + checkboxmod + QCheckBox +
checkboxmod.h
+
+
+ + +
diff --git a/widget.cpp b/widget.cpp new file mode 100644 index 0000000..5027423 --- /dev/null +++ b/widget.cpp @@ -0,0 +1,3309 @@ +#include +#include +#include "widget.h" +#include "ui_widget.h" + +#include + +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() +{ + // -- . . + 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; // , + // 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 + d >> tFloat; // y + d >> tFloat; // z + d >> tFloat; // + d >> tFloat; // + + d >> tFloat; // + 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); + +// + d << (qint8)currentTaskNum; +// + d << (qint16)metAv.temp << (qint8)metAv.wind << (qint16)metAv.azim << (qint16)metAv.pressure; +// + if (meteoSred) tByte=1; else tByte = 0; + d << tByte; + +// + QByteArray tmpMetSr = metSr.toLocal8Bit(); + tmpMetSr.resize(182); + + for (i=0; i<182; i++) + { + tByte=tmpMetSr[i]; + d << tByte; + } + +// + d << (qint16)ZAnastrel << (qint16)ZAtempZar; +// , + + for (i=0; i<9; i++) + { + d << (qint16)errZAgor[i]; + } + + for (i=0; i<7; i++) + { + d << (qint16)errZAver[i]; + } + + d << (qint16)errZAdB; + +// + + d << (qint8)rezhimZerk; + + + +// + + 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<radioButton_set5->isChecked())||(ui->radioButton_set6->isChecked())); + d << tBool; + + if (VCUnumTarget!=-1) + tWord = qint16(targetsIds[VCUnumTarget]); + else + tWord = 0; + d << tWord; + +// 4x 9 + + 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) // + { + 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) // + { + 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; // + errZAdB = tWord; + + d >> tByte; // byte - zerk strelba [0 - vikl, 1 - x, 2 - y] + rezhimZerk = tByte; + + + for (i=0; i<5; i++) d>>tByte; + +// pos + 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); + + // (0 - , 1 - , 2 - ) + for (i=0; i<4; i++) + { + d>>tByte; + } + d>>tBool; + + + d>>tBool; // <<-- , + d>>tWord;// <<-- , +// pos + + d >> tWord; // + for (i=0; i<4; i++) // + { + d >> tWord; + BK[i] = tWord; + } + + d >> tByte; + BK[4] = tByte; // - + + // + 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; +// 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; + + } + + +// Alt Ctrl +// Alt Ctrl 1 , + + + 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; + } + + + } + + +// 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; + } + +// ----- - +// keybd_event(keyWin, 0,0,0); +// keybd_event(keyWin, 0, KEYEVENTF_KEYUP, 0); + +// } +} + +void Widget::processPendingDatagrams() // +{ + 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) + { + // + + 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(" 1")); + break; + case 2: + ui->lineEdit_3->setText(QString::fromLocal8Bit(" 2")); + break; + case 3: + ui->lineEdit_3->setText(QString::fromLocal8Bit(" 3")); + break; + case 4: + ui->lineEdit_3->setText(QString::fromLocal8Bit(" 4")); + break; + case 5: + ui->lineEdit_3->setText(QString::fromLocal8Bit("")); + break; + case 6: + ui->lineEdit_3->setText(QString::fromLocal8Bit("")); + break; + case 7: + ui->lineEdit_3->setText(QString::fromLocal8Bit("")); + 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; // 2 azMetkaCURLS 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; // + 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("-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("")); + 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; // + ui->radioButton_Z2->setChecked(tBool); + + + + d >> tByte; // + switch (tByte) + { + case 0: + ui->lineEdit_2->setText(QString::fromLocal8Bit("")); + umMissTur = -162; + basePoxod = 1; + + break; + case 1: + ui->lineEdit_2->setText(QString::fromLocal8Bit("")); + 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("")); + 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; // + d >> tWord; // + + + for (i=0; i<2; i++) d >> tReal; // + + + + d >> tByte; // + // 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 100 , .. + 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() { // + 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); + + // 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> 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; // x + //yTek: single; // y + //hTek: single; // h + d >> tFloat; cY = tFloat; + d >> tFloat; cX = tFloat; + d >> tFloat; cH = tFloat; + //aX: single; // + //aY: single; // + //aH: single; // + for (int i=0; i<3; ++i) d >> tFloat; + //vxTek: single; // + //vyTek: single; // + //vhTek: single; // h + d >> tFloat; vY = tFloat; + d >> tFloat; vX = tFloat; + d >> tFloat; + //akt: longword; // + //OnVisLine: boolean; + d >> tDWord >> tBool; + d >> tWord >> tByte; // + } + // 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; + // id, , + 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; // + 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); // + +// 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; iexist) { + currentNum=i; + return i; + }; +// . : , +// 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; // + 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<<" "<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(""); + rezhimGAGtxt[1] = QString::fromLocal8Bit(""); + rezhimGAGtxt[2] = QString::fromLocal8Bit("0"); + rezhimGAGtxt[3] = QString::fromLocal8Bit(""); + + currentTaskNum = 0; + metSr.resize(260); + metSr.clear(); + + + +// splashIsOn=1; +// + openWidget = 0; + + rckV0 = 0; + rckV = 60; // 600 / + rckT0 = 1; // 1 + + rckD0 = (rckV0+rckV)/2*rckT0; // + rckHmin = 0.1; + rckHmax = 35; + + rckDmin = 5; + rckDmax = 60; + + rckAngle = 80; // 80 - + +// + 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("-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)) + { +// Crtl+1x, Crtl+2x, Crtl+5x 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(" "), 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(" Ctrl+11"), this); + // connect + m1Trace = new QAction(QString::fromLocal8Bit(" Ctrl+12"), this); + // connect + + m1RazvorotL = new QAction(QString::fromLocal8Bit(" "), this); + m1RazvorotR = new QAction(QString::fromLocal8Bit(" "), this); + m1Barrazh = new QAction(QString::fromLocal8Bit(" "), this); + m1Pikir = new QAction(QString::fromLocal8Bit(""), this); + m1Kabrir = new QAction(QString::fromLocal8Bit(""), this); + m1Speed = new QAction(QString::fromLocal8Bit(" "), this); + m1JumpHeli = new QAction(QString::fromLocal8Bit("'' "), this); + + m1Reset = new QAction(QString::fromLocal8Bit(" Ctrl+13"), this); + m1Load = new QAction(QString::fromLocal8Bit(" Ctrl+14"), this); + m1Save = new QAction(QString::fromLocal8Bit(" Ctrl+15"), this); + m1Start = new QAction(QString::fromLocal8Bit(" Ctrl+16"), this); + m1Stop = new QAction(QString::fromLocal8Bit(" Ctrl+17"), this); + m1SectorVvod = new QAction(QString::fromLocal8Bit(" "), this); + m1SectorEnable = new QAction(QString::fromLocal8Bit("/ "), this); + m1SectorReset = new QAction(QString::fromLocal8Bit(" "), this); + + m1Rezhim = new QAction(QString::fromLocal8Bit(" "), this); + m1ShowMark = new QAction(QString::fromLocal8Bit(" "), this); + m1ResetCourse = new QAction(QString::fromLocal8Bit(" "), this); + m1ResetMark = new QAction(QString::fromLocal8Bit(" "), this); + m1Timer = new QAction(QString::fromLocal8Bit(" "), this); + + + m2Reper = new QAction(QString::fromLocal8Bit(" Ctrl+21"), this); + connect(m2Reper, SIGNAL(triggered()), this, SLOT(msVvodReper())); + m2Mestopol = new QAction(QString::fromLocal8Bit(" Ctrl+22"), this); + connect(m2Mestopol, SIGNAL(triggered()), this, SLOT(msVvodTS())); + m2Geo_GK = new QAction(QString::fromLocal8Bit("- Ctrl+23"), this); + connect(m2Geo_GK, SIGNAL(triggered()), this, SLOT(msGeoToGK())); + m2GK_Geo = new QAction(QString::fromLocal8Bit("- Ctrl+24"), this); + connect(m2GK_Geo, SIGNAL(triggered()), this, SLOT(msGKToGeo())); + m2GK_GK = new QAction(QString::fromLocal8Bit("- Ctrl+25"), this); + connect(m2GK_GK, SIGNAL(triggered()), this, SLOT(msGKToGK())); + + + m3GAG = new QAction(QString::fromLocal8Bit(" "), this); + connect(m3GAG, SIGNAL(triggered()), this, SLOT(msGAG())); + + m4RezhimMA = new QAction(QString::fromLocal8Bit(" /"), this); + connect(m4RezhimMA, SIGNAL(triggered()), this, SLOT(msMeteoSredShow())); + m4Bulletin = new QAction(QString::fromLocal8Bit(" "), this); + connect(m4Bulletin, SIGNAL(triggered()), this, SLOT(msBulletinShow())); + m4Nastrel = new QAction(QString::fromLocal8Bit(" "), this); + connect(m4Nastrel, SIGNAL(triggered()), this, SLOT(msNastrel())); + m4Temperature = new QAction(QString::fromLocal8Bit(" "), this); + connect(m4Temperature, SIGNAL(triggered()), this, SLOT(msTempZar())); + m4Errors = new QAction(QString::fromLocal8Bit(" "), this); + connect(m4Errors, SIGNAL(triggered()), this, SLOT(msErrorZA())); + m4Data = new QAction(QString::fromLocal8Bit(" "), this); + connect(m4Data, SIGNAL(triggered()), this, SLOT(msVvodMA())); + m4RezhimZerk = new QAction(QString::fromLocal8Bit(" "), this); + connect(m4RezhimZerk, SIGNAL(triggered()), this, SLOT(msZerkuS())); + m4Adress = new QAction(QString::fromLocal8Bit(" "), this); + connect(m4Adress, SIGNAL(triggered()), this, SLOT(msOwnAdr())); + + m5VvodBK = new QAction(QString::fromLocal8Bit(" "), this); + connect(m5VvodBK, SIGNAL(triggered()), this, SLOT(msVvodBK())); + m5Ready = new QAction(QString::fromLocal8Bit("/ "), this); + connect(m5Ready, SIGNAL(triggered()), this, SLOT(msVvodReady())); + m5TargDestr = new QAction(QString::fromLocal8Bit(" "), this); + connect(m5TargDestr, SIGNAL(triggered()), this, SLOT(msVvodKKill())); + m5TargMissed = new QAction(QString::fromLocal8Bit(" "), this); + connect(m5TargMissed, SIGNAL(triggered()), this, SLOT(msVvodKMiss())); + m5DKO = new QAction(QString::fromLocal8Bit(""), this); + connect(m5DKO, SIGNAL(triggered()), this, SLOT(msVvodDKO())); + + m5PeriodicFK = new QAction(QString::fromLocal8Bit(" "), this); + m5CtrlSum = new QAction(QString::fromLocal8Bit(" "), this); + connect(m5CtrlSum, SIGNAL(triggered()), this, SLOT(msShowCRC())); + + m6SectAzim = new QAction(QString::fromLocal8Bit(" "), this); + connect(m6SectAzim, SIGNAL(triggered()), this, SLOT(msVvodSectAzim())); + m6SectUgol = new QAction(QString::fromLocal8Bit(" "), this); + connect(m6SectUgol, SIGNAL(triggered()), this, SLOT(msVvodSectUgol())); + m6SectOtv = new QAction(QString::fromLocal8Bit(" "), this); + connect(m6SectOtv, SIGNAL(triggered()), this, SLOT(msVvodSectOtvet())); + m6ManualZA = new QAction(QString::fromLocal8Bit(". "), this); + connect(m6ManualZA, SIGNAL(triggered()), this, SLOT(msVvodManualZA())); + m6AutoZA = new QAction(QString::fromLocal8Bit(". ."), this); + connect(m6AutoZA, SIGNAL(triggered()), this, SLOT(msVvodAutoZA())); + + m7Default = new QAction(QString::fromLocal8Bit(" "), this); + m7BR = new QAction(QString::fromLocal8Bit(""), this); + m7FK = new QAction(QString::fromLocal8Bit(""), this); + m7TRU = new QAction(QString::fromLocal8Bit(""), this); + m7CU = new QAction(QString::fromLocal8Bit("_N/_B"), this); + connect(m7CU, SIGNAL(triggered()), this, SLOT(msVvodCU_N())); + m7CUDenied = new QAction(QString::fromLocal8Bit(" "), this); + connect(m7CUDenied, SIGNAL(triggered()), this, SLOT(msVvodKCancel())); + + m8Reset = new QAction(QString::fromLocal8Bit(" Ctrl+51"), this); + m8Param = new QAction(QString::fromLocal8Bit(" Ctrl+53"), this); + + m9Oscil = new QAction(QString::fromLocal8Bit(""), this); + m9View = new QAction(QString::fromLocal8Bit(" /"), this); + + m0Reboot = new QAction(QString::fromLocal8Bit(" Ctrl+91"), this); + m0Shutdown = new QAction(QString::fromLocal8Bit(" Ctrl+92"), this); + connect(m0Shutdown, SIGNAL(triggered()), this, SLOT(closeSlot())); +} + +void Widget::createMenu() +{ + + + + QList 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("")); + mTrenag->addAction(m1Source); + mTrenag->addAction(m1Trace); + + m1Manevr=mTrenag->addMenu(QString::fromLocal8Bit("")); + la.clear(); + la<addActions(la); + + la.clear(); + la<addActions(la); + + m1OperatorTren = mTrenag->addMenu(QString::fromLocal8Bit(" ")); + la.clear(); + la << m1Rezhim +// << m1ShowMark + << m1ResetCourse +// << m1ResetMark +// << m1Timer + ; + m1OperatorTren->addActions(la); + + + + + mTopo = menu->addMenu(QString::fromLocal8Bit("")); + + mTopo->addAction(m2Reper); + mTopo->addAction(m2Mestopol); + m2Pereschet=mTopo->addMenu(QString::fromLocal8Bit(" ")); + + la.clear(); + la << m2Geo_GK << m2GK_Geo << m2GK_GK; + m2Pereschet->addActions(la); + + + + + + mGAG = menu->addMenu(QString::fromLocal8Bit("")); + mGAG->addAction(m3GAG); + + mPodgotovka = menu->addMenu(QString::fromLocal8Bit("")); + la.clear(); + la<addActions(la); + + + + + mSost = menu->addMenu(QString::fromLocal8Bit(".")); + mSost->addAction(m5VvodBK); + + m5Reports = mSost->addMenu(QString::fromLocal8Bit("")); + la.clear(); + la<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("")); + la.clear(); + la<addActions(la); + + + mCVS = menu1->addMenu(QString::fromLocal8Bit("")); + la.clear(); + la<addActions(la); + + mOtogd = menu1->addMenu(QString::fromLocal8Bit("")); + mOtogd->addAction(m8Reset); + mOtogd->addAction(m8Param); + + + mReg = menu1->addMenu(QString::fromLocal8Bit("")); + mReg->addAction(m9Oscil); + mReg->addAction(m9View); + + + mExit = menu1->addMenu(QString::fromLocal8Bit("")); + 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 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 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("")); + else + ui->lineEdit_30->setText(QString::fromLocal8Bit("")); +} + +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("")); + ui->lineEdit_26->setText(QString::fromLocal8Bit("")); + 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("")); + ui->lineEdit_26->setText(QString::fromLocal8Bit("")); + 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("")); + ui->lineEdit_26->setText(QString::fromLocal8Bit("")); + 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("")); + ui->lineEdit_26->setText(QString::fromLocal8Bit("")); + 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) // ( ) +{ + if ((NC)&&(grAir[abs(NC)-1]->exist)) + { + lastKO = z2Z; + ui->lineEdit_27->setText(QString::fromLocal8Bit(" ")); + ui->lineEdit_26->setText(QString::fromLocal8Bit("")); + + QClipboard *clipboard = QApplication::clipboard(); + clipboard->setText(QString::fromLocal8Bit(".")); + + 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("")); + else ui->lineEdit_16->setText(QString::fromLocal8Bit("")); + + +// reCalculate(); + + // . + } +} + + +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 (tlradioButton_set5->setChecked(((td>tl)&&(tdradioButton_set5->setChecked(((tdtl))); + } + 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 (trradioButton_set6->setChecked(((tdtr))); + 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) +{ +// 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) // + { + 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(" 23-206 "), 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(" 23-206 "), 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(" 23-421 "), 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(" 909 "); + if (ui->checkBox_ctrl0->isChecked()==true) strTab.append(QString::fromLocal8Bit(" ")); + strTab.append(QString::fromLocal8Bit("")); + 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(" 21-403 "), 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(" 23-401 "), 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(" ")); + else + strTab.append(QString::fromLocal8Bit(" ")); + 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(" "), 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(" = "), 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()); + +} diff --git a/widget.h b/widget.h new file mode 100644 index 0000000..5aab25e --- /dev/null +++ b/widget.h @@ -0,0 +1,431 @@ +#ifndef WIDGET_H +#define WIDGET_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "menubarmod.h" +#include "geo.h" +#include "graphicsviewmod.h" +#include "graphicsarcitem.h" +#include "graphicslineitem.h" +#include +#include "grairobject.h" + +#include +#include + + + +#include "meteosred.h" +#include "vvodma.h" +#include "vvodms.h" +#include "nastrel.h" +#include "tempzar.h" +#include "errorsza.h" +#include "zerkus.h" +#include "ownadr.h" + +#include "gag.h" + +#include "vvodts.h" +#include "vvodreper.h" +#include "geotogk.h" +#include "gktogeo.h" +#include "gktogk.h" + +#include "vvodsectazim.h" +#include "vvodsectugol.h" +#include "vvodsectotvet.h" +#include "vvodautozadef.h" + +#include "vvodbk.h" +#include "vvoddko.h" +#include "vvodkcu.h" +#include "vvodready.h" + +#include "vvod2z.h" + +#include "showcrc.h" +#include "texit.h" + +namespace Ui { +class Widget; +} + +class Widget : public QWidget +{ + Q_OBJECT + +public: + explicit Widget(QWidget *parent = 0); + ~Widget(); + + QUdpSocket *udpSocket, *udpSend, *udpKeybRead; + + + QWidget *openWidget; + + MenuBarMod *menu, *menu1; + GraphicsViewMod *gV; + QGraphicsScene *gsc; + + QMenu *mTrenag; + QMenu *mTopo; + QMenu *mGAG; + QMenu *mPodgotovka; + QMenu *mSost; + QMenu *mStrelba; + QMenu *mCVS; + QMenu *mOtogd; + QMenu *mReg; + QMenu *mExit; +// "" + QAction *m1Source; + QAction *m1Trace; + + QMenu *m1Manevr; + QAction *m1RazvorotL; + QAction *m1RazvorotR; + QAction *m1Barrazh; + QAction *m1Pikir; + QAction *m1Kabrir; + QAction *m1Speed; + QAction *m1JumpHeli; + + + + QAction *m1Reset; + QAction *m1Load; + QAction *m1Save; + QAction *m1Start; + QAction *m1Stop; + QAction *m1SectorVvod; + QAction *m1SectorEnable; + QAction *m1SectorReset; + + QMenu *m1OperatorTren; + QAction *m1Rezhim; + QAction *m1ShowMark; + QAction *m1ResetCourse; + QAction *m1ResetMark; + QAction *m1Timer; +// "" + QAction *m2Reper; + QAction *m2Mestopol; + QMenu *m2Pereschet; + QAction *m2Geo_GK; + QAction *m2GK_Geo; + QAction *m2GK_GK; +// "" + QAction *m3GAG; +// "" + QAction *m4RezhimMA; + QAction *m4Bulletin; + QAction *m4Nastrel; + QAction *m4Temperature; + QAction *m4Errors; + QAction *m4Data; + QAction *m4RezhimZerk; + QAction *m4Adress; +// "" + QAction *m5VvodBK; + QMenu *m5Reports; + QAction *m5Ready; + QAction *m5TargDestr; + QAction *m5TargMissed; + QAction *m5DKO; + QAction *m5PeriodicFK; + QAction *m5CtrlSum; + +// "" + QAction *m6SectAzim; + QAction *m6SectUgol; + QAction *m6SectOtv; + QAction *m6ManualZA; + QAction *m6AutoZA; + +// "" + QAction *m7Default; + QAction *m7BR; + QAction *m7FK; + QAction *m7TRU; + QAction *m7CU; + QAction *m7CUDenied; + +// "" + QAction *m8Reset; + QAction *m8Param; + +// "" + QAction *m9Oscil; + QAction *m9View; + +// "" + QAction *m0Reboot; + QAction *m0Shutdown; + + bool readFile(); + void writeFile(); + void createMenu(); + void createActions(); + void initBtnUIDs(); + void initParams(); + void setGraph(); + + void setVCU(int id); + void clearVCU(); + int findTargetFromId(int id); + void addTargets(); + void addTarget(int id, int aType, int gType, qreal cX, qreal cY, qreal cH, qreal vX, qreal vY); +// ( ) + bool MRUmode; +// + qreal rckV0, rckV, rckT0, rckTmax, rckD0; + qreal rckHmax, rckHmin, rckDmax, rckDmin; + qreal rckAngle; +// + QGraphicsScene *gscRckt; + QGraphicsView *gvRckt; + + QGraphicsRectItem *grRckt1, *grRckt2; + +// loading + QGraphicsScene *tmpGS; + QGraphicsTextItem *grLoadDate, *grLoadLogin, *grLoadPass; + + QString strLoadDate, strLoadLogin, strLoadPass; + qint16 curPosition; + + qint16 keybMaxDelay; + bool quickLoad; + bool silentMode; + +// + qreal zoomKoef[9]; + + qint8 pwrCVS[3]; + bool pwrMon, pwrMonPrev; + bool resetCVS[3]; + + int splashIsOn; + + bool meteoAvtonom, meteoSred; + void setMeteo(bool m1, bool m2); + + + int rezhimGAG; + QString rezhimGAGtxt[4]; + int GAGmdu, GAGdu; + int GAGmdu0, GAGdu0; + void setRezhimGAG(int pos); + + int rezhimZerk; + + T_geoPoint ts, reper; + T_metAv metAv; + QString metSr; + + int errZAgor[9]; + int errZAver[7]; + int errZAdB; + + int currentNum; + + int findNextNum(int n); + + int sectAzLow1, sectAzLow2, sectAzHigh1, sectAzHigh2; + int sectUgLow1, sectUgLow2, sectUgHigh1, sectUgHigh2; + + int grViewSetting; + + T_sectOtv ownSect; + graphicsArcItem *grOwnSect; + T_sectOtv kzsSect; + graphicsArcItem *grKzsSect; + qreal azimutGUN, azimutGUNprev; + qreal ugolGUN, ugolGUNprev; + graphicsLineItem *grAzimutGUN; + + int umMissTur; + int basePoxod; // 1 - , 2- , 3 - + +// t1 - , t2 - +// AS - , VCU - , R_N - , +// R_V - + + qreal AS_t1, AS_t2, VCU_t1, VCU_t2, R_N_t1, R_N_t2, R_V_t1, R_V_t2; + qreal AS_par; + +// qreal grCrossAzim, grCrossDist; +// QGraphicsItem grCross; + + + qreal azimutRLS; + graphicsLineItem *grAzimutRLS; + graphicsLineItem *grAzimutRLSnormal; + + qreal azimutKurs; + graphicsLineItem *grAzimutKurs; + + grAirObject *grAir[100]; + int targetsIds[100]; + qreal globalScale; + int targetsCount; + + int VCUnumTarget; + int ASnumTarget; + graphicsLineItem *grVCU; + int lastKO; + + + bool autoZAdefault; + + int BK[5]; // 0-3 , , , ; 4- + + bool readyBoegotov; + + int ZAtempZar; + int ZAnastrel; + + + QTimer *loadScreenTmr; + int loadingPos; + int loadingShift; + + void keybReadDatagrams(int d1, int d2, int d3, int d4, int d5); + +// + + QUdpSocket *udpNewTask, *udpOptServer, *udpOptServer2; + QUdpSocket *udpTarget, *udpCU; + char currentTaskNum; + +public slots: + void changeOpenWidget(QObject* p); + void clearOpenWidget(); + + void catcher(int); + void catchel(int); + void switchWidget(int); + + void showSplash(int d=1); + void hideSplash() {showSplash(0);}; + + void msMeteoSredShow(void); + void msVvodMA(void); + void msBulletinShow(void); + void msNastrel(void); + void msTempZar(void); + void msErrorZA(void); + void msZerkuS(void); + void msOwnAdr(void); + + void msGAG(void); + + void msVvodReper(); + void msVvodTS(); + void msGeoToGK(); + void msGKToGeo(); + void msGKToGK(); + + void msVvodSectAzim(); + void msVvodSectUgol(); + void msVvodSectOtvet(); + void msVvodAutoZA(); + void msVvodManualZA(); + + void msVvodBK(); + void msVvodDKO(); + void msVvodKCancel(); + void msVvodKZapret(); + void msVvodKKill(); + void msVvodKMiss(); + + void msVvodCU_N(); + void msVvodCU_N2(int NC, int z2Z=0); + + void msVvodReady(); + + void msShowCRC(); + + void msVvod2z(); + + + void closeSlot(); + void reCalculate(); + + void processSendingDatagrams(QByteArray buf, int port=45460); + void sendReport(); +private slots: + void setSector(qint8 zoneType, float anglStart, float anglEnd); + + void processPendingDatagrams(); + + void clearOldTarget(QBitArray &subAr); + void process_TargetKDG(); + void process_CU_KRU_KDG(); + + void newOptServerData(); + + void newOptServerData2(); + + void synhrTimeout(); + + void newTaskReadDatagrams(); + + void msTickGraph(); + + void on_pushButton_8_clicked(); + + void on_pushButton_10_clicked(); + + void on_pushButton_14_clicked(); + + void on_pushButton_12_clicked(); + + void on_pushButton_13_clicked(); + + void on_pushButton_7_clicked(); + + void on_comboBox_2_currentIndexChanged(int index); + + void on_pushButton_4_clicked(); + + void on_comboBox_currentIndexChanged(int index); + + void on_pushButton_11_clicked(); + + void loadScreenTick(); + + void focusSS(QWidget*, QWidget*); + + void activateWindow(int); + + void putLogin(); + + void getFocus(); + + void on_pushButton_9_clicked(); + +private: + void putDate(); + + + virtual void keyPressEvent ( QKeyEvent * e ); + + Ui::Widget *ui; + + + + +}; + +#endif // WIDGET_H diff --git a/widget.ui b/widget.ui new file mode 100644 index 0000000..b62ea40 --- /dev/null +++ b/widget.ui @@ -0,0 +1,2301 @@ + + + Widget + + + + 0 + 0 + 800 + 600 + + + + + 0 + 0 + + + + + 800 + 600 + + + + Widget + + + + + 530 + 0 + 271 + 161 + + + + Qt::NoFocus + + + + + 10 + 50 + 251 + 101 + + + + + QLayout::SetFixedSize + + + 0 + + + + + true + + + + 58 + 23 + + + + + 58 + 23 + + + + Qt::TabFocus + + + + + + ИСХ + + + + + + + + 58 + 23 + + + + + 58 + 23 + + + + БР + + + + + + + true + + + + 58 + 23 + + + + + 58 + 23 + + + + Qt::TabFocus + + + ФК + + + + + + + true + + + + 57 + 23 + + + + + 57 + 23 + + + + Qt::TabFocus + + + ТРУ + + + + + + + + 58 + 23 + + + + + 58 + 23 + + + + ЦУ_N + + + + + + + + 58 + 23 + + + + + 58 + 23 + + + + Отказ + + + + + + + + 58 + 23 + + + + + 58 + 23 + + + + Упрежд. + + + true + + + true + + + + + + + + 57 + 23 + + + + + 57 + 23 + + + + БК + + + + + + + + 58 + 23 + + + + + 58 + 23 + + + + 2Z + + + + + + + + 58 + 23 + + + + + 58 + 23 + + + + Уничтож. + + + + + + + + 58 + 23 + + + + + 58 + 23 + + + + Пропуск + + + + + + + + 57 + 23 + + + + + 57 + 23 + + + + ДКЗС + + + + + + + + + + 10 + 0 + 540 + 571 + + + + + + 13 + 10 + 61 + 24 + + + + QFrame::Box + + + QFrame::Sunken + + + 2 + + + 54x50 + + + Qt::RichText + + + false + + + Qt::AlignCenter + + + + + + 80 + 10 + 41 + 23 + + + + Qt::StrongFocus + + + Сел. + + + true + + + false + + + + + + 240 + 10 + 41 + 22 + + + + Qt::TabFocus + + + + 800 + + + + + 400 + + + + + 200 + + + + + 90 + + + + + 45 + + + + + 35 + + + + + 25 + + + + + 12 + + + + + 6 + + + + + + + 130 + 10 + 101 + 22 + + + + Qt::TabFocus + + + + полный + + + + + пустой + + + + + источник + + + + + номер + + + + + без ТЦ + + + + + + + + 530 + 160 + 271 + 441 + + + + + + 0 + 40 + 271 + 121 + + + + Сопровождение АВТОМАТ + + + + + 10 + 20 + 21 + 16 + + + + + + + + + + 34 + 19 + 51 + 16 + + + + Qt::NoFocus + + + 0 + + + true + + + + + + 120 + 19 + 61 + 16 + + + + Qt::NoFocus + + + 0 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + + + + + + 110 + 20 + 16 + 16 + + + + Р + + + + + + 190 + 10 + 81 + 71 + + + + ЗА + + + + + 1 + 14 + 61 + 51 + + + + Qt::Vertical + + + + Qt::NoFocus + + + Зона-2 + + + false + + + + + Qt::NoFocus + + + Зона + + + true + + + false + + + + + Qt::NoFocus + + + Огонь + + + false + + + + + + + + 120 + 44 + 61 + 16 + + + + Qt::NoFocus + + + 0 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + + + + + + 12 + 44 + 16 + 16 + + + + + 11 + + + + τ + + + + + + 34 + 44 + 51 + 16 + + + + Qt::NoFocus + + + 0 + + + true + + + + + + 110 + 45 + 16 + 16 + + + + 3 + + + + + + 110 + 99 + 16 + 16 + + + + H + + + + + + 120 + 98 + 61 + 16 + + + + Qt::NoFocus + + + 0 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + + + + + + 12 + 100 + 16 + 16 + + + + D + + + + + + 30 + 99 + 61 + 16 + + + + Qt::NoFocus + + + 0 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + + + + + + 200 + 99 + 61 + 16 + + + + Qt::NoFocus + + + 0 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + + + + + + 190 + 100 + 16 + 16 + + + + V + + + + + + 10 + 70 + 21 + 16 + + + + + 10 + + + + β + + + + + + 36 + 70 + 21 + 16 + + + + Qt::NoFocus + + + 0 + + + true + + + + + + 109 + 68 + 16 + 16 + + + + + 11 + + + + ε + + + + + + 70 + 70 + 21 + 16 + + + + Qt::NoFocus + + + 0 + + + true + + + + + + 62 + 71 + 21 + 16 + + + + - + + + + + + 122 + 70 + 21 + 16 + + + + Qt::NoFocus + + + 0 + + + true + + + + + + 148 + 71 + 21 + 16 + + + + - + + + + + + 156 + 71 + 21 + 16 + + + + Qt::NoFocus + + + 0 + + + true + + + + + + 20 + 50 + 16 + 16 + + + + + 7 + + + + п + + + + + + 102 + 41 + 16 + 16 + + + + + 11 + + + + τ + + + + + + 102 + 166 + 16 + 16 + + + + 3 + + + + + + 94 + 162 + 16 + 16 + + + + + 12 + + + + τ + + + + + + + 0 + 280 + 171 + 81 + + + + Установки + + + + + 10 + 20 + 82 + 17 + + + + Qt::NoFocus + + + УПР + + + true + + + false + + + + + + 10 + 40 + 71 + 17 + + + + Qt::NoFocus + + + СЕКТ.АЗ + + + false + + + + + + 10 + 60 + 82 + 17 + + + + Qt::NoFocus + + + СЕКТ.УМ + + + false + + + + + + 110 + 60 + 51 + 17 + + + + Qt::NoFocus + + + ЗЕРК + + + false + + + + + + 99 + 40 + 21 + 16 + + + + ГАГ + + + + + + 124 + 40 + 41 + 16 + + + + Qt::NoFocus + + + ГАГдв + + + + + + 140 + 20 + 21 + 16 + + + + Qt::NoFocus + + + МА + + + + + + 96 + 20 + 41 + 16 + + + + МЕТЕО + + + + + + + 178 + 280 + 91 + 81 + + + + Контроль + + + + + 10 + 15 + 72 + 68 + + + + + + + Qt::NoFocus + + + Р909 + + + true + + + false + + + + + + + Qt::NoFocus + + + БР21-403 + + + true + + + false + + + + + + + Qt::NoFocus + + + БР21-401 + + + true + + + false + + + + + + + + + + 0 + 360 + 271 + 26 + + + + + + + + + 10 + 5 + 82 + 17 + + + + Qt::NoFocus + + + ЗАПРЕТ АЗ. + + + false + + + + + + 90 + 5 + 82 + 17 + + + + Qt::NoFocus + + + ЗАПРЕТ УМ. + + + false + + + + + + 177 + 6 + 31 + 16 + + + + Сч.Вр. + + + + + + 214 + 3 + 41 + 20 + + + + Qt::NoFocus + + + 0.0 + + + + + + + 0 + 390 + 271 + 51 + + + + + + + Qt::NoFocus + + + δβ + + + false + + + + + + + Qt::NoFocus + + + δε + + + false + + + + + + + Qt::NoFocus + + + δQ + + + false + + + + + + + Qt::NoFocus + + + δΔε + + + false + + + + + + + Qt::NoFocus + + + δD + + + false + + + + + + + Qt::NoFocus + + + δε рл + + + false + + + + + + + Qt::NoFocus + + + δε рп + + + false + + + + + + + Qt::NoFocus + + + δФ + + + false + + + + + + + Qt::NoFocus + + + δΔq + + + false + + + + + + + + + 0 + 0 + 271 + 41 + + + + Режимы + + + + + 10 + 20 + 21 + 16 + + + + Qt::NoFocus + + + ЦВС + + + + + + 34 + 19 + 41 + 16 + + + + Qt::NoFocus + + + БР + + + true + + + + + + 97 + 19 + 50 + 16 + + + + + 7 + + + + Qt::NoFocus + + + РЕЖИМ Р + + + 7 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + + + + + + 79 + 20 + 21 + 16 + + + + Qt::NoFocus + + + ЗР + + + + + + 187 + 20 + 61 + 16 + + + + Qt::NoFocus + + + РЕЖИМ 1 + + + 7 + + + true + + + + + + 161 + 21 + 21 + 16 + + + + Qt::NoFocus + + + РЛС + + + + + + + 0 + 160 + 267 + 121 + + + + ВЦУ + + + + + 10 + 20 + 21 + 16 + + + + + + + + + + 34 + 19 + 51 + 16 + + + + Qt::NoFocus + + + 0 + + + true + + + + + + 120 + 19 + 61 + 16 + + + + Qt::NoFocus + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + + + + + + 110 + 20 + 16 + 16 + + + + + + + + + + 120 + 44 + 61 + 16 + + + + Qt::NoFocus + + + 0 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + + + + + + 34 + 44 + 51 + 16 + + + + Qt::NoFocus + + + 0 + + + true + + + + + + 110 + 99 + 16 + 16 + + + + H + + + + + + 120 + 98 + 61 + 16 + + + + Qt::NoFocus + + + 0 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + + + + + + 10 + 100 + 16 + 16 + + + + D + + + + + + 30 + 99 + 61 + 16 + + + + Qt::NoFocus + + + 0 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + + + + + + 206 + 99 + 55 + 16 + + + + Qt::NoFocus + + + 0 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + + + + + + 190 + 100 + 16 + 16 + + + + V + + + + + + 10 + 70 + 21 + 16 + + + + β + + + + + + 36 + 70 + 21 + 16 + + + + Qt::NoFocus + + + 0 + + + true + + + + + + 70 + 70 + 21 + 16 + + + + Qt::NoFocus + + + 00 + + + true + + + + + + 62 + 71 + 21 + 16 + + + + Qt::NoFocus + + + - + + + + + + 122 + 70 + 21 + 16 + + + + Qt::NoFocus + + + 0 + + + true + + + + + + 148 + 71 + 21 + 16 + + + + - + + + + + + 156 + 71 + 21 + 16 + + + + Qt::NoFocus + + + 00 + + + true + + + + + + 190 + 20 + 16 + 16 + + + + Оп + + + + + + 206 + 19 + 55 + 16 + + + + Qt::NoFocus + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + + + + + + 190 + 44 + 16 + 16 + + + + ПД + + + + + + 206 + 43 + 55 + 16 + + + + Qt::NoFocus + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + + + + + + 190 + 70 + 16 + 16 + + + + К0 + + + + + + 206 + 69 + 55 + 16 + + + + Qt::NoFocus + + + 00 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + + + + + + 110 + 70 + 16 + 16 + + + + + 11 + + + + ε + + + + + + 10 + 43 + 16 + 16 + + + + + 11 + + + + τ + + + + + + 18 + 49 + 16 + 16 + + + + + 7 + + + + п + + + + + + 110 + 48 + 16 + 16 + + + + 3 + + + + + + 102 + 44 + 16 + 16 + + + + + 11 + + + + τ + + + + + + + 0 + 390 + 271 + 51 + + + + + Century Gothic + 14 + 75 + true + + + + Qt::NoFocus + + + false + + + ЗОНА + + + false + + + + + + + 0 + 570 + 521 + 31 + + + + + + 5 + 3 + 480 + 25 + + + + Qt::NoFocus + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + + + 255 + 0 + 0 + + + + + + + + + 20 + 50 + 161 + 151 + + + + Qt::NoFocus + + + QFrame::NoFrame + + + QFrame::Plain + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + + + 50 + 50 + 50 + + + + + false + + + Qt::AlignJustify|Qt::AlignTop + + + QGraphicsView::FullViewportUpdate + + + + + + 30 + 80 + 161 + 151 + + + + Qt::NoFocus + + + QFrame::NoFrame + + + QFrame::Plain + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + + + 50 + 50 + 50 + + + + + + + 50 + 50 + 50 + + + + + false + + + Qt::AlignJustify|Qt::AlignTop + + + QGraphicsView::FullViewportUpdate + + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+ + comboboxmod + QComboBox +
comboboxmod.h
+
+
+ + pushButton + comboBox + comboBox_2 + pushButton_3 + pushButton_4 + pushButton_5 + pushButton_6 + pushButton_7 + pushButton_8 + pushButton_9 + pushButton_10 + pushButton_11 + pushButton_12 + pushButton_13 + pushButton_14 + + + +
diff --git a/zerkus.cpp b/zerkus.cpp new file mode 100644 index 0000000..a419d10 --- /dev/null +++ b/zerkus.cpp @@ -0,0 +1,55 @@ +#include "zerkus.h" +#include "ui_zerkus.h" + +zerkus::zerkus(QWidget *parent) : + QDialog(parent), + ui(new Ui::zerkus) +{ + ui->setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + + ((Widget*)parent)->changeOpenWidget(this); + + rezhimZerk = (((Widget*)parent)->rezhimZerk); + + if (rezhimZerk) + { + ui->checkBox->setChecked(true); + if (rezhimZerk==2) ui->comboBox->setCurrentIndex(1); + else ui->comboBox->setCurrentIndex(0); + } + else + { + ui->checkBox->setChecked(false); + ui->comboBox->setCurrentIndex(0); + } +} + +zerkus::~zerkus() +{ + delete ui; +} + +void zerkus::on_pushButton_2_clicked() +{ + close(); +} + +void zerkus::on_pushButton_clicked() +{ + int ret=0; + if (ui->checkBox->isChecked()) + { + ret = ui->comboBox->currentIndex()+1; + } + + ((Widget*)parent())->rezhimZerk = ret; + ((Widget*)parent())->writeFile(); + close(); +} + +void zerkus::closeEvent(QCloseEvent *event) +{ + ((Widget*)parent())->clearOpenWidget(); + event->accept(); +} diff --git a/zerkus.h b/zerkus.h new file mode 100644 index 0000000..976a8f1 --- /dev/null +++ b/zerkus.h @@ -0,0 +1,29 @@ +#ifndef ZERKUS_H +#define ZERKUS_H + +#include +#include "widget.h" + +namespace Ui { +class zerkus; +} + +class zerkus : public QDialog +{ + Q_OBJECT + +public: + explicit zerkus(QWidget *parent = 0); + ~zerkus(); + +private slots: + void on_pushButton_2_clicked(); + void closeEvent(QCloseEvent *event); + void on_pushButton_clicked(); + +private: + Ui::zerkus *ui; + int rezhimZerk; +}; + +#endif // ZERKUS_H diff --git a/zerkus.ui b/zerkus.ui new file mode 100644 index 0000000..b533435 --- /dev/null +++ b/zerkus.ui @@ -0,0 +1,134 @@ + + + zerkus + + + + 0 + 0 + 274 + 139 + + + + Зеркальная учебная стрельба + + + + + 50 + 103 + 75 + 23 + + + + Ввод + + + + + + 10 + 10 + 241 + 81 + + + + + + + + + 20 + 5 + 101 + 31 + + + + Режим включен + + + + + + 20 + 35 + 101 + 31 + + + + Ось координат + + + + + + 157 + 13 + 31 + 17 + + + + + + + + + + 157 + 38 + 61 + 22 + + + + + Ось Х + + + + + Ось У + + + + + + + + 170 + 103 + 75 + 23 + + + + Отказ + + + + + + pushbuttonmod + QPushButton +
pushbuttonmod.h
+
+ + comboboxmod + QComboBox +
comboboxmod.h
+
+ + checkboxmod + QCheckBox +
checkboxmod.h
+
+
+ + +