diff --git a/usbcontroller.cpp b/usbcontroller.cpp index e7f553e..558403f 100644 --- a/usbcontroller.cpp +++ b/usbcontroller.cpp @@ -225,17 +225,17 @@ void usbController::runTimer() } else if ((buttons >> i & 1) && !(tempButtons >> i & 1)) { - /* if (i < buttonList.size() && buttonList[i].offCommand.text && buttonList[i].onCommand.index>0) { - qDebug() << "Off Button event:" << buttonList[i].offCommand.text->toPlainText(); - if (buttonList[i].offCommand.index > 2) // Band selection + if (i < buttonList.size()) { + qDebug() << "Off Button event:" << buttonList[i].offCommand.text; + if (buttonList[i].offCommand.bandswitch) { - emit setBand(buttonList[i].offCommand.index - 3); + //emit setBand(buttonList[i].onCommand.index - 13); } else { emit button(false, i); } } - */ + } } } diff --git a/usbcontroller.h b/usbcontroller.h index 8faa457..9750c6f 100644 --- a/usbcontroller.h +++ b/usbcontroller.h @@ -54,7 +54,7 @@ enum cmds { }; struct COMMAND { - COMMAND(){} + COMMAND() {} COMMAND(int index, QString text, cmds command, char suffix) : index(index), text(text), command(command), suffix(suffix), bandswitch(false){} @@ -62,24 +62,26 @@ struct COMMAND { index(index), text(text), command(command),band(band), bandswitch(true) {} int index; + QString text; cmds command; char suffix; - bool bandswitch; bandType band; - QString text; + bool bandswitch; }; struct BUTTON { - BUTTON(char num, QRect pos, const QColor col) : - num(num), pos(pos), textColour(col) {} + BUTTON() {} + + BUTTON(char num, QRect pos, const QColor textColour) : + num(num), pos(pos), textColour(textColour) {} quint8 num; QRect pos; + const QColor textColour; int onEvent = 0; int offEvent = 0; COMMAND onCommand; COMMAND offCommand; - const QColor textColour; QGraphicsTextItem* onText; QGraphicsTextItem* offText; };