qcpfix
Phil Taylor 2023-04-15 11:25:35 +01:00
rodzic c392874b3b
commit 3c90a9363b
6 zmienionych plików z 214 dodań i 189 usunięć

Wyświetl plik

@ -15,8 +15,7 @@ aboutbox::aboutbox(QWidget *parent) :
ui->topText->setText("wfview version " + QString(WFVIEW_VERSION)); ui->topText->setText("wfview version " + QString(WFVIEW_VERSION));
QString head = QString("<html><head></head><body>"); QString head = QString("<html><head></head><body>");
QString copyright = QString("Copyright 2017-2022 Elliott H. Liggett, W6EL. All rights reserved.<br/>wfview source code is <a href=\"https://gitlab.com/eliggett/wfview/-/blob/master/LICENSE\">licensed</a> under the GNU GPLv3."); QString copyright = QString("Copyright 2017-2023 Elliott H. Liggett, W6EL and Phil E. Taylor, M0VSE. All rights reserved.<br/>wfview source code is <a href=\"https://gitlab.com/eliggett/wfview/-/blob/master/LICENSE\">licensed</a> under the GNU GPLv3.");
QString nacode = QString("<br/><br/>Networking, audio, rigctl server, and much more written by Phil Taylor, M0VSE");
QString scm = QString("<br/><br/>Source code and issues managed by Roeland Jansen, PA3MET"); QString scm = QString("<br/><br/>Source code and issues managed by Roeland Jansen, PA3MET");
QString doctest = QString("<br/><br/>Testing and development mentorship from Jim Nijkamp, PA8E."); QString doctest = QString("<br/><br/>Testing and development mentorship from Jim Nijkamp, PA8E.");
@ -86,7 +85,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.");
// String it all together: // String it all together:
QString aboutText = head + copyright + "\n" + nacode + "\n" + scm + "\n" + doctest + dedication + wfviewcommunityack; QString aboutText = head + copyright + "\n" + "\n" + scm + "\n" + doctest + dedication + wfviewcommunityack;
aboutText.append(website + "\n" + donate + "\n"+ docs + support + contact +"\n"); aboutText.append(website + "\n" + donate + "\n"+ docs + support + contact +"\n");
aboutText.append("\n" + ssCredit + "\n" + rsCredit + "\n"); aboutText.append("\n" + ssCredit + "\n" + rsCredit + "\n");

Wyświetl plik

