Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pref Sound: auto select free device channels #11859

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
SoundDeviceItem: rename member var, invert bool/meaning
ronso0 committed Sep 13, 2023
commit 427bf396b097852d732802435640934e65c3bc3a
27 changes: 14 additions & 13 deletions src/preferences/dialog/dlgprefsounditem.cpp
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ DlgPrefSoundItem::DlgPrefSoundItem(
m_type(type),
m_index(index),
m_isInput(isInput),
m_inhibitSettingChanged(false) {
m_emitSettingChanged(true) {
setupUi(this);
typeLabel->setText(AudioPath::getTrStringFromType(type, index));

@@ -119,13 +119,13 @@ void DlgPrefSoundItem::deviceChanged(int index) {
}
}
emitAndReturn:
if (m_inhibitSettingChanged == false) {
if (m_emitSettingChanged) {
emit settingChanged();
}
}

void DlgPrefSoundItem::channelChanged() {
if (m_inhibitSettingChanged == false) {
if (m_emitSettingChanged) {
emit settingChanged();
}
}
@@ -230,13 +230,13 @@ SoundDevicePointer DlgPrefSoundItem::getDevice() const {
void DlgPrefSoundItem::setDevice(const SoundDeviceId& device) {
int index = deviceComboBox->findData(QVariant::fromValue(device));
//qDebug() << "DlgPrefSoundItem::setDevice" << device;
if (index != -1) {
m_inhibitSettingChanged = true;
deviceComboBox->setCurrentIndex(index);
m_inhibitSettingChanged = false;
} else {
if (index == -1) {
deviceComboBox->setCurrentIndex(0); // None
emit settingChanged();
} else {
m_emitSettingChanged = false;
deviceComboBox->setCurrentIndex(index);
m_emitSettingChanged = true;
}
}

@@ -248,13 +248,14 @@ void DlgPrefSoundItem::setChannel(unsigned int channelBase,
// to store the channel info. x is the channel base and y is the channel
// count.
int index = channelComboBox->findData(QPoint(channelBase, channels));
if (index != -1) {
m_inhibitSettingChanged = true;
channelComboBox->setCurrentIndex(index);
m_inhibitSettingChanged = false;
} else {
if (index == -1) {
// channel(s) not found
channelComboBox->setCurrentIndex(0); // 1
emit settingChanged();
} else {
m_emitSettingChanged = false;
channelComboBox->setCurrentIndex(index);
m_emitSettingChanged = true;
}
}

2 changes: 1 addition & 1 deletion src/preferences/dialog/dlgprefsounditem.h
Original file line number Diff line number Diff line change
@@ -50,5 +50,5 @@ class DlgPrefSoundItem : public QWidget, public Ui::DlgPrefSoundItem {
// Because QVariant supports QPoint natively we use a QPoint to store the
// channel info. x is the channel base and y is the channel count.
QPoint m_savedChannel;
bool m_inhibitSettingChanged;
bool m_emitSettingChanged;
};