1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-06 16:05:13 -04:00

Massive UI revamping (v7): devices basic

This commit is contained in:
f4exb
2022-04-07 16:32:03 +02:00
parent 43f53fe26a
commit aad90aeabc
193 changed files with 2598 additions and 691 deletions
@@ -40,9 +40,12 @@ AudioInputGui::AudioInputGui(DeviceUISet *deviceUISet, QWidget* parent) :
m_sampleSource(nullptr),
m_centerFrequency(0)
{
setAttribute(Qt::WA_DeleteOnClose, true);
m_sampleSource = (AudioInput*) m_deviceUISet->m_deviceAPI->getSampleSource();
ui->setupUi(this);
ui->setupUi(getContents());
getContents()->setStyleSheet("#AudioInputGui { border: 1px solid #C06900 }");
m_helpURL = "plugins/samplesource/audioinput/readme.md";
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
@@ -50,6 +53,7 @@ AudioInputGui::AudioInputGui(DeviceUISet *deviceUISet, QWidget* parent) :
connect(startStopRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(openDeviceSettingsDialog(const QPoint &)));
displaySettings();
makeUIConnections();
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
m_sampleSource->setMessageQueueToGUI(&m_inputMessageQueue);
@@ -306,3 +310,13 @@ void AudioInputGui::openDeviceSettingsDialog(const QPoint& p)
sendSettings();
}
void AudioInputGui::makeUIConnections()
{
QObject::connect(ui->device, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &AudioInputGui::on_device_currentIndexChanged);
QObject::connect(ui->sampleRate, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &AudioInputGui::on_sampleRate_currentIndexChanged);
QObject::connect(ui->decim, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &AudioInputGui::on_decim_currentIndexChanged);
QObject::connect(ui->volume, &QDial::valueChanged, this, &AudioInputGui::on_volume_valueChanged);
QObject::connect(ui->channels, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &AudioInputGui::on_channels_currentIndexChanged);
QObject::connect(ui->startStop, &ButtonSwitch::toggled, this, &AudioInputGui::on_startStop_toggled);
}
@@ -46,6 +46,10 @@ public:
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
virtual void setWorkspaceIndex(int index) { m_settings.m_workspaceIndex = index; }
virtual int getWorkspaceIndex() const { return m_settings.m_workspaceIndex; }
virtual void setGeometryBytes(const QByteArray& blob) { m_settings.m_geometryBytes = blob; }
virtual QByteArray getGeometryBytes() const { return m_settings.m_geometryBytes; }
private:
Ui::AudioInputGui* ui;
@@ -68,6 +72,7 @@ private:
void sendSettings();
void updateSampleRateAndFrequency();
bool handleMessage(const Message& message);
void makeUIConnections();
private slots:
void handleInputMessages();
@@ -36,6 +36,7 @@ void AudioInputSettings::resetToDefaults()
m_reverseAPIAddress = "127.0.0.1";
m_reverseAPIPort = 8888;
m_reverseAPIDeviceIndex = 0;
m_workspaceIndex = 0;
}
QByteArray AudioInputSettings::serialize() const
@@ -47,6 +48,8 @@ QByteArray AudioInputSettings::serialize() const
s.writeFloat(3, m_volume);
s.writeU32(4, m_log2Decim);
s.writeS32(5, (int)m_iqMapping);
s.writeS32(6, m_workspaceIndex);
s.writeBlob(7, m_geometryBytes);
s.writeBool(24, m_useReverseAPI);
s.writeString(25, m_reverseAPIAddress);
@@ -75,6 +78,8 @@ bool AudioInputSettings::deserialize(const QByteArray& data)
d.readFloat(3, &m_volume, 1.0f);
d.readU32(4, &m_log2Decim, 0);
d.readS32(5, (int *)&m_iqMapping, IQMapping::L);
d.readS32(6, &m_workspaceIndex, 0);
d.readBlob(7, &m_geometryBytes);
d.readBool(24, &m_useReverseAPI, false);
d.readString(25, &m_reverseAPIAddress, "127.0.0.1");
@@ -39,6 +39,8 @@ struct AudioInputSettings {
QString m_reverseAPIAddress;
uint16_t m_reverseAPIPort;
uint16_t m_reverseAPIDeviceIndex;
int m_workspaceIndex;
QByteArray m_geometryBytes;
AudioInputSettings();
void resetToDefaults();