RTL-SDR input plugin: GUI cosmetic changes

pull/6/head
f4exb 2016-03-29 16:22:24 +02:00
rodzic b70fa3f191
commit 39d5ecf6de
3 zmienionych plików z 124 dodań i 114 usunięć

Wyświetl plik

@ -15,6 +15,14 @@ RTLSDRGui::RTLSDRGui(PluginAPI* pluginAPI, QWidget* parent) :
ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
ui->centerFrequency->setValueRange(7, 24000U, 1900000U);
ui->sampleRate->clear();
for (int i = 0; i < RTLSDRSampleRates::getNbRates(); i++)
{
ui->sampleRate->addItem(QString::number(RTLSDRSampleRates::getRate(i)));
}
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
displaySettings();
@ -129,13 +137,11 @@ void RTLSDRGui::displaySettings()
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
ui->dcOffset->setChecked(m_settings.m_dcBlock);
ui->iqImbalance->setChecked(m_settings.m_iqImbalance);
ui->samplerateText->setText(tr("%1k").arg(m_settings.m_devSampleRate / 1000));
unsigned int sampleRateIndex = RTLSDRSampleRates::getRateIndex(m_settings.m_devSampleRate);
ui->samplerate->setValue(sampleRateIndex);
ui->sampleRate->setCurrentIndex(sampleRateIndex);
ui->ppm->setValue(m_settings.m_loPpmCorrection);
ui->ppmText->setText(tr("%1").arg(m_settings.m_loPpmCorrection));
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);
if (m_gains.size() > 0)
@ -179,15 +185,14 @@ void RTLSDRGui::on_centerFrequency_changed(quint64 value)
sendSettings();
}
void RTLSDRGui::on_decim_valueChanged(int value)
void RTLSDRGui::on_decim_currentIndexChanged(int index)
{
if ((value <0) || (value > 4))
if ((index <0) || (index > 4))
{
return;
}
ui->decimText->setText(tr("%1").arg(1<<value));
m_settings.m_log2Decim = value;
m_settings.m_log2Decim = index;
sendSettings();
}
@ -233,10 +238,9 @@ void RTLSDRGui::on_gain_valueChanged(int value)
sendSettings();
}
void RTLSDRGui::on_samplerate_valueChanged(int value)
void RTLSDRGui::on_sampleRate_currentIndexChanged(int index)
{
int newrate = RTLSDRSampleRates::getRate(value);
ui->samplerateText->setText(tr("%1k").arg(newrate));
int newrate = RTLSDRSampleRates::getRate(index);
m_settings.m_devSampleRate = newrate * 1000;
sendSettings();
@ -300,3 +304,8 @@ unsigned int RTLSDRSampleRates::getRateIndex(unsigned int rate)
return 0;
}
unsigned int RTLSDRSampleRates::getNbRates()
{
return RTLSDRSampleRates::m_nb_rates;
}

Wyświetl plik

@ -46,11 +46,11 @@ private slots:
void on_centerFrequency_changed(quint64 value);
void on_dcOffset_toggled(bool checked);
void on_iqImbalance_toggled(bool checked);
void on_decim_valueChanged(int value);
void on_decim_currentIndexChanged(int index);
void on_fcPos_currentIndexChanged(int index);
void on_ppm_valueChanged(int value);
void on_gain_valueChanged(int value);
void on_samplerate_valueChanged(int value);
void on_sampleRate_currentIndexChanged(int index);
void on_checkBox_stateChanged(int state);
void updateHardware();
void handleSourceMessages();
@ -60,6 +60,7 @@ class RTLSDRSampleRates {
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[7];
static unsigned int m_nb_rates;

Wyświetl plik

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>305</width>
<width>287</width>
<height>271</height>
</rect>
</property>
@ -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>
@ -194,42 +185,7 @@
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_rate">
<property name="spacing">
<number>3</number>
</property>
<item row="0" column="2">
<widget class="QLabel" name="samplerateText">
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>1024k</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSlider" name="samplerate">
<property name="toolTip">
<string>Device Samplerate</string>
</property>
<property name="maximum">
<number>6</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<layout class="QGridLayout" name="gridLayout_rateDecimPos">
<item row="0" column="0">
<widget class="QLabel" name="samplerateLabel">
<property name="sizePolicy">
@ -239,68 +195,31 @@
</sizepolicy>
</property>
<property name="text">
<string>Rate</string>
</property>
</widget>
</item>
</layout>
</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>4</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>4</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<string>SR</string>
</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>
<widget class="QLabel" name="sampleRateUnit">
<property name="text">
<string>16</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<string>k</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_fcPos">
<item row="0" column="1">
<item row="0" column="8">
<widget class="QComboBox" name="fcPos">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Relative postion of device center frequency</string>
</property>
<property name="currentIndex">
<number>2</number>
</property>
<item>
<property name="text">
<string>Inf</string>
@ -313,19 +232,19 @@
</item>
<item>
<property name="text">
<string>Cent</string>
<string>Cen</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0">
<item row="0" column="7">
<widget class="QLabel" name="fcPosLabel">
<property name="text">
<string>Fc pos</string>
<string>Fp</string>
</property>
</widget>
</item>
<item row="0" column="2">
<item row="0" column="9">
<spacer name="horizontalSpacer_fcPos">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -338,6 +257,87 @@
</property>
</spacer>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer_4">
<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="1">
<widget class="QComboBox" name="sampleRate">
<property name="toolTip">
<string>Sample rate in kS/s</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QComboBox" name="decim">
<property name="maximumSize">
<size>
<width>45</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Decimation factor</string>
</property>
<property name="currentIndex">
<number>0</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>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="label_decim">
<property name="text">
<string>Dec</string>
</property>
</widget>
</item>
<item row="0" column="6">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>