Merge branch 'widgets' into creator-widgets

creator-widgets
Phil Taylor 2023-05-26 23:49:26 +01:00
commit 4634da3c23
19 zmienionych plików z 7696 dodań i 2296 usunięć

338
bandbuttons.cpp 100644
Wyświetl plik

@ -0,0 +1,338 @@
#include "bandbuttons.h"
#include "ui_bandbuttons.h"
bandbuttons::bandbuttons(QWidget *parent) :
QWidget(parent),
ui(new Ui::bandbuttons)
{
ui->setupUi(this);
ui->bandStkLastUsedBtn->setVisible(false);
ui->bandStkVoiceBtn->setVisible(false);
ui->bandStkDataBtn->setVisible(false);
ui->bandStkCWBtn->setVisible(false);
this->setWindowTitle("Band Switcher");
}
bandbuttons::~bandbuttons()
{
delete ui;
}
int bandbuttons::getBSRNumber()
{
return ui->bandStkPopdown->currentIndex()+1;
}
void bandbuttons::acceptRigCaps(rigCapabilities rc)
{
this->rigCaps = rc;
qDebug(logGui()) << "Accepting new rigcaps into band buttons.";
if(haveRigCaps)
qDebug(logGui()) << "Accepting additional rigcaps into band buttons.";
qDebug(logGui()) << "Bands in this rigcaps: ";
for(size_t i=0; i < rigCaps.bands.size(); i++)
{
qDebug(logGui()) << "band[" << i << "]: " << (unsigned char)rigCaps.bands.at(i).band;
}
for(size_t i=0; i < 20; i++)
{
qDebug(logGui()) << "bsr[" << i << "]: " << (unsigned char)rigCaps.bsr[i];
}
setUIToRig();
haveRigCaps = true;
}
void bandbuttons::setUIToRig()
{
// Turn off each button first:
hideButton(ui->band23cmbtn);
hideButton(ui->band70cmbtn);
hideButton(ui->band2mbtn);
hideButton(ui->bandAirbtn);
hideButton(ui->bandWFMbtn);
hideButton(ui->band4mbtn);
hideButton(ui->band6mbtn);
hideButton(ui->band10mbtn);
hideButton(ui->band12mbtn);
hideButton(ui->band15mbtn);
hideButton(ui->band17mbtn);
hideButton(ui->band20mbtn);
hideButton(ui->band30mbtn);
hideButton(ui->band40mbtn);
hideButton(ui->band60mbtn);
hideButton(ui->band80mbtn);
hideButton(ui->band160mbtn);
hideButton(ui->band630mbtn);
hideButton(ui->band2200mbtn);
hideButton(ui->bandGenbtn);
bandType bandSel;
for(unsigned int i=0; i < rigCaps.bands.size(); i++)
{
bandSel = rigCaps.bands.at(i);
switch(bandSel.band)
{
case(band23cm):
showButton(ui->band23cmbtn);
break;
case(band70cm):
showButton(ui->band70cmbtn);
break;
case(band2m):
showButton(ui->band2mbtn);
break;
case(bandAir):
showButton(ui->bandAirbtn);
break;
case(bandWFM):
showButton(ui->bandWFMbtn);
break;
case(band4m):
showButton(ui->band4mbtn);
break;
case(band6m):
showButton(ui->band6mbtn);
break;
case(band10m):
showButton(ui->band10mbtn);
break;
case(band12m):
showButton(ui->band12mbtn);
break;
case(band15m):
showButton(ui->band15mbtn);
break;
case(band17m):
showButton(ui->band17mbtn);
break;
case(band20m):
showButton(ui->band20mbtn);
break;
case(band30m):
showButton(ui->band30mbtn);
break;
case(band40m):
showButton(ui->band40mbtn);
break;
case(band60m):
showButton(ui->band60mbtn);
break;
case(band80m):
showButton(ui->band80mbtn);
break;
case(band160m):
showButton(ui->band160mbtn);
break;
case(band630m):
showButton(ui->band630mbtn);
break;
case(band2200m):
showButton(ui->band2200mbtn);
break;
case(bandGen):
showButton(ui->bandGenbtn);
break;
default:
break;
}
}
}
void bandbuttons::showButton(QPushButton *b)
{
b->setVisible(true);
}
void bandbuttons::hideButton(QPushButton *b)
{
b->setHidden(true);
}
void bandbuttons::receiveBandStackReg(freqt freqGo, char mode, char filter, bool dataOn)
{
// This function is not currently used, but perhaps it should be?
// Issue: wfmain is also waiting for a BSR and acts upon it.
if(waitingForBSR)
{
qDebug(logGui()) << "Received band stack register and was waiting for one.";
emit issueCmdF(cmdSetFreq, freqGo);
emit issueCmd(cmdSetMode, mode);
//emit issueCmd(cmdSetFilter, filter); // TODO
if(dataOn)
emit issueDelayedCommand(cmdSetDataModeOn);
else
emit issueDelayedCommand(cmdSetDataModeOff);
waitingForBSR = false;
} else {
qWarning(logGui()) << "Received a BSR but did not expect one.";
}
(void)filter;
}
void bandbuttons::bandStackBtnClick(availableBands band)
{
if(haveRigCaps)
{
unsigned char bandRegister = rigCaps.bsr[band];
if(bandRegister == 00)
{
qDebug(logGui()) << "requested to drop to band that does not have a BSR.";
// TODO: Jump to reasonable frequency for the selected band
jumpToBandWithoutBSR(band);
} else {
waitingForBSR = true;
// TODO: request the BSR 1, 2, or 3
emit issueCmd(cmdGetBandStackReg, (unsigned char)band);
}
} else {
qWarning(logGui()) << "bandbuttons, Asked to go to a band but do not have rigCaps yet.";
}
}
void bandbuttons::jumpToBandWithoutBSR(availableBands band)
{
// Sometimes we do not have a BSR for these bands:
freqt f;
f.Hz = 0;
switch(band)
{
case band2200m:
f.Hz = 136 * 1E3;
break;
case band630m:
f.Hz = 475 * 1E3;
break;
case band60m:
f.Hz = (5.3305) * 1E6;
break;
case band4m:
f.Hz = (70.200) * 1E6;
break;
case bandAir:
f.Hz = 121.5 * 1E6;
break;
case bandGen:
f.Hz = 10.0 * 1E6;
break;
case bandWFM:
f.Hz = (100.1) * 1E6;
break;
default:
qCritical(logGui()) << "Band " << (unsigned char) band << " not understood.";
break;
}
if(f.Hz != 0)
{
emit issueCmdF(cmdSetFreq, f);
}
}
void bandbuttons::on_band2200mbtn_clicked()
{
bandStackBtnClick(band2200m);
}
void bandbuttons::on_band630mbtn_clicked()
{
bandStackBtnClick(band630m);
}
void bandbuttons::on_band160mbtn_clicked()
{
bandStackBtnClick(band160m);
}
void bandbuttons::on_band80mbtn_clicked()
{
bandStackBtnClick(band80m);
}
void bandbuttons::on_band60mbtn_clicked()
{
bandStackBtnClick(band60m);
}
void bandbuttons::on_band40mbtn_clicked()
{
bandStackBtnClick(band40m);
}
void bandbuttons::on_band30mbtn_clicked()
{
bandStackBtnClick(band30m);
}
void bandbuttons::on_band20mbtn_clicked()
{
bandStackBtnClick(band20m);
}
void bandbuttons::on_band17mbtn_clicked()
{
bandStackBtnClick(band17m);
}
void bandbuttons::on_band15mbtn_clicked()
{
bandStackBtnClick(band15m);
}
void bandbuttons::on_band12mbtn_clicked()
{
bandStackBtnClick(band12m);
}
void bandbuttons::on_band10mbtn_clicked()
{
bandStackBtnClick(band10m);
}
void bandbuttons::on_band6mbtn_clicked()
{
bandStackBtnClick(band6m);
}
void bandbuttons::on_band4mbtn_clicked()
{
bandStackBtnClick(band4m);
}
void bandbuttons::on_band2mbtn_clicked()
{
bandStackBtnClick(band2m);
}
void bandbuttons::on_band70cmbtn_clicked()
{
bandStackBtnClick(band70cm);
}
void bandbuttons::on_band23cmbtn_clicked()
{
bandStackBtnClick(band23cm);
}
void bandbuttons::on_bandWFMbtn_clicked()
{
bandStackBtnClick(bandWFM);
}
void bandbuttons::on_bandAirbtn_clicked()
{
bandStackBtnClick(bandAir);
}
void bandbuttons::on_bandGenbtn_clicked()
{
bandStackBtnClick(bandGen);
}

