You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
567 lines
21 KiB
567 lines
21 KiB
/////////////////////////////////////////////////////////////////////////////////// |
|
// Copyright (C) 2026 Dan Chokola, KD2HSG // |
|
// Based on the packet modulator plugin: // |
|
// Copyright (C) 2020-2023 Jon Beniston, M7RCE <jon@beniston.com> // |
|
// Copyright (C) 2020-2022 Edouard Griffiths, F4EXB <f4exb06@gmail.com> // |
|
// // |
|
// 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 <QDateTime> |
|
#include <QSignalBlocker> |
|
|
|
#include <cmath> |
|
|
|
#include "device/deviceuiset.h" |
|
#include "dsp/dspcommands.h" |
|
#include "dsp/spectrumvis.h" |
|
#include "gui/basicchannelsettingsdialog.h" |
|
#include "gui/dialogpositioner.h" |
|
#include "gui/glspectrum.h" |
|
#include "maincore.h" |
|
#include "util/db.h" |
|
|
|
#include "chirpmodemmod.h" |
|
#include "chirpmodemmodgui.h" |
|
#include "ui_chirpmodemmodgui.h" |
|
|
|
// Bandwidths offered in the combo box. Other values (from the web API) are |
|
// added to it when displayed. |
|
static const int bandwidths[] = {15625, 31250, 62500, 125000, 250000, 500000}; |
|
|
|
static QString bandwidthText(int bandwidth) |
|
{ |
|
return QString("%1 kHz").arg(bandwidth / 1000.0, 0, 'g', 6); |
|
} |
|
|
|
ChirpModemModGUI *ChirpModemModGUI::create(PluginAPI *pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel) |
|
{ |
|
return new ChirpModemModGUI(pluginAPI, deviceUISet, txChannel); |
|
} |
|
|
|
void ChirpModemModGUI::destroy() |
|
{ |
|
delete this; |
|
} |
|
|
|
ChirpModemModGUI::ChirpModemModGUI(PluginAPI *, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel, QWidget *parent) : |
|
ChannelGUI(parent), |
|
ui(new Ui::ChirpModemModGUI), |
|
m_deviceUISet(deviceUISet), |
|
m_channelMarker(this), |
|
m_chirpModemMod(static_cast<ChirpModemMod *>(txChannel)) |
|
{ |
|
setAttribute(Qt::WA_DeleteOnClose, true); |
|
m_helpURL = "plugins/channeltx/modchirpmodem/readme.md"; |
|
ui->setupUi(getRollupContents()); |
|
setSizePolicy(getRollupContents()->sizePolicy()); |
|
m_chirpModemMod->setMessageQueueToGUI(getInputMessageQueue()); |
|
|
|
// Spectrum of the channel being sent |
|
m_spectrumVis = m_chirpModemMod->getSpectrumVis(); |
|
m_spectrumVis->setGLSpectrum(ui->glSpectrum); |
|
ui->spectrumGUI->setBuddies(m_spectrumVis, ui->glSpectrum); |
|
ui->glSpectrum->setCenterFrequency(0); |
|
ui->glSpectrum->setSampleRate(m_settings.requestedChannelSampleRate()); |
|
SpectrumSettings spectrumSettings = m_spectrumVis->getSettings(); |
|
spectrumSettings.m_ssb = false; |
|
spectrumSettings.m_fftSize = 512; |
|
spectrumSettings.m_displayWaterfall = true; |
|
spectrumSettings.m_displayCurrent = true; |
|
m_spectrumVis->getInputMessageQueue()->push(SpectrumVis::MsgConfigureSpectrumVis::create(spectrumSettings, false)); |
|
|
|
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold)); |
|
ui->deltaFrequency->setValueRange(false, 8, -99999999, 99999999); |
|
|
|
for (int sf = 7; sf <= 12; sf++) { |
|
ui->spreadFactor->addItem(QString::number(sf), sf); |
|
} |
|
|
|
for (int bandwidth : bandwidths) { |
|
ui->bandwidth->addItem(bandwidthText(bandwidth), bandwidth); |
|
} |
|
|
|
ui->cwWpm->setMaximum(ChirpModemModSettings::m_maxWpm); |
|
m_chirpModemMod->setLevelMeter(ui->volumeMeter); |
|
|
|
m_settings.setChannelMarker(&m_channelMarker); |
|
m_settings.setRollupState(&m_rollupState); |
|
m_settings.setSpectrumGUI(ui->spectrumGUI); |
|
m_channelMarker.setSourceOrSinkStream(false); |
|
m_channelMarker.setVisible(true); |
|
m_deviceUISet->addChannelMarker(&m_channelMarker); |
|
connect(&m_channelMarker, &ChannelMarker::changedByCursor, this, &ChirpModemModGUI::channelMarkerChangedByCursor); |
|
connect(&m_channelMarker, &ChannelMarker::highlightedByCursor, this, &ChirpModemModGUI::channelMarkerHighlightedByCursor); |
|
connect(getInputMessageQueue(), &MessageQueue::messageEnqueued, this, &ChirpModemModGUI::handleInputMessages); |
|
connect(&MainCore::instance()->getMasterTimer(), &QTimer::timeout, this, &ChirpModemModGUI::tick); |
|
connect(this, &ChirpModemModGUI::customContextMenuRequested, this, &ChirpModemModGUI::onMenuDialogCalled); |
|
connect(getRollupContents(), &RollupContents::widgetRolled, this, &ChirpModemModGUI::onWidgetRolled); |
|
|
|
displaySettings(); |
|
makeUIConnections(); |
|
applySettings({}, true); |
|
getRollupContents()->arrangeRollups(); |
|
m_resizer.enableChildMouseTracking(); |
|
} |
|
|
|
ChirpModemModGUI::~ChirpModemModGUI() |
|
{ |
|
delete ui; |
|
} |
|
|
|
void ChirpModemModGUI::resetToDefaults() |
|
{ |
|
m_settings.resetToDefaults(); |
|
displaySettings(); |
|
applySettings({}, true); |
|
} |
|
|
|
QByteArray ChirpModemModGUI::serialize() const |
|
{ |
|
return m_settings.serialize(); |
|
} |
|
|
|
bool ChirpModemModGUI::deserialize(const QByteArray& data) |
|
{ |
|
bool valid = m_settings.deserialize(data); |
|
displaySettings(); |
|
applySettings({}, true); |
|
return valid; |
|
} |
|
|
|
void ChirpModemModGUI::applySettings(const QStringList& keys, bool force) |
|
{ |
|
if (!m_doApplySettings) { |
|
return; |
|
} |
|
|
|
m_settings.normalize(); |
|
updateChannelMarker(); |
|
m_chirpModemMod->getInputMessageQueue()->push(ChirpModemMod::MsgConfigureChirpModemMod::create(keys, m_settings, force)); |
|
updateAbsoluteCenterFrequency(); |
|
displayFrameInfo(); |
|
} |
|
|
|
void ChirpModemModGUI::updateChannelMarker() |
|
{ |
|
QSignalBlocker blocker(&m_channelMarker); |
|
m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset); |
|
m_channelMarker.setBandwidth(m_settings.m_bandwidth); |
|
m_channelMarker.setSidebands(ChannelMarker::dsb); |
|
} |
|
|
|
void ChirpModemModGUI::displayBandwidth() |
|
{ |
|
QSignalBlocker blocker(ui->bandwidth); |
|
int index = ui->bandwidth->findData(m_settings.m_bandwidth); |
|
|
|
if (index < 0) |
|
{ |
|
ui->bandwidth->addItem(bandwidthText(m_settings.m_bandwidth), m_settings.m_bandwidth); |
|
index = ui->bandwidth->count() - 1; |
|
} |
|
|
|
ui->bandwidth->setCurrentIndex(index); |
|
} |
|
|
|
// Airtime, capacity and warnings for the settings as they stand, from libchirpmodem |
|
void ChirpModemModGUI::displayFrameInfo() |
|
{ |
|
ChirpModemMod::FrameInfo info = ChirpModemMod::frameInfo(m_settings); |
|
bool tooLong = info.m_bodyBytes > info.m_maxBody; |
|
ui->frameInfo->setText(QString("%1 s/frame %2/%3 B %4") |
|
.arg(info.m_frameSeconds, 0, 'f', 2) |
|
.arg(info.m_bodyBytes) |
|
.arg(info.m_maxBody) |
|
.arg(info.m_coherent ? "coherent" : "non-coherent")); |
|
ui->frameInfo->setStyleSheet(tooLong ? "QLabel { color: red; }" : ""); |
|
ui->frameInfo->setToolTip(tooLong ? "The message does not fit one frame" : "Time on air of one frame, body bytes / most that fit, payload mode"); |
|
|
|
QStringList warnings; |
|
|
|
if (!info.m_warning.isEmpty()) { |
|
warnings << info.m_warning; |
|
} |
|
if ((m_settings.m_profile == ChirpModemModSettings::ProfileLicensed) && m_settings.m_source.isEmpty()) { |
|
warnings << "The licensed profile needs a source callsign"; |
|
} |
|
|
|
ui->warning->setText(warnings.join("\n")); |
|
ui->warning->setVisible(!warnings.isEmpty()); |
|
|
|
// The unlicensed profile is shown prominently, so it is never selected by accident |
|
ui->profile->setStyleSheet(m_settings.m_profile == ChirpModemModSettings::ProfileUnlicensed |
|
? "QComboBox { background-color: rgb(160, 30, 30); }" : ""); |
|
} |
|
|
|
void ChirpModemModGUI::displaySettings() |
|
{ |
|
m_doApplySettings = false; |
|
|
|
{ |
|
QSignalBlocker blocker(&m_channelMarker); |
|
m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset); |
|
m_channelMarker.setBandwidth(m_settings.m_bandwidth); |
|
m_channelMarker.setSidebands(ChannelMarker::dsb); |
|
m_channelMarker.setTitle(m_settings.m_title); |
|
m_channelMarker.setColor(m_settings.m_rgbColor); |
|
m_channelMarker.clearStreamIndexes(); |
|
m_channelMarker.addStreamIndex(m_settings.m_streamIndex); |
|
} |
|
|
|
setTitle(m_settings.m_title); |
|
setWindowTitle(m_settings.m_title); |
|
setTitleColor(m_settings.m_rgbColor); |
|
|
|
QSignalBlocker b1(ui->deltaFrequency); |
|
QSignalBlocker b2(ui->spreadFactor); |
|
QSignalBlocker b3(ui->mode); |
|
QSignalBlocker b4(ui->profile); |
|
QSignalBlocker b5(ui->source); |
|
QSignalBlocker b6(ui->destination); |
|
QSignalBlocker b7(ui->message); |
|
QSignalBlocker b8(ui->repeat); |
|
QSignalBlocker b9(ui->gap); |
|
QSignalBlocker b10(ui->amplitude); |
|
QSignalBlocker b11(ui->cwId); |
|
QSignalBlocker b12(ui->cwWpm); |
|
|
|
ui->deltaFrequency->setValue(m_settings.m_inputFrequencyOffset); |
|
ui->spreadFactor->setCurrentIndex(ui->spreadFactor->findData(m_settings.m_spreadFactor)); |
|
displayBandwidth(); |
|
ui->mode->setCurrentIndex(m_settings.m_mode + 1); |
|
ui->profile->setCurrentIndex(m_settings.m_profile); |
|
ui->source->setText(m_settings.m_source); |
|
ui->destination->setText(m_settings.m_destination); |
|
ui->message->setText(m_settings.m_message); |
|
ui->repeat->setValue(m_settings.m_repeat); |
|
ui->gap->setValue(m_settings.m_gap); |
|
ui->amplitude->setValue(m_settings.m_amplitude); |
|
ui->cwId->setChecked(m_settings.m_cwId); |
|
ui->cwWpm->setValue(m_settings.m_cwWpm); |
|
|
|
getRollupContents()->restoreState(m_rollupState); |
|
updateIndexLabel(); |
|
updateAbsoluteCenterFrequency(); |
|
displayFrameInfo(); |
|
m_doApplySettings = true; |
|
} |
|
|
|
void ChirpModemModGUI::makeUIConnections() |
|
{ |
|
QObject::connect(ui->deltaFrequency, &ValueDialZ::changed, this, &ChirpModemModGUI::on_deltaFrequency_changed); |
|
QObject::connect(ui->spreadFactor, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ChirpModemModGUI::on_spreadFactor_currentIndexChanged); |
|
QObject::connect(ui->bandwidth, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ChirpModemModGUI::on_bandwidth_currentIndexChanged); |
|
QObject::connect(ui->mode, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ChirpModemModGUI::on_mode_currentIndexChanged); |
|
QObject::connect(ui->profile, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ChirpModemModGUI::on_profile_currentIndexChanged); |
|
QObject::connect(ui->source, &QLineEdit::editingFinished, this, &ChirpModemModGUI::on_source_editingFinished); |
|
QObject::connect(ui->destination, &QLineEdit::editingFinished, this, &ChirpModemModGUI::on_destination_editingFinished); |
|
QObject::connect(ui->message, &QLineEdit::textEdited, this, &ChirpModemModGUI::on_message_textEdited); |
|
QObject::connect(ui->message, &QLineEdit::editingFinished, this, &ChirpModemModGUI::on_message_editingFinished); |
|
QObject::connect(ui->message, &QLineEdit::returnPressed, this, &ChirpModemModGUI::on_message_returnPressed); |
|
QObject::connect(ui->repeat, QOverload<int>::of(&QSpinBox::valueChanged), this, &ChirpModemModGUI::on_repeat_valueChanged); |
|
QObject::connect(ui->gap, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &ChirpModemModGUI::on_gap_valueChanged); |
|
QObject::connect(ui->amplitude, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &ChirpModemModGUI::on_amplitude_valueChanged); |
|
QObject::connect(ui->cwId, &ButtonSwitch::toggled, this, &ChirpModemModGUI::on_cwId_toggled); |
|
QObject::connect(ui->cwWpm, QOverload<int>::of(&QSpinBox::valueChanged), this, &ChirpModemModGUI::on_cwWpm_valueChanged); |
|
QObject::connect(ui->txButton, &QToolButton::clicked, this, &ChirpModemModGUI::on_txButton_clicked); |
|
QObject::connect(ui->clearLog, &QPushButton::clicked, this, &ChirpModemModGUI::on_clearLog_clicked); |
|
} |
|
|
|
void ChirpModemModGUI::on_deltaFrequency_changed(qint64 value) |
|
{ |
|
m_settings.m_inputFrequencyOffset = value; |
|
applySettings({"inputFrequencyOffset"}); |
|
} |
|
|
|
void ChirpModemModGUI::on_spreadFactor_currentIndexChanged(int index) |
|
{ |
|
m_settings.m_spreadFactor = ui->spreadFactor->itemData(index).toInt(); |
|
applySettings({"spreadFactor"}); |
|
} |
|
|
|
void ChirpModemModGUI::on_bandwidth_currentIndexChanged(int index) |
|
{ |
|
m_settings.m_bandwidth = ui->bandwidth->itemData(index).toInt(); |
|
applySettings({"bandwidth"}); |
|
} |
|
|
|
void ChirpModemModGUI::on_mode_currentIndexChanged(int index) |
|
{ |
|
m_settings.m_mode = index - 1; |
|
applySettings({"mode"}); |
|
} |
|
|
|
void ChirpModemModGUI::on_profile_currentIndexChanged(int index) |
|
{ |
|
m_settings.m_profile = index; |
|
applySettings({"profile"}); |
|
} |
|
|
|
void ChirpModemModGUI::on_source_editingFinished() |
|
{ |
|
if (ui->source->text() == m_settings.m_source) { |
|
return; |
|
} |
|
|
|
m_settings.m_source = ui->source->text(); |
|
applySettings({"source"}); |
|
ui->source->setText(m_settings.m_source); // normalized |
|
} |
|
|
|
void ChirpModemModGUI::on_destination_editingFinished() |
|
{ |
|
if (ui->destination->text() == m_settings.m_destination) { |
|
return; |
|
} |
|
|
|
m_settings.m_destination = ui->destination->text(); |
|
applySettings({"destination"}); |
|
ui->destination->setText(m_settings.m_destination); |
|
} |
|
|
|
void ChirpModemModGUI::on_message_textEdited(const QString& text) |
|
{ |
|
// Airtime and capacity follow the typing, settings are applied when done |
|
ChirpModemModSettings settings = m_settings; |
|
settings.m_message = text; |
|
std::swap(settings, m_settings); |
|
displayFrameInfo(); |
|
std::swap(settings, m_settings); |
|
} |
|
|
|
void ChirpModemModGUI::on_message_editingFinished() |
|
{ |
|
if (ui->message->text() != m_settings.m_message) |
|
{ |
|
m_settings.m_message = ui->message->text(); |
|
applySettings({"message"}); |
|
} |
|
} |
|
|
|
void ChirpModemModGUI::on_message_returnPressed() |
|
{ |
|
on_message_editingFinished(); |
|
on_txButton_clicked(); |
|
} |
|
|
|
void ChirpModemModGUI::on_repeat_valueChanged(int value) |
|
{ |
|
m_settings.m_repeat = value; |
|
applySettings({"repeat"}); |
|
} |
|
|
|
void ChirpModemModGUI::on_gap_valueChanged(double value) |
|
{ |
|
m_settings.m_gap = value; |
|
applySettings({"gap"}); |
|
} |
|
|
|
void ChirpModemModGUI::on_amplitude_valueChanged(double value) |
|
{ |
|
m_settings.m_amplitude = value; |
|
applySettings({"amplitude"}); |
|
} |
|
|
|
void ChirpModemModGUI::on_cwId_toggled(bool checked) |
|
{ |
|
m_settings.m_cwId = checked; |
|
applySettings({"cwId"}); |
|
} |
|
|
|
void ChirpModemModGUI::on_cwWpm_valueChanged(int value) |
|
{ |
|
m_settings.m_cwWpm = value; |
|
applySettings({"cwWpm"}); |
|
} |
|
|
|
void ChirpModemModGUI::on_txButton_clicked() |
|
{ |
|
// Make sure edits not yet applied go with this transmission |
|
on_source_editingFinished(); |
|
on_destination_editingFinished(); |
|
on_message_editingFinished(); |
|
// Through the channel's queue, behind the settings just applied, so they |
|
// reach the DSP thread first |
|
m_chirpModemMod->getInputMessageQueue()->push(ChirpModemModMessages::MsgTx::create()); |
|
log(QString("TX %1>%2: %3 (x%4%5)") |
|
.arg(m_settings.m_source.isEmpty() ? "?" : m_settings.m_source) |
|
.arg(m_settings.m_destination.isEmpty() ? "*" : m_settings.m_destination) |
|
.arg(m_settings.m_message) |
|
.arg(m_settings.m_repeat) |
|
.arg(m_settings.m_cwId && !m_settings.m_source.isEmpty() ? ", CW ID" : "")); |
|
} |
|
|
|
void ChirpModemModGUI::on_clearLog_clicked() |
|
{ |
|
ui->log->clear(); |
|
} |
|
|
|
void ChirpModemModGUI::log(const QString& text) |
|
{ |
|
ui->log->appendPlainText(QDateTime::currentDateTimeUtc().toString("HH:mm:ss ") + text); |
|
} |
|
|
|
void ChirpModemModGUI::handleInputMessages() |
|
{ |
|
while (auto *message = m_inputMessageQueue.pop()) |
|
{ |
|
if (ChirpModemMod::MsgConfigureChirpModemMod::match(*message)) |
|
{ |
|
const auto& config = static_cast<const ChirpModemMod::MsgConfigureChirpModemMod&>(*message); |
|
|
|
if (config.getForce()) |
|
{ |
|
ChirpModemModSettings settings = config.getSettings(); |
|
settings.m_workspaceIndex = m_settings.m_workspaceIndex; |
|
settings.m_geometryBytes = m_settings.m_geometryBytes; |
|
settings.m_hidden = m_settings.m_hidden; |
|
m_settings = settings; |
|
} |
|
else |
|
{ |
|
m_settings.applySettings(config.getSettingsKeys(), config.getSettings()); |
|
} |
|
|
|
m_settings.setChannelMarker(&m_channelMarker); |
|
m_settings.setRollupState(&m_rollupState); |
|
m_settings.setSpectrumGUI(ui->spectrumGUI); |
|
displaySettings(); |
|
} |
|
else if (DSPSignalNotification::match(*message)) |
|
{ |
|
const auto& notification = static_cast<const DSPSignalNotification&>(*message); |
|
m_deviceCenterFrequency = notification.getCenterFrequency(); |
|
m_basebandSampleRate = notification.getSampleRate(); |
|
{ |
|
// Changing the range clamps the dial: never send that back as a |
|
// setting, and show the real offset again once the range allows it |
|
QSignalBlocker blocker(ui->deltaFrequency); |
|
ui->deltaFrequency->setValueRange(false, 8, -m_basebandSampleRate / 2, m_basebandSampleRate / 2); |
|
ui->deltaFrequency->setValue(m_settings.m_inputFrequencyOffset); |
|
} |
|
updateAbsoluteCenterFrequency(); |
|
} |
|
else if (ChirpModemModMessages::MsgStatus::match(*message)) |
|
{ |
|
statusReceived(static_cast<const ChirpModemModMessages::MsgStatus&>(*message).getStatus()); |
|
} |
|
|
|
delete message; |
|
} |
|
} |
|
|
|
void ChirpModemModGUI::statusReceived(const ChirpModemModMessages::Status& status) |
|
{ |
|
if (status.m_channelSampleRate > 0 && status.m_channelSampleRate != m_spectrumSampleRate) |
|
{ |
|
m_spectrumSampleRate = status.m_channelSampleRate; |
|
ui->glSpectrum->setSampleRate(m_spectrumSampleRate); |
|
} |
|
|
|
ui->txButton->setStyleSheet(status.m_transmitting ? "QToolButton { background-color: rgb(160, 30, 30); }" : ""); |
|
ui->status->setText(QString("%1 kS/s IF %2 Hz %3 queue %4 sent %5 frames, %6 s") |
|
.arg(status.m_channelSampleRate / 1000.0, 0, 'f', 1) |
|
.arg(status.m_ifOffset) |
|
.arg(status.m_transmitting ? "ON AIR" : "idle") |
|
.arg(status.m_queueLength) |
|
.arg(status.m_framesSent) |
|
.arg(status.m_airtime, 0, 'f', 1)); |
|
|
|
if (status.m_event == "error" || status.m_event == "aborted") { |
|
log(status.m_event.toUpper() + ": " + status.m_error); |
|
} else if (status.m_event == "queued") { |
|
log(QString("queued, %1 s").arg(status.m_lastDuration, 0, 'f', 2)); |
|
} else if (status.m_event == "sent") { |
|
log("sent"); |
|
} |
|
} |
|
|
|
void ChirpModemModGUI::tick() |
|
{ |
|
double power = CalcDb::dbPower(m_chirpModemMod->getMagSq()); |
|
ui->channelPower->setText(QString::number(power, 'f', 1) + " dB"); |
|
} |
|
|
|
void ChirpModemModGUI::updateAbsoluteCenterFrequency() |
|
{ |
|
setStatusFrequency(m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset); |
|
} |
|
|
|
void ChirpModemModGUI::channelMarkerChangedByCursor() |
|
{ |
|
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); |
|
ui->deltaFrequency->setValue(m_settings.m_inputFrequencyOffset); |
|
applySettings({"inputFrequencyOffset"}); |
|
} |
|
|
|
void ChirpModemModGUI::channelMarkerHighlightedByCursor() |
|
{ |
|
setHighlighted(m_channelMarker.getHighlighted()); |
|
} |
|
|
|
void ChirpModemModGUI::onWidgetRolled(QWidget *widget, bool rollDown) |
|
{ |
|
(void) widget; |
|
(void) rollDown; |
|
|
|
if (!m_doApplySettings) { |
|
return; |
|
} |
|
|
|
getRollupContents()->saveState(m_rollupState); |
|
applySettings({"rollupState"}); |
|
} |
|
|
|
void ChirpModemModGUI::onMenuDialogCalled(const QPoint& point) |
|
{ |
|
if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings) |
|
{ |
|
BasicChannelSettingsDialog dialog(&m_channelMarker, this); |
|
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); |
|
dialog.setReverseAPIAddress(m_settings.m_reverseAPIAddress); |
|
dialog.setReverseAPIPort(m_settings.m_reverseAPIPort); |
|
dialog.setReverseAPIDeviceIndex(m_settings.m_reverseAPIDeviceIndex); |
|
dialog.setReverseAPIChannelIndex(m_settings.m_reverseAPIChannelIndex); |
|
dialog.setDefaultTitle(m_displayedName); |
|
|
|
if (m_deviceUISet->m_deviceMIMOEngine) |
|
{ |
|
dialog.setNumberOfStreams(m_chirpModemMod->getNumberOfDeviceStreams()); |
|
dialog.setStreamIndex(m_settings.m_streamIndex); |
|
} |
|
|
|
dialog.move(point); |
|
new DialogPositioner(&dialog, false); |
|
dialog.exec(); |
|
|
|
m_settings.m_rgbColor = m_channelMarker.getColor().rgb(); |
|
m_settings.m_title = m_channelMarker.getTitle(); |
|
m_settings.m_useReverseAPI = dialog.useReverseAPI(); |
|
m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress(); |
|
m_settings.m_reverseAPIPort = dialog.getReverseAPIPort(); |
|
m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex(); |
|
m_settings.m_reverseAPIChannelIndex = dialog.getReverseAPIChannelIndex(); |
|
|
|
if (m_deviceUISet->m_deviceMIMOEngine) { |
|
m_settings.m_streamIndex = dialog.getSelectedStreamIndex(); |
|
} |
|
|
|
displaySettings(); |
|
applySettings({"rgbColor", "title", "useReverseAPI", "reverseAPIAddress", "reverseAPIPort", |
|
"reverseAPIDeviceIndex", "reverseAPIChannelIndex", "streamIndex"}); |
|
} |
|
|
|
resetContextMenuType(); |
|
}
|
|
|