From d5203ddaff38f5b44ef15864dae6c0bd4c264229 Mon Sep 17 00:00:00 2001 From: Dan Nagle Date: Mon, 8 Jan 2018 19:53:50 -0600 Subject: [PATCH 1/2] always bind to any if qt5.10 --- src/globals.h | 17 +++++++++++++++-- src/main.cpp | 19 +++++++++++++++++++ src/mainwindow.cpp | 3 +++ src/settings.cpp | 6 ++++++ 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/globals.h b/src/globals.h index c8be094b..d814a826 100755 --- a/src/globals.h +++ b/src/globals.h @@ -57,7 +57,20 @@ #define PSLOGO ":pslogo.png" #define UPDOWNICON ":icons/moveupdown.png" -//used when binding -#define IPV4_OR_IPV6 (ipMode > 4) ? (QHostAddress::AnyIPv6) : (QHostAddress::AnyIPv4) + + +//Qt 5.10 changed the way sockets bind +//It seems dual ipv4/ipv6 mode works better. + +//I'm not convinced it works perfect when in server mode. + +#include +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + #define IPV4_OR_IPV6 (QHostAddress::Any) +#else + //used when binding + #define IPV4_OR_IPV6 (ipMode > 4) ? (QHostAddress::AnyIPv6) : (QHostAddress::AnyIPv4) +#endif + #endif // GLOBALS_H diff --git a/src/main.cpp b/src/main.cpp index d734b9b0..7779f60b 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -444,11 +444,17 @@ int main(int argc, char *argv[]) if(tcp || ssl) { QSslSocket sock; +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + sock.bind(QHostAddress::Any, bind); +#else if(ipv6) { sock.bind(QHostAddress::AnyIPv6, bind); } else { sock.bind(QHostAddress::AnyIPv4, bind); } +#endif + + if(tcp) { sock.connectToHost(addy, port); @@ -554,6 +560,16 @@ int main(int argc, char *argv[]) } else { QUdpSocket sock; +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + + if(!sock.bind(QHostAddress::Any, bind)) { + OUTIF() << "Error: Could not bind to " << bind; + + OUTPUT(); + return -1; + } +#else + if(ipv6) { if(!sock.bind(QHostAddress::AnyIPv6, bind)) { OUTIF() << "Error: Could not bind to " << bind; @@ -571,6 +587,9 @@ int main(int argc, char *argv[]) } } + +#endif + OUTIF() << "UDP (" <setFlat(true); IPmodeButton->setCursor(Qt::PointingHandCursor); + +#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) statusBar()->insertPermanentWidget(5, IPmodeButton); +#endif setIPMode(); diff --git a/src/settings.cpp b/src/settings.cpp index 4903e775..0caa14c4 100755 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -119,6 +119,12 @@ Settings::Settings(QWidget *parent) : ui->asciiResponseEdit->setText(Packet::hexToASCII(ascii)); +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + ui->ipv4Radio->hide(); + ui->ipv6Radio->hide(); +#endif + + int ipMode = settings.value("ipMode", 4).toInt(); if (ipMode > 4) { ui->ipv6Radio->setChecked(true); From f433d26a2d955ab10f6b5b2ee8f89d3b9c98cffd Mon Sep 17 00:00:00 2001 From: Dan Nagle Date: Mon, 8 Jan 2018 20:08:52 -0600 Subject: [PATCH 2/2] version 5.6.2 --- src/globals.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/globals.h b/src/globals.h index d814a826..f1c7d45a 100755 --- a/src/globals.h +++ b/src/globals.h @@ -11,7 +11,7 @@ #define GLOBALS_H //BEGIN SW VERSION -#define SW_VERSION "v5.6.1" +#define SW_VERSION "v5.6.2" //END SW VERSION