94
bandbuttons.h 100644
Wyświetl plik

@ -0,0 +1,94 @@
#ifndef BANDBUTTONS_H
#define BANDBUTTONS_H
#include <QWidget>
#include <QPushButton>
#include "logcategories.h"
#include "wfviewtypes.h"
#include "rigidentities.h"
namespace Ui {
class bandbuttons;
}
class bandbuttons : public QWidget
{
Q_OBJECT
public:
explicit bandbuttons(QWidget *parent = nullptr);
~bandbuttons();
int getBSRNumber(); // returns the BSR combo box position
// flow:
// User presses button
// this sends request for BSR information and flags waitingForBSR=true
// When BSR data is received, and if we were waiting for it,
// then we select the frequency and mode and act upon it,
// by sending out a gotoFreqMode(freq, mode).
// Or we could grant access to the command queue and not have to do these
// custom functions.
// The BSR can presumably show up without having been invited.
// Most of the connections shall be to rigCommander and
// to the command queue in wfmain (soon to be broken out).
// One connection may also be made to update the UI when we change frequency and mode.
signals:
// look at what cmdSetModeFilter does, can we depreciate it?
void issueCmdUniquePriority(cmds cmd, char c); // to go to a mode
void issueDelayedCommand(cmds cmd); // for data mode and filter
void issueCmdF(cmds cmd, freqt f); // go to frequency
void issueCmd(cmds, char); // to get BSR of a specific band
// void getBandStackReg(char band, char regCode); // no, use the queue.
// void gotoFreqMode(); // TODO, arguments will contain BSR data
public slots:
// These should come from connections to rigCommander:
void acceptRigCaps(rigCapabilities rc);
void receiveBandStackReg(freqt freqGo, char mode, char filter, bool dataOn);
private slots:
void on_band2200mbtn_clicked();
void on_band630mbtn_clicked();
void on_band160mbtn_clicked();
void on_band80mbtn_clicked();
void on_band60mbtn_clicked();
void on_band40mbtn_clicked();
void on_band30mbtn_clicked();
void on_band20mbtn_clicked();
void on_band17mbtn_clicked();
void on_band15mbtn_clicked();
void on_band12mbtn_clicked();
void on_band10mbtn_clicked();
void on_band6mbtn_clicked();
void on_band4mbtn_clicked();
void on_band2mbtn_clicked();
void on_band70cmbtn_clicked();
void on_band23cmbtn_clicked();
void on_bandWFMbtn_clicked();
void on_bandAirbtn_clicked();
void on_bandGenbtn_clicked();
private:
Ui::bandbuttons *ui;
void bandStackBtnClick(availableBands band);
void jumpToBandWithoutBSR(availableBands band);
void setUIToRig();
void showButton(QPushButton *b);
void hideButton(QPushButton *b);
char bandStkRegCode;
bool waitingForBSR = false;
rigCapabilities rigCaps;
bool haveRigCaps = false;
};
#endif // BANDBUTTONS_H

581
bandbuttons.ui 100644
Wyświetl plik

@ -0,0 +1,581 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>bandbuttons</class>
<widget class="QWidget" name="bandbuttons">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>737</width>
<height>512</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Band</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_26">
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="band2200mbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>128</height>
</size>
</property>
<property name="text">
<string>2200m</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="band630mbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>128</height>
</size>
</property>
<property name="text">
<string>630m</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="band160mbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>128</height>
</size>
</property>
<property name="text">
<string>160m</string>
</property>
<property name="shortcut">
<string>L</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="band80mbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>128</height>
</size>
</property>
<property name="text">
<string>80m</string>
</property>
<property name="shortcut">
<string>8</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QPushButton" name="band60mbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>128</height>
</size>
</property>
<property name="text">
<string>60m</string>
</property>
<property name="shortcut">
<string>S</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="band40mbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>128</height>
</size>
</property>
<property name="text">
<string>40m</string>
</property>
<property name="shortcut">
<string>4</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="band30mbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>128</height>
</size>
</property>
<property name="text">
<string>30m</string>
</property>
<property name="shortcut">
<string>3</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="band20mbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>128</height>
</size>
</property>
<property name="text">
<string>20m</string>
</property>
<property name="shortcut">
<string>2</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QPushButton" name="band17mbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>128</height>
</size>
</property>
<property name="text">
<string>17m</string>
</property>
<property name="shortcut">
<string>7</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="band15mbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>128</height>
</size>
</property>
<property name="text">
<string>15m</string>
</property>
<property name="shortcut">
<string>5</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="band12mbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>128</height>
</size>
</property>
<property name="text">
<string>12m</string>
</property>
<property name="shortcut">
<string>T</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="band10mbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>128</height>
</size>
</property>
<property name="text">
<string>10m</string>
</property>
<property name="shortcut">
<string>1</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<widget class="QPushButton" name="band6mbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>128</height>
</size>
</property>
<property name="text">
<string>6m</string>
</property>
<property name="shortcut">
<string>6</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="band4mbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>128</height>
</size>
</property>
<property name="text">
<string>4m</string>
</property>
<property name="shortcut">
<string>$</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="band2mbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>128</height>
</size>
</property>
<property name="text">
<string>2m</string>
</property>
<property name="shortcut">
<string>V</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="band70cmbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>128</height>
</size>
</property>
<property name="text">
<string>70cm</string>
</property>
<property name="shortcut">
<string>U</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="band23cmbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>128</height>
</size>
</property>
<property name="text">
<string>23cm</string>
</property>
<property name="shortcut">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<widget class="QPushButton" name="bandWFMbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>128</height>
</size>
</property>
<property name="text">
<string>WFM</string>
</property>
<property name="shortcut">
<string>W</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="bandAirbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>128</height>
</size>
</property>
<property name="text">
<string>Air</string>
</property>
<property name="shortcut">
<string>A</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="bandGenbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>128</height>
</size>
</property>
<property name="text">
<string>Gen</string>
</property>
<property name="shortcut">
<string>G</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Segment</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<widget class="QRadioButton" name="bandStkLastUsedBtn">
<property name="text">
<string>&amp;Last Used</string>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Band Stack Selection:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="bandStkPopdown">
<item>
<property name="text">
<string>1 - Latest Used</string>
</property>
</item>
<item>
<property name="text">
<string>2 - Older</string>
</property>
</item>
<item>
<property name="text">
<string>3 - Oldest Used</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QRadioButton" name="bandStkVoiceBtn">
<property name="text">
<string>Voice</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="bandStkDataBtn">
<property name="text">
<string>Data</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="bandStkCWBtn">
<property name="text">
<string>&amp;CW</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>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

