kopia lustrzana https://gitlab.com/eliggett/wfview
Added VSP list
rodzic
e355c7763a
commit
00bb42c31d
|
@ -313,12 +313,27 @@ void settingswidget::updateRaPref(prefRaItem pra)
|
|||
break;
|
||||
case ra_serialPortRadio:
|
||||
{
|
||||
int serialIndex = ui->serialDeviceListCombo->findText(prefs->serialPortRadio);
|
||||
if (serialIndex != -1) {
|
||||
ui->serialDeviceListCombo->setCurrentIndex(serialIndex);
|
||||
if(!haveSerialDevices)
|
||||
{
|
||||
qCritical(logGui()) << "Asked to show serial device without serial device list.";
|
||||
break;
|
||||
}
|
||||
if(!prefs->serialPortRadio.isEmpty())
|
||||
{
|
||||
int serialIndex = -1;
|
||||
if(prefs->serialPortRadio.toLower() == "auto")
|
||||
{
|
||||
serialIndex = ui->serialDeviceListCombo->findText(QString("Auto"));
|
||||
} else {
|
||||
serialIndex = ui->serialDeviceListCombo->findText(prefs->serialPortRadio);
|
||||
}
|
||||
if (serialIndex != -1) {
|
||||
ui->serialDeviceListCombo->setCurrentIndex(serialIndex);
|
||||
} else {
|
||||
qWarning(logGui()) << "Cannot find serial port" << prefs->serialPortRadio << "mentioned in preferences inside the serial combo box.";
|
||||
}
|
||||
} else {
|
||||
// TODO: load the combo box with the serial port choices first!
|
||||
qWarning(logGui()) << "Cannot find serial port in serial combo box.";
|
||||
qDebug(logGui()) << "Serial port in prefs is blank";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -329,14 +344,21 @@ void settingswidget::updateRaPref(prefRaItem pra)
|
|||
break;
|
||||
case ra_virtualSerialPort:
|
||||
{
|
||||
if(!haveVspDevices)
|
||||
{
|
||||
qCritical(logGui()) << "Asked to select VSP device without VSP device list.";
|
||||
break;
|
||||
}
|
||||
int vspIndex = ui->vspCombo->findText(prefs->virtualSerialPort);
|
||||
if (vspIndex != -1) {
|
||||
ui->vspCombo->setCurrentIndex(vspIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->vspCombo->addItem(prefs->virtualSerialPort);
|
||||
ui->vspCombo->setCurrentIndex(ui->vspCombo->count() - 1);
|
||||
} else {
|
||||
// TODO: Are we sure this is a good idea?
|
||||
if(!prefs->virtualSerialPort.isEmpty())
|
||||
{
|
||||
ui->vspCombo->addItem(prefs->virtualSerialPort);
|
||||
ui->vspCombo->setCurrentIndex(ui->vspCombo->count() - 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -603,11 +625,44 @@ void settingswidget::updateSerialPortList(QStringList deviceList, QVector<int> d
|
|||
ui->serialDeviceListCombo->addItem("Manual...", 256);
|
||||
#endif
|
||||
ui->serialDeviceListCombo->blockSignals(false);
|
||||
haveSerialDevices = true;
|
||||
} else {
|
||||
qCritical(logGui()) << "Cannot populate serial device list. Data of unequal length.";
|
||||
}
|
||||
}
|
||||
|
||||
void settingswidget::updateVSPList(QStringList deviceList, QVector<int> data)
|
||||
{
|
||||
// Do not supply "None" device, that is a UI thing and it is done here.
|
||||
// Supply the complete filename
|
||||
|
||||
// TODO: Should we clear the list first?
|
||||
if(deviceList.length() == data.length())
|
||||
{
|
||||
ui->vspCombo->blockSignals(true);
|
||||
|
||||
for(int i=0; i < deviceList.length(); i++)
|
||||
{
|
||||
ui->vspCombo->addItem(deviceList.at(i), data.at(i));
|
||||
|
||||
if (QFile::exists(deviceList.at(i))) {
|
||||
auto* model = qobject_cast<QStandardItemModel*>(ui->vspCombo->model());
|
||||
auto* item = model->item(ui->vspCombo->count() - 1);
|
||||
item->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
ui->serialDeviceListCombo->addItem("None", deviceList.size());
|
||||
|
||||
ui->vspCombo->blockSignals(false);
|
||||
haveVspDevices = true;
|
||||
} else {
|
||||
qCritical(logGui()) << "Cannot populate serial device list. Data of unequal length.";
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: VSP from wfmain line 1498...
|
||||
|
||||
// Utility Functions:
|
||||
void settingswidget::updateUnderlayMode()
|
||||
{
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#ifndef SETTINGSWIDGET_H
|
||||
#define SETTINGSWIDGET_H
|
||||
|
||||
#include <QStandardItemModel>
|
||||
#include <QWidget>
|
||||
#include <QFile>
|
||||
#include <QSlider>
|
||||
#include <QSpinBox>
|
||||
#include <QCheckBox>
|
||||
|
@ -51,6 +53,8 @@ public slots:
|
|||
void updateServerTXAudioOutputs(QStringList deviceList, int currentIndex, int chars);
|
||||
|
||||
void updateSerialPortList(QStringList deviceList, QVector<int> data);
|
||||
void updateVSPList(QStringList deviceList, QVector<int> data);
|
||||
|
||||
|
||||
signals:
|
||||
// Not sure if we should do it this way,
|
||||
|
@ -86,6 +90,7 @@ private:
|
|||
bool havePrefs = false;
|
||||
bool haveUdpPrefs = false;
|
||||
bool haveSerialDevices = false;
|
||||
bool haveVspDevices = false;
|
||||
bool haveAudioInputs = false;
|
||||
bool haveAudioOutputs = false;
|
||||
bool haveServerAudioInputs = false;
|
||||
|
|
22
wfmain.cpp
22
wfmain.cpp
|
@ -1479,14 +1479,22 @@ void wfmain::setSerialDevicesUI()
|
|||
|
||||
setupui->updateSerialPortList(deviceList, deviceData);
|
||||
|
||||
|
||||
// VSP:
|
||||
QStringList vspList;
|
||||
QVector<int> vspData;
|
||||
int vspCount=0;
|
||||
ui->vspCombo->blockSignals(true);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
ui->vspCombo->addItem(QString("None"), i++);
|
||||
ui->vspCombo->addItem(QString("None"), i++); // i=0 when this is run
|
||||
|
||||
foreach(const QSerialPortInfo & serialPortInfo, QSerialPortInfo::availablePorts())
|
||||
{
|
||||
ui->vspCombo->addItem(serialPortInfo.portName());
|
||||
vspList.append(serialPortInfo.portName(), vspCount);
|
||||
vspData.append(vspCount);
|
||||
vspCount++;
|
||||
}
|
||||
#else
|
||||
// Provide reasonable names for the symbolic link to the pty device
|
||||
|
@ -1497,15 +1505,21 @@ void wfmain::setSerialDevicesUI()
|
|||
#endif
|
||||
for (i = 1; i < 8; i++) {
|
||||
ui->vspCombo->addItem(vspName + QString::number(i));
|
||||
|
||||
vspList.append(vspName + QString::number(i));
|
||||
vspData.append(vspCount);
|
||||
vspCount++;
|
||||
if (QFile::exists(vspName + QString::number(i))) {
|
||||
auto* model = qobject_cast<QStandardItemModel*>(ui->vspCombo->model());
|
||||
auto* item = model->item(ui->vspCombo->count() - 1);
|
||||
item->setEnabled(false);
|
||||
}
|
||||
}
|
||||
ui->vspCombo->addItem(vspName + QString::number(i));
|
||||
ui->vspCombo->addItem(QString("None"), i++);
|
||||
ui->vspCombo->addItem(vspName + QString::number(i)); // i=8
|
||||
vspList.append(vspName + QString::number(i));
|
||||
vspData.append(vspCount);
|
||||
ui->vspCombo->addItem(QString("None"), i++); // i=9 when this is run
|
||||
|
||||
setupui->updateVSPList(vspList, vspData);
|
||||
|
||||
#endif
|
||||
ui->vspCombo->setEditable(true);
|
||||
|
|
Ładowanie…
Reference in New Issue