1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-13 20:01:46 -05:00

BladeRF input plugin: GUI cosmetic changes

This commit is contained in:
f4exb 2016-03-29 17:31:44 +02:00
parent 574141be6c
commit ce20f21b08
5 changed files with 231 additions and 258 deletions

View File

@ -23,7 +23,7 @@
</font>
</property>
<property name="windowTitle">
<string>BladeRF</string>
<string>Airspy</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">

View File

@ -33,6 +33,19 @@ BladerfGui::BladerfGui(PluginAPI* pluginAPI, QWidget* parent) :
ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
ui->centerFrequency->setValueRange(7, BLADERF_FREQUENCY_MIN_XB200/1000, BLADERF_FREQUENCY_MAX/1000);
ui->samplerate->clear();
for (int i = 0; i < BladerfSampleRates::getNbRates(); i++)
{
ui->samplerate->addItem(QString::number(BladerfSampleRates::getRate(i)));
}
ui->bandwidth->clear();
for (int i = 0; i < BladerfBandwidths::getNbBandwidths(); i++)
{
ui->bandwidth->addItem(QString::number(BladerfBandwidths::getBandwidth(i)));
}
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
displaySettings();
@ -117,21 +130,17 @@ void BladerfGui::displaySettings()
ui->dcOffset->setChecked(m_settings.m_dcBlock);
ui->iqImbalance->setChecked(m_settings.m_iqCorrection);
ui->samplerateText->setText(tr("%1k").arg(m_settings.m_devSampleRate / 1000));
unsigned int sampleRateIndex = BladerfSampleRates::getRateIndex(m_settings.m_devSampleRate);
ui->samplerate->setValue(sampleRateIndex);
ui->samplerate->setCurrentIndex(sampleRateIndex);
ui->bandwidthText->setText(tr("%1k").arg(m_settings.m_bandwidth / 1000));
unsigned int bandwidthIndex = BladerfBandwidths::getBandwidthIndex(m_settings.m_bandwidth);
ui->bandwidth->setValue(bandwidthIndex);
ui->bandwidth->setCurrentIndex(bandwidthIndex);
ui->decimText->setText(tr("%1").arg(1<<m_settings.m_log2Decim));
ui->decim->setValue(m_settings.m_log2Decim);
ui->decim->setCurrentIndex(m_settings.m_log2Decim);
ui->fcPos->setCurrentIndex((int) m_settings.m_fcPos);
ui->lnaGainText->setText(tr("%1dB").arg(m_settings.m_lnaGain*3));
ui->lna->setValue(m_settings.m_lnaGain);
ui->lna->setCurrentIndex(m_settings.m_lnaGain);
ui->vga1Text->setText(tr("%1dB").arg(m_settings.m_vga1));
ui->vga1->setValue(m_settings.m_vga1);
@ -166,28 +175,25 @@ void BladerfGui::on_iqImbalance_toggled(bool checked)
sendSettings();
}
void BladerfGui::on_samplerate_valueChanged(int value)
void BladerfGui::on_samplerate_currentIndexChanged(int index)
{
int newrate = BladerfSampleRates::getRate(value);
ui->samplerateText->setText(tr("%1k").arg(newrate));
int newrate = BladerfSampleRates::getRate(index);
m_settings.m_devSampleRate = newrate * 1000;
sendSettings();
}
void BladerfGui::on_bandwidth_valueChanged(int value)
void BladerfGui::on_bandwidth_currentIndexChanged(int index)
{
int newbw = BladerfBandwidths::getBandwidth(value);
ui->bandwidthText->setText(tr("%1k").arg(newbw));
int newbw = BladerfBandwidths::getBandwidth(index);
m_settings.m_bandwidth = newbw * 1000;
sendSettings();
}
void BladerfGui::on_decim_valueChanged(int value)
void BladerfGui::on_decim_currentIndexChanged(int index)
{
if ((value <0) || (value > 5))
if ((index <0) || (index > 5))
return;
ui->decimText->setText(tr("%1").arg(1<<value));
m_settings.m_log2Decim = value;
m_settings.m_log2Decim = index;
sendSettings();
}
@ -205,15 +211,14 @@ void BladerfGui::on_fcPos_currentIndexChanged(int index)
}
}
void BladerfGui::on_lna_valueChanged(int value)
void BladerfGui::on_lna_currentIndexChanged(int index)
{
qDebug() << "BladerfGui: LNA gain = " << value;
qDebug() << "BladerfGui: LNA gain = " << index * 3 << " dB";
if ((value < 0) || (value > 2))
if ((index < 0) || (index > 2))
return;
ui->lnaGainText->setText(tr("%1dB").arg(value*3));
m_settings.m_lnaGain = value;
m_settings.m_lnaGain = index;
sendSettings();
}
@ -379,6 +384,11 @@ unsigned int BladerfSampleRates::getRateIndex(unsigned int rate)
return 0;
}
unsigned int BladerfSampleRates::getNbRates()
{
return BladerfSampleRates::m_nb_rates;
}
unsigned int BladerfBandwidths::m_halfbw[] = {750, 875, 1250, 1375, 1500, 1920, 2500, 2750, 3000, 3500, 4375, 5000, 6000, 7000, 10000, 14000};
unsigned int BladerfBandwidths::m_nb_halfbw = 16;
@ -406,3 +416,9 @@ unsigned int BladerfBandwidths::getBandwidthIndex(unsigned int bandwidth)
return 0;
}
unsigned int BladerfBandwidths::getNbBandwidths()
{
return BladerfBandwidths::m_nb_halfbw;
}

