1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 10:05:46 -05:00

PlutoSDR input: refactored GUI

This commit is contained in:
f4exb 2017-09-05 08:48:09 +02:00
parent 1ac34678da
commit b957c35493
3 changed files with 97 additions and 23 deletions

View File

@ -17,6 +17,7 @@
#include <stdio.h>
#include "device/devicesourceapi.h"
#include "plutosdrinput.h"
#include "ui_plutosdrinputgui.h"
#include "plutosdrinputgui.h"
@ -24,8 +25,40 @@ PlutoSDRInputGui::PlutoSDRInputGui(DeviceSourceAPI *deviceAPI, QWidget* parent)
QWidget(parent),
ui(new Ui::PlutoSDRInputGUI),
m_deviceAPI(deviceAPI),
m_settings()
m_settings(),
m_forceSettings(true),
m_sampleSource(NULL),
m_sampleRate(0),
m_deviceCenterFrequency(0),
m_lastEngineState((DSPDeviceSourceEngine::State)-1)
{
m_sampleSource = new PlutoSDRInput(m_deviceAPI);
m_deviceAPI->setSource(m_sampleSource);
float minF, maxF, stepF;
// TODO: call device core to get values
minF = 100000;
maxF = 4000000;
stepF = 1000;
ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
ui->centerFrequency->setValueRange(7, 325000U, 3800000U);
ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow));
ui->sampleRate->setValueRange(8, (uint32_t) minF, (uint32_t) maxF);
ui->lpf->setColorMapper(ColorMapper(ColorMapper::GrayYellow));
ui->lpf->setValueRange(6, (minF/1000)+1, maxF/1000);
ui->lpFIR->setColorMapper(ColorMapper(ColorMapper::GrayYellow));
ui->lpFIR->setValueRange(5, 1U, 56000U);
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
m_statusTimer.start(500);
connect(m_deviceAPI->getDeviceOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
}
PlutoSDRInputGui::~PlutoSDRInputGui()

View File

@ -17,13 +17,16 @@
#ifndef PLUGINS_SAMPLESOURCE_PLUTOSDRINPUT_PLUTOSDRINPUTGUI_H_
#define PLUGINS_SAMPLESOURCE_PLUTOSDRINPUT_PLUTOSDRINPUTGUI_H_
#include <plugin/plugininstanceui.h>
#include <QObject>
#include <QWidget>
#include <QTimer>
#include <plugin/plugininstanceui.h>
#include "plutosdrinputsettings.h"
class DeviceSourceAPI;
class DeviceSampleSource;
namespace Ui {
class PlutoSDRInputGUI;
@ -50,6 +53,13 @@ private:
Ui::PlutoSDRInputGUI* ui;
DeviceSourceAPI* m_deviceAPI;
PlutoSDRInputSettings m_settings;
bool m_forceSettings;
QTimer m_updateTimer;
QTimer m_statusTimer;
DeviceSampleSource* m_sampleSource;
int m_sampleRate;
quint64 m_deviceCenterFrequency; //!< Center frequency in device
int m_lastEngineState;
};
#endif /* PLUGINS_SAMPLESOURCE_PLUTOSDRINPUT_PLUTOSDRINPUTGUI_H_ */

View File

@ -297,7 +297,7 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="ncoSampleRateLayout">
<layout class="QHBoxLayout" name="decimationLayout">
<property name="topMargin">
<number>2</number>
</property>
@ -399,14 +399,14 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="fcPosLabel">
<property name="text">
<string>Fc</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox">
<widget class="QComboBox" name="fcPos">
<property name="maximumSize">
<size>
<width>55</width>
@ -446,6 +446,10 @@
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="sampleRateLayout">
<item>
<widget class="QLabel" name="samplerateLabel">
<property name="sizePolicy">
@ -496,23 +500,19 @@
</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="QHBoxLayout" name="lpfLayout">
<property name="topMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<spacer name="horizontalSpacer">
<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>
<widget class="QLabel" name="lpfLabel">
<property name="text">
@ -548,6 +548,7 @@
<property name="toolTip">
<string>Analog lowpass filer bandwidth (kHz)</string>
</property>
<zorder>lpfUnits</zorder>
</widget>
</item>
<item>
@ -557,6 +558,23 @@
</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="QHBoxLayout" name="firLayout">
<property name="topMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="ButtonSwitch" name="lpFIREnable">
<property name="toolTip">
@ -596,7 +614,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="lpFIRUnits">
<widget class="QLabel" name="lpfUnits_2">
<property name="text">
<string>kHz</string>
</property>
@ -663,6 +681,19 @@
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<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>