修正使用代理之后UDP无法连接问题

This commit is contained in:
hm
2022-09-08 15:24:17 +08:00
parent 1d872c2ca6
commit ddcde70bd3
5 changed files with 58 additions and 44 deletions
+1
View File
@@ -51,6 +51,7 @@ MenuBarUI::MenuBarUI(QWidget *parent) :
ui->label_Status->hide(); ui->label_Status->hide();
ui->pushButton_SelfTest->hide();
//setArm(true); //setArm(true);
+48 -38
View File
@@ -890,10 +890,8 @@ void MainWindow::closeEvent(QCloseEvent *event)
void MainWindow::resizeEvent(QResizeEvent *event) void MainWindow::resizeEvent(QResizeEvent *event)
{ {
Q_UNUSED(event) Q_UNUSED(event)
menuBarUI->setGeometry(0,0,this->width(),100); menuBarUI->setGeometry(0,0,this->width(),100);
//qDebug() << "resize"; //qDebug() << "resize";
@@ -910,16 +908,25 @@ void MainWindow::resizeEvent(QResizeEvent *event)
if(MainIndex == 2)//renwu if(MainIndex == 2)//renwu
{ {
/*
map->setGeometry(0,menuBarUI->height(),
this->width()- copk->width(),this->height() - menuBarUI->height());
*/
map->setGeometry(0,menuBarUI->height(),
this->width(),this->height() - menuBarUI->height());
}
if(statusui->isHidden())
{
/*
map->setGeometry(0,menuBarUI->height(),
this->width()- copk->width(),this->height() - menuBarUI->height());
*/
map->setGeometry(0,menuBarUI->height(), map->setGeometry(0,menuBarUI->height(),
this->width()- copk->width(),this->height() - menuBarUI->height()); this->width()- copk->width(),this->height() - menuBarUI->height());
} }
//if(MainIndex == 5)//renwu
{
if(statusui->isHidden())
map->setGeometry(0,menuBarUI->height(),
this->width()- copk->width(),this->height() - menuBarUI->height());
}
copk->setGeometry(this->width() - copk->width(),menuBarUI->height(), copk->setGeometry(this->width() - copk->width(),menuBarUI->height(),
@@ -934,10 +941,10 @@ void MainWindow::resizeEvent(QResizeEvent *event)
statusui->width(),//copk->width() * 1.0, statusui->width(),//copk->width() * 1.0,
this->height() - menuBarUI->height()); this->height() - menuBarUI->height());
/*
missionUI->setGeometry(this->width() - copk->width(),menuBarUI->height(), missionUI->setGeometry(this->width() - copk->width(),menuBarUI->height(),
copk->width(),this->height() - menuBarUI->height()); copk->width(),this->height() - menuBarUI->height());
*/
if(!healthui->isHidden()) if(!healthui->isHidden())
@@ -1151,7 +1158,8 @@ void MainWindow::onTabIndexChanged(const int &index)//界面选择管理
{ {
map->setWPLock(false); map->setWPLock(false);
map->setWPCreate(true); map->setWPCreate(true);
missionUI->show(); //missionUI->show();
missionUI->hide();
} }
else else
@@ -1548,6 +1556,35 @@ void MainWindow::updateVehicle(MavLinkNode::_vehicle vehicle)//事件驱动式
copk->setPitchTarget(vehicle.nav_controller_output.nav_pitch);// copk->setPitchTarget(vehicle.nav_controller_output.nav_pitch);//
copk->setYawTarget(vehicle.nav_controller_output.nav_bearing);// copk->setYawTarget(vehicle.nav_controller_output.nav_bearing);//
copk->setAirSpeed(vehicle.vfr_hud.airspeed,5);//真空速
copk->setAirSpeedTarget(vehicle.vfr_hud.airspeed
+vehicle.nav_controller_output.aspd_error,5);
//c t g m
switch (copk->AirSpeedFlag()) {
default:
case 0:
copk->setSpeed(vehicle.vfr_hud.airspeed,copk->AirSpeedFlag());//表速
break;
case 1:
//copk->setSpeed(info.vt,copk->AirSpeedFlag());//真空速
break;
case 2:
copk->setSpeed(vehicle.vfr_hud.groundspeed,copk->AirSpeedFlag());//地速
break;
case 3:
//copk->setSpeed(info.mi,copk->AirSpeedFlag());//马赫
break;
}
//copk->setAOA(info.aoat1);
QString gps_str; QString gps_str;
gps_str.clear(); gps_str.clear();
@@ -2435,34 +2472,7 @@ void MainWindow::EADC_Info(Parse::_eadc info)
} }
if(copk)
{
copk->setAirSpeed(info.vt,5);//真空速
copk->setAirSpeedTarget(info.vt
+0,5);
//c t g m
switch (copk->AirSpeedFlag()) {
default:
case 0:
copk->setSpeed(info.vi,copk->AirSpeedFlag());//表速
break;
case 1:
copk->setSpeed(info.vt,copk->AirSpeedFlag());//真空速
break;
case 2:
copk->setSpeed(0,copk->AirSpeedFlag());//地速
break;
case 3:
copk->setSpeed(info.mi,copk->AirSpeedFlag());//马赫
break;
}
copk->setAOA(info.aoat1);
}
if(healthui) if(healthui)
+6 -4
View File
@@ -571,11 +571,13 @@ bool DLink::setupClient(const QHostAddress &local_addr,int local_port,const QHos
} }
QUdpSocket *clientsock = new QUdpSocket(this); QUdpSocket *clientsock = new QUdpSocket(this);
int rst = clientsock->bind(QHostAddress::AnyIPv4,local_port,QAbstractSocket::ShareAddress); //int rst = clientsock->bind(QHostAddress::AnyIPv4,local_port,QAbstractSocket::ShareAddress);
int rst = clientsock->open(QIODevice::ReadWrite);
if(rst) if(rst)
{ {
if(clientsock->open(QIODevice::ReadWrite)) clientsock->setProxy(QNetworkProxy::NoProxy);
if(clientsock->bind(local_addr,local_port,QAbstractSocket::ShareAddress))
{ {
connect(clientsock, SIGNAL(readyRead()), connect(clientsock, SIGNAL(readyRead()),
this, SLOT(readPendingDatagramsClient())); this, SLOT(readPendingDatagramsClient()));
@@ -599,7 +601,7 @@ bool DLink::setupClient(const QHostAddress &local_addr,int local_port,const QHos
{ {
clientsock->close(); clientsock->close();
isSuccess = false; isSuccess = false;
qWarning() << "sock not open"; qWarning() << "sock open failure" << clientsock->state();
delete clientsock; delete clientsock;
clientsock = nullptr; clientsock = nullptr;
} }
+2 -1
View File
@@ -117,8 +117,9 @@ QByteArray OPMaps::GetImageFrom(const MapType::Types &type, const Point &pos, co
qDebug() << "opmaps before make image url" << time.elapsed(); qDebug() << "opmaps before make image url" << time.elapsed();
#endif #endif
QString url = MakeImageUrl(type, pos, zoom, LanguageStr); QString url = MakeImageUrl(type, pos, zoom, LanguageStr);
qDebug() << "url" << url << type << zoom;
#ifdef DEBUG_TIMINGS #ifdef DEBUG_TIMINGS
qDebug() << "url" << url << type << zoom;
qDebug() << "opmaps after make image url" << time.elapsed(); qDebug() << "opmaps after make image url" << time.elapsed();
#endif // url "http://vec02.maps.yandex.ru/tiles?l=map&v=2.10.2&x=7&y=5&z=3" string #endif // url "http://vec02.maps.yandex.ru/tiles?l=map&v=2.10.2&x=7&y=5&z=3" string
// "http://map3.pergo.com.tr/tile/02/000/000/007/000/000/002.png" // "http://map3.pergo.com.tr/tile/02/000/000/007/000/000/002.png"
+1 -1
View File
@@ -45,7 +45,7 @@ UrlFactory::UrlFactory()
Proxy.setType (QNetworkProxy::HttpProxy); Proxy.setType (QNetworkProxy::HttpProxy);
Proxy.setHostName ("127.0.0.1"); Proxy.setHostName ("127.0.0.1");
Proxy.setPort (33210); Proxy.setPort (33210);
QNetworkProxy::setApplicationProxy (Proxy); //QNetworkProxy::setApplicationProxy (Proxy);
/// <summary> /// <summary>