SSB mod/demod: improve LSB/USB experience: DSB/SSB icon shows right sideband. Filter limit sliders with ticks. Button to flip sidebands

pull/127/head
f4exb 2017-11-21 01:09:47 +01:00
rodzic 5e13c16cb6
commit 9455a4c5f6
13 zmienionych plików z 258 dodań i 12 usunięć

Wyświetl plik

@ -1,10 +1,10 @@
#include <QPixmap>
#include "ssbdemodgui.h"
#include "ssbdemodgui.h"
#include <device/devicesourceapi.h>
#include "device/deviceuiset.h"
#include <QDockWidget>
#include <QMainWindow>
#include "ui_ssbdemodgui.h"
#include "dsp/spectrumvis.h"
@ -107,8 +107,9 @@ void SSBDemodGUI::on_audioFlipChannels_toggled(bool flip)
applySettings();
}
void SSBDemodGUI::on_dsb_toggled(bool dsb __attribute__((unused)))
void SSBDemodGUI::on_dsb_toggled(bool dsb)
{
ui->flipSidebands->setEnabled(!dsb);
applyBandwidths();
}
@ -187,6 +188,14 @@ void SSBDemodGUI::on_spanLog2_valueChanged(int value)
applyBandwidths();
}
void SSBDemodGUI::on_flipSidebands_clicked(bool checked __attribute__((unused)))
{
int bwValue = ui->BW->value();
int lcValue = ui->lowCut->value();
ui->BW->setValue(-bwValue);
ui->lowCut->setValue(-lcValue);
}
void SSBDemodGUI::onWidgetRolled(QWidget* widget __attribute__((unused)), bool rollDown __attribute__((unused)))
{
}
@ -251,6 +260,11 @@ SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
ui->spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, ui->glSpectrum);
m_iconDSBUSB.addPixmap(QPixmap("://dsb.png"), QIcon::Normal, QIcon::On);
m_iconDSBUSB.addPixmap(QPixmap("://usb.png"), QIcon::Normal, QIcon::Off);
m_iconDSBLSB.addPixmap(QPixmap("://dsb.png"), QIcon::Normal, QIcon::On);
m_iconDSBLSB.addPixmap(QPixmap("://lsb.png"), QIcon::Normal, QIcon::Off);
displaySettings();
applyBandwidths(true); // does applySettings(true)
}
@ -373,6 +387,7 @@ void SSBDemodGUI::applyBandwidths(bool force)
bool wasBlocked = blockApplySettings(true);
m_channelMarker.setBandwidth(bw * 200);
m_channelMarker.setSidebands(dsb ? ChannelMarker::dsb : bw < 0 ? ChannelMarker::lsb : ChannelMarker::usb);
ui->dsb->setIcon(bw < 0 ? m_iconDSBLSB: m_iconDSBUSB);
if (!dsb) { m_channelMarker.setLowCutoff(lw * 100); }
blockApplySettings(wasBlocked);
}
@ -385,13 +400,17 @@ void SSBDemodGUI::displaySettings()
m_channelMarker.setBandwidth(m_settings.m_rfBandwidth * 2);
m_channelMarker.setLowCutoff(m_settings.m_lowCutoff);
ui->flipSidebands->setEnabled(!m_settings.m_dsb);
if (m_settings.m_dsb) {
m_channelMarker.setSidebands(ChannelMarker::dsb);
} else {
if (m_settings.m_rfBandwidth < 0) {
m_channelMarker.setSidebands(ChannelMarker::lsb);
ui->dsb->setIcon(m_iconDSBLSB);
} else {
m_channelMarker.setSidebands(ChannelMarker::usb);
ui->dsb->setIcon(m_iconDSBUSB);
}
}

Wyświetl plik

@ -1,7 +1,9 @@
#ifndef INCLUDE_SSBDEMODGUI_H
#define INCLUDE_SSBDEMODGUI_H
#include <plugin/plugininstancegui.h>
#include <QIcon>
#include "plugin/plugininstancegui.h"
#include "gui/rollupwidget.h"
#include "dsp/channelmarker.h"
#include "dsp/movingaverage.h"
@ -60,6 +62,9 @@ private:
SpectrumVis* m_spectrumVis;
MessageQueue m_inputMessageQueue;
QIcon m_iconDSBUSB;
QIcon m_iconDSBLSB;
explicit SSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet* deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent = 0);
virtual ~SSBDemodGUI();
@ -89,6 +94,7 @@ private slots:
void on_agcThresholdGate_valueChanged(int value);
void on_audioMute_toggled(bool checked);
void on_spanLog2_valueChanged(int value);
void on_flipSidebands_clicked(bool checked);
void onWidgetRolled(QWidget* widget, bool rollDown);
void tick();
};

Wyświetl plik

