From eb85bb1802f2b1b667d1747104172d549952cddb Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Wed, 27 Apr 2022 12:56:54 +0100 Subject: [PATCH] Improve logging and some code cleanup --- logcategories.cpp | 1 + logcategories.h | 1 + shuttlesetup.cpp | 16 +++++------ usbcontroller.cpp | 71 +++++++++++++++++++++++++++++++++-------------- usbcontroller.h | 9 ++++-- wfmain.cpp | 11 ++++---- wfmain.h | 4 +-- 7 files changed, 74 insertions(+), 39 deletions(-) diff --git a/logcategories.cpp b/logcategories.cpp index 5719ef1..3c3bf10 100644 --- a/logcategories.cpp +++ b/logcategories.cpp @@ -9,3 +9,4 @@ Q_LOGGING_CATEGORY(logUdp, "udp") Q_LOGGING_CATEGORY(logUdpServer, "udp.server") Q_LOGGING_CATEGORY(logRigCtlD, "rigctld") Q_LOGGING_CATEGORY(logTcpServer, "tcpserver") +Q_LOGGING_CATEGORY(logUsbControl, "usbcontrol") diff --git a/logcategories.h b/logcategories.h index 5f7362a..3d55848 100644 --- a/logcategories.h +++ b/logcategories.h @@ -12,6 +12,7 @@ Q_DECLARE_LOGGING_CATEGORY(logUdp) Q_DECLARE_LOGGING_CATEGORY(logUdpServer) Q_DECLARE_LOGGING_CATEGORY(logRigCtlD) Q_DECLARE_LOGGING_CATEGORY(logTcpServer) +Q_DECLARE_LOGGING_CATEGORY(logUsbControl) #if defined(Q_OS_WIN) && !defined(__PRETTY_FUNCTION__) diff --git a/shuttlesetup.cpp b/shuttlesetup.cpp index 8d94b02..811be39 100644 --- a/shuttlesetup.cpp +++ b/shuttlesetup.cpp @@ -72,9 +72,8 @@ void shuttleSetup::mousePressed(QPoint p) void shuttleSetup::onEventIndexChanged(int index) { qDebug() << "On Event for button" << currentButton->num << "Event" << index; if (currentButton != Q_NULLPTR && index < commands->size()) { - currentButton->onCommand = commands->at(index); - currentButton->onText->setPlainText(currentButton->onCommand.text); - currentButton->onCommand.index = index; + currentButton->onCommand = &commands->at(index); + currentButton->onText->setPlainText(currentButton->onCommand->text); } } @@ -82,9 +81,8 @@ void shuttleSetup::onEventIndexChanged(int index) { void shuttleSetup::offEventIndexChanged(int index) { qDebug() << "Off Event for button" << currentButton->num << "Event" << index; if (currentButton != Q_NULLPTR && index < commands->size()) { - currentButton->offCommand = commands->at(index); - currentButton->offText->setPlainText(currentButton->offCommand.text); - currentButton->offCommand.index = index; + currentButton->offCommand = &commands->at(index); + currentButton->offText->setPlainText(currentButton->offCommand->text); } } @@ -142,12 +140,14 @@ void shuttleSetup::newDevice(unsigned char devType, QVector