@ -20,8 +20,19 @@ controllerSetup::~controllerSetup()
qInfo(logUsbControl()) << "Deleting controllerSetup() window"; qInfo(logUsbControl()) << "Deleting controllerSetup() window";
delete noControllersText; delete noControllersText;
delete updateDialog; delete updateDialog;
delete ui; delete ui; // Will delete all content in all tabs
tabs.clear();
// Step through ALL buttons and knobs setting their text to NULL (just in case)
for (auto b = buttons->begin(); b != buttons->end(); b++)
{
b->text=Q_NULLPTR;
b->bgRect=Q_NULLPTR;
}
for (auto k= knobs->begin(); k != knobs->end(); k++)
{
k->text=Q_NULLPTR;
}
} }
void controllerSetup::hideEvent(QHideEvent *event) void controllerSetup::hideEvent(QHideEvent *event)
@ -33,21 +44,20 @@ void controllerSetup::hideEvent(QHideEvent *event)
void controllerSetup::on_tabWidget_currentChanged(int index) void controllerSetup::on_tabWidget_currentChanged(int index)
{ {
// We may get the indexChanged event before the tabWidget has been initialized
if (ui->tabWidget->widget(index) != Q_NULLPTR) { if (ui->tabWidget->widget(index) != Q_NULLPTR) {
QWidget* widget = ui->tabWidget->widget(index);
QString path = ui->tabWidget->widget(index)->objectName(); QString path = ui->tabWidget->widget(index)->objectName();
auto tab = tabs.find(path); auto tab = tabs.find(path);
if (tab != tabs.end()) if (tab != tabs.end())
{ {
tabContent* c = tab.value();
this->resize(this->sizeHint()); this->resize(this->sizeHint());
//this->resize(c->bgImage->boundingRect().width() + 20, c->bgImage->boundingRect().height() + 150);
} }
} }
if (updateDialog != Q_NULLPTR) if (updateDialog != Q_NULLPTR)
{
updateDialog->hide(); updateDialog->hide();
}
} }
@ -468,180 +478,193 @@ void controllerSetup::newDevice(USBDEVICE* dev)
tabContent* c = new tabContent(); tabContent* c = new tabContent();
c->tab.setObjectName(dev->path); c->tab = new QWidget();
ui->tabWidget->addTab(&c->tab,dev->product); c->widget = new QWidget();
c->tab.setLayout(&c->mainLayout);
c->mainLayout.addLayout(&c->topLayout);
c->mainLayout.addWidget(&c->widget);
c->widget.setLayout(&c->layout); c->tab->setObjectName(dev->path);
ui->tabWidget->addTab(c->tab,dev->product);
// Create the different layouts required
c->mainLayout = new QVBoxLayout(c->tab);
c->layout = new QVBoxLayout();
c->topLayout = new QHBoxLayout();
c->sensLayout = new QHBoxLayout();
c->grid = new QGridLayout();
c->topLayout.addWidget(&c->disabled); c->mainLayout->addLayout(c->topLayout);
c->disabled.setText("Disable"); c->mainLayout->addWidget(c->widget);
connect(&c->disabled, qOverload<bool>(&QCheckBox::clicked), c->widget->setLayout(c->layout);
[dev,this,c](bool checked) { this->disableClicked(dev,checked,&c->widget); });
c->disabled.setChecked(dev->disabled);
c->disabled = new QCheckBox("Disable");
c->topLayout->addWidget(c->disabled);
connect(c->disabled, qOverload<bool>(&QCheckBox::clicked),
[dev,this,c](bool checked) { this->disableClicked(dev,checked,c->widget); });
c->disabled->setChecked(dev->disabled);
c->message = new QLabel();
if (dev->connected) { if (dev->connected) {
c->message.setStyleSheet("QLabel { color : green; }"); c->message->setStyleSheet("QLabel { color : green; }");
c->message.setText("Connected"); c->message->setText("Connected");
} else { } else {
c->message.setStyleSheet("QLabel { color : red; }"); c->message->setStyleSheet("QLabel { color : red; }");
c->message.setText("Not Connected"); c->message->setText("Not Connected");
} }
c->topLayout->addWidget(c->message);
c->message->setAlignment(Qt::AlignRight);
c->topLayout.addWidget(&c->message); c->view = new QGraphicsView();
c->message.setAlignment(Qt::AlignRight); c->layout->addWidget(c->view);
c->layout.addWidget(&c->view); c->layout->addLayout(c->sensLayout);
c->sensLabel = new QLabel("Sensitivity");
c->sensLayout->addWidget(c->sensLabel);
c->layout.addLayout(&c->sensLayout); c->sens = new QSlider(Qt::Horizontal);
c->sensLabel.setText("Sensitivity:"); c->sens->setMinimum(1);
c->sensLayout.addWidget(&c->sensLabel); c->sens->setMaximum(21);
c->sens.setMinimum(1); c->sens->setInvertedAppearance(true);
c->sens.setMaximum(21); c->sensLayout->addWidget(c->sens);
c->sens.setOrientation(Qt::Horizontal); c->sens->setValue(dev->sensitivity);
c->sens.setInvertedAppearance(true); connect(c->sens, &QSlider::valueChanged,
c->sensLayout.addWidget(&c->sens);
c->sens.setValue(dev->sensitivity);
connect(&c->sens, &QSlider::valueChanged,
[dev,this](int val) { this->sensitivityMoved(dev,val); }); [dev,this](int val) { this->sensitivityMoved(dev,val); });
c->sensLayout.addStretch(0); c->sensLayout->addStretch(0);
c->pageLabel.setText("Page:");
c->sensLayout.addWidget(&c->pageLabel);
c->page.setObjectName("Page SpinBox");
c->page.setValue(1);
c->page.setMinimum(1);
c->page.setMaximum(dev->pages);
c->page.setToolTip("Select current page to edit");
c->sensLayout.addWidget(&c->page);
dev->pageSpin = &c->page; c->pageLabel = new QLabel("Page:");
c->sensLayout->addWidget(c->pageLabel);
c->page = new QSpinBox();
c->page->setValue(1);
c->page->setMinimum(1);
c->page->setMaximum(dev->pages);
c->page->setToolTip("Select current page to edit");
c->sensLayout->addWidget(c->page);
dev->pageSpin = c->page;
c->image = new QImage();
switch (dev->type.model) { switch (dev->type.model) {
case shuttleXpress: case shuttleXpress:
c->image.load(":/resources/shuttlexpress.png"); c->image->load(":/resources/shuttlexpress.png");
break; break;
case shuttlePro2: case shuttlePro2:
c->image.load(":/resources/shuttlepro.png"); c->image->load(":/resources/shuttlepro.png");
break; break;
case RC28: case RC28:
c->image.load(":/resources/rc28.png"); c->image->load(":/resources/rc28.png");
break; break;
case xBoxGamepad: case xBoxGamepad:
c->image.load(":/resources/xbox.png"); c->image->load(":/resources/xbox.png");
break; break;
case eCoderPlus: case eCoderPlus:
c->image.load(":/resources/ecoder.png"); c->image->load(":/resources/ecoder.png");
break; break;
case QuickKeys: case QuickKeys:
c->image.load(":/resources/quickkeys.png"); c->image->load(":/resources/quickkeys.png");
break; break;
case StreamDeckOriginal: case StreamDeckOriginal:
case StreamDeckOriginalV2: case StreamDeckOriginalV2:
case StreamDeckOriginalMK2: case StreamDeckOriginalMK2:
c->image.load(":/resources/streamdeck.png"); c->image->load(":/resources/streamdeck.png");
break; break;
case StreamDeckMini: case StreamDeckMini:
case StreamDeckMiniV2: case StreamDeckMiniV2:
c->image.load(":/resources/streamdeckmini.png"); c->image->load(":/resources/streamdeckmini.png");
break; break;
case StreamDeckXL: case StreamDeckXL:
case StreamDeckXLV2: case StreamDeckXLV2:
c->image.load(":/resources/streamdeckxl.png"); c->image->load(":/resources/streamdeckxl.png");
break; break;
case StreamDeckPlus: case StreamDeckPlus:
c->image.load(":/resources/streamdeckplus.png"); c->image->load(":/resources/streamdeckplus.png");
break; break;
case StreamDeckPedal: case StreamDeckPedal:
c->image.load(":/resources/streamdeckpedal.png"); c->image->load(":/resources/streamdeckpedal.png");
break; break;
default: default:
this->adjustSize(); this->adjustSize();
break; break;
} }
c->bgImage = new QGraphicsPixmapItem(QPixmap::fromImage(c->image)); c->bgImage = new QGraphicsPixmapItem(QPixmap::fromImage(*c->image));
c->view.setMinimumSize(c->bgImage->boundingRect().width() + 2, c->bgImage->boundingRect().height() + 2); c->view->setMinimumSize(c->bgImage->boundingRect().width() + 2, c->bgImage->boundingRect().height() + 2);
ui->tabWidget->show(); ui->tabWidget->show();
c->scene = new controllerScene(); c->scene = new controllerScene();
c->view.setScene(c->scene); c->view->setScene(c->scene);
connect(c->scene, SIGNAL(showMenu(controllerScene*,QPoint)), this, SLOT(showMenu(controllerScene*,QPoint))); connect(c->scene, SIGNAL(showMenu(controllerScene*,QPoint)), this, SLOT(showMenu(controllerScene*,QPoint)));
c->scene->addItem(c->bgImage); c->scene->addItem(c->bgImage);
c->layout.addLayout(&c->grid);
c->brightLabel.setText("Brightness"); c->layout->addLayout(c->grid);
c->grid.addWidget(&c->brightLabel,0,0);
c->brightness.addItem("Off"); c->brightLabel = new QLabel("Brightness");
c->brightness.addItem("Low"); c->grid->addWidget(c->brightLabel,0,0);
c->brightness.addItem("Medium"); c->brightness = new QComboBox();
c->brightness.addItem("High"); c->brightness->addItem("Off");
c->brightness.setCurrentIndex(dev->brightness); c->brightness->addItem("Low");
c->grid.addWidget(&c->brightness,1,0); c->brightness->addItem("Medium");
connect(&c->brightness, qOverload<int>(&QComboBox::currentIndexChanged), c->brightness->addItem("High");
c->brightness->setCurrentIndex(dev->brightness);
c->grid->addWidget(c->brightness,1,0);
connect(c->brightness, qOverload<int>(&QComboBox::currentIndexChanged),
[dev,this](int index) { this->brightnessChanged(dev,index); }); [dev,this](int index) { this->brightnessChanged(dev,index); });
c->speedLabel.setText("Speed"); c->speedLabel = new QLabel("Speed");
c->grid.addWidget(&c->speedLabel,0,1); c->grid->addWidget(c->speedLabel,0,1);
c->speed.setObjectName("Speed"); c->speed = new QComboBox();
c->speed.addItem("Fastest"); c->speed->addItem("Fastest");
c->speed.addItem("Faster"); c->speed->addItem("Faster");
c->speed.addItem("Normal"); c->speed->addItem("Normal");
c->speed.addItem("Slower"); c->speed->addItem("Slower");
c->speed.addItem("Slowest"); c->speed->addItem("Slowest");
c->speed.setCurrentIndex(dev->speed); c->speed->setCurrentIndex(dev->speed);
c->grid.addWidget(&c->speed,1,1); c->grid->addWidget(c->speed,1,1);
connect(&c->speed, qOverload<int>(&QComboBox::currentIndexChanged), connect(c->speed, qOverload<int>(&QComboBox::currentIndexChanged),
[dev,this](int index) { this->speedChanged(dev,index); }); [dev,this](int index) { this->speedChanged(dev,index); });
c->orientLabel.setText("Orientation"); c->orientLabel = new QLabel("Orientation");
c->grid.addWidget(&c->orientLabel,0,2); c->grid->addWidget(c->orientLabel,0,2);
c->orientation.addItem("Rotate 0"); c->orientation = new QComboBox();
c->orientation.addItem("Rotate 90"); c->orientation->addItem("Rotate 0");
c->orientation.addItem("Rotate 180"); c->orientation->addItem("Rotate 90");
c->orientation.addItem("Rotate 270"); c->orientation->addItem("Rotate 180");
c->orientation.setCurrentIndex(dev->orientation); c->orientation->addItem("Rotate 270");
c->grid.addWidget(&c->orientation,1,2); c->orientation->setCurrentIndex(dev->orientation);
connect(&c->orientation, qOverload<int>(&QComboBox::currentIndexChanged), c->grid->addWidget(c->orientation,1,2);
connect(c->orientation, qOverload<int>(&QComboBox::currentIndexChanged),
[dev,this](int index) { this->orientationChanged(dev,index); }); [dev,this](int index) { this->orientationChanged(dev,index); });
c->color.setText("Color"); c->color = new QPushButton("Color");
c->grid.addWidget(&c->colorLabel,0,3); c->color->setStyleSheet(QString("background-color: %1").arg(dev->color.name(QColor::HexArgb)));
c->color.setStyleSheet(QString("background-color: %1").arg(dev->color.name(QColor::HexArgb))); c->grid->addWidget(c->color,1,3);
c->grid.addWidget(&c->color,1,3); connect(c->color, &QPushButton::clicked,
connect(&c->color, &QPushButton::clicked, [dev,c,this]() { this->colorPicker(dev,c->color,dev->color); });
[dev,c,this]() { this->colorPicker(dev,&c->color,dev->color); });
c->timeoutLabel.setText("Timeout"); c->timeoutLabel = new QLabel("Timeout");
c->grid.addWidget(&c->timeoutLabel,0,4); c->grid->addWidget(c->timeoutLabel,0,4);
c->timeout.setValue(dev->timeout); c->timeout = new QSpinBox();
c->grid.addWidget(&c->timeout,1,4); c->timeout->setValue(dev->timeout);
connect(&c->timeout, qOverload<int>(&QSpinBox::valueChanged), c->grid->addWidget(c->timeout,1,4);
connect(c->timeout, qOverload<int>(&QSpinBox::valueChanged),
[dev,this](int index) { this->timeoutChanged(dev,index); }); [dev,this](int index) { this->timeoutChanged(dev,index); });
c->pagesLabel.setText("Num Pages"); c->pagesLabel = new QLabel("Num Pages");
c->grid.addWidget(&c->pagesLabel,0,5); c->grid->addWidget(c->pagesLabel,0,5);
c->pages.setValue(dev->pages); c->pages = new QSpinBox();
c->pages.setMinimum(1); c->pages->setValue(dev->pages);
c->grid.addWidget(&c->pages,1,5); c->pages->setMinimum(1);
connect(&c->pages, qOverload<int>(&QSpinBox::valueChanged), c->grid->addWidget(c->pages,1,5);
connect(c->pages, qOverload<int>(&QSpinBox::valueChanged),
[dev,this](int index) { this->pagesChanged(dev,index); }); [dev,this](int index) { this->pagesChanged(dev,index); });
for (int i=0;i<6;i++) for (int i=0;i<6;i++)
c->grid.setColumnStretch(i,1); c->grid->setColumnStretch(i,1);
c->helpText.setText("<p><b>Button configuration:</b> Right-click on each button to configure it.</p>"); c->helpText = new QLabel();
c->helpText.setAlignment(Qt::AlignCenter); c->helpText->setText("<p><b>Button configuration:</b> Right-click on each button to configure it.</p>");
c->layout.addWidget(&c->helpText); c->helpText->setAlignment(Qt::AlignCenter);
c->layout->addWidget(c->helpText);
c->view.setSceneRect(c->scene->itemsBoundingRect()); c->view->setSceneRect(c->scene->itemsBoundingRect());
this->adjustSize(); this->adjustSize();
@ -661,7 +684,7 @@ void controllerSetup::newDevice(USBDEVICE* dev)
// Attach pageChanged() here so we have access to all necessary vars // Attach pageChanged() here so we have access to all necessary vars
connect(&c->page, qOverload<int>(&QSpinBox::valueChanged), connect(c->page, qOverload<int>(&QSpinBox::valueChanged),
[dev, this](int index) { this->pageChanged(dev, index); }); [dev, this](int index) { this->pageChanged(dev, index); });
// Hide all controls that are not relevant to this controller // Hide all controls that are not relevant to this controller
@ -675,22 +698,22 @@ void controllerSetup::newDevice(USBDEVICE* dev)
case QuickKeys: case QuickKeys:
break; break;
case StreamDeckPedal: case StreamDeckPedal:
c->sensLabel.setVisible(false); c->sensLabel->setVisible(false);
c->sens.setVisible(false); c->sens->setVisible(false);
case shuttleXpress: case shuttleXpress:
case shuttlePro2: case shuttlePro2:
case RC28: case RC28:
case xBoxGamepad: case xBoxGamepad:
case eCoderPlus: case eCoderPlus:
c->brightLabel.setVisible(false); c->brightLabel->setVisible(false);
c->speedLabel.setVisible(false); c->speedLabel->setVisible(false);
c->timeoutLabel.setVisible(false); c->timeoutLabel->setVisible(false);
c->orientLabel.setVisible(false); c->orientLabel->setVisible(false);
c->brightness.setVisible(false); c->brightness->setVisible(false);
c->speed.setVisible(false); c->speed->setVisible(false);
c->timeout.setVisible(false); c->timeout->setVisible(false);
c->orientation.setVisible(false); c->orientation->setVisible(false);
c->color.setVisible(false); c->color->setVisible(false);
break; break;
case StreamDeckOriginal: case StreamDeckOriginal:
case StreamDeckOriginalV2: case StreamDeckOriginalV2:
@ -699,15 +722,15 @@ void controllerSetup::newDevice(USBDEVICE* dev)
case StreamDeckMiniV2: case StreamDeckMiniV2:
case StreamDeckXL: case StreamDeckXL:
case StreamDeckXLV2: case StreamDeckXLV2:
c->sensLabel.setVisible(false); c->sensLabel->setVisible(false);
c->sens.setVisible(false); // No knobs! c->sens->setVisible(false); // No knobs!
case StreamDeckPlus: case StreamDeckPlus:
c->speedLabel.setVisible(false); c->speedLabel->setVisible(false);
c->timeoutLabel.setVisible(false); c->timeoutLabel->setVisible(false);
c->orientLabel.setVisible(false); c->orientLabel->setVisible(false);
c->speed.setVisible(false); c->speed->setVisible(false);
c->timeout.setVisible(false); c->timeout->setVisible(false);
c->orientation.setVisible(false); c->orientation->setVisible(false);
break; break;
default: default:
break; break;
@ -871,11 +894,11 @@ void controllerSetup::setConnected(USBDEVICE* dev)
{ {
if (dev->connected) if (dev->connected)
{ {
tab.value()->message.setStyleSheet("QLabel { color : green; }"); tab.value()->message->setStyleSheet("QLabel { color : green; }");
tab.value()->message.setText("Connected"); tab.value()->message->setText("Connected");
} else { } else {
tab.value()->message.setStyleSheet("QLabel { color : red; }"); tab.value()->message->setStyleSheet("QLabel { color : red; }");
tab.value()->message.setText("Not Connected"); tab.value()->message->setText("Not Connected");
} }
} }
} }

