mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
New button type for transverter frequency translation toggle. Added to RTLSDR GUI
This commit is contained in:
parent
7c7b24de0d
commit
d1b4e24804
@ -264,6 +264,8 @@ set(sdrbase_SOURCES
|
||||
sdrbase/gui/samplingdevicecontrol.cpp
|
||||
sdrbase/gui/scale.cpp
|
||||
sdrbase/gui/scaleengine.cpp
|
||||
sdrbase/gui/transverterbutton.cpp
|
||||
sdrbase/gui/transverterdialog.cpp
|
||||
sdrbase/gui/valuedial.cpp
|
||||
sdrbase/gui/valuedialz.cpp
|
||||
|
||||
@ -386,6 +388,8 @@ set(sdrbase_HEADERS
|
||||
sdrbase/gui/samplingdevicecontrol.h
|
||||
sdrbase/gui/scale.h
|
||||
sdrbase/gui/scaleengine.h
|
||||
sdrbase/gui/transverterbutton.h
|
||||
sdrbase/gui/transverterdialog.h
|
||||
sdrbase/gui/valuedial.h
|
||||
sdrbase/gui/valuedialz.h
|
||||
|
||||
@ -439,6 +443,7 @@ set(sdrbase_FORMS
|
||||
sdrbase/gui/audiodialog.ui
|
||||
sdrbase/gui/samplingdevicecontrol.ui
|
||||
sdrbase/gui/myposdialog.ui
|
||||
sdrbase/gui/transverterdialog.ui
|
||||
)
|
||||
|
||||
set(sdrbase_RESOURCES
|
||||
|
@ -298,6 +298,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<widget class="TransverterButton" name="toolButton">
|
||||
<property name="toolTip">
|
||||
<string>Transverter frequency translation toggle</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>X</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@ -581,6 +591,11 @@
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/buttonswitch.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>TransverterButton</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/transverterbutton.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../../sdrbase/resources/res.qrc"/>
|
||||
|
43
sdrbase/gui/transverterbutton.cpp
Normal file
43
sdrbase/gui/transverterbutton.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2017 F4EXB //
|
||||
// written by Edouard Griffiths //
|
||||
// //
|
||||
// OpenGL interface modernization. //
|
||||
// See: http://doc.qt.io/qt-5/qopenglshaderprogram.html //
|
||||
// //
|
||||
// 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 "transverterdialog.h"
|
||||
#include "transverterbutton.h"
|
||||
|
||||
TransverterButton::TransverterButton(QWidget* parent) :
|
||||
ButtonSwitch(parent),
|
||||
m_deltaFrequency(0)
|
||||
{
|
||||
connect(this, SIGNAL(toggled(bool)), this, SLOT(onToggled(bool)));
|
||||
}
|
||||
|
||||
void TransverterButton::onToggled(bool checked)
|
||||
{
|
||||
if (checked) {
|
||||
TransverterDialog transverterDialog(&m_deltaFrequency, this);
|
||||
transverterDialog.exec();
|
||||
setToolTip(tr("Transverter frequency translation toggle. Delta frequency %1 kHz").arg(m_deltaFrequency));
|
||||
}
|
||||
}
|
||||
|
||||
void TransverterButton::doToggle(bool checked)
|
||||
{
|
||||
onToggled(checked);
|
||||
}
|
43
sdrbase/gui/transverterbutton.h
Normal file
43
sdrbase/gui/transverterbutton.h
Normal file
@ -0,0 +1,43 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2017 F4EXB //
|
||||
// written by Edouard Griffiths //
|
||||
// //
|
||||
// OpenGL interface modernization. //
|
||||
// See: http://doc.qt.io/qt-5/qopenglshaderprogram.html //
|
||||
// //
|
||||
// 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/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SDRBASE_GUI_TRANSVERTERBUTTON_H_
|
||||
#define SDRBASE_GUI_TRANSVERTERBUTTON_H_
|
||||
|
||||
#include "buttonswitch.h"
|
||||
|
||||
class TransverterButton : public ButtonSwitch {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TransverterButton(QWidget* parent = 0);
|
||||
void doToggle(bool checked);
|
||||
qint64 getDeltaFrequency() const { return m_deltaFrequency; }
|
||||
void setDeltaFrequency(qint64 deltaFrequency) { m_deltaFrequency = deltaFrequency; }
|
||||
|
||||
private slots:
|
||||
void onToggled(bool checked);
|
||||
|
||||
private:
|
||||
qint64 m_deltaFrequency;
|
||||
};
|
||||
|
||||
|
||||
#endif /* SDRBASE_GUI_TRANSVERTERBUTTON_H_ */
|
47
sdrbase/gui/transverterdialog.cpp
Normal file
47
sdrbase/gui/transverterdialog.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2017 F4EXB //
|
||||
// written by Edouard Griffiths //
|
||||
// //
|
||||
// OpenGL interface modernization. //
|
||||
// See: http://doc.qt.io/qt-5/qopenglshaderprogram.html //
|
||||
// //
|
||||
// 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 "transverterdialog.h"
|
||||
|
||||
#include "ui_transverterdialog.h"
|
||||
|
||||
|
||||
TransverterDialog::TransverterDialog(qint64 *deltaFrequency, QWidget* parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::TransverterDialog),
|
||||
m_deltaFrequency(deltaFrequency)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
|
||||
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
||||
ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999);
|
||||
ui->deltaFrequency->setValue(*m_deltaFrequency);
|
||||
}
|
||||
|
||||
TransverterDialog::~TransverterDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void TransverterDialog::accept()
|
||||
{
|
||||
*m_deltaFrequency = ui->deltaFrequency->getValueNew();
|
||||
QDialog::accept();
|
||||
}
|
47
sdrbase/gui/transverterdialog.h
Normal file
47
sdrbase/gui/transverterdialog.h
Normal file
@ -0,0 +1,47 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2017 F4EXB //
|
||||
// written by Edouard Griffiths //
|
||||
// //
|
||||
// OpenGL interface modernization. //
|
||||
// See: http://doc.qt.io/qt-5/qopenglshaderprogram.html //
|
||||
// //
|
||||
// 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/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SDRBASE_GUI_TRANSVERTERDIALOG_H_
|
||||
#define SDRBASE_GUI_TRANSVERTERDIALOG_H_
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class TransverterDialog;
|
||||
}
|
||||
|
||||
class TransverterDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TransverterDialog(qint64 *deltaFrequency, QWidget* parent = 0);
|
||||
~TransverterDialog();
|
||||
|
||||
private:
|
||||
Ui::TransverterDialog* ui;
|
||||
qint64 *m_deltaFrequency;
|
||||
|
||||
private slots:
|
||||
void accept();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* SDRBASE_GUI_TRANSVERTERDIALOG_H_ */
|
148
sdrbase/gui/transverterdialog.ui
Normal file
148
sdrbase/gui/transverterdialog.ui
Normal file
@ -0,0 +1,148 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TransverterDialog</class>
|
||||
<widget class="QDialog" name="TransverterDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>324</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Sans Serif</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Delta Frequency</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="TransverterLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="DeltaFrequencyLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="deltaFrequencyLabel">
|
||||
<property name="text">
|
||||
<string>Df</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ValueDialZ" name="deltaFrequency" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>DejaVu Sans Mono</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Transverter delta frequency (kHz)</string>
|
||||
</property>
|
||||
<zorder>deltaFrequencyUnits</zorder>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="deltaFrequencyUnits">
|
||||
<property name="text">
|
||||
<string>kHz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<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>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ValueDialZ</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/valuedialz.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>TransverterDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>257</x>
|
||||
<y>194</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>203</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>TransverterDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>314</x>
|
||||
<y>194</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>203</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
Loading…
Reference in New Issue
Block a user