Some more fixes

qcpfix
Phil Taylor 2023-04-12 10:24:00 +01:00
rodzic c9300f4d86
commit 5ded2a0e79
4 zmienionych plików z 33 dodań i 36 usunięć

Wyświetl plik

@ -26,12 +26,14 @@ controllerSetup::~controllerSetup()
void controllerSetup::hideEvent(QHideEvent *event) void controllerSetup::hideEvent(QHideEvent *event)
{ {
Q_UNUSED(event)
qDebug(logUsbControl()) << "Controller window hideEvent()"; qDebug(logUsbControl()) << "Controller window hideEvent()";
updateDialog->hide(); updateDialog->hide();
} }
void controllerSetup::on_tabWidget_currentChanged(int index) void controllerSetup::on_tabWidget_currentChanged(int index)
{ {
Q_UNUSED(index)
if (updateDialog != Q_NULLPTR) if (updateDialog != Q_NULLPTR)
updateDialog->hide(); updateDialog->hide();
} }
@ -726,7 +728,6 @@ void controllerSetup::pageChanged(USBDEVICE* dev, int val)
updateDialog->hide(); // Hide the dialog if the page changes. updateDialog->hide(); // Hide the dialog if the page changes.
int lastPage = dev->currentPage;
dev->currentPage=val; dev->currentPage=val;
dev->pageSpin->setValue(val); dev->pageSpin->setValue(val);
@ -735,18 +736,16 @@ void controllerSetup::pageChanged(USBDEVICE* dev, int val)
{ {
if (b->parent == dev) if (b->parent == dev)
{ {
if (b->page == lastPage) // Make sure we delete any other pages content and then update to latest.
{ if (b->text != Q_NULLPTR) {
if (b->text != Q_NULLPTR) { tab.value()->scene->removeItem(b->text);
tab.value()->scene->removeItem(b->text); delete b->text;
delete b->text; b->text = Q_NULLPTR;
b->text = Q_NULLPTR; }
} if (b->graphics && b->bgRect != Q_NULLPTR) {
if (b->bgRect != Q_NULLPTR) { tab.value()->scene->removeItem(b->bgRect);
tab.value()->scene->removeItem(b->bgRect); delete b->bgRect;
delete b->bgRect; b->bgRect = Q_NULLPTR;
b->bgRect = Q_NULLPTR;
}
} }
if (b->page == dev->currentPage) if (b->page == dev->currentPage)
{ {
@ -770,13 +769,10 @@ void controllerSetup::pageChanged(USBDEVICE* dev, int val)
for (auto k = knobs->begin();k != knobs->end(); k++) for (auto k = knobs->begin();k != knobs->end(); k++)
{ {
if (k->parent == dev) { if (k->parent == dev) {
if (k->page == lastPage) if (k->text != Q_NULLPTR) {
{ tab.value()->scene->removeItem(k->text);
if (k->text) { delete k->text;
tab.value()->scene->removeItem(k->text); k->text = Q_NULLPTR;
delete k->text;
k->text = Q_NULLPTR;
}
} }
if (k->page == dev->currentPage) if (k->page == dev->currentPage)
{ {

Wyświetl plik

@ -1572,19 +1572,19 @@ void usbController::loadButtons()
void usbController::loadKnobs() void usbController::loadKnobs()
{ {
defaultKnobs.clear(); defaultKnobs.clear();
defaultKnobs.append(KNOB(shuttleXpress, 0, QRect(205, 189, 203, 203), Qt::green, &commands[4])); defaultKnobs.append(KNOB(shuttleXpress, 0, QRect(205, 189, 203, 203), Qt::green, &commands[3]));
defaultKnobs.append(KNOB(shuttlePro2, 0, QRect(104, 164, 124, 119), Qt::green, &commands[4])); defaultKnobs.append(KNOB(shuttlePro2, 0, QRect(104, 164, 124, 119), Qt::green, &commands[3]));
defaultKnobs.append(KNOB(RC28, 0, QRect(78, 128, 184, 168), Qt::green, &commands[4])); defaultKnobs.append(KNOB(RC28, 0, QRect(78, 128, 184, 168), Qt::green, &commands[3]));
defaultKnobs.append(KNOB(QuickKeys, 0, QRect(114, 130, 121, 43), Qt::green, &commands[4])); defaultKnobs.append(KNOB(QuickKeys, 0, QRect(114, 130, 121, 43), Qt::green, &commands[3]));
// eCoder // eCoder
defaultKnobs.append(KNOB(eCoderPlus, 0, QRect(173, 360, 205, 209), Qt::green, &commands[4])); defaultKnobs.append(KNOB(eCoderPlus, 0, QRect(173, 360, 205, 209), Qt::green, &commands[3]));
defaultKnobs.append(KNOB(eCoderPlus, 1, QRect(120, 153, 72, 27), Qt::green, &commands[0])); defaultKnobs.append(KNOB(eCoderPlus, 1, QRect(120, 153, 72, 27), Qt::green, &commands[0]));
defaultKnobs.append(KNOB(eCoderPlus, 2, QRect(242, 153, 72, 27), Qt::green, &commands[0])); defaultKnobs.append(KNOB(eCoderPlus, 2, QRect(242, 153, 72, 27), Qt::green, &commands[0]));
defaultKnobs.append(KNOB(eCoderPlus, 3, QRect(362, 153, 72, 27), Qt::green, &commands[0])); defaultKnobs.append(KNOB(eCoderPlus, 3, QRect(362, 153, 72, 27), Qt::green, &commands[0]));
// StreamDeckPlus // StreamDeckPlus
defaultKnobs.append(KNOB(StreamDeckPlus, 0, QRect(74, 413, 64, 28), Qt::green, &commands[4])); defaultKnobs.append(KNOB(StreamDeckPlus, 0, QRect(74, 413, 64, 28), Qt::green, &commands[3]));
defaultKnobs.append(KNOB(StreamDeckPlus, 1, QRect(204, 413, 64, 28), Qt::green, &commands[0])); defaultKnobs.append(KNOB(StreamDeckPlus, 1, QRect(204, 413, 64, 28), Qt::green, &commands[0]));
defaultKnobs.append(KNOB(StreamDeckPlus, 2, QRect(332, 413, 64, 28), Qt::green, &commands[0])); defaultKnobs.append(KNOB(StreamDeckPlus, 2, QRect(332, 413, 64, 28), Qt::green, &commands[0]));
defaultKnobs.append(KNOB(StreamDeckPlus, 3, QRect(462, 413, 64, 28), Qt::green, &commands[0])); defaultKnobs.append(KNOB(StreamDeckPlus, 3, QRect(462, 413, 64, 28), Qt::green, &commands[0]));
@ -1598,12 +1598,12 @@ void usbController::loadCommands()
commands.append(COMMAND(num++, "None", commandAny, cmdNone, (quint8)0x0)); commands.append(COMMAND(num++, "None", commandAny, cmdNone, (quint8)0x0));
commands.append(COMMAND(num++, "PTT On", commandButton, cmdSetPTT, (quint8)0x1)); commands.append(COMMAND(num++, "PTT On", commandButton, cmdSetPTT, (quint8)0x1));
commands.append(COMMAND(num++, "PTT Off", commandButton, cmdSetPTT, (quint8)0x0)); commands.append(COMMAND(num++, "PTT Off", commandButton, cmdSetPTT, (quint8)0x0));
commands.append(COMMAND(num++, "VFOA", commandKnob, cmdSetFreq, (quint8)0x0));
commands.append(COMMAND(num++, "VFOB", commandKnob, cmdSetFreq, (quint8)0x1));
commands.append(COMMAND(num++, "Freq Down", commandButton, cmdSetFreq, (int)-1)); commands.append(COMMAND(num++, "Freq Down", commandButton, cmdSetFreq, (int)-1));
commands.append(COMMAND(num++, "Freq Up", commandButton, cmdSetFreq, (int)1)); commands.append(COMMAND(num++, "Freq Up", commandButton, cmdSetFreq, (int)1));
commands.append(COMMAND(num++, "PTT Off", commandButton, cmdSetPTT, (quint8)0x0)); commands.append(COMMAND(num++, "PTT Off", commandButton, cmdSetPTT, (quint8)0x0));
commands.append(COMMAND(num++, "PTT Toggle", commandButton, cmdPTTToggle, (quint8)0x0)); commands.append(COMMAND(num++, "PTT Toggle", commandButton, cmdPTTToggle, (quint8)0x0));
commands.append(COMMAND(num++, "VFOA", commandKnob, cmdSetFreq, (quint8)0x0));
commands.append(COMMAND(num++, "VFOB", commandKnob, cmdSetFreq, (quint8)0x1));
commands.append(COMMAND(num++, "Span/Step", commandKnob, cmdSeparator, (quint8)0x0)); commands.append(COMMAND(num++, "Span/Step", commandKnob, cmdSeparator, (quint8)0x0));
commands.append(COMMAND(num++, "Tune", commandButton, cmdStartATU, (quint8)0x0)); commands.append(COMMAND(num++, "Tune", commandButton, cmdStartATU, (quint8)0x0));
commands.append(COMMAND(num++, "Span/Step", commandButton, cmdSeparator, (quint8)0x0)); commands.append(COMMAND(num++, "Span/Step", commandButton, cmdSeparator, (quint8)0x0));

Wyświetl plik

@ -236,13 +236,14 @@ wfmain::~wfmain()
usbControllerThread->quit(); usbControllerThread->quit();
usbControllerThread->wait(); usbControllerThread->wait();
} }
#if defined(Q_OS_LINUX)
if (uDevMonitor) if (uDevMonitor)
{ {
udev_monitor_unref(uDevMonitor); udev_monitor_unref(uDevMonitor);
udev_unref(uDev); udev_unref(uDev);
delete uDevNotifier; delete uDevNotifier;
} }
#endif
#endif #endif
} }

Wyświetl plik

@ -1204,7 +1204,7 @@ private:
QVector<KNOB> usbKnobs; QVector<KNOB> usbKnobs;
usbDevMap usbDevices; usbDevMap usbDevices;
QMutex usbMutex; QMutex usbMutex;
qint64 lastUsbNotify; qint64 lastUsbNotify=0;
#if defined (Q_OS_LINUX) #if defined (Q_OS_LINUX)
struct udev* uDev = nullptr; struct udev* uDev = nullptr;