Wyświetl plik

@ -75,36 +75,36 @@ protected:
struct tabContent { struct tabContent {
QWidget tab; QWidget* tab;
QVBoxLayout mainLayout; QVBoxLayout* mainLayout;
QHBoxLayout topLayout; QHBoxLayout* topLayout;
QWidget widget; QWidget* widget;
QVBoxLayout layout; QVBoxLayout* layout;
QCheckBox disabled; QCheckBox* disabled;
QLabel message; QLabel* message;
QGraphicsView view; QGraphicsView* view;
QLabel pageLabel; QLabel* pageLabel;
QSpinBox page; QSpinBox* page;
QHBoxLayout sensLayout; QHBoxLayout* sensLayout;
QLabel sensLabel; QLabel* sensLabel;
QSlider sens; QSlider* sens;
QImage image; QImage* image;
QGraphicsItem* bgImage = Q_NULLPTR; QGraphicsItem* bgImage = Q_NULLPTR;
controllerScene* scene = Q_NULLPTR; controllerScene* scene = Q_NULLPTR;
QGridLayout grid; QGridLayout* grid;
QLabel brightLabel; QLabel* brightLabel;
QComboBox brightness; QComboBox* brightness;
QLabel speedLabel; QLabel* speedLabel;
QComboBox speed; QComboBox* speed;
QLabel orientLabel; QLabel* orientLabel;
QComboBox orientation; QComboBox* orientation;
QLabel colorLabel; QLabel* colorLabel;
QPushButton color; QPushButton* color;
QLabel timeoutLabel; QLabel* timeoutLabel;
QSpinBox timeout; QSpinBox* timeout;
QLabel pagesLabel; QLabel* pagesLabel;
QSpinBox pages; QSpinBox* pages;
QLabel helpText; QLabel* helpText;
}; };

