diff --git a/src/IO/Drivers/BluetoothLE.cpp b/src/IO/Drivers/BluetoothLE.cpp index c791929e..3f59a822 100644 --- a/src/IO/Drivers/BluetoothLE.cpp +++ b/src/IO/Drivers/BluetoothLE.cpp @@ -43,15 +43,22 @@ IO::Drivers::BluetoothLE::BluetoothLE() , m_controller(Q_NULLPTR) { // clang-format off + + // Update connect button status when a BLE device is selected by the user connect(this, &IO::Drivers::BluetoothLE::deviceIndexChanged, this, &IO::Drivers::BluetoothLE::configurationChanged); + + // Register discovered devices connect(&m_discoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered, this, &IO::Drivers::BluetoothLE::onDeviceDiscovered); + + // Report BLE discovery errors connect(&m_discoveryAgent, static_cast( &QBluetoothDeviceDiscoveryAgent::error), this, &IO::Drivers::BluetoothLE::onDiscoveryError); + // clang-format on } diff --git a/src/IO/Drivers/Network.cpp b/src/IO/Drivers/Network.cpp index 148f1839..77828bc1 100644 --- a/src/IO/Drivers/Network.cpp +++ b/src/IO/Drivers/Network.cpp @@ -38,6 +38,7 @@ IO::Drivers::Network::Network() , m_lookupActive(false) , m_udpIgnoreFrameSequences(false) { + // Set initial configuration setRemoteAddress(""); setTcpPort(defaultTcpPort()); setUdpLocalPort(defaultUdpLocalPort()); @@ -45,12 +46,16 @@ IO::Drivers::Network::Network() setSocketType(QAbstractSocket::TcpSocket); // clang-format off + + // Update connect button status when the configuration is changed connect(this, &IO::Drivers::Network::addressChanged, this, &IO::Drivers::Network::configurationChanged); connect(this, &IO::Drivers::Network::socketTypeChanged, this, &IO::Drivers::Network::configurationChanged); connect(this, &IO::Drivers::Network::portChanged, this, &IO::Drivers::Network::configurationChanged); + + // Report socket errors #if QT_VERSION < QT_VERSION_CHECK(5, 12, 0) connect(&m_tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(onErrorOccurred(QAbstractSocket::SocketError))); @@ -62,6 +67,7 @@ IO::Drivers::Network::Network() connect(&m_udpSocket, &QUdpSocket::errorOccurred, this, &IO::Drivers::Network::onErrorOccurred); #endif + // clang-format on } diff --git a/src/IO/Drivers/Serial.cpp b/src/IO/Drivers/Serial.cpp index 20534deb..71af3e63 100644 --- a/src/IO/Drivers/Serial.cpp +++ b/src/IO/Drivers/Serial.cpp @@ -50,12 +50,16 @@ IO::Drivers::Serial::Serial() setParity(parityList().indexOf(tr("None"))); setFlowControl(flowControlList().indexOf(tr("None"))); - // Build serial devices list and refresh it every second // clang-format off + + // Build serial devices list and refresh it every second connect(&Misc::TimerEvents::instance(), &Misc::TimerEvents::timeout1Hz, this, &IO::Drivers::Serial::refreshSerialDevices); + + // Update connect button status when user selects a serial device connect(this, &IO::Drivers::Serial::portIndexChanged, this, &IO::Drivers::Serial::configurationChanged); + // clang-format on } diff --git a/src/IO/Manager.cpp b/src/IO/Manager.cpp index 762587c6..4f3f5252 100644 --- a/src/IO/Manager.cpp +++ b/src/IO/Manager.cpp @@ -63,9 +63,17 @@ IO::Manager::Manager() , m_finishSequence("*/") , m_separatorSequence(",") { + // Set initial settings setMaxBufferSize(1024 * 1024); setSelectedDriver(SelectedDriver::Serial); - connect(this, SIGNAL(selectedDriverChanged()), this, SIGNAL(configurationChanged())); + + // clang-format off + + // Update connect button status when device type is changed + connect(this, &IO::Manager::selectedDriverChanged, + this, &IO::Manager::configurationChanged); + + // clang-format on } /**