mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-03-31 16:48:29 -04:00
SoapySDR support: added GUI for complex factors (manual DC offset and IQ imbalance settings)
This commit is contained in:
parent
48340f253a
commit
98b79de593
@ -60,6 +60,7 @@ set(sdrgui_SOURCES
|
||||
soapygui/stringrangegui.cpp
|
||||
soapygui/dynamicitemsettinggui.cpp
|
||||
soapygui/intervalslidergui.cpp
|
||||
soapygui/complexfactorgui.cpp
|
||||
|
||||
webapi/webapiadaptergui.cpp
|
||||
)
|
||||
@ -124,6 +125,7 @@ set(sdrgui_HEADERS
|
||||
soapygui/stringrangegui.h
|
||||
soapygui/dynamicitemsettinggui.h
|
||||
soapygui/intervalslidergui.h
|
||||
soapygui/complexfactorgui.h
|
||||
|
||||
webapi/webapiadaptergui.h
|
||||
)
|
||||
@ -156,6 +158,7 @@ set(sdrgui_FORMS
|
||||
soapygui/discreterangegui.ui
|
||||
soapygui/intervalrangegui.ui
|
||||
soapygui/intervalslidergui.ui
|
||||
soapygui/complexfactorgui.ui
|
||||
)
|
||||
|
||||
set(sdrgui_RESOURCES
|
||||
|
88
sdrgui/soapygui/complexfactorgui.cpp
Normal file
88
sdrgui/soapygui/complexfactorgui.cpp
Normal file
@ -0,0 +1,88 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "ui_complexfactorgui.h"
|
||||
#include "complexfactorgui.h"
|
||||
|
||||
ComplexFactorGUI::ComplexFactorGUI(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::ComplexFactorGUI)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->automatic->setChecked(false);
|
||||
}
|
||||
|
||||
ComplexFactorGUI::~ComplexFactorGUI()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
double ComplexFactorGUI::getModule() const
|
||||
{
|
||||
return ui->module->value() / 100.0;
|
||||
}
|
||||
|
||||
double ComplexFactorGUI::getArgument() const
|
||||
{
|
||||
return ui->arg->value() * 1.0;
|
||||
}
|
||||
|
||||
bool ComplexFactorGUI::getAutomatic() const
|
||||
{
|
||||
return ui->automatic->isChecked();
|
||||
}
|
||||
|
||||
void ComplexFactorGUI::setModule(double value)
|
||||
{
|
||||
ui->module->setValue((int) (value < -1.0 ? -1.0 : value > 1.0 ? 1.0 : value)*100.0f);
|
||||
}
|
||||
|
||||
void ComplexFactorGUI::setArgument(double value)
|
||||
{
|
||||
ui->module->setValue((int) (value < -180.0 ? -180.0 : value > 180.0 ? 180.0 : value));
|
||||
}
|
||||
|
||||
void ComplexFactorGUI::setAutomatic(bool automatic)
|
||||
{
|
||||
ui->automatic->setChecked(automatic);
|
||||
}
|
||||
|
||||
void ComplexFactorGUI::setAutomaticEnable(bool enable)
|
||||
{
|
||||
ui->automatic->setEnabled(enable);
|
||||
}
|
||||
|
||||
void ComplexFactorGUI::setLabel(const QString& text)
|
||||
{
|
||||
ui->label->setText(text);
|
||||
}
|
||||
|
||||
void ComplexFactorGUI::on_automatic_toggled(bool set)
|
||||
{
|
||||
ui->module->setEnabled(!set);
|
||||
ui->arg->setEnabled(!set);
|
||||
emit automaticChanged(set);
|
||||
}
|
||||
|
||||
void ComplexFactorGUI::on_module_valueChanged(int value)
|
||||
{
|
||||
emit moduleChanged(value / 100.0f);
|
||||
}
|
||||
|
||||
void ComplexFactorGUI::on_arg_valueChanged(int value)
|
||||
{
|
||||
emit argumentChanged(value);
|
||||
}
|
65
sdrgui/soapygui/complexfactorgui.h
Normal file
65
sdrgui/soapygui/complexfactorgui.h
Normal file
@ -0,0 +1,65 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This is an interface to an elementary GUI item used to get/set a normalized complex value from the GUI
|
||||
// There is an automatic check to activate/deactivate possible automatic setting
|
||||
// It is intended to be used primarily for DC offset and IQ imbalance corrections
|
||||
|
||||
#ifndef PLUGINS_SAMPLESOURCE_SOAPYSDRINPUT_COMPLEXFACTORGUI_H_
|
||||
#define PLUGINS_SAMPLESOURCE_SOAPYSDRINPUT_COMPLEXFACTORGUI_H_
|
||||
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
|
||||
#include "export.h"
|
||||
|
||||
namespace Ui {
|
||||
class ComplexFactorGUI;
|
||||
}
|
||||
|
||||
class SDRGUI_API ComplexFactorGUI : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ComplexFactorGUI(QWidget *parent = 0);
|
||||
~ComplexFactorGUI();
|
||||
|
||||
double getModule() const;
|
||||
double getArgument() const;
|
||||
bool getAutomatic() const;
|
||||
|
||||
void setModule(double value);
|
||||
void setArgument(double value);
|
||||
void setAutomatic(bool automatic);
|
||||
void setAutomaticEnable(bool enable);
|
||||
|
||||
void setLabel(const QString& text);
|
||||
|
||||
signals:
|
||||
void moduleChanged(double value);
|
||||
void argumentChanged(double value);
|
||||
void automaticChanged(bool value);
|
||||
|
||||
private slots:
|
||||
void on_automatic_toggled(bool set);
|
||||
void on_module_valueChanged(int value);
|
||||
void on_arg_valueChanged(int value);
|
||||
|
||||
private:
|
||||
Ui::ComplexFactorGUI* ui;
|
||||
};
|
||||
|
||||
#endif /* PLUGINS_SAMPLESOURCE_SOAPYSDRINPUT_COMPLEXFACTORGUI_H_ */
|
183
sdrgui/soapygui/complexfactorgui.ui
Normal file
183
sdrgui/soapygui/complexfactorgui.ui
Normal file
@ -0,0 +1,183 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ComplexFactorGUI</class>
|
||||
<widget class="QWidget" name="ComplexFactorGUI">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>307</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>301</width>
|
||||
<height>48</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Label</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="automatic">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Auto</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="moduleLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="moduleLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mod</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="module">
|
||||
<property name="toolTip">
|
||||
<string>Normalized module</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-100</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="moduleText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-1.00</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="argLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="argLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Arg</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="arg">
|
||||
<property name="toolTip">
|
||||
<string>Argument (angle) in degrees</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-180</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>180</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="argText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-180</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in New Issue
Block a user