Wyświetl plik

@ -18,11 +18,12 @@ usbController::usbController()
loadKnobs(); loadKnobs();
// This is a the "master" list of supported devices. Maybe move to settings at some point? // This is a the "master" list of supported devices. Maybe move to settings at some point?
// usbDeviceType, manufacturer, product, usage, usagePage, butons, knobs, maxPayload, iconSize
knownDevices.append(USBTYPE(shuttleXpress,0x0b33,0x0020,0x0000,0x0000,15,2,5,0)); knownDevices.append(USBTYPE(shuttleXpress,0x0b33,0x0020,0x0000,0x0000,15,2,5,0));
knownDevices.append(USBTYPE(shuttlePro2,0x0b33,0x0030,0x0000,0x0000,15,2,5,0)); knownDevices.append(USBTYPE(shuttlePro2,0x0b33,0x0030,0x0000,0x0000,15,2,5,0));
knownDevices.append(USBTYPE(shuttlePro2,0x0b33,0x0011,0x0000,0x0000,15,2,5,0)); // Actually a ShuttlePro but hopefully will work? knownDevices.append(USBTYPE(shuttlePro2,0x0b33,0x0011,0x0000,0x0000,15,2,5,0)); // Actually a ShuttlePro but hopefully will work?
knownDevices.append(USBTYPE(RC28,0x0c26,0x001e,0x0000,0x0000,3,1,64,0)); knownDevices.append(USBTYPE(RC28,0x0c26,0x001e,0x0000,0x0000,3,1,64,0));
knownDevices.append(USBTYPE(eCoderPlus, 0x1fc9, 0x0003,0x0000,0x0000,16,4,32,0)); knownDevices.append(USBTYPE(eCoderPlus, 0x1fc9, 0x0003,0x0000,0x0000,22,4,32,0)); // Actually 20 but some bit0 and bit15 aren't used
knownDevices.append(USBTYPE(QuickKeys, 0x28bd, 0x5202,0x0001,0xff0a,10,1,32,0)); knownDevices.append(USBTYPE(QuickKeys, 0x28bd, 0x5202,0x0001,0xff0a,10,1,32,0));
knownDevices.append(USBTYPE(StreamDeckMini, 0x0fd9, 0x0063, 0x0000, 0x0000,6,0,1024,80)); knownDevices.append(USBTYPE(StreamDeckMini, 0x0fd9, 0x0063, 0x0000, 0x0000,6,0,1024,80));
knownDevices.append(USBTYPE(StreamDeckMiniV2, 0x0fd9, 0x0090, 0x0000, 0x0000,6,0,1024,80)); knownDevices.append(USBTYPE(StreamDeckMiniV2, 0x0fd9, 0x0090, 0x0000, 0x0000,6,0,1024,80));
@ -48,8 +49,12 @@ usbController::~usbController()
if (dev->type.model == RC28) { if (dev->type.model == RC28) {
sendRequest(dev,usbFeatureType::featureLEDControl,3,"off"); sendRequest(dev,usbFeatureType::featureLEDControl,3,"off");
} }
emit removeDevice(dev);
hid_close(dev->handle); hid_close(dev->handle);
dev->handle = NULL;
dev->connected = false;
dev->detected = false;
dev->uiCreated = false;
devicesConnected--;
} }
++devIt; ++devIt;
} }
@ -1255,12 +1260,12 @@ void usbController::sendRequest(USBDEVICE *dev, usbFeatureType feature, int val,
break; break;
case usbFeatureType::featureLEDControl: case usbFeatureType::featureLEDControl:
data[1] = 0x01; data[1] = 0x01;
data[2] = 0x07; if (text == "on")
//if (text == "on") dev->ledStatus &= ~(1UL << val);
//data[2] &= quint8(~(1UL << val)); else
//else dev->ledStatus |= 1UL << val;
// data[2] |= quint8(1UL << val); data[2] = dev->ledStatus;
//break; break;
default: default:
return; // No command return; // No command
break; break;

Wyświetl plik

@ -133,7 +133,7 @@ struct USBDEVICE {
QGraphicsScene* scene = Q_NULLPTR; QGraphicsScene* scene = Q_NULLPTR;
QSpinBox* pageSpin = Q_NULLPTR; QSpinBox* pageSpin = Q_NULLPTR;
QImage image; QImage image;
quint8 ledStatus=0x07;
}; };
struct COMMAND { struct COMMAND {

Wyświetl plik

@ -1729,32 +1729,35 @@ void wfmain::setupUsbControllerDevice()
if (usbWindow == Q_NULLPTR) { if (usbWindow == Q_NULLPTR) {
usbWindow = new controllerSetup(); usbWindow = new controllerSetup();
} }
usbControllerDev = new usbController(); usbControllerDev = new usbController();
usbControllerThread = new QThread(this); usbControllerThread = new QThread(this);
usbControllerThread->setObjectName("usb()");
usbControllerDev->moveToThread(usbControllerThread); usbControllerDev->moveToThread(usbControllerThread);
connect(usbControllerThread, SIGNAL(started()), usbControllerDev, SLOT(run())); connect(usbControllerThread, SIGNAL(started()), usbControllerDev, SLOT(run()));
connect(usbControllerThread, SIGNAL(finished()), usbControllerDev, SLOT(deleteLater())); connect(usbControllerThread, SIGNAL(finished()), usbControllerDev, SLOT(deleteLater()));
connect(usbControllerThread, SIGNAL(finished()), usbWindow, SLOT(deleteLater())); // Delete window when controller is deleted
connect(usbControllerDev, SIGNAL(sendJog(int)), this, SLOT(changeFrequency(int))); connect(usbControllerDev, SIGNAL(sendJog(int)), this, SLOT(changeFrequency(int)));
connect(usbControllerDev, SIGNAL(doShuttle(bool,unsigned char)), this, SLOT(doShuttle(bool,unsigned char))); connect(usbControllerDev, SIGNAL(doShuttle(bool,unsigned char)), this, SLOT(doShuttle(bool,unsigned char)));
connect(usbControllerDev, SIGNAL(button(const COMMAND*)), this, SLOT(buttonControl(const COMMAND*))); connect(usbControllerDev, SIGNAL(button(const COMMAND*)), this, SLOT(buttonControl(const COMMAND*)));
connect(usbControllerDev, SIGNAL(setBand(int)), this, SLOT(setBand(int))); connect(usbControllerDev, SIGNAL(setBand(int)), this, SLOT(setBand(int)));
connect(usbControllerDev, SIGNAL(removeDevice(USBDEVICE*)), usbWindow, SLOT(removeDevice(USBDEVICE*))); connect(usbControllerDev, SIGNAL(removeDevice(USBDEVICE*)), usbWindow, SLOT(removeDevice(USBDEVICE*)));
connect(usbControllerDev, SIGNAL(initUI(usbDevMap*, QVector<BUTTON>*, QVector<KNOB>*, QVector<COMMAND>*, QMutex*)), usbWindow, SLOT(init(usbDevMap*, QVector<BUTTON>*, QVector<KNOB>*, QVector<COMMAND>*, QMutex*))); connect(usbControllerDev, SIGNAL(initUI(usbDevMap*, QVector<BUTTON>*, QVector<KNOB>*, QVector<COMMAND>*, QMutex*)), usbWindow, SLOT(init(usbDevMap*, QVector<BUTTON>*, QVector<KNOB>*, QVector<COMMAND>*, QMutex*)));
connect(usbControllerDev, SIGNAL(changePage(USBDEVICE*, int)), usbWindow, SLOT(pageChanged(USBDEVICE*, int))); connect(usbControllerDev, SIGNAL(changePage(USBDEVICE*,int)), usbWindow, SLOT(pageChanged(USBDEVICE*,int)));
connect(usbControllerDev, SIGNAL(setConnected(USBDEVICE*)), usbWindow, SLOT(setConnected(USBDEVICE*))); connect(usbControllerDev, SIGNAL(setConnected(USBDEVICE*)), usbWindow, SLOT(setConnected(USBDEVICE*)));
connect(usbControllerDev, SIGNAL(newDevice(USBDEVICE*)), usbWindow, SLOT(newDevice(USBDEVICE *))); connect(usbControllerDev, SIGNAL(newDevice(USBDEVICE*)), usbWindow, SLOT(newDevice(USBDEVICE*)));
usbControllerThread->start(QThread::LowestPriority); usbControllerThread->start(QThread::LowestPriority);
connect(usbWindow, SIGNAL(sendRequest(USBDEVICE*, usbFeatureType, int, QString, QImage*, QColor *)), usbControllerDev, SLOT(sendRequest(USBDEVICE*, usbFeatureType, int, QString, QImage*, QColor *))); connect(usbWindow, SIGNAL(sendRequest(USBDEVICE*, usbFeatureType, int, QString, QImage*, QColor *)), usbControllerDev, SLOT(sendRequest(USBDEVICE*, usbFeatureType, int, QString, QImage*, QColor *)));
connect(this, SIGNAL(sendControllerRequest(USBDEVICE*, usbFeatureType, int, QString, QImage*, QColor *)), usbControllerDev, SLOT(sendRequest(USBDEVICE*, usbFeatureType, int, QString, QImage*, QColor *))); connect(this, SIGNAL(sendControllerRequest(USBDEVICE*, usbFeatureType, int, QString, QImage*, QColor *)), usbControllerDev, SLOT(sendRequest(USBDEVICE*, usbFeatureType, int, QString, QImage*, QColor *)));
connect(usbWindow, SIGNAL(programPages(USBDEVICE*, int)), usbControllerDev, SLOT(programPages(USBDEVICE*, int))); connect(usbWindow, SIGNAL(programPages(USBDEVICE*,int)), usbControllerDev, SLOT(programPages(USBDEVICE*,int)));
connect(usbWindow, SIGNAL(programDisable(USBDEVICE*, bool)), usbControllerDev, SLOT(programDisable(USBDEVICE*, bool))); connect(usbWindow, SIGNAL(programDisable(USBDEVICE*,bool)), usbControllerDev, SLOT(programDisable(USBDEVICE*,bool)));
connect(this, SIGNAL(setPTT(bool)), usbControllerDev, SLOT(receivePTTStatus(bool))); connect(this, SIGNAL(setPTT(bool)), usbControllerDev, SLOT(receivePTTStatus(bool)));
connect(this, SIGNAL(sendLevel(cmds, unsigned char)), usbControllerDev, SLOT(receiveLevel(cmds, unsigned char))); connect(this, SIGNAL(sendLevel(cmds,unsigned char)), usbControllerDev, SLOT(receiveLevel(cmds,unsigned char)));
connect(this, SIGNAL(initUsbController(QMutex*,usbDevMap*,QVector<BUTTON>*,QVector<KNOB>*)), usbControllerDev, SLOT(init(QMutex*,usbDevMap*,QVector<BUTTON>*,QVector<KNOB>*))); connect(this, SIGNAL(initUsbController(QMutex*,usbDevMap*,QVector<BUTTON>*,QVector<KNOB>*)), usbControllerDev, SLOT(init(QMutex*,usbDevMap*,QVector<BUTTON>*,QVector<KNOB>*)));
connect(this, SIGNAL(usbHotplug()), usbControllerDev, SLOT(run())); connect(this, SIGNAL(usbHotplug()), usbControllerDev, SLOT(run()));
connect(usbWindow, SIGNAL(backup(USBDEVICE*, QString)), usbControllerDev, SLOT(backupController(USBDEVICE*, QString))); connect(usbWindow, SIGNAL(backup(USBDEVICE*,QString)), usbControllerDev, SLOT(backupController(USBDEVICE*,QString)));
connect(usbWindow, SIGNAL(restore(USBDEVICE*, QString)), usbControllerDev, SLOT(restoreController(USBDEVICE*, QString))); connect(usbWindow, SIGNAL(restore(USBDEVICE*,QString)), usbControllerDev, SLOT(restoreController(USBDEVICE*,QString)));
#endif #endif
} }
@ -9461,6 +9464,7 @@ void wfmain::on_enableUsbChk_clicked(bool checked)
usbControllerThread->quit(); usbControllerThread->quit();
usbControllerThread->wait(); usbControllerThread->wait();
usbControllerThread = Q_NULLPTR; usbControllerThread = Q_NULLPTR;
usbWindow = Q_NULLPTR;
} }
if (checked) { if (checked) {
@ -9468,12 +9472,6 @@ void wfmain::on_enableUsbChk_clicked(bool checked)
setupUsbControllerDevice(); setupUsbControllerDevice();
emit initUsbController(&usbMutex,&usbDevices,&usbButtons,&usbKnobs); emit initUsbController(&usbMutex,&usbDevices,&usbButtons,&usbKnobs);
} }
else {
if (usbWindow != Q_NULLPTR) {
delete usbWindow;
usbWindow = Q_NULLPTR;
}
}
#endif #endif
} }