diff --git a/CMakeLists.txt b/CMakeLists.txt index e5675f6e1..f5cc99f2d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/plugins/samplesource/rtlsdr/rtlsdrgui.ui b/plugins/samplesource/rtlsdr/rtlsdrgui.ui index d56fa26f4..e6e5e23dc 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrgui.ui +++ b/plugins/samplesource/rtlsdr/rtlsdrgui.ui @@ -298,6 +298,16 @@ + + + + Transverter frequency translation toggle + + + X + + + @@ -581,6 +591,11 @@ QToolButton
gui/buttonswitch.h
+ + TransverterButton + QToolButton +
gui/transverterbutton.h
+
diff --git a/sdrbase/gui/transverterbutton.cpp b/sdrbase/gui/transverterbutton.cpp new file mode 100644 index 000000000..33b2eb9d4 --- /dev/null +++ b/sdrbase/gui/transverterbutton.cpp @@ -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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#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); +} diff --git a/sdrbase/gui/transverterbutton.h b/sdrbase/gui/transverterbutton.h new file mode 100644 index 000000000..d6a490064 --- /dev/null +++ b/sdrbase/gui/transverterbutton.h @@ -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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#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_ */ diff --git a/sdrbase/gui/transverterdialog.cpp b/sdrbase/gui/transverterdialog.cpp new file mode 100644 index 000000000..c6e3e557e --- /dev/null +++ b/sdrbase/gui/transverterdialog.cpp @@ -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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#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(); +} diff --git a/sdrbase/gui/transverterdialog.h b/sdrbase/gui/transverterdialog.h new file mode 100644 index 000000000..58edcc063 --- /dev/null +++ b/sdrbase/gui/transverterdialog.h @@ -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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#ifndef SDRBASE_GUI_TRANSVERTERDIALOG_H_ +#define SDRBASE_GUI_TRANSVERTERDIALOG_H_ + +#include + +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_ */ diff --git a/sdrbase/gui/transverterdialog.ui b/sdrbase/gui/transverterdialog.ui new file mode 100644 index 000000000..775311359 --- /dev/null +++ b/sdrbase/gui/transverterdialog.ui @@ -0,0 +1,148 @@ + + + TransverterDialog + + + + 0 + 0 + 324 + 81 + + + + + Sans Serif + 9 + + + + Delta Frequency + + + + + + + + + + Df + + + + + + + + 0 + 0 + + + + + 32 + 16 + + + + + DejaVu Sans Mono + 12 + + + + PointingHandCursor + + + Qt::StrongFocus + + + Transverter delta frequency (kHz) + + deltaFrequencyUnits + + + + + + kHz + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + ValueDialZ + QWidget +
gui/valuedialz.h
+ 1 +
+
+ + buttonBox + + + + + buttonBox + accepted() + TransverterDialog + accept() + + + 257 + 194 + + + 157 + 203 + + + + + buttonBox + rejected() + TransverterDialog + reject() + + + 314 + 194 + + + 286 + 203 + + + + +