@ -205,6 +205,27 @@
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="flipSidebands">
<property name="toolTip">
<string>Flip sidebands in SSB mode (LSB-&gt;USB or USB-&gt;LSB)</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/flip_sidebands.png</normaloff>:/flip_sidebands.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="dsb">
<property name="toolTip">
@ -337,7 +358,7 @@
</widget>
</item>
<item>
<widget class="QSlider" name="BW">
<widget class="TickedSlider" name="BW">
<property name="toolTip">
<string>Lowpass filter cutoff frequency</string>
</property>
@ -356,6 +377,12 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>5</number>
</property>
</widget>
</item>
<item>
@ -404,7 +431,7 @@
</font>
</property>
<property name="text">
<string>f </string>
<string>f: </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -514,7 +541,7 @@
</widget>
</item>
<item>
<widget class="QSlider" name="lowCut">
<widget class="TickedSlider" name="lowCut">
<property name="toolTip">
<string>Highpass filter cutoff frequency (SSB)</string>
</property>
@ -533,6 +560,12 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksAbove</enum>
</property>
<property name="tickInterval">
<number>5</number>
</property>
</widget>
</item>
<item>
@ -893,6 +926,11 @@
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>TickedSlider</class>
<extends>QSlider</extends>
<header>gui/tickedslider.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../../../sdrgui/resources/res.qrc"/>

Wyświetl plik

@ -8,7 +8,7 @@
const PluginDescriptor SSBPlugin::m_pluginDescriptor = {
QString("SSB Demodulator"),
QString("3.8.4"),
QString("3.8.5"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

Wyświetl plik

@ -150,8 +150,17 @@ void SSBModGUI::on_deltaFrequency_changed(qint64 value)
applySettings();
}
void SSBModGUI::on_dsb_toggled(bool checked __attribute__((unused)))
void SSBModGUI::on_flipSidebands_clicked(bool checked __attribute__((unused)))
{
int bwValue = ui->BW->value();
int lcValue = ui->lowCut->value();
ui->BW->setValue(-bwValue);
ui->lowCut->setValue(-lcValue);
}
void SSBModGUI::on_dsb_toggled(bool dsb)
{
ui->flipSidebands->setEnabled(!dsb);
applyBandwidths();
}
@ -404,6 +413,11 @@ SSBModGUI::SSBModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
connect(m_ssbMod, SIGNAL(levelChanged(qreal, qreal, int)), ui->volumeMeter, SLOT(levelChanged(qreal, qreal, int)));
m_iconDSBUSB.addPixmap(QPixmap("://dsb.png"), QIcon::Normal, QIcon::On);
m_iconDSBUSB.addPixmap(QPixmap("://usb.png"), QIcon::Normal, QIcon::Off);
m_iconDSBLSB.addPixmap(QPixmap("://dsb.png"), QIcon::Normal, QIcon::On);
m_iconDSBLSB.addPixmap(QPixmap("://lsb.png"), QIcon::Normal, QIcon::Off);
displaySettings();
applyBandwidths(true); // does applySettings(true)
}
@ -526,6 +540,7 @@ void SSBModGUI::applyBandwidths(bool force)
bool applySettingsWereBlocked = blockApplySettings(true);
m_channelMarker.setBandwidth(bw * 200);
m_channelMarker.setSidebands(dsb ? ChannelMarker::dsb : bw < 0 ? ChannelMarker::lsb : ChannelMarker::usb);
ui->dsb->setIcon(bw < 0 ? m_iconDSBLSB : m_iconDSBUSB);
if (!dsb) { m_channelMarker.setLowCutoff(lw * 100); }
blockApplySettings(applySettingsWereBlocked);
}
@ -537,13 +552,17 @@ void SSBModGUI::displaySettings()
m_channelMarker.setBandwidth(m_settings.m_bandwidth * 2);
m_channelMarker.setLowCutoff(m_settings.m_lowCutoff);
ui->flipSidebands->setEnabled(!m_settings.m_dsb);
if (m_settings.m_dsb) {
m_channelMarker.setSidebands(ChannelMarker::dsb);
} else {
if (m_settings.m_bandwidth < 0) {
m_channelMarker.setSidebands(ChannelMarker::lsb);
ui->dsb->setIcon(m_iconDSBLSB);
} else {
m_channelMarker.setSidebands(ChannelMarker::usb);
ui->dsb->setIcon(m_iconDSBUSB);
}
}

Wyświetl plik

@ -17,6 +17,8 @@
#ifndef PLUGINS_CHANNELTX_MODSSB_SSBMODGUI_H_
#define PLUGINS_CHANNELTX_MODSSB_SSBMODGUI_H_
#include <QIcon>
#include <plugin/plugininstancegui.h>
#include "gui/rollupwidget.h"
#include "dsp/channelmarker.h"
@ -78,6 +80,9 @@ private:
SSBMod::SSBModInputAF m_modAFInput;
MessageQueue m_inputMessageQueue;
QIcon m_iconDSBUSB;
QIcon m_iconDSBLSB;
explicit SSBModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent = 0);
virtual ~SSBModGUI();
@ -96,6 +101,7 @@ private:
private slots:
void handleSourceMessages();
void on_deltaFrequency_changed(qint64 value);
void on_flipSidebands_clicked(bool checked);
void on_dsb_toggled(bool checked);
void on_audioBinaural_toggled(bool checked);
void on_audioFlipChannels_toggled(bool checked);

