mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-08-14 23:43:43 -04:00
New Jogdial Controller feature plugin. Implements #1088
This commit is contained in:
@@ -87,6 +87,7 @@ set(sdrbase_SOURCES
|
||||
channel/remotedatareadqueue.cpp
|
||||
|
||||
commands/command.cpp
|
||||
commands/commandkeyreceiver.cpp
|
||||
|
||||
dsp/afsquelch.cpp
|
||||
dsp/agc.cpp
|
||||
@@ -259,6 +260,7 @@ set(sdrbase_HEADERS
|
||||
channel/remotedatablock.h
|
||||
|
||||
commands/command.h
|
||||
commands/commandkeyreceiver.h
|
||||
|
||||
dsp/afsquelch.h
|
||||
dsp/autocorrector.h
|
||||
|
||||
@@ -58,6 +58,7 @@ public:
|
||||
virtual void setName(const QString& name) { m_name = name; }
|
||||
virtual const QString& getName() const { return m_name; }
|
||||
virtual qint64 getCenterFrequency() const = 0; //!< Applies to a default stream
|
||||
virtual void setCenterFrequency(qint64 frequency) = 0;
|
||||
|
||||
virtual QByteArray serialize() const = 0;
|
||||
virtual bool deserialize(const QByteArray& data) = 0;
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// 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 //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// 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 <QEvent>
|
||||
#include <QKeyEvent>
|
||||
|
||||
#include "commandkeyreceiver.h"
|
||||
|
||||
const std::vector<Qt::Key> CommandKeyReceiver::m_composeKeys = {Qt::Key_Shift, Qt::Key_Control, Qt::Key_Meta, Qt::Key_Alt, Qt::Key_AltGr};
|
||||
|
||||
CommandKeyReceiver::CommandKeyReceiver() :
|
||||
m_release(false),
|
||||
m_pass(true)
|
||||
{
|
||||
}
|
||||
|
||||
bool CommandKeyReceiver::eventFilter(QObject* obj, QEvent* event)
|
||||
{
|
||||
if (event->type() == QEvent::KeyPress)
|
||||
{
|
||||
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
|
||||
|
||||
if ((!keyEvent->isAutoRepeat()) && (!isComposeKey(static_cast<Qt::Key>(keyEvent->key()))))
|
||||
{
|
||||
// qDebug("KeyReceiver::eventFilter: KeyPress");
|
||||
Qt::Key key;
|
||||
Qt::KeyboardModifiers keyModifiers;
|
||||
keyEventHandler(keyEvent, key, keyModifiers);
|
||||
emit capturedKey(key, keyModifiers, false);
|
||||
|
||||
if (!m_pass) { // do not pass the event
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_release && (event->type()==QEvent::KeyRelease))
|
||||
{
|
||||
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
|
||||
|
||||
if ((!keyEvent->isAutoRepeat()) && (!isComposeKey(static_cast<Qt::Key>(keyEvent->key()))))
|
||||
{
|
||||
// qDebug("KeyReceiver::eventFilter: KeyRelease");
|
||||
Qt::Key key;
|
||||
Qt::KeyboardModifiers keyModifiers;
|
||||
keyEventHandler(keyEvent, key, keyModifiers);
|
||||
emit capturedKey(key, keyModifiers, true);
|
||||
|
||||
if (!m_pass) { // do not pass the event
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return QObject::eventFilter(obj, event); // pass the event on
|
||||
}
|
||||
|
||||
void CommandKeyReceiver::keyEventHandler(QKeyEvent *e, Qt::Key& key, Qt::KeyboardModifiers& keyModifiers)
|
||||
{
|
||||
key = static_cast<Qt::Key>(e->key());
|
||||
|
||||
if (e->modifiers())
|
||||
{
|
||||
keyModifiers = e->modifiers();
|
||||
}
|
||||
else
|
||||
{
|
||||
keyModifiers = Qt::NoModifier;
|
||||
}
|
||||
}
|
||||
|
||||
bool CommandKeyReceiver::isComposeKey(Qt::Key key)
|
||||
{
|
||||
auto it = std::find(m_composeKeys.begin(), m_composeKeys.end(), key);
|
||||
return it != m_composeKeys.end();
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// 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 //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// 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_COMMANDKEYRECEIVER_H_
|
||||
#define SDRGUI_GUI_COMMANDKEYRECEIVER_H_
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "export.h"
|
||||
|
||||
class QKeyEvent;
|
||||
|
||||
class SDRGUI_API CommandKeyReceiver : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CommandKeyReceiver();
|
||||
|
||||
void setRelease(bool release) { m_release = release; }
|
||||
void setPass(bool pass) { m_pass = pass; }
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject* obj, QEvent* event);
|
||||
|
||||
private:
|
||||
bool m_release; //!< check release events
|
||||
bool m_pass; //!< do not block events just tap them
|
||||
|
||||
void keyEventHandler(QKeyEvent *e, Qt::Key& key, Qt::KeyboardModifiers& keyModifiers);
|
||||
bool isComposeKey(Qt::Key key);
|
||||
|
||||
static const std::vector<Qt::Key> m_composeKeys;
|
||||
|
||||
signals:
|
||||
void capturedKey(Qt::Key key, Qt::KeyboardModifiers keyModifiers, bool release);
|
||||
};
|
||||
|
||||
|
||||
#endif /* SDRGUI_GUI_COMMANDKEYRECEIVER_H_ */
|
||||
@@ -144,6 +144,7 @@ public:
|
||||
|
||||
DSPDeviceSourceEngine *getDeviceSourceEngine() { return m_deviceSourceEngine; }
|
||||
DSPDeviceSinkEngine *getDeviceSinkEngine() { return m_deviceSinkEngine; }
|
||||
DSPDeviceMIMOEngine *getDeviceMIMOEngine() { return m_deviceMIMOEngine; }
|
||||
|
||||
void addSourceBuddy(DeviceAPI* buddy);
|
||||
void addSinkBuddy(DeviceAPI* buddy);
|
||||
|
||||
@@ -5269,6 +5269,9 @@ margin-bottom: 20px;
|
||||
"DemodAnalyzerSettings" : {
|
||||
"$ref" : "#/definitions/DemodAnalyzerSettings"
|
||||
},
|
||||
"JogdialControllerSettings" : {
|
||||
"$ref" : "#/definitions/JogdialControllerSettings"
|
||||
},
|
||||
"GS232ControllerSettings" : {
|
||||
"$ref" : "#/definitions/GS232ControllerSettings"
|
||||
},
|
||||
@@ -6689,6 +6692,33 @@ margin-bottom: 20px;
|
||||
}
|
||||
},
|
||||
"description" : "Interferometer"
|
||||
};
|
||||
defs.JogdialControllerSettings = {
|
||||
"properties" : {
|
||||
"title" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"rgbColor" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"useReverseAPI" : {
|
||||
"type" : "integer",
|
||||
"description" : "Synchronize with reverse API\n * 1 - yes\n * 0 - no\n"
|
||||
},
|
||||
"reverseAPIAddress" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"reverseAPIPort" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"reverseAPIFeatureSetIndex" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"reverseAPIFeatureIndex" : {
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"description" : "JogdialController"
|
||||
};
|
||||
defs.KiwiSDRReport = {
|
||||
"properties" : {
|
||||
@@ -51653,7 +51683,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2021-12-29T17:23:49.058+01:00
|
||||
Generated 2022-01-04T21:15:15.924+01:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -23,6 +23,8 @@ FeatureSettings:
|
||||
$ref: "/doc/swagger/include/APRS.yaml#/APRSSettings"
|
||||
DemodAnalyzerSettings:
|
||||
$ref: "/doc/swagger/include/DemodAnalyzer.yaml#/DemodAnalyzerSettings"
|
||||
JogdialControllerSettings:
|
||||
$ref: "/doc/swagger/include/JogdialController.yaml#/JogdialControllerSettings"
|
||||
GS232ControllerSettings:
|
||||
$ref: "/doc/swagger/include/GS232Controller.yaml#/GS232ControllerSettings"
|
||||
MapSettings:
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
JogdialControllerSettings:
|
||||
description: JogdialController
|
||||
properties:
|
||||
title:
|
||||
type: string
|
||||
rgbColor:
|
||||
type: integer
|
||||
useReverseAPI:
|
||||
type: integer
|
||||
description: >
|
||||
Synchronize with reverse API
|
||||
* 1 - yes
|
||||
* 0 - no
|
||||
reverseAPIAddress:
|
||||
type: string
|
||||
reverseAPIPort:
|
||||
type: integer
|
||||
reverseAPIFeatureSetIndex:
|
||||
type: integer
|
||||
reverseAPIFeatureIndex:
|
||||
type: integer
|
||||
@@ -4795,6 +4795,11 @@ bool WebAPIRequestMapper::getFeatureSettings(
|
||||
featureSettings->setDemodAnalyzerSettings(new SWGSDRangel::SWGDemodAnalyzerSettings());
|
||||
featureSettings->getDemodAnalyzerSettings()->fromJsonObject(settingsJsonObject);
|
||||
}
|
||||
else if (featureSettingsKey == "JogdialControllerSettings")
|
||||
{
|
||||
featureSettings->setJogdialControllerSettings(new SWGSDRangel::SWGJogdialControllerSettings());
|
||||
featureSettings->getJogdialControllerSettings()->fromJsonObject(settingsJsonObject);
|
||||
}
|
||||
else if (featureSettingsKey == "GS232ControllerSettings")
|
||||
{
|
||||
featureSettings->setGs232ControllerSettings(new SWGSDRangel::SWGGS232ControllerSettings());
|
||||
|
||||
@@ -268,6 +268,7 @@ const QMap<QString, QString> WebAPIUtils::m_featureTypeToSettingsKey = {
|
||||
{"AntennaTools", "AntennaToolsSettings"},
|
||||
{"APRS", "APRSSettings"},
|
||||
{"DemodAnalyzer", "DemodAnalyzerSettings"},
|
||||
{"JogdialController", "JogdialControllerSettings"},
|
||||
{"GS232Controller", "GS232ControllerSettings"},
|
||||
{"Map", "MapSettings"},
|
||||
{"PERTester", "PERTesterSettings"},
|
||||
@@ -294,6 +295,7 @@ const QMap<QString, QString> WebAPIUtils::m_featureURIToSettingsKey = {
|
||||
{"sdrangel.feature.antennatools", "AntennaToolsSettings"},
|
||||
{"sdrangel.feature.aprs", "APRSSettings"},
|
||||
{"sdrangel.feature.demodanalyzer", "DemodAnalyzerSettings"},
|
||||
{"sdrangel.feature.jogdialcontroller", "JogdialControllerSettings"},
|
||||
{"sdrangel.feature.gs232controller", "GS232ControllerSettings"},
|
||||
{"sdrangel.feature.map", "MapSettings"},
|
||||
{"sdrangel.feature.pertester", "PERTesterSettings"},
|
||||
|
||||
Reference in New Issue
Block a user