1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-02 22:14:45 -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
@@ -45,12 +45,15 @@ BladeRF2InputGui::BladeRF2InputGui(DeviceUISet *deviceUISet, QWidget* parent) :
m_sampleRate(0),
m_lastEngineState(DeviceAPI::StNotStarted)
{
setAttribute(Qt::WA_DeleteOnClose, true);
m_sampleSource = (BladeRF2Input*) m_deviceUISet->m_deviceAPI->getSampleSource();
int max, min, step;
float scale;
uint64_t f_min, f_max;
ui->setupUi(this);
ui->setupUi(getContents());
getContents()->setStyleSheet("#Bladerf2InputGui { border: 1px solid #C06900 }");
m_helpURL = "plugins/samplesource/bladerf2input/readme.md";
m_sampleSource->getFrequencyRange(f_min, f_max, step, scale);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
@@ -96,6 +99,7 @@ BladeRF2InputGui::BladeRF2InputGui(DeviceUISet *deviceUISet, QWidget* parent) :
m_sampleSource->setMessageQueueToGUI(&m_inputMessageQueue);
sendSettings();
makeUIConnections();
}
BladeRF2InputGui::~BladeRF2InputGui()
@@ -542,3 +546,21 @@ int BladeRF2InputGui::getGainValue(float gainDB)
// gainDB, m_gainMin, m_gainMax, m_gainStep, m_gainScale, gain);
return gain;
}
void BladeRF2InputGui::makeUIConnections()
{
QObject::connect(ui->centerFrequency, &ValueDial::changed, this, &BladeRF2InputGui::on_centerFrequency_changed);
QObject::connect(ui->LOppm, &QSlider::valueChanged, this, &BladeRF2InputGui::on_LOppm_valueChanged);
QObject::connect(ui->sampleRate, &ValueDial::changed, this, &BladeRF2InputGui::on_sampleRate_changed);
QObject::connect(ui->dcOffset, &ButtonSwitch::toggled, this, &BladeRF2InputGui::on_dcOffset_toggled);
QObject::connect(ui->iqImbalance, &ButtonSwitch::toggled, this, &BladeRF2InputGui::on_iqImbalance_toggled);
QObject::connect(ui->biasTee, &ButtonSwitch::toggled, this, &BladeRF2InputGui::on_biasTee_toggled);
QObject::connect(ui->bandwidth, &ValueDial::changed, this, &BladeRF2InputGui::on_bandwidth_changed);
QObject::connect(ui->decim, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &BladeRF2InputGui::on_decim_currentIndexChanged);
QObject::connect(ui->fcPos, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &BladeRF2InputGui::on_fcPos_currentIndexChanged);
QObject::connect(ui->gainMode, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &BladeRF2InputGui::on_gainMode_currentIndexChanged);
QObject::connect(ui->gain, &QSlider::valueChanged, this, &BladeRF2InputGui::on_gain_valueChanged);
QObject::connect(ui->transverter, &TransverterButton::clicked, this, &BladeRF2InputGui::on_transverter_clicked);
QObject::connect(ui->startStop, &ButtonSwitch::toggled, this, &BladeRF2InputGui::on_startStop_toggled);
QObject::connect(ui->sampleRateMode, &QToolButton::toggled, this, &BladeRF2InputGui::on_sampleRateMode_toggled);
}
@@ -44,6 +44,10 @@ public:
virtual QByteArray serialize() const;
virtual 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::Bladerf2InputGui* ui;
@@ -77,6 +81,7 @@ private:
int getGainValue(float gainDB);
void blockApplySettings(bool block);
bool handleMessage(const Message& message);
void makeUIConnections();
private slots:
void handleInputMessages();
@@ -44,6 +44,7 @@ void BladeRF2InputSettings::resetToDefaults()
m_reverseAPIAddress = "127.0.0.1";
m_reverseAPIPort = 8888;
m_reverseAPIDeviceIndex = 0;
m_workspaceIndex = 0;
}
QByteArray BladeRF2InputSettings::serialize() const
@@ -67,6 +68,8 @@ QByteArray BladeRF2InputSettings::serialize() const
s.writeU32(15, m_reverseAPIPort);
s.writeU32(16, m_reverseAPIDeviceIndex);
s.writeBool(17, m_iqOrder);
s.writeS32(18, m_workspaceIndex);
s.writeBlob(19, m_geometryBytes);
return s.final();
}
@@ -112,6 +115,8 @@ bool BladeRF2InputSettings::deserialize(const QByteArray& data)
d.readU32(16, &uintval, 0);
m_reverseAPIDeviceIndex = uintval > 99 ? 99 : uintval;
d.readBool(17, &m_iqOrder, true);
d.readS32(18, &m_workspaceIndex, 0);
d.readBlob(19, &m_geometryBytes);
return true;
}
@@ -46,6 +46,8 @@ struct BladeRF2InputSettings {
QString m_reverseAPIAddress;
uint16_t m_reverseAPIPort;
uint16_t m_reverseAPIDeviceIndex;
int m_workspaceIndex;
QByteArray m_geometryBytes;
BladeRF2InputSettings();
void resetToDefaults();