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

IQ swap: implementation in transverter dialog

This commit is contained in:
f4exb 2020-06-23 05:02:50 +02:00
parent 77c583385a
commit 4b388f02c3
5 changed files with 76 additions and 6 deletions

View File

@ -25,7 +25,8 @@
TransverterButton::TransverterButton(QWidget* parent) :
QPushButton(parent),
m_deltaFrequency(0),
m_deltaFrequencyActive(false)
m_deltaFrequencyActive(false),
m_iqOrder(true)
{
setObjectName("TransverterButton");
connect(this, SIGNAL(clicked()), this, SLOT(onClicked()));
@ -33,7 +34,8 @@ TransverterButton::TransverterButton(QWidget* parent) :
void TransverterButton::onClicked()
{
TransverterDialog transverterDialog(m_deltaFrequency, m_deltaFrequencyActive, this);
TransverterDialog transverterDialog(m_deltaFrequency, m_deltaFrequencyActive, m_iqOrder, this);
transverterDialog.setIQSwapEnabled(m_iqOrderEnabled);
transverterDialog.exec();
updateState();
}

View File

@ -33,6 +33,7 @@ public:
TransverterButton(QWidget* parent = 0);
qint64 getDeltaFrequency() const { return m_deltaFrequency; }
bool getDeltaFrequencyAcive() const { return m_deltaFrequencyActive; }
bool getIQOrder() const { return m_iqOrder; }
void setDeltaFrequency(qint64 deltaFrequency)
{
@ -46,12 +47,26 @@ public:
updateState();
}
void setIQOrder(bool iqOrder)
{
m_iqOrder = iqOrder;
updateState();
}
void setIQOrderEnabled(bool enabled)
{
m_iqOrderEnabled = enabled;
updateState();
}
private slots:
void onClicked();
private:
qint64 m_deltaFrequency;
bool m_deltaFrequencyActive;
bool m_iqOrder;
bool m_iqOrderEnabled;
void updateState();
};

View File

@ -19,23 +19,29 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include <QDebug>
#include "transverterdialog.h"
#include "ui_transverterdialog.h"
TransverterDialog::TransverterDialog(qint64& deltaFrequency, bool& deltaFrequencyActive, QWidget* parent) :
TransverterDialog::TransverterDialog(qint64& deltaFrequency, bool& deltaFrequencyActive, bool& iqOrder, QWidget* parent) :
QDialog(parent),
ui(new Ui::TransverterDialog),
m_deltaFrequency(deltaFrequency),
m_deltaFrequencyActive(deltaFrequencyActive)
m_deltaFrequencyActive(deltaFrequencyActive),
m_iqOrder(iqOrder)
{
qDebug() << "TransverterDialog::TransverterDialog: " << m_iqOrder;
ui->setupUi(this);
ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
ui->deltaFrequency->setValueRange(false, 10, -9999999999L, 9999999999L);
ui->deltaFrequency->setValue(m_deltaFrequency);
ui->deltaFrequencyActive->setChecked(m_deltaFrequencyActive);
ui->iqOrder->setEnabled(true);
ui->iqOrder->setChecked(m_iqOrder);
}
TransverterDialog::~TransverterDialog()
@ -43,9 +49,26 @@ TransverterDialog::~TransverterDialog()
delete ui;
}
void TransverterDialog::setIQSwapEnabled(bool enabled)
{
ui->iqOrder->setEnabled(enabled);
if (enabled) {
ui->iqOrder->setChecked(m_iqOrder);
} else {
ui->iqOrder->setChecked(true);
}
}
void TransverterDialog::accept()
{
m_deltaFrequency = ui->deltaFrequency->getValueNew();
m_deltaFrequencyActive = ui->deltaFrequencyActive->isChecked();
m_iqOrder = ui->iqOrder->isChecked();
QDialog::accept();
}
void TransverterDialog::on_iqOrder_toggled(bool checked)
{
ui->iqOrder->setText(checked ? "IQ" : "QI");
}

View File

@ -34,16 +34,19 @@ class SDRGUI_API TransverterDialog : public QDialog {
Q_OBJECT
public:
explicit TransverterDialog(qint64& deltaFrequency, bool& deltaFrequencyActive, QWidget* parent = 0);
explicit TransverterDialog(qint64& deltaFrequency, bool& deltaFrequencyActive, bool& iqOrder, QWidget* parent = 0);
~TransverterDialog();
void setIQSwapEnabled(bool enabled);
private:
Ui::TransverterDialog* ui;
qint64& m_deltaFrequency;
bool& m_deltaFrequencyActive;
bool& m_iqOrder;
private slots:
void accept();
void on_iqOrder_toggled(bool checked);
};

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>324</width>
<height>81</height>
<height>114</height>
</rect>
</property>
<property name="font">
@ -100,6 +100,33 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="OptionsLayout">
<item>
<widget class="ButtonSwitch" name="iqOrder">
<property name="toolTip">
<string>IQ order: IQ: straight QI: swapped</string>
</property>
<property name="text">
<string>IQ</string>
</property>
</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>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">