Wyświetl plik

@ -21,7 +21,7 @@ void freqMemory::initializePresets()
{
presets[p].frequency = 14.1 + p/1000.0;
presets[p].mode = modeUSB;
presets[p].isSet = true;
presets[p].isSet = false;
}
}
@ -61,6 +61,9 @@ void freqMemory::dumpMemory()
{
for(unsigned int p=0; p < numPresets; p++)
{
if(presets[p].isSet)
{
qInfo(logSystem()) << "Index: " << p << " freq: " << presets[p].frequency << " Mode: " << presets[p].mode << " isSet: " << presets[p].isSet;
}
}
}

Wyświetl plik

@ -0,0 +1,241 @@
#include "frequencyinputwidget.h"
#include "ui_frequencyinputwidget.h"
frequencyinputwidget::frequencyinputwidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::frequencyinputwidget)
{
ui->setupUi(this);
this->setWindowTitle("Frequency Input");
ui->freqMhzLineEdit->setValidator( new QDoubleValidator(0, 100, 6, this));
}
frequencyinputwidget::~frequencyinputwidget()
{
delete ui;
}
void frequencyinputwidget::showEvent(QShowEvent *event)
{
ui->freqMhzLineEdit->setFocus();
QWidget::showEvent(event);
}
void frequencyinputwidget::setAutomaticSidebandSwitching(bool autossb)
{
this->automaticSidebandSwitching = autossb;
}
void frequencyinputwidget::updateCurrentMode(mode_kind mode)
{
currentMode = mode;
}
void frequencyinputwidget::updateFilterSelection(int filter)
{
currentFilter = filter;
}
void frequencyinputwidget::on_f1btn_clicked()
{
checkFreqSel();
ui->freqMhzLineEdit->setText(ui->freqMhzLineEdit->text().append("1"));
}
void frequencyinputwidget::on_f2btn_clicked()
{
checkFreqSel();
ui->freqMhzLineEdit->setText(ui->freqMhzLineEdit->text().append("2"));
}
void frequencyinputwidget::on_f3btn_clicked()
{
checkFreqSel();
ui->freqMhzLineEdit->setText(ui->freqMhzLineEdit->text().append("3"));
}
void frequencyinputwidget::on_f4btn_clicked()
{
checkFreqSel();
ui->freqMhzLineEdit->setText(ui->freqMhzLineEdit->text().append("4"));
}
void frequencyinputwidget::on_f5btn_clicked()
{
checkFreqSel();
ui->freqMhzLineEdit->setText(ui->freqMhzLineEdit->text().append("5"));
}
void frequencyinputwidget::on_f6btn_clicked()
{
checkFreqSel();
ui->freqMhzLineEdit->setText(ui->freqMhzLineEdit->text().append("6"));
}
void frequencyinputwidget::on_f7btn_clicked()
{
checkFreqSel();
ui->freqMhzLineEdit->setText(ui->freqMhzLineEdit->text().append("7"));
}
void frequencyinputwidget::on_f8btn_clicked()
{
checkFreqSel();
ui->freqMhzLineEdit->setText(ui->freqMhzLineEdit->text().append("8"));
}
void frequencyinputwidget::on_f9btn_clicked()
{
checkFreqSel();
ui->freqMhzLineEdit->setText(ui->freqMhzLineEdit->text().append("9"));
}
void frequencyinputwidget::on_fDotbtn_clicked()
{
checkFreqSel();
ui->freqMhzLineEdit->setText(ui->freqMhzLineEdit->text().append("."));
}
void frequencyinputwidget::on_f0btn_clicked()
{
checkFreqSel();
ui->freqMhzLineEdit->setText(ui->freqMhzLineEdit->text().append("0"));
}
void frequencyinputwidget::on_fCEbtn_clicked()
{
ui->freqMhzLineEdit->clear();
freqTextSelected = false;
}
void frequencyinputwidget::on_fStoBtn_clicked()
{
// Memory Store
// sequence:
// type frequency
// press Enter or Go
// change mode if desired
// type in index number 0 through 99
// press STO
bool ok;
int preset_number = ui->freqMhzLineEdit->text().toInt(&ok);
if(ok && (preset_number >= 0) && (preset_number < 100))
{
//emit setMemory(preset_number, freq, currentMode);
emit saveMemoryPreset(preset_number);
//mem.setPreset(preset_number, freq.MHzDouble, (mode_kind)ui->modeSelectCombo->currentData().toInt() );
//showStatusBarText( QString("Storing frequency %1 to memory location %2").arg( freq.MHzDouble ).arg(preset_number) );
} else {
//showStatusBarText(QString("Could not store preset to %1. Valid preset numbers are 0 to 99").arg(preset_number));
}
ui->freqMhzLineEdit->clear();
}
void frequencyinputwidget::on_fRclBtn_clicked()
{
// Memory Recall
bool ok;
int preset_number = ui->freqMhzLineEdit->text().toInt(&ok);
if(ok && (preset_number >= 0) && (preset_number < 100))
{
emit gotoMemoryPreset(preset_number);
// temp = mem.getPreset(preset_number);
// // TODO: change to int hz
// // TODO: store filter setting as well.
// freqString = QString("%1").arg(temp.frequency);
// ui->freqMhzLineEdit->setText( freqString );
// ui->goFreqBtn->click();
// setModeVal = temp.mode;
// setFilterVal = ui->modeFilterCombo->currentIndex()+1; // TODO, add to memory
// issueDelayedCommand(cmdSetModeFilter);
// issueDelayedCommand(cmdGetMode);
} else {
qInfo(logSystem()) << "Could not recall preset. Valid presets are 0 through 99.";
}
ui->freqMhzLineEdit->clear();
}
void frequencyinputwidget::on_fEnterBtn_clicked()
{
on_goFreqBtn_clicked();
}
void frequencyinputwidget::on_fBackbtn_clicked()
{
QString currentFreq = ui->freqMhzLineEdit->text();
currentFreq.chop(1);
ui->freqMhzLineEdit->setText(currentFreq);
}
void frequencyinputwidget::on_goFreqBtn_clicked()
{
freqt f;
bool ok = false;
double freqDbl = 0;
int KHz = 0;
if(ui->freqMhzLineEdit->text().contains("."))
{
freqDbl = ui->freqMhzLineEdit->text().toDouble(&ok);
if(ok)
{
f.Hz = freqDbl*1E6;
}
} else {
KHz = ui->freqMhzLineEdit->text().toInt(&ok);
if(ok)
{
f.Hz = KHz*1E3;
}
}
if(ok)
{
mode_info m;
issueCmdF(cmdSetFreq, f);
m.mk = sidebandChooser::getMode(f, currentMode);
m.reg = (unsigned char) m.mk;
m.filter = currentFilter;
// TODO: usingDataMode
// TODO: auto sideband preference
if((m.mk != currentMode) && !usingDataMode && automaticSidebandSwitching)
{
emit issueCmdM(cmdSetMode, m); // mode info or mode kind.....
emit updateUIMode(m.mk); // mode kind or mode info? Check UI code
currentMode = m.mk;
}
f.MHzDouble = (float)f.Hz / 1E6;
emit updateUIFrequency(f);
currentFrequency = f;
} else {
qWarning(logGui()) << "Could not understand frequency" << ui->freqMhzLineEdit->text();
ui->freqMhzLineEdit->clear();
}
//ui->freqMhzLineEdit->clear();
ui->freqMhzLineEdit->selectAll();
freqTextSelected = true;
//ui->tabWidget->setCurrentIndex(0);
}
void frequencyinputwidget::on_freqMhzLineEdit_returnPressed()
{
on_goFreqBtn_clicked();
}
void frequencyinputwidget::checkFreqSel()
{
if(freqTextSelected)
{
freqTextSelected = false;
ui->freqMhzLineEdit->clear();
}
}

