mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-02-03 09:44:01 -05:00
Audio Input: Make sure audio device name corresponds to GUI setting. Set start/stop button background colour according to device status.
This commit is contained in:
parent
0a257f393e
commit
d548ff0eb9
@ -51,6 +51,8 @@ AudioInputGui::AudioInputGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
|||||||
|
|
||||||
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
|
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
|
||||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(openDeviceSettingsDialog(const QPoint &)));
|
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(openDeviceSettingsDialog(const QPoint &)));
|
||||||
|
connect(deviceUISet->m_deviceAPI, &DeviceAPI::stateChanged, this, &AudioInputGui::updateStatus);
|
||||||
|
updateStatus();
|
||||||
|
|
||||||
displaySettings();
|
displaySettings();
|
||||||
makeUIConnections();
|
makeUIConnections();
|
||||||
@ -233,6 +235,8 @@ void AudioInputGui::displaySettings()
|
|||||||
} else {
|
} else {
|
||||||
ui->device->setCurrentIndex(0);
|
ui->device->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
|
// Make sure on_device_currentIndexChanged is called. Index may be the same for a different device
|
||||||
|
on_device_currentIndexChanged(ui->device->currentIndex());
|
||||||
|
|
||||||
ui->decim->setCurrentIndex(m_settings.m_log2Decim);
|
ui->decim->setCurrentIndex(m_settings.m_log2Decim);
|
||||||
ui->volume->setValue((int)(m_settings.m_volume*10.0f));
|
ui->volume->setValue((int)(m_settings.m_volume*10.0f));
|
||||||
@ -312,6 +316,30 @@ void AudioInputGui::updateHardware()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AudioInputGui::updateStatus()
|
||||||
|
{
|
||||||
|
int state = m_deviceUISet->m_deviceAPI->state();
|
||||||
|
|
||||||
|
switch (state)
|
||||||
|
{
|
||||||
|
case DeviceAPI::StNotStarted:
|
||||||
|
ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||||
|
break;
|
||||||
|
case DeviceAPI::StIdle:
|
||||||
|
ui->startStop->setStyleSheet("QToolButton { background-color : blue; }");
|
||||||
|
break;
|
||||||
|
case DeviceAPI::StRunning:
|
||||||
|
ui->startStop->setStyleSheet("QToolButton { background-color : green; }");
|
||||||
|
break;
|
||||||
|
case DeviceAPI::StError:
|
||||||
|
ui->startStop->setStyleSheet("QToolButton { background-color : red; }");
|
||||||
|
QMessageBox::information(this, tr("Message"), m_deviceUISet->m_deviceAPI->errorMessage());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AudioInputGui::openDeviceSettingsDialog(const QPoint& p)
|
void AudioInputGui::openDeviceSettingsDialog(const QPoint& p)
|
||||||
{
|
{
|
||||||
if (m_contextMenuType == ContextMenuDeviceSettings)
|
if (m_contextMenuType == ContextMenuDeviceSettings)
|
||||||
|
@ -80,6 +80,7 @@ private slots:
|
|||||||
void on_startStop_toggled(bool checked);
|
void on_startStop_toggled(bool checked);
|
||||||
void updateHardware();
|
void updateHardware();
|
||||||
void openDeviceSettingsDialog(const QPoint& p);
|
void openDeviceSettingsDialog(const QPoint& p);
|
||||||
|
void updateStatus();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_AUDIOINPUTGUI_H
|
#endif // INCLUDE_AUDIOINPUTGUI_H
|
||||||
|
Loading…
Reference in New Issue
Block a user