Wyświetl plik

@ -205,6 +205,27 @@
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="flipSidebands">
<property name="toolTip">
<string>Flip sidebands in SSB mode (LSB-&gt;USB or USB-&gt;LSB)</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/flip_sidebands.png</normaloff>:/flip_sidebands.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="dsb">
<property name="toolTip">
@ -301,7 +322,7 @@
</widget>
</item>
<item>
<widget class="QSlider" name="BW">
<widget class="TickedSlider" name="BW">
<property name="toolTip">
<string>Lowpass filter cutoff frequency</string>
</property>
@ -320,6 +341,12 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>5</number>
</property>
</widget>
</item>
<item>
@ -481,7 +508,7 @@
</widget>
</item>
<item>
<widget class="QSlider" name="lowCut">
<widget class="TickedSlider" name="lowCut">
<property name="toolTip">
<string>Highpass filter cutoff frequency (SSB)</string>
</property>
@ -500,6 +527,12 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksAbove</enum>
</property>
<property name="tickInterval">
<number>5</number>
</property>
</widget>
</item>
<item>
@ -1225,6 +1258,11 @@
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>TickedSlider</class>
<extends>QSlider</extends>
<header>gui/tickedslider.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../../../sdrgui/resources/res.qrc"/>

Wyświetl plik

@ -24,7 +24,7 @@
const PluginDescriptor SSBModPlugin::m_pluginDescriptor = {
QString("SSB Modulator"),
QString("3.8.4"),
QString("3.8.5"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

Wyświetl plik

@ -34,6 +34,7 @@ set(sdrgui_SOURCES
gui/samplingdevicedialog.cpp
gui/scale.cpp
gui/scaleengine.cpp
gui/tickedslider.cpp
gui/transverterbutton.cpp
gui/transverterdialog.cpp
gui/valuedial.cpp
@ -85,6 +86,7 @@ set(sdrgui_HEADERS
gui/samplingdevicedialog.h
gui/scale.h
gui/scaleengine.h
gui/tickedslider.h
gui/transverterbutton.h
gui/transverterdialog.h
gui/valuedial.h

Wyświetl plik

@ -0,0 +1,78 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2017 Edouard Griffiths, F4EXB. //
// //
// Swagger server adapter interface //
// //
// 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 <QStylePainter>
#include <QStyleOptionSlider>
#include "tickedslider.h"
TickedSlider::TickedSlider(QWidget* parent) :
QSlider(parent),
m_tickColor(Qt::white)
{ }
void TickedSlider::paintEvent(QPaintEvent *ev __attribute__((unused)))
{
QStylePainter p(this);
QStyleOptionSlider opt;
initStyleOption(&opt);
QRect handle = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this);
// draw tick marks
// do this manually because they are very badly behaved with style sheets
int interval = tickInterval();
if (interval == 0)
{
interval = pageStep();
}
if (tickPosition() != NoTicks)
{
for (int i = minimum(); i <= maximum(); i += interval)
{
int x = round((double)((double)((double)(i - this->minimum()) / (double)(this->maximum() - this->minimum())) * (double)(this->width() - handle.width()) + (double)(handle.width() / 2.0))) - 1;
int h = 4;
p.setPen(m_tickColor);
if (tickPosition() == TicksBothSides || tickPosition() == TicksAbove)
{
int y = this->rect().top();
p.drawLine(x, y, x, y + h);
}
if (tickPosition() == TicksBothSides || tickPosition() == TicksBelow)
{
int y = this->rect().bottom();
p.drawLine(x, y, x, y - h);
}
}
}
// draw the slider (this is basically copy/pasted from QSlider::paintEvent)
opt.subControls = QStyle::SC_SliderGroove;
p.drawComplexControl(QStyle::CC_Slider, opt);
// draw the slider handle
opt.subControls = QStyle::SC_SliderHandle;
p.drawComplexControl(QStyle::CC_Slider, opt);
}

Wyświetl plik

@ -0,0 +1,39 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2017 Edouard Griffiths, F4EXB. //
// //
// Swagger server adapter interface //
// //
// 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 SDRGUI_GUI_TICKEDSLIDER_H_
#define SDRGUI_GUI_TICKEDSLIDER_H_
#include <QSlider>
#include <QColor>
class TickedSlider : public QSlider
{
public:
TickedSlider(QWidget* parent = 0);
void setTickColor(const QColor& color) { m_tickColor = color; }
protected:
virtual void paintEvent(QPaintEvent *ev);
private:
QColor m_tickColor;
};
#endif /* SDRGUI_GUI_TICKEDSLIDER_H_ */

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 735 B

Wyświetl plik

@ -81,5 +81,6 @@
<file>link.png</file>
<file>choose.png</file>
<file>clocksource.png</file>
<file>flip_sidebands.png</file>
</qresource>
</RCC>