kopia lustrzana https://gitlab.com/eliggett/wfview
Added audio devices to the settings widget. Currently does not refresh
when you change audio systems, not surprising really.widgets
rodzic
918f20eb55
commit
f674dc6250
|
@ -17,6 +17,7 @@ settingswidget::~settingswidget()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
// Startup:
|
||||
void settingswidget::createSettingsListItems()
|
||||
{
|
||||
// Add items to the settings tab list widget
|
||||
|
@ -68,11 +69,7 @@ void settingswidget::populateComboBoxes()
|
|||
ui->controlPortTxt->setValidator(new QIntValidator(this));
|
||||
}
|
||||
|
||||
void settingswidget::on_settingsList_currentRowChanged(int currentRow)
|
||||
{
|
||||
ui->settingsStack->setCurrentIndex(currentRow);
|
||||
}
|
||||
|
||||
// Updating Preferences:
|
||||
void settingswidget::acceptPreferencesPtr(preferences *pptr)
|
||||
{
|
||||
if(pptr != NULL)
|
||||
|
@ -502,6 +499,85 @@ void settingswidget::updateUdpPref(udpPrefsItem upi)
|
|||
updatingUIFromPrefs = false;
|
||||
}
|
||||
|
||||
void settingswidget::updateAllPrefs()
|
||||
{
|
||||
// DEPRECIATED
|
||||
// Maybe make this a public convenience function
|
||||
|
||||
// Review all the preferences. This is intended to be called
|
||||
// after new settings are loaded in.
|
||||
// Not sure if we actually want to always assume we should load prefs.
|
||||
updatingUIFromPrefs = true;
|
||||
if(havePrefs)
|
||||
{
|
||||
updateIfPrefs((int)if_all);
|
||||
updateRaPrefs((int)ra_all);
|
||||
updateCtPrefs((int)ct_all);
|
||||
updateClusterPrefs((int)cl_all);
|
||||
updateLanPrefs((int)l_all);
|
||||
}
|
||||
if(haveUdpPrefs)
|
||||
{
|
||||
updateUdpPrefs((int)u_all);
|
||||
}
|
||||
|
||||
updatingUIFromPrefs = false;
|
||||
}
|
||||
|
||||
void settingswidget::updateAudioInputs(QStringList deviceList, int currentIndex, int chars)
|
||||
{
|
||||
// see wfmain::setAudioDevicesUI()
|
||||
if(haveAudioInputs)
|
||||
qInfo(logGui()) << "Reloading audio input list";
|
||||
ui->audioInputCombo->blockSignals(true);
|
||||
ui->audioInputCombo->clear();
|
||||
ui->audioInputCombo->addItems(deviceList);
|
||||
ui->audioInputCombo->setCurrentIndex(-1);
|
||||
ui->audioInputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(chars + 30));
|
||||
ui->audioInputCombo->blockSignals(false);
|
||||
ui->audioInputCombo->setCurrentIndex(currentIndex);
|
||||
haveAudioInputs = true;
|
||||
}
|
||||
|
||||
void settingswidget::updateAudioOutputs(QStringList deviceList, int currentIndex, int chars)
|
||||
{
|
||||
if(haveAudioOutputs)
|
||||
qInfo(logGui()) << "Reloading audio output list";
|
||||
ui->audioOutputCombo->blockSignals(true);
|
||||
ui->audioOutputCombo->clear();
|
||||
ui->audioOutputCombo->addItems(deviceList);
|
||||
ui->audioOutputCombo->setCurrentIndex(-1);
|
||||
ui->audioOutputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(chars + 30));
|
||||
ui->audioOutputCombo->blockSignals(false);
|
||||
ui->audioOutputCombo->setCurrentIndex(currentIndex);
|
||||
haveAudioOutputs = true;
|
||||
}
|
||||
|
||||
void settingswidget::updateServerTXAudioOutputs(QStringList deviceList, int currentIndex, int chars)
|
||||
{
|
||||
ui->serverTXAudioOutputCombo->blockSignals(true);
|
||||
ui->serverTXAudioOutputCombo->clear();
|
||||
ui->serverTXAudioOutputCombo->addItems(deviceList);
|
||||
ui->serverTXAudioOutputCombo->setCurrentIndex(-1);
|
||||
ui->serverTXAudioOutputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(chars + 30));
|
||||
ui->serverTXAudioOutputCombo->blockSignals(false);
|
||||
ui->serverTXAudioOutputCombo->setCurrentIndex(currentIndex);
|
||||
haveServerAudioOutputs = true;
|
||||
}
|
||||
|
||||
void settingswidget::updateServerRXAudioInputs(QStringList deviceList, int currentIndex, int chars)
|
||||
{
|
||||
ui->serverRXAudioInputCombo->blockSignals(true);
|
||||
ui->serverRXAudioInputCombo->clear();
|
||||
ui->serverRXAudioInputCombo->addItems(deviceList);
|
||||
ui->serverRXAudioInputCombo->setCurrentIndex(-1);
|
||||
ui->serverRXAudioInputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(chars+30));
|
||||
ui->serverRXAudioInputCombo->blockSignals(false);
|
||||
ui->serverRXAudioInputCombo->setCurrentIndex(currentIndex);
|
||||
haveServerAudioInputs = true;
|
||||
}
|
||||
|
||||
// Utility Functions:
|
||||
void settingswidget::updateUnderlayMode()
|
||||
{
|
||||
|
||||
|
@ -528,40 +604,6 @@ void settingswidget::updateUnderlayMode()
|
|||
}
|
||||
}
|
||||
|
||||
void settingswidget::updateAllPrefs()
|
||||
{
|
||||
// DEPRECIATED
|
||||
|
||||
|
||||
// Review all the preferences. This is intended to be called
|
||||
// after new settings are loaded in.
|
||||
updatingUIFromPrefs = true;
|
||||
ui->fullScreenChk->setChecked(prefs->useFullScreen);
|
||||
ui->useSystemThemeChk->setChecked(prefs->useSystemTheme);
|
||||
//drawPeaks not used
|
||||
switch(prefs->underlayMode) {
|
||||
case underlayNone:
|
||||
ui->underlayNone->setChecked(true);
|
||||
break;
|
||||
case underlayPeakHold:
|
||||
ui->underlayPeakHold->setChecked(true);
|
||||
break;
|
||||
case underlayPeakBuffer:
|
||||
ui->underlayPeakBuffer->setChecked(true);
|
||||
break;
|
||||
case underlayAverageBuffer:
|
||||
ui->underlayAverageBuffer->setChecked(true);
|
||||
break;
|
||||
default:
|
||||
qWarning() << "Do not understand underlay mode: " << (unsigned int) prefs->underlayMode;
|
||||
}
|
||||
quietlyUpdateSlider(ui->underlayBufferSlider, prefs->underlayBufferSize);
|
||||
ui->wfAntiAliasChk->setChecked(prefs->wfAntiAlias);
|
||||
ui->wfInterpolateChk->setChecked(prefs->wfInterpolate);
|
||||
|
||||
updatingUIFromPrefs = false;
|
||||
}
|
||||
|
||||
void settingswidget::quietlyUpdateSlider(QSlider *sl, int val)
|
||||
{
|
||||
sl->blockSignals(true);
|
||||
|
@ -570,6 +612,14 @@ void settingswidget::quietlyUpdateSlider(QSlider *sl, int val)
|
|||
sl->blockSignals(false);
|
||||
}
|
||||
|
||||
void settingswidget::quietlyUpdateSpinbox(QSpinBox *sb, int val)
|
||||
{
|
||||
sb->blockSignals(true);
|
||||
if( (val >= sb->minimum()) && (val <= sb->maximum()) )
|
||||
sb->setValue(val);
|
||||
sb->blockSignals(false);
|
||||
}
|
||||
|
||||
void settingswidget::quietlyUpdateCheckbox(QCheckBox *cb, bool isChecked)
|
||||
{
|
||||
cb->blockSignals(true);
|
||||
|
@ -584,6 +634,13 @@ void settingswidget::quietlyUpdateRadiobutton(QRadioButton *rb, bool isChecked)
|
|||
rb->blockSignals(false);
|
||||
}
|
||||
|
||||
// Resulting from User Interaction
|
||||
|
||||
void settingswidget::on_settingsList_currentRowChanged(int currentRow)
|
||||
{
|
||||
ui->settingsStack->setCurrentIndex(currentRow);
|
||||
}
|
||||
|
||||
void settingswidget::on_lanEnableBtn_clicked(bool checked)
|
||||
{
|
||||
// TODO: prefs.enableLAN = checked;
|
||||
|
@ -610,5 +667,12 @@ void settingswidget::on_lanEnableBtn_clicked(bool checked)
|
|||
//showStatusBarText("After filling in values, press Save Settings.");
|
||||
}
|
||||
prefs->enableLAN = checked;
|
||||
emit changedLanPrefs(l_enableLAN);
|
||||
// TODO: emit widgetChangedPrefs(l_enableLAN);
|
||||
}
|
||||
|
||||
void settingswidget::on_autoSSBchk_clicked(bool checked)
|
||||
{
|
||||
prefs->automaticSidebandSwitching = checked;
|
||||
emit changedCtPrefs(ct_automaticSidebandSwitching);
|
||||
}
|
||||
|
|
|
@ -3,8 +3,10 @@
|
|||
|
||||
#include <QWidget>
|
||||
#include <QSlider>
|
||||
#include <QSpinBox>
|
||||
#include <QCheckBox>
|
||||
#include <QRadioButton>
|
||||
#include <QStringList>
|
||||
|
||||
#include "logcategories.h"
|
||||
#include "prefs.h"
|
||||
|
@ -40,12 +42,14 @@ public slots:
|
|||
void updateLanPref(prefLanItem plan);
|
||||
void updateClusterPref(prefClusterItem pcl);
|
||||
|
||||
// depreciated:
|
||||
//void externalChangedPreferences(prefItem pi);
|
||||
void updateUdpPref(udpPrefsItem upi);
|
||||
//void externalChangedMultiplePreferences(uint64_t items);
|
||||
void updateUdpPrefs(int items);
|
||||
|
||||
void updateAudioInputs(QStringList deviceList, int currentIndex, int chars);
|
||||
void updateAudioOutputs(QStringList deviceList, int currentIndex, int chars);
|
||||
void updateServerRXAudioInputs(QStringList deviceList, int currentIndex, int chars);
|
||||
void updateServerTXAudioOutputs(QStringList deviceList, int currentIndex, int chars);
|
||||
|
||||
|
||||
signals:
|
||||
// Not sure if we should do it this way,
|
||||
|
@ -63,6 +67,8 @@ private slots:
|
|||
|
||||
void on_lanEnableBtn_clicked(bool checked);
|
||||
|
||||
void on_autoSSBchk_clicked(bool checked);
|
||||
|
||||
private:
|
||||
Ui::settingswidget *ui;
|
||||
void createSettingsListItems();
|
||||
|
@ -70,6 +76,7 @@ private:
|
|||
void updateAllPrefs();
|
||||
void updateUnderlayMode();
|
||||
void quietlyUpdateSlider(QSlider* sl, int val);
|
||||
void quietlyUpdateSpinbox(QSpinBox *sb, int val);
|
||||
void quietlyUpdateCheckbox(QCheckBox *cb, bool isChecked);
|
||||
void quietlyUpdateRadiobutton(QRadioButton *rb, bool isChecked);
|
||||
|
||||
|
@ -77,6 +84,11 @@ private:
|
|||
udpPreferences *udpPrefs = NULL;
|
||||
bool havePrefs = false;
|
||||
bool haveUdpPrefs = false;
|
||||
bool haveSerialDevices = false;
|
||||
bool haveAudioInputs = false;
|
||||
bool haveAudioOutputs = false;
|
||||
bool haveServerAudioInputs = false;
|
||||
bool haveServerAudioOutputs = false;
|
||||
bool updatingUIFromPrefs = false;
|
||||
};
|
||||
|
||||
|
|
13
wfmain.cpp
13
wfmain.cpp
|
@ -7433,6 +7433,7 @@ void wfmain::on_radioStatusBtn_clicked()
|
|||
void wfmain::setAudioDevicesUI()
|
||||
{
|
||||
qInfo() << "Looking for inputs";
|
||||
// got these:
|
||||
ui->audioInputCombo->blockSignals(true);
|
||||
ui->audioInputCombo->clear();
|
||||
ui->audioInputCombo->addItems(audioDev->getInputs());
|
||||
|
@ -7441,7 +7442,10 @@ void wfmain::setAudioDevicesUI()
|
|||
ui->audioInputCombo->blockSignals(false);
|
||||
ui->audioInputCombo->setCurrentIndex(audioDev->findInput("Client", txSetup.name));
|
||||
|
||||
setupui->updateAudioInputs(audioDev->getInputs(), audioDev->findInput("Client", txSetup.name), audioDev->getNumCharsIn());
|
||||
|
||||
qInfo() << "Looking for outputs";
|
||||
// done:
|
||||
ui->audioOutputCombo->blockSignals(true);
|
||||
ui->audioOutputCombo->clear();
|
||||
ui->audioOutputCombo->addItems(audioDev->getOutputs());
|
||||
|
@ -7450,12 +7454,15 @@ void wfmain::setAudioDevicesUI()
|
|||
ui->audioOutputCombo->blockSignals(false);
|
||||
ui->audioOutputCombo->setCurrentIndex(audioDev->findOutput("Client", rxSetup.name));
|
||||
|
||||
setupui->updateAudioOutputs(audioDev->getOutputs(), audioDev->findOutput("Client", rxSetup.name), audioDev->getNumCharsOut());
|
||||
|
||||
ui->serverTXAudioOutputCombo->blockSignals(true);
|
||||
ui->serverTXAudioOutputCombo->clear();
|
||||
ui->serverTXAudioOutputCombo->addItems(audioDev->getOutputs());
|
||||
ui->serverTXAudioOutputCombo->setCurrentIndex(-1);
|
||||
ui->serverTXAudioOutputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(audioDev->getNumCharsOut() + 30));
|
||||
ui->serverTXAudioOutputCombo->blockSignals(false);
|
||||
int serverOutputIndex = -1;
|
||||
|
||||
ui->serverRXAudioInputCombo->blockSignals(true);
|
||||
ui->serverRXAudioInputCombo->clear();
|
||||
|
@ -7463,6 +7470,7 @@ void wfmain::setAudioDevicesUI()
|
|||
ui->serverRXAudioInputCombo->setCurrentIndex(-1);
|
||||
ui->serverRXAudioInputCombo->setStyleSheet(QString("QComboBox QAbstractItemView {min-width: %1px;}").arg(audioDev->getNumCharsIn()+30));
|
||||
ui->serverRXAudioInputCombo->blockSignals(false);
|
||||
int serverInputIndex = -1;
|
||||
|
||||
rxSetup.type = prefs.audioSystem;
|
||||
txSetup.type = prefs.audioSystem;
|
||||
|
@ -7473,9 +7481,14 @@ void wfmain::setAudioDevicesUI()
|
|||
serverConfig.rigs.first()->txAudioSetup.type = prefs.audioSystem;
|
||||
|
||||
ui->serverRXAudioInputCombo->setCurrentIndex(audioDev->findInput("Server", serverConfig.rigs.first()->rxAudioSetup.name));
|
||||
serverOutputIndex = audioDev->findOutput("Server", serverConfig.rigs.first()->txAudioSetup.name);
|
||||
ui->serverTXAudioOutputCombo->setCurrentIndex(audioDev->findOutput("Server", serverConfig.rigs.first()->txAudioSetup.name));
|
||||
serverInputIndex = audioDev->findOutput("Server", serverConfig.rigs.first()->txAudioSetup.name);
|
||||
}
|
||||
|
||||
setupui->updateServerRXAudioInputs(audioDev->getInputs(), audioDev->getNumCharsIn(), serverInputIndex);
|
||||
setupui->updateServerTXAudioOutputs(audioDev->getOutputs(), audioDev->getNumCharsOut(), serverOutputIndex);
|
||||
|
||||
|
||||
qDebug(logSystem()) << "Audio devices done.";
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue