kopia lustrzana https://gitlab.com/eliggett/wfview
Update wfmain.cpp
rodzic
88ebf74e14
commit
360ceccdc6
70
wfmain.cpp
70
wfmain.cpp
|
@ -53,11 +53,6 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s
|
|||
|
||||
setSerialDevicesUI();
|
||||
|
||||
#if QT_VERSION >= 0x060000
|
||||
connect(&mediaDevices, &QMediaDevices::audioInputsChanged, this, &wfmain::setAudioDevicesUI);
|
||||
connect(&mediaDevices, &QMediaDevices::audioOutputsChanged, this, &wfmain::setAudioDevicesUI);
|
||||
#endif
|
||||
|
||||
setAudioDevicesUI();
|
||||
|
||||
setDefaultColors();
|
||||
|
@ -1118,9 +1113,8 @@ void wfmain::setAudioDevicesUI()
|
|||
}
|
||||
#else
|
||||
|
||||
#if QT_VERSION < 0x060000
|
||||
// If no external library is configured, use QTMultimedia
|
||||
// Enumerate audio devices, need to do before settings are loaded.
|
||||
// If no external library is configured, use QTMultimedia
|
||||
// Enumerate audio devices, need to do before settings are loaded.
|
||||
const auto audioOutputs = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
|
||||
for (const QAudioDeviceInfo& deviceInfo : audioOutputs) {
|
||||
ui->audioOutputCombo->addItem(deviceInfo.deviceName(), QVariant::fromValue(deviceInfo));
|
||||
|
@ -1137,29 +1131,6 @@ void wfmain::setAudioDevicesUI()
|
|||
txSetup.port = QAudioDeviceInfo::defaultInputDevice();
|
||||
serverRxSetup.port = QAudioDeviceInfo::defaultOutputDevice();
|
||||
serverTxSetup.port = QAudioDeviceInfo::defaultInputDevice();
|
||||
|
||||
#else
|
||||
// If no external library is configured, use QTMultimedia
|
||||
// Enumerate audio devices, need to do before settings are loaded.
|
||||
ui->audioOutputCombo->clear();
|
||||
const auto audioOutputs = mediaDevices.audioOutputs();
|
||||
for (const QAudioDevice& deviceInfo : audioOutputs) {
|
||||
ui->audioOutputCombo->addItem(deviceInfo.description(), QVariant::fromValue(deviceInfo));
|
||||
ui->serverTXAudioOutputCombo->addItem(deviceInfo.description(), QVariant::fromValue(deviceInfo));
|
||||
}
|
||||
ui->audioInputCombo->clear();
|
||||
const auto audioInputs = mediaDevices.audioInputs();
|
||||
for (const QAudioDevice& deviceInfo : audioInputs) {
|
||||
ui->audioInputCombo->addItem(deviceInfo.description(), QVariant::fromValue(deviceInfo));
|
||||
ui->serverRXAudioInputCombo->addItem(deviceInfo.description(), QVariant::fromValue(deviceInfo));
|
||||
}
|
||||
// Set these to default audio devices initially.
|
||||
rxSetup.port = QMediaDevices::defaultAudioOutput();
|
||||
txSetup.port = QMediaDevices::defaultAudioInput();
|
||||
serverTxSetup.port = QMediaDevices::defaultAudioOutput();
|
||||
serverRxSetup.port = QMediaDevices::defaultAudioInput();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1335,7 +1306,7 @@ void wfmain::setupKeyShortcuts()
|
|||
connect(keyM, SIGNAL(activated()), this, SLOT(shortcutM()));
|
||||
|
||||
keyDebug = new QShortcut(this);
|
||||
keyDebug->setKey(Qt::CTRL && Qt::SHIFT && Qt::Key_D);
|
||||
keyDebug->setKey(Qt::CTRL + Qt::SHIFT + Qt::Key_D);
|
||||
connect(keyDebug, SIGNAL(activated()), this, SLOT(on_debugBtn_clicked()));
|
||||
}
|
||||
|
||||
|
@ -1597,12 +1568,7 @@ void wfmain::loadSettings()
|
|||
rxSetup.port = ui->audioOutputCombo->itemData(audioOutputIndex).toInt();
|
||||
#else
|
||||
QVariant v = ui->audioOutputCombo->currentData();
|
||||
|
||||
#if QT_VERSION >= 0x060000
|
||||
rxSetup.port = v.value<QAudioDevice>();
|
||||
#else
|
||||
rxSetup.port = v.value<QAudioDeviceInfo>();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
ui->audioOutputCombo->blockSignals(false);
|
||||
|
@ -1619,11 +1585,7 @@ void wfmain::loadSettings()
|
|||
txSetup.port = ui->audioInputCombo->itemData(audioInputIndex).toInt();
|
||||
#else
|
||||
QVariant v = ui->audioInputCombo->currentData();
|
||||
#if QT_VERSION >= 0x060000
|
||||
txSetup.port = v.value<QAudioDevice>();
|
||||
#else
|
||||
txSetup.port = v.value<QAudioDeviceInfo>();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
ui->audioInputCombo->blockSignals(false);
|
||||
|
@ -1671,16 +1633,11 @@ void wfmain::loadSettings()
|
|||
serverRxSetup.port = ui->audioOutputCombo->itemData(serverAudioInputIndex).toInt();
|
||||
#else
|
||||
QVariant v = ui->serverRXAudioInputCombo->currentData();
|
||||
#if QT_VERSION >= 0x060000
|
||||
serverRxSetup.port = v.value<QAudioDevice>();
|
||||
#else
|
||||
serverRxSetup.port = v.value<QAudioDeviceInfo>();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
ui->serverRXAudioInputCombo->blockSignals(false);
|
||||
|
||||
|
||||
serverRxSetup.resampleQuality = settings->value("ResampleQuality", "4").toInt();
|
||||
serverRxSetup.resampleQuality = rxSetup.resampleQuality;
|
||||
|
||||
|
@ -1696,11 +1653,7 @@ void wfmain::loadSettings()
|
|||
serverTxSetup.port = ui->serverTXAudioOutputCombo->itemData(serverAudioOutputIndex).toInt();
|
||||
#else
|
||||
QVariant v = ui->serverTXAudioOutputCombo->currentData();
|
||||
#if QT_VERSION >= 0x060000
|
||||
serverRxSetup.port = v.value<QAudioDevice>();
|
||||
#else
|
||||
serverRxSetup.port = v.value<QAudioDeviceInfo>();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
ui->serverTXAudioOutputCombo->blockSignals(false);
|
||||
|
@ -1852,11 +1805,7 @@ void wfmain::on_serverRXAudioInputCombo_currentIndexChanged(int value)
|
|||
serverRxSetup.port = ui->serverRXAudioInputCombo->itemData(value).toInt();
|
||||
#else
|
||||
QVariant v = ui->serverRXAudioInputCombo->itemData(value);
|
||||
#if QT_VERSION < 0x060000
|
||||
serverRxSetup.port = v.value<QAudioDeviceInfo>();
|
||||
#else
|
||||
serverRxSetup.port = v.value<QAudioDevice>();
|
||||
#endif
|
||||
#endif
|
||||
serverRxSetup.name = ui->serverRXAudioInputCombo->itemText(value);
|
||||
qDebug(logGui()) << "Changed default server audio input to:" << serverRxSetup.name;
|
||||
|
@ -1870,11 +1819,7 @@ void wfmain::on_serverTXAudioOutputCombo_currentIndexChanged(int value)
|
|||
serverTxSetup.port = ui->serverTXAudioOutputCombo->itemData(value).toInt();
|
||||
#else
|
||||
QVariant v = ui->serverTXAudioOutputCombo->itemData(value);
|
||||
#if QT_VERSION < 0x060000
|
||||
serverTxSetup.port = v.value<QAudioDeviceInfo>();
|
||||
#else
|
||||
serverTxSetup.port = v.value<QAudioDevice>();
|
||||
#endif
|
||||
#endif
|
||||
serverTxSetup.name = ui->serverTXAudioOutputCombo->itemText(value);
|
||||
qDebug(logGui()) << "Changed default server audio output to:" << serverTxSetup.name;
|
||||
|
@ -4666,12 +4611,7 @@ void wfmain::on_audioOutputCombo_currentIndexChanged(int value)
|
|||
rxSetup.port = ui->audioOutputCombo->itemData(value).toInt();
|
||||
#else
|
||||
QVariant v = ui->audioOutputCombo->itemData(value);
|
||||
|
||||
#if QT_VERSION >= 0x060000
|
||||
rxSetup.port = v.value<QAudioDevice>();
|
||||
#else
|
||||
rxSetup.port = v.value<QAudioDeviceInfo>();
|
||||
#endif
|
||||
#endif
|
||||
rxSetup.name = ui->audioOutputCombo->itemText(value);
|
||||
qDebug(logGui()) << "Changed default audio output to:" << rxSetup.name;
|
||||
|
@ -4685,11 +4625,7 @@ void wfmain::on_audioInputCombo_currentIndexChanged(int value)
|
|||
txSetup.port = ui->audioInputCombo->itemData(value).toInt();
|
||||
#else
|
||||
QVariant v = ui->audioInputCombo->itemData(value);
|
||||
#if QT_VERSION >= 0x060000
|
||||
txSetup.port = v.value<QAudioDevice>();
|
||||
#else
|
||||
txSetup.port = v.value<QAudioDeviceInfo>();
|
||||
#endif
|
||||
#endif
|
||||
txSetup.name = ui->audioInputCombo->itemText(value);
|
||||
qDebug(logGui()) << "Changed default audio input to:" << txSetup.name;
|
||||
|
|
Ładowanie…
Reference in New Issue