Wyświetl plik

@ -0,0 +1,68 @@
#ifndef FREQUENCYINPUTWIDGET_H
#define FREQUENCYINPUTWIDGET_H
#include <QWidget>
#include <QDoubleValidator>
#include "sidebandchooser.h"
#include "wfviewtypes.h"
#include "logcategories.h"
namespace Ui {
class frequencyinputwidget;
}
class frequencyinputwidget : public QWidget
{
Q_OBJECT
public:
explicit frequencyinputwidget(QWidget *parent = nullptr);
~frequencyinputwidget();
signals:
void issueCmdF(cmds cmd, freqt f);
void issueCmdM(cmds cmd, mode_info m);
void updateUIMode(mode_kind mode);
void updateUIFrequency(freqt f);
void gotoMemoryPreset(int presetNumber);
void saveMemoryPreset(int presetNumber);
public slots:
void updateCurrentMode(mode_kind mode);
void updateFilterSelection(int filter);
void setAutomaticSidebandSwitching(bool autossb);
private slots:
void showEvent(QShowEvent *event);
void on_f1btn_clicked();
void on_f2btn_clicked();
void on_f3btn_clicked();
void on_f4btn_clicked();
void on_f5btn_clicked();
void on_f6btn_clicked();
void on_f7btn_clicked();
void on_f8btn_clicked();
void on_f9btn_clicked();
void on_fDotbtn_clicked();
void on_f0btn_clicked();
void on_fCEbtn_clicked();
void on_fStoBtn_clicked();
void on_fRclBtn_clicked();
void on_fEnterBtn_clicked();
void on_fBackbtn_clicked();
void on_goFreqBtn_clicked();
void on_freqMhzLineEdit_returnPressed();
private:
Ui::frequencyinputwidget *ui;
bool freqTextSelected = false;
bool usingDataMode = false;
bool automaticSidebandSwitching = true;
mode_kind currentMode;
freqt currentFrequency;
int currentFilter = 1;
void checkFreqSel();
};
#endif // FREQUENCYINPUTWIDGET_H

Wyświetl plik

@ -0,0 +1,427 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>frequencyinputwidget</class>
<widget class="QWidget" name="frequencyinputwidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>601</width>
<height>527</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>Frequency:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="freqMhzLineEdit">
<property name="font">
<font>
<family>DejaVu Sans Mono</family>
<pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="goFreqBtn">
<property name="text">
<string>Go</string>
</property>
<property name="shortcut">
<string>Return</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Entry</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="1">
<widget class="QPushButton" name="f5btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>5</string>
</property>
<property name="shortcut">
<string>5</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="fRclBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;To recall a preset memory:&lt;/p&gt;&lt;p&gt;1. Type in the preset number (0 through 99)&lt;/p&gt;&lt;p&gt;2. Press RCL (or use hotkey &amp;quot;R&amp;quot;)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>&amp;RCL</string>
</property>
<property name="shortcut">
<string>R</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="f6btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>6</string>
</property>
<property name="shortcut">
<string>6</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="f3btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>3</string>
</property>
<property name="shortcut">
<string>3</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="fCEbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>&amp;CE</string>
</property>
<property name="shortcut">
<string>C</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="f4btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>4</string>
</property>
<property name="shortcut">
<string>4</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="fStoBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;To store a preset:&lt;/p&gt;&lt;p&gt;1. Set the desired frequency and mode per normal methods&lt;/p&gt;&lt;p&gt;2. Type the index to to store to (0 through 99)&lt;/p&gt;&lt;p&gt;3. Press STO (or use hotkey &amp;quot;S&amp;quot;)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>&amp;STO</string>
</property>
<property name="shortcut">
<string>S</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="f9btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>9</string>
</property>
<property name="shortcut">
<string>9</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QPushButton" name="fBackbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>Back</string>
</property>
<property name="shortcut">
<string>Backspace</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="fEnterBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>Enter</string>
</property>
<property name="shortcut">
<string>Enter</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="f0btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>0</string>
</property>
<property name="shortcut">
<string>0</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="fDotbtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>.</string>
</property>
<property name="shortcut">
<string>.</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="f1btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>1</string>
</property>
<property name="shortcut">
<string>1</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="f2btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>2</string>
</property>
<property name="shortcut">
<string>2</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="f7btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>7</string>
</property>
<property name="shortcut">
<string>7</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="f8btn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>8</string>
</property>
<property name="shortcut">
<string>8</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

77
prefs.h
Wyświetl plik