View File

@ -64,10 +64,10 @@ private slots:
void on_centerFrequency_changed(quint64 value);
void on_dcOffset_toggled(bool checked);
void on_iqImbalance_toggled(bool checked);
void on_samplerate_valueChanged(int value);
void on_bandwidth_valueChanged(int value);
void on_decim_valueChanged(int value);
void on_lna_valueChanged(int value);
void on_samplerate_currentIndexChanged(int index);
void on_bandwidth_currentIndexChanged(int index);
void on_decim_currentIndexChanged(int index);
void on_lna_currentIndexChanged(int index);
void on_vga1_valueChanged(int value);
void on_vga2_valueChanged(int value);
void on_xb200_currentIndexChanged(int index);
@ -79,6 +79,7 @@ class BladerfSampleRates {
public:
static unsigned int getRate(unsigned int rate_index);
static unsigned int getRateIndex(unsigned int rate);
static unsigned int getNbRates();
private:
static unsigned int m_rates[20];
static unsigned int m_nb_rates;
@ -88,6 +89,7 @@ class BladerfBandwidths {
public:
static unsigned int getBandwidth(unsigned int bandwidth_index);
static unsigned int getBandwidthIndex(unsigned int bandwidth);
static unsigned int getNbBandwidths();
private:
static unsigned int m_halfbw[16];
static unsigned int m_nb_halfbw;

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>247</width>
<height>308</height>
<width>300</width>
<height>172</height>
</rect>
</property>
<property name="sizePolicy">
@ -29,16 +29,7 @@
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>2</number>
</property>
<item>
@ -109,6 +100,13 @@
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_corr">
<item row="0" column="2">
@ -117,7 +115,7 @@
<string>Automatic IQ imbalance correction</string>
</property>
<property name="text">
<string>IQ imbalance</string>
<string>IQ</string>
</property>
</widget>
</item>
@ -127,33 +125,19 @@
<string>Automatic DC offset removal</string>
</property>
<property name="text">
<string>DC offset</string>
<string>DC</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="corrLabel">
<property name="text">
<string>Auto corr</string>
<string>Auto</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_freq">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_xb200">
<property name="spacing">
<number>3</number>
</property>
<item row="0" column="2">
<spacer name="xb200Spacer">
<item row="0" column="3">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -165,12 +149,19 @@
</property>
</spacer>
</item>
<item row="0" column="1">
<item row="0" column="4">
<widget class="QLabel" name="xb200Label">
<property name="text">
<string>xb200</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QComboBox" name="xb200">
<property name="toolTip">
<string>XB200 board mode</string>
</property>
<property name="currentText">
<property name="currentText" stdset="0">
<string>None</string>
</property>
<property name="currentIndex">
@ -221,17 +212,10 @@
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="xb200Label">
<property name="text">
<string>xb200</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_dial">
<widget class="Line" name="line_freq">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -242,25 +226,6 @@
<property name="spacing">
<number>3</number>
</property>
<item row="0" column="1">
<widget class="QSlider" name="samplerate">
<property name="toolTip">
<string>Device Samplerate</string>
</property>
<property name="maximum">
<number>13</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>3</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="samplerateLabel">
<property name="sizePolicy">
@ -270,57 +235,57 @@
</sizepolicy>
</property>
<property name="text">
<string>Rate</string>
<string>SR</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="samplerate">
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Sample rate in kS/s</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="samplerateText">
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<widget class="QLabel" name="samplerateUnit">
<property name="text">
<string>---</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<string>k</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_rate">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_bandwidth">
<property name="spacing">
<number>3</number>
</property>
<item row="0" column="1">
<widget class="QSlider" name="bandwidth">
<item row="0" column="5">
<widget class="QComboBox" name="bandwidth">
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>RF filter bandwidth</string>
</property>
<property name="maximum">
<number>15</number>
</property>
<property name="pageStep">
<number>1</number>
<string>IF bandwidth in kHz</string>
</property>
</widget>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<item row="0" column="4">
<widget class="QLabel" name="bandwidthLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
@ -333,101 +298,15 @@
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="bandwidthText">
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<item row="0" column="6">
<widget class="QLabel" name="bandwidthUnit">
<property name="text">
<string>---</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<string>k</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_decim">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_decim" columnstretch="0,0,0">
<property name="spacing">
<number>3</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_decim">
<property name="text">
<string>Dec.</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSlider" name="decim">
<property name="toolTip">
<string>Decimation factor</string>
</property>
<property name="maximum">
<number>5</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="decimText">
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>1</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_bandwidth">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_fcPos" columnstretch="0,0,0">
<property name="spacing">
<number>3</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_fcPos">
<property name="text">
<string>Fc pos</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="fcPosRightSpacer">
<item row="0" column="7">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -439,7 +318,74 @@
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_decim" columnstretch="0,0,0,0,0,0,0,0,0">
<property name="spacing">
<number>3</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_decim">
<property name="text">
<string>Dec</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="decim">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Decimation factor</string>
</property>
<property name="currentIndex">
<number>3</number>
</property>
<item>
<property name="text">
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
</property>
</item>
<item>
<property name="text">
<string>4</string>
</property>
</item>
<item>
<property name="text">
<string>8</string>
</property>
</item>
<item>
<property name="text">
<string>16</string>
</property>
</item>
<item>
<property name="text">
<string>32</string>
</property>
</item>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_fcPos">
<property name="text">
<string>Fp</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QComboBox" name="fcPos">
<property name="toolTip">
<string>Relative position of device center frequency</string>
@ -456,26 +402,12 @@
</item>
<item>
<property name="text">
<string>Cent</string>
<string>Cen</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_fcPos">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_lna">
<property name="spacing">
<number>3</number>
</property>
<item row="0" column="0">
<item row="0" column="6">
<widget class="QLabel" name="lnaGainLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
@ -488,40 +420,63 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSlider" name="lna">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>LNA gain (dB)</string>
</property>
<property name="maximum">
<number>2</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<item row="0" column="5">
<spacer name="fcPosRightSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="7">
<widget class="QComboBox" name="lna">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<item>
<property name="text">
<string>0</string>
</property>
</item>
<item>
<property name="text">
<string>3</string>
</property>
</item>
<item>
<property name="text">
<string>6</string>
</property>
</item>
</widget>
</item>
<item row="0" column="8">
<widget class="QLabel" name="label">
<property name="text">
<string>dB</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="lnaGainText">
<property name="minimumSize">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>0</height>
<height>20</height>
</size>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</spacer>
</item>
</layout>
</item>

View File

@ -29,7 +29,7 @@
</font>
</property>
<property name="windowTitle">
<string>BladeRF</string>
<string>HackRF</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
@ -281,7 +281,7 @@
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_decim" columnstretch="0,0,0,0,0,0">
<layout class="QGridLayout" name="gridLayout_decim" columnstretch="0,0,0,0,0">
<property name="spacing">
<number>3</number>
</property>