@ -6,6 +6,74 @@
#include <QMap>
#include "wfviewtypes.h"
enum prefIfItem {
if_useFullScreen = 1 << 0,
if_useSystemTheme = 1 << 1,
if_drawPeaks = 1 << 2,
if_underlayMode = 1 << 3,
if_underlayBufferSize = 1 << 4,
if_wfAntiAlias = 1 << 5,
if_wfInterpolate = 1 << 6,
if_wftheme = 1 << 7,
if_plotFloor = 1 << 8,
if_plotCeiling = 1 << 9,
if_stylesheetPath = 1 << 10,
if_wflength = 1 << 11,
if_confirmExit = 1 << 12,
if_confirmPowerOff = 1 << 13,
if_meter2Type = 1 << 14,
if_clickDragTuningEnable = 1 << 15,
if_currentColorPresetNumber = 1 << 16,
if_all = 1 << 17
};
enum prefRaItem {
ra_radioCIVAddr = 1 << 0,
ra_CIVisRadioModel = 1 << 1,
ra_forceRTSasPTT = 1 << 2,
ra_polling_ms = 1 << 3,
ra_serialPortRadio = 1 << 4,
ra_serialPortBaud = 1 << 5,
ra_virtualSerialPort = 1 << 6,
ra_localAFgain = 1 << 7,
ra_audioSystem = 1 << 8,
ra_all = 1 << 9
};
enum prefCtItem {
ct_enablePTT = 1 << 0,
ct_niceTS = 1 << 1,
ct_automaticSidebandSwitching = 1 << 2,
ct_enableUSBControllers = 1 << 3,
ct_usbSensitivity = 1 << 4,
ct_all = 1 << 5
};
enum prefLanItem {
l_enableLAN = 1 << 0,
l_enableRigCtlD = 1 << 1,
l_rigCtlPort = 1 << 2,
l_tcpPort = 1 << 3,
l_waterfallFormat = 1 << 4,
l_all = 1 << 5
};
enum prefClusterItem {
cl_clusterUdpEnable = 1 << 0,
cl_clusterTcpEnable = 1 << 1,
cl_clusterUdpPort = 1 << 2,
cl_clusterTcpServerName = 1 << 3,
cl_clusterTcpUserName = 1 << 4,
cl_clusterTcpPassword = 1 << 5,
cl_clusterTcpPort = 1 << 6,
cl_clusterTimeout = 1 << 7,
cl_clusterSkimmerSpotsEnable = 1 << 8,
cl_all = 1 << 9
};
struct preferences {
// Program:
@ -32,6 +100,8 @@ struct preferences {
bool confirmPowerOff;
meter_t meter2Type;
bool clickDragTuningEnable;
int currentColorPresetNumber = 0;
// Radio:
unsigned char radioCIVAddr;
@ -54,7 +124,6 @@ struct preferences {
bool enableLAN;
bool enableRigCtlD;
quint16 rigCtlPort;
int currentColorPresetNumber = 0;
quint16 tcpPort;
quint8 waterfallFormat;
@ -65,9 +134,9 @@ struct preferences {
QString clusterTcpServerName;
QString clusterTcpUserName;
QString clusterTcpPassword;
int clusterTimeout;
bool clusterSkimmerSpotsEnable;
int clusterTcpPort = 7300;
int clusterTimeout; // used?
bool clusterSkimmerSpotsEnable; // where is this used?
};
#endif // PREFS_H

Wyświetl plik

@ -74,41 +74,23 @@ private slots:
void on_toneDTCS_clicked();
void on_splitPlusButton_clicked();
void on_splitMinusBtn_clicked();
void on_splitTxFreqSetBtn_clicked();
void on_selABtn_clicked();
void on_selBBtn_clicked();
void on_aEqBBtn_clicked();
void on_swapABBtn_clicked();
void on_selMainBtn_clicked();
void on_selSubBtn_clicked();
void on_mEqSBtn_clicked();
void on_swapMSBtn_clicked();
void on_setToneSubVFOBtn_clicked();
void on_setRptrSubVFOBtn_clicked();
void on_rptrOffsetSetBtn_clicked();
void on_splitOffBtn_clicked();
void on_splitEnableChk_clicked();
void on_rptrOffsetEdit_returnPressed();
void on_splitTransmitFreqEdit_returnPressed();
void on_setSplitRptrToneChk_clicked(bool checked);
void on_quickSplitChk_clicked(bool checked);
private:

Wyświetl plik

@ -176,6 +176,11 @@ struct bandStackType {
//model_kind determineRadioModel(unsigned char rigID);
struct bsrRequest {
availableBands band;
int bsrPosition=1;
};
struct rigCapabilities {
quint8 model;
quint8 civ;

1613
settingswidget.cpp 100644

Plik diff jest za duży Load Diff

191
settingswidget.h 100644
Wyświetl plik

@ -0,0 +1,191 @@
#ifndef SETTINGSWIDGET_H
#define SETTINGSWIDGET_H
#include <QStandardItemModel>
#include <QWidget>
#include <QList>
#include <QInputDialog>
#include <QFile>
#include <QSlider>
#include <QSpinBox>
#include <QCheckBox>
#include <QRadioButton>
#include <QLineEdit>
#include <QStringList>
#include "logcategories.h"
#include "prefs.h"
#include "colorprefs.h"
#include "udpbase.h" // for udp preferences
#include "cluster.h" // for clusterSettings
#include "rigidentities.h" // for rigInputs
#include "udpserver.h" // for SERVERCONFIG
namespace Ui {
class settingswidget;
}
class settingswidget : public QWidget
{
Q_OBJECT
public:
explicit settingswidget(QWidget *parent = nullptr);
~settingswidget();
public slots:
void acceptPreferencesPtr(preferences *pptr);
void acceptUdpPreferencesPtr(udpPreferences *upptr);
void acceptServerConfig(SERVERCONFIG *serverConfig);
void copyClusterList(QList<clusterSettings> c);
void insertClusterOutputText(QString text);
void updateIfPrefs(int items);
void updateRaPrefs(int items);
void updateCtPrefs(int items);
void updateLanPrefs(int items);
void updateClusterPrefs(int items);
void updateServerConfigs(int items);
void updateIfPref(prefIfItem pif);
void updateRaPref(prefRaItem pra);
void updateCtPref(prefCtItem pct);
void updateLanPref(prefLanItem plan);
void updateClusterPref(prefClusterItem pcl);
void updateServerConfig(serverItems si);
void updateUdpPref(udpPrefsItem upi);
void updateUdpPrefs(int items);
void updateAudioInputs(QStringList deviceList, int currentIndex, int chars);
void updateAudioOutputs(QStringList deviceList, int currentIndex, int chars);
void updateServerRXAudioInputs(QStringList deviceList, int currentIndex, int chars);
void updateServerTXAudioOutputs(QStringList deviceList, int currentIndex, int chars);
void updateSerialPortList(QStringList deviceList, QVector<int> data);
void updateVSPList(QStringList deviceList, QVector<int> data);
void updateModSourceList(QStringList deviceNames, QVector<rigInput> data);
void updateDataModSourceList(QStringList deviceNames, QVector<rigInput> data);
signals:
void changedIfPrefs(int items);
void changedRaPrefs(int items);
void changedCtPrefs(int items);
void changedLanPrefs(int items);
void changedClusterPrefs(int items);
void changedUdpPrefs(int items);
void changedServerConfigs(int i);
void changedAudioOutputCombo(int index);
void changedAudioInputCombo(int index);
void changedServerTXAudioOutputCombo(int index);
void changedServerRXAudioInputCombo(int index);
void changedIfPref(prefIfItem i);
void changedRaPref(prefRaItem i);
void changedCtPref(prefCtItem i);
void changedLanPref(prefLanItem i);
void changedClusterPref(prefClusterItem i);
void changedUdpPref(udpPrefsItem i);
void changedServerConfig(serverItems i);
void showUSBControllerSetup();
private slots:
void on_settingsList_currentRowChanged(int currentRow);
void onServerUserFieldChanged();
void on_lanEnableBtn_clicked(bool checked);
void on_autoSSBchk_clicked(bool checked);
void on_useSystemThemeChk_clicked(bool checked);
void on_enableUsbChk_clicked(bool checked);
void on_usbControllerBtn_clicked();
void on_autoPollBtn_clicked(bool checked);
void on_manualPollBtn_clicked(bool checked);
void on_pollTimeMsSpin_valueChanged(int arg1);
void on_serialDeviceListCombo_activated(const QString &arg1);
void on_baudRateCombo_activated(int index);
void on_vspCombo_activated(int index);
void on_audioSystemCombo_currentIndexChanged(int index);
void on_audioSystemServerCombo_currentIndexChanged(int index);
void on_meter2selectionCombo_currentIndexChanged(int index);
void on_tuningFloorZerosChk_clicked(bool checked);
void on_fullScreenChk_clicked(bool checked);
void on_wfAntiAliasChk_clicked(bool checked);
void on_wfInterpolateChk_clicked(bool checked);
void on_underlayNone_clicked(bool checked);
void on_underlayPeakHold_clicked(bool checked);
void on_underlayPeakBuffer_clicked(bool checked);
void on_underlayAverageBuffer_clicked(bool checked);
void on_underlayBufferSlider_valueChanged(int value);
void on_pttEnableChk_clicked(bool checked);
void on_clickDragTuningEnableChk_clicked(bool checked);
void on_serialEnableBtn_clicked(bool checked);
void on_enableRigctldChk_clicked(bool checked);
void on_rigctldPortTxt_editingFinished();
void on_tcpServerPortTxt_editingFinished();
void on_clusterServerNameCombo_currentIndexChanged(int index);
void on_clusterUdpEnable_clicked(bool checked);
void on_clusterTcpEnable_clicked(bool checked);
void on_clusterTcpSetNowBtn_clicked();
void on_clusterServerNameCombo_currentTextChanged(const QString &arg1);
void on_clusterTcpPortLineEdit_editingFinished();
void on_clusterUsernameLineEdit_editingFinished();
void on_clusterPasswordLineEdit_editingFinished();
void on_clusterTimeoutLineEdit_editingFinished();
void on_clusterUdpPortLineEdit_editingFinished();
void on_clusterSkimmerSpotsEnable_clicked(bool checked);
void on_debugBtn_clicked();
void on_ipAddressTxt_textChanged(const QString &arg1);
void on_usernameTxt_textChanged(const QString &arg1);
void on_controlPortTxt_textChanged(const QString &arg1);
void on_passwordTxt_textChanged(const QString &arg1);
void on_audioDuplexCombo_currentIndexChanged(int index);
void on_audioOutputCombo_currentIndexChanged(int index);
void on_audioInputCombo_currentIndexChanged(int index);
void on_serverRXAudioInputCombo_currentIndexChanged(int index);
void on_serverTXAudioOutputCombo_currentIndexChanged(int index);
void on_serverEnableCheckbox_clicked(bool checked);
void on_serverAddUserBtn_clicked();
private:
Ui::settingswidget *ui;
void createSettingsListItems();
void populateComboBoxes();
void updateAllPrefs();
void updateUnderlayMode();
void setUItoClustersList();
// Utility:
void quietlyUpdateSlider(QSlider* sl, int val);
void quietlyUpdateSpinbox(QSpinBox *sb, int val);
void quietlyUpdateCheckbox(QCheckBox *cb, bool isChecked);
void quietlyUpdateRadiobutton(QRadioButton *rb, bool isChecked);
void quietlyUpdateLineEdit(QLineEdit *le, const QString text);
void populateServerUsers();
void serverAddUserLine(const QString& user, const QString& pass, const int& type);
preferences *prefs = NULL;
udpPreferences *udpPrefs = NULL;
SERVERCONFIG *serverConfig = NULL;
bool havePrefs = false;
bool haveUdpPrefs = false;
bool haveServerConfig = false;
bool haveSerialDevices = false;
bool haveVspDevices = false;
bool haveAudioInputs = false;
bool haveAudioOutputs = false;
bool haveServerAudioInputs = false;
bool haveServerAudioOutputs = false;
bool haveClusterList = false;
bool updatingUIFromPrefs = false;
QList<clusterSettings> clusters;
};
#endif // SETTINGSWIDGET_H

3187
settingswidget.ui 100644

Plik diff jest za duży Load Diff

Wyświetl plik

@ -24,6 +24,18 @@
#include "packettypes.h"
enum udpPrefsItem {
u_ipAddress = 1 << 0,
u_controlLANPort = 1 << 1,
u_serialLANPort = 1 << 2,
u_audioLANPort = 1 << 3,
u_username = 1 << 4,
u_password = 1 << 5,
u_clientName = 1 << 6,
u_waterfallFormat = 1 << 7,
u_halfDuplex = 1 << 8,
u_all = 1 << 9
};
struct udpPreferences {

Wyświetl plik

@ -94,6 +94,21 @@ struct SERVERCONFIG {
QList <RIGCONFIG*> rigs;
};
enum serverItems {
s_enabled = 1 << 0,
s_lan = 1 << 1,
s_controlPort = 1 << 2,
s_civPort = 1 << 3,
s_audioPort = 1 << 4,
s_audioOutput = 1 << 5,
s_audioInput = 1 << 6,
s_resampleQuality = 1 << 7,
s_baudRate = 1 << 8,
s_users = 1 << 9,
s_rigs = 1 << 10,
s_all = 1 << 11
};
class udpServer : public QObject
{

1455
wfmain.cpp

Plik diff jest za duży Load Diff

270
wfmain.h
Wyświetl plik

@ -38,6 +38,9 @@
#include "satellitesetup.h"
#include "transceiveradjustments.h"
#include "cwsender.h"
#include "bandbuttons.h"
#include "frequencyinputwidget.h"
#include "settingswidget.h"
#include "udpserver.h"
#include "qledlabel.h"
#include "rigctld.h"
@ -305,6 +308,22 @@ signals:
void haveMemory(memoryType mem);
private slots:
// Triggered from external preference changes:
void extChangedIfPrefs(int items);
void extChangedRaPrefs(int items);
void extChangedCtPrefs(int items);
void extChangedLanPrefs(int items);
void extChangedClusterPrefs(int items);
void extChangedUdpPrefs(int items);
void extChangedIfPref(prefIfItem i);
void extChangedRaPref(prefRaItem i);
void extChangedCtPref(prefCtItem i);
void extChangedLanPref(prefLanItem i);
void extChangedClusterPref(prefClusterItem i);
void extChangedUdpPref(udpPrefsItem i);
void receiveValue(cacheItem val);
void setAudioDevicesUI();
void updateSizes(int tabIndex);
@ -355,8 +374,8 @@ private slots:
void receivespectrumMode_t(spectrumMode_t spectMode);
void receiveSpectrumSpan(freqt freqspan, bool isSub);
void receivePTTstatus(bool pttOn);
void receiveDataModeStatus(unsigned char data, unsigned char filter);
void receiveBandStackReg(freqt f, char mode, char filter, bool dataOn); // freq, mode, (filter,) datamode
void receiveDataModeStatus(bool dataOn);
void handleBandStackReg(freqt f, char mode, char filter, bool dataOn); // freq, mode, (filter,) datamode
void receiveRITStatus(bool ritEnabled);
void receiveRITValue(int ritValHz);
void receiveModInput(rigInput input, unsigned char data);
@ -435,84 +454,21 @@ private slots:
void buttonControl(const COMMAND* cmd);
// void on_getFreqBtn_clicked();
// void on_getModeBtn_clicked();
// void on_debugBtn_clicked();
void on_clearPeakBtn_clicked();
void on_fullScreenChk_clicked(bool checked);
void changeFullScreenMode(bool checked);
void on_goFreqBtn_clicked();
void on_f0btn_clicked();
void on_f1btn_clicked();
void on_f2btn_clicked();
void on_f3btn_clicked();
void on_f4btn_clicked();
void on_f5btn_clicked();
void on_f6btn_clicked();
void on_f7btn_clicked();
void on_f8btn_clicked();
void on_f9btn_clicked();
void on_fDotbtn_clicked();
void on_fBackbtn_clicked();
void on_fCEbtn_clicked();
void on_fEnterBtn_clicked();
void on_usbControllerBtn_clicked();
void on_usbControllersResetBtn_clicked();
void on_enableUsbChk_clicked(bool checked);
void on_scopeBWCombo_currentIndexChanged(int index);
void on_scopeEdgeCombo_currentIndexChanged(int index);
void on_modeSelectCombo_activated(int index);
void on_freqDial_valueChanged(int value);
void on_band6mbtn_clicked();
void on_band10mbtn_clicked();
void on_band12mbtn_clicked();
void on_band15mbtn_clicked();
void on_band17mbtn_clicked();
void on_band20mbtn_clicked();
void on_band30mbtn_clicked();
void on_band40mbtn_clicked();
void on_band60mbtn_clicked();
void on_band80mbtn_clicked();
void on_band160mbtn_clicked();
void on_bandGenbtn_clicked();
void on_aboutBtn_clicked();
void on_fStoBtn_clicked();
void on_fRclBtn_clicked();
void on_rfGainSlider_valueChanged(int value);
void on_afGainSlider_valueChanged(int value);
void on_monitorSlider_valueChanged(int value);
@ -520,75 +476,40 @@ private slots:
void on_monitorCheck_clicked(bool checked);
void on_tuneNowBtn_clicked();
void on_tuneEnableChk_clicked(bool checked);
void on_exitBtn_clicked();
void on_pttOnBtn_clicked();
void on_pttOffBtn_clicked();
void on_saveSettingsBtn_clicked();
void on_debugBtn_clicked();
void on_pttEnableChk_clicked(bool checked);
void on_lanEnableBtn_clicked(bool checked);
void on_ipAddressTxt_textChanged(QString text);
void on_controlPortTxt_textChanged(QString text);
void on_usernameTxt_textChanged(QString text);
void on_passwordTxt_textChanged(QString text);
void on_audioDuplexCombo_currentIndexChanged(int value);
void on_audioOutputCombo_currentIndexChanged(int value);
void on_audioInputCombo_currentIndexChanged(int value);
void changedAudioInput(int value);
void changedAudioOutput(int value);
void on_toFixedBtn_clicked();
void on_connectBtn_clicked();
void on_rxLatencySlider_valueChanged(int value);
void on_txLatencySlider_valueChanged(int value);
void on_audioRXCodecCombo_currentIndexChanged(int value);
void on_audioTXCodecCombo_currentIndexChanged(int value);
void on_audioSampleRateCombo_currentIndexChanged(int value);
void on_vspCombo_currentIndexChanged(int value);
void on_scopeEnableWFBtn_stateChanged(int state);
void on_scopeEnableWFBtn_clicked(bool checked);
void on_sqlSlider_valueChanged(int value);
void on_modeFilterCombo_activated(int index);
void on_datamodeCombo_activated(int index);
void on_transmitBtn_clicked();
void on_adjRefBtn_clicked();
void on_satOpsBtn_clicked();
void on_txPowerSlider_valueChanged(int value);
void on_micGainSlider_valueChanged(int value);
void on_scopeRefLevelSlider_valueChanged(int value);
void on_useSystemThemeChk_clicked(bool checked);
void useSystemTheme(bool checked);
void on_modInputCombo_activated(int index);
void on_modInputData1Combo_activated(int index);
@ -600,69 +521,26 @@ private slots:
void on_spectrumMode_tCombo_currentIndexChanged(int index);
void on_serialEnableBtn_clicked(bool checked);
void on_tuningStepCombo_currentIndexChanged(int index);
void on_serialDeviceListCombo_textActivated(const QString &arg1);
void on_rptSetupBtn_clicked();
void on_attSelCombo_activated(int index);
void on_preampSelCombo_activated(int index);
void on_antennaSelCombo_activated(int index);
void on_rxAntennaCheck_clicked(bool value);
void on_wfthemeCombo_activated(int index);
void on_rigPowerOnBtn_clicked();
void on_rigPowerOffBtn_clicked();
void on_ritTuneDial_valueChanged(int value);
void on_ritEnableChk_clicked(bool checked);
void on_band23cmbtn_clicked();
void on_band70cmbtn_clicked();
void on_band2mbtn_clicked();
void on_band4mbtn_clicked();
void on_band630mbtn_clicked();
void on_band2200mbtn_clicked();
void on_bandAirbtn_clicked();
void on_bandWFMbtn_clicked();
void on_rigCIVManualAddrChk_clicked(bool checked);
void on_rigCIVaddrHexLine_editingFinished();
void on_baudRateCombo_activated(int);
void on_wfLengthSlider_valueChanged(int value);
void on_wfAntiAliasChk_clicked(bool checked);
void on_wfInterpolateChk_clicked(bool checked);
void on_meter2selectionCombo_activated(int index);
void on_waterfallFormatCombo_activated(int index);
void on_enableRigctldChk_clicked(bool checked);
void on_rigctldPortTxt_editingFinished();
void on_tcpServerPortTxt_editingFinished();
void changeMeter2Type(meterKind m);
void enableRigCtl(bool enabled);
void on_moreControlsBtn_clicked();
void on_memoriesBtn_clicked();
@ -672,135 +550,73 @@ private slots:
void receiveStateInfo(rigstate* state);
void on_settingsList_currentRowChanged(int currentRow);
void on_setClockBtn_clicked();
void on_serverEnableCheckbox_clicked(bool checked);
void on_serverControlPortText_textChanged(QString text);
void on_serverCivPortText_textChanged(QString text);
void on_serverAudioPortText_textChanged(QString text);
void on_serverTXAudioOutputCombo_currentIndexChanged(int value);
void on_serverRXAudioInputCombo_currentIndexChanged(int value);
void changedServerTXAudioOutput(int value);
void changedServerRXAudioInput(int value);
void onServerUserFieldChanged();
void on_serverAddUserBtn_clicked();
void on_useRTSforPTTchk_clicked(bool checked);
void on_radioStatusBtn_clicked();
void on_audioSystemCombo_currentIndexChanged(int value);
void on_topLevelSlider_valueChanged(int value);
void on_botLevelSlider_valueChanged(int value);
void on_underlayBufferSlider_valueChanged(int value);
void on_underlayNone_toggled(bool checked);
void on_underlayPeakHold_toggled(bool checked);
void on_underlayPeakBuffer_toggled(bool checked);
void on_underlayAverageBuffer_toggled(bool checked);
void on_colorSetBtnGrid_clicked();
void on_colorSetBtnPlotBackground_clicked();
void on_colorSetBtnText_clicked();
void on_colorSetBtnSpecLine_clicked();
void on_colorSetBtnSpecFill_clicked();
void on_colorEditPlotBackground_editingFinished();
void on_colorPopOutBtn_clicked();
void on_colorPresetCombo_currentIndexChanged(int index);
void on_colorEditSpecLine_editingFinished();
void on_colorEditGrid_editingFinished();
void on_colorEditText_editingFinished();
void on_colorEditSpecFill_editingFinished();
void on_colorSetBtnAxis_clicked();
void on_colorEditAxis_editingFinished();
void on_colorSetBtnUnderlayLine_clicked();
void on_colorEditUnderlayLine_editingFinished();
void on_colorSetBtnUnderlayFill_clicked();
void on_colorEditUnderlayFill_editingFinished();
void on_colorSetBtnwfBackground_clicked();
void on_colorEditWfBackground_editingFinished();
void on_colorSetBtnWfGrid_clicked();
void on_colorEditWfGrid_editingFinished();
void on_colorSetBtnWfAxis_clicked();
void on_colorEditWfAxis_editingFinished();
void on_colorSetBtnWfText_clicked();
void on_colorEditWfText_editingFinished();
void on_colorSetBtnTuningLine_clicked();
void on_colorEditTuningLine_editingFinished();
void on_colorSetBtnPassband_clicked();
void on_colorEditPassband_editingFinished();
void on_colorSetBtnPBT_clicked();
void on_colorEditPBT_editingFinished();
void on_colorSetBtnMeterLevel_clicked();
void on_colorEditMeterLevel_editingFinished();
void on_colorSetBtnMeterAvg_clicked();
void on_colorEditMeterAvg_editingFinished();
void on_colorSetBtnMeterScale_clicked();
void on_colorEditMeterScale_editingFinished();
void on_colorSetBtnMeterText_clicked();
void on_colorEditMeterText_editingFinished();
void on_colorSetBtnClusterSpots_clicked();
void on_colorEditClusterSpots_editingFinished();
void on_colorRenamePresetBtn_clicked();
void on_colorRevertPresetBtn_clicked();
void on_colorSetBtnMeterPeakLevel_clicked();
void on_colorEditMeterPeakLevel_editingFinished();
void on_colorSetBtnMeterPeakScale_clicked();
void on_colorEditMeterPeakScale_editingFinished();
void on_colorSavePresetBtn_clicked();
void on_showLogBtn_clicked();
@ -826,16 +642,14 @@ private slots:
void receiveClusterOutput(QString text);
void receiveSpots(QList<spotData> spots);
void on_autoPollBtn_clicked(bool checked);
void on_manualPollBtn_clicked(bool checked);
void on_pollTimeMsSpin_valueChanged(int arg1);
void on_autoSSBchk_clicked(bool checked);
void on_cwButton_clicked();
void on_showBandsBtn_clicked();
void on_showFreqBtn_clicked();
void on_showSettingsBtn_clicked();
void on_rigCreatorBtn_clicked();
private:
@ -847,9 +661,9 @@ private:
QSettings *settings=Q_NULLPTR;
void loadSettings();
void saveSettings();
void connectSettingsWidget();
void createSettingsListItems();
void connectSettingsList();
void initLogging();
QTimer logCheckingTimer;
@ -870,7 +684,6 @@ private:
void computePlasma();
void showHideSpectrum(bool show);
void getInitialRigState();
void setBandButtons();
void showButton(QPushButton *btn);
void hideButton(QPushButton *btn);
@ -995,8 +808,7 @@ private:
bool onFullscreen;
bool freqTextSelected;
void checkFreqSel();
void setUISpectrumControlsToMode(spectrumMode_t smode);
void setUISpectrumControlsToMode(spectrumMode smode);
double oldLowerFreq;
double oldUpperFreq;
@ -1025,6 +837,8 @@ private:
datekind datesetpoint;
freqMemory mem;
void gotoMemoryPreset(int presetNumber);
void saveMemoryPreset(int presetNumber);
colorPrefsType colorPreset[numColorPresetsTotal];
@ -1080,6 +894,7 @@ private:
void changeTxBtn();
void changeSliderQuietly(QSlider *slider, int value);
void showAndRaiseWidget(QWidget *w);
void statusFromSliderPercent(QString name, int percentValue);
void statusFromSliderRaw(QString name, int rawValue);
@ -1130,6 +945,9 @@ private:
selectRadio *selRad = Q_NULLPTR;
loggingWindow *logWindow = Q_NULLPTR;
rigCreator *creator = Q_NULLPTR;
bandbuttons* bandbtns;
frequencyinputwidget* finputbtns;
settingswidget* setupui;
udpServer* udp = Q_NULLPTR;
rigCtlD* rigCtl = Q_NULLPTR;

1386
wfmain.ui

Plik diff jest za duży Load Diff

Wyświetl plik

@ -230,11 +230,14 @@ win32:INCLUDEPATH += ../qcustomplot
INCLUDEPATH += resampler
SOURCES += main.cpp\
bandbuttons.cpp \
cachingqueue.cpp \
cwsender.cpp \
frequencyinputwidget.cpp \
cwsidetone.cpp \
debugwindow.cpp \
loggingwindow.cpp \
settingswidget.cpp \
memories.cpp \
rigcreator.cpp \
tablewidget.cpp \
@ -272,10 +275,12 @@ SOURCES += main.cpp\
audiodevices.cpp
HEADERS += wfmain.h \
bandbuttons.h \
cachingqueue.h \
colorprefs.h \
commhandler.h \
cwsender.h \
frequencyinputwidget.h \
cwsidetone.h \
debugwindow.h \
loggingwindow.h \
@ -286,6 +291,7 @@ HEADERS += wfmain.h \
freqmemory.h \
rigcreator.h \
rigidentities.h \
settingswidget.h \
sidebandchooser.h \
tablewidget.h \
udpbase.h \
@ -325,8 +331,10 @@ HEADERS += wfmain.h \
audiodevices.h
FORMS += wfmain.ui \
bandbuttons.ui \
calibrationwindow.ui \
cwsender.ui \
frequencyinputwidget.ui \
debugwindow.ui \
loggingwindow.ui \
memories.ui \
@ -334,6 +342,7 @@ FORMS += wfmain.ui \
satellitesetup.ui \
selectradio.ui \
repeatersetup.ui \
settingswidget.ui \
transceiveradjustments.ui \
controllersetup.ui \
aboutbox.ui