creator-widgets
Phil Taylor 2023-07-16 10:08:28 +01:00
rodzic d5fb3536e1
commit 9b8cfa3d71
7 zmienionych plików z 220 dodań i 62 usunięć

Wyświetl plik

@ -6212,6 +6212,18 @@ void rigCommander::receiveCommand(funcs func, QVariant value, bool sub)
}
payload.append(bcdEncodeInt(value.value<uint>() & 0xffff));
}
else if (!strcmp(value.typeName(),"int") && (func == funcScopeMainRef || func == funcScopeSubRef))
{
bool isNegative = false;
int level = value.value<int>();
if(level < 0)
{
isNegative = true;
level *= -1;
}
payload.append(bcdEncodeInt(level*10));
payload.append(static_cast<unsigned char>(isNegative));
}
else if (!strcmp(value.typeName(),"modeInfo"))
{
if (func == funcDataModeWithFilter)

Wyświetl plik

@ -40,18 +40,16 @@ spectrumScope::spectrumScope(QWidget *parent)
holdButton = new QPushButton("HOLD");
holdButton->setCheckable(true);
holdButton->setFocusPolicy(Qt::NoFocus);
speedCombo = new QComboBox();
speedCombo->addItem("Speed Fast",QVariant::fromValue(uchar(0)));
speedCombo->addItem("Speed Mid",QVariant::fromValue(uchar(1)));
speedCombo->addItem("Speed Slow",QVariant::fromValue(uchar(2)));
controlSpacer = new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Fixed);
midSpacer = new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Fixed);
clearPeaksButton = new QPushButton("Clear Peaks");
themeCombo = new QComboBox();
themeCombo->setAccessibleName("Waterfall display color themey");
themeCombo->setAccessibleDescription("Selects the theme for the color waterfall display");
themeCombo->setToolTip("Waterfall color theme");
configButton = new QPushButton("Conf");
configButton->setAccessibleName("Configure Scope");
configButton->setAccessibleDescription("Change various settings of the current Scope");
configButton->setToolTip("Configure Scope");
modeCombo = new QComboBox();
dataCombo = new QComboBox();
@ -80,14 +78,13 @@ spectrumScope::spectrumScope(QWidget *parent)
controlLayout->addWidget(edgeButton);
controlLayout->addWidget(toFixedButton);
controlLayout->addWidget(holdButton);
controlLayout->addWidget(speedCombo);
controlLayout->addSpacerItem(controlSpacer);
controlLayout->addWidget(modeCombo);
controlLayout->addWidget(dataCombo);
controlLayout->addWidget(filterCombo);
controlLayout->addSpacerItem(midSpacer);
controlLayout->addWidget(clearPeaksButton);
controlLayout->addWidget(themeCombo);
controlLayout->addWidget(configButton);
this->layout->setContentsMargins(5,5,5,5);
@ -97,20 +94,6 @@ spectrumScope::spectrumScope(QWidget *parent)
scopeModeCombo->addItem("Scroll-F", (spectrumMode_t)spectModeScrollF);
scopeModeCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents);
themeCombo->addItem("Theme Jet", QCPColorGradient::gpJet);
themeCombo->addItem("Theme Cold", QCPColorGradient::gpCold);
themeCombo->addItem("Theme Hot", QCPColorGradient::gpHot);
themeCombo->addItem("Theme Therm", QCPColorGradient::gpThermal);
themeCombo->addItem("Theme Night", QCPColorGradient::gpNight);
themeCombo->addItem("Theme Ion", QCPColorGradient::gpIon);
themeCombo->addItem("Theme Gray", QCPColorGradient::gpGrayscale);
themeCombo->addItem("Theme Geo", QCPColorGradient::gpGeography);
themeCombo->addItem("Theme Hues", QCPColorGradient::gpHues);
themeCombo->addItem("Theme Polar", QCPColorGradient::gpPolar);
themeCombo->addItem("Theme Spect", QCPColorGradient::gpSpectrum);
themeCombo->addItem("Theme Candy", QCPColorGradient::gpCandy);
themeCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents);
edgeCombo->insertItems(0, QStringList({"Fixed Edge 1","Fixed Edge 2","Fixed Edge 3","Fixed Edge 4"}));
//edgeCombo->setSizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow);
@ -185,13 +168,12 @@ spectrumScope::spectrumScope(QWidget *parent)
connect(scopeModeCombo,SIGNAL(currentIndexChanged(int)),this,SLOT(updatedScopeMode(int)));
connect(spanCombo,SIGNAL(currentIndexChanged(int)),this,SLOT(updatedSpan(int)));
connect(themeCombo,SIGNAL(currentIndexChanged(int)),this,SLOT(updatedTheme(int)));
connect(configButton,SIGNAL(pressed()), this, SLOT(configPressed()));
connect(toFixedButton,SIGNAL(pressed()), this, SLOT(toFixedPressed()));
connect(edgeCombo,SIGNAL(currentIndexChanged(int)),this,SLOT(updatedEdge(int)));
connect(edgeButton,SIGNAL(pressed()), this, SLOT(customSpanPressed()));
connect(speedCombo,SIGNAL(currentIndexChanged(int)),this,SLOT(updatedSpeed(int)));
connect(holdButton,SIGNAL(toggled(bool)), this, SLOT(holdPressed(bool)));
connect(modeCombo,SIGNAL(currentIndexChanged(int)),this,SLOT(updatedMode(int)));
@ -686,10 +668,9 @@ void spectrumScope::enableScope(bool en)
this->toFixedButton->setVisible(en);
this->spanCombo->setVisible(en);
}
this->themeCombo->setVisible(en);
this->clearPeaksButton->setVisible(en);
this->speedCombo->setVisible(en);
this->holdButton->setVisible(en);
this->configButton->setVisible(en);
}
void spectrumScope::selectScopeMode(spectrumMode_t m)
@ -731,11 +712,6 @@ void spectrumScope::updatedMode(int index)
queue->add(priorityImmediate,queueItem((sub?funcUnselectedMode:funcSelectedMode),QVariant::fromValue(mi),false,sub));
}
void spectrumScope::updatedTheme(int index)
{
currentTheme = themeCombo->itemData(index).toInt();
colorMap->setGradient(static_cast<QCPColorGradient::GradientPreset>(currentTheme));
}
void spectrumScope::updatedEdge(int index)
{
@ -1281,11 +1257,6 @@ void spectrumScope::selected(bool en)
this->setStyleSheet("QGroupBox { border:2px solid gray;}");
}
void spectrumScope::updatedSpeed(int index)
{
queue->add(priorityImmediate,queueItem(sub?funcScopeSubSpeed:funcScopeMainSpeed,this->speedCombo->itemData(index),false,sub));
}
void spectrumScope::holdPressed(bool en)
{
queue->add(priorityImmediate,queueItem(sub?funcScopeSubHold:funcScopeMainHold,QVariant::fromValue(en),false,sub));
@ -1300,9 +1271,7 @@ void spectrumScope::setHold(bool h)
void spectrumScope::setSpeed(uchar s)
{
this->speedCombo->blockSignals(true);
this->speedCombo->setCurrentIndex(this->speedCombo->findData(s));
this->speedCombo->blockSignals(false);
this->currentSpeed = s;
}
@ -1394,3 +1363,111 @@ void spectrumScope::receiveSpots(QList<spotData> spots)
//qDebug(logCluster()) << "Processing took" << timer.nsecsElapsed() / 1000 << "us";
}
void spectrumScope::configPressed()
{
QDialog* configDialog = new QDialog(this);
configDialog->setModal(true);
QFormLayout* layout = new QFormLayout;
//spotDialog->setFixedSize(240, 100);
configDialog->setBaseSize(1, 1);
configDialog->setWindowTitle(QString("Config %0 Scope").arg(this->sub?"Sub":"Main"));
configDialog->setLayout(layout);
QSlider* ref = new QSlider(Qt::Orientation::Horizontal);
ref->setRange(-200,200);
ref->setTickInterval(50);
ref->setSingleStep(20);
ref->setValue(0);
ref->setAccessibleName("Scope display reference");
ref->setAccessibleDescription("Selects the display reference for the Scope display");
ref->setToolTip("Select display reference of scope");
layout->addRow("Ref",ref);
QSlider* length = new QSlider(Qt::Orientation::Horizontal);
length->setRange(100,1024);
length->setValue(400);
layout->addRow("Length",length);
QSlider* top = new QSlider(Qt::Orientation::Horizontal);
top->setRange(1,160);
top->setValue(160);
top->setAccessibleName("Scope display ceiling");
top->setAccessibleDescription("Selects the display ceiling for the Scope display");
top->setToolTip("Select display ceiling of scope");
layout->addRow("Ceiling",top);
QSlider* bottom = new QSlider(Qt::Orientation::Horizontal);
bottom->setRange(0,160);
bottom->setValue(0);
bottom->setAccessibleName("Scope display floor");
bottom->setAccessibleDescription("Selects the display floor for the Scope display");
bottom->setToolTip("Select display floor of scope");
layout->addRow("Floor",bottom);
QComboBox* speed = new QComboBox();
speed->addItem("Speed Fast",QVariant::fromValue(uchar(0)));
speed->addItem("Speed Mid",QVariant::fromValue(uchar(1)));
speed->addItem("Speed Slow",QVariant::fromValue(uchar(2)));
speed->setCurrentIndex(speed->findData(currentSpeed));
speed->setAccessibleName("Waterfall display speed");
speed->setAccessibleDescription("Selects the speed for the waterfall display");
speed->setToolTip("Waterfall Speed");
layout->addRow("Speed",speed);
QComboBox* theme = new QComboBox();
theme->setAccessibleName("Waterfall display color theme");
theme->setAccessibleDescription("Selects the color theme for the waterfall display");
theme->setToolTip("Waterfall color theme");
theme->addItem("Theme Jet", QCPColorGradient::gpJet);
theme->addItem("Theme Cold", QCPColorGradient::gpCold);
theme->addItem("Theme Hot", QCPColorGradient::gpHot);
theme->addItem("Theme Therm", QCPColorGradient::gpThermal);
theme->addItem("Theme Night", QCPColorGradient::gpNight);
theme->addItem("Theme Ion", QCPColorGradient::gpIon);
theme->addItem("Theme Gray", QCPColorGradient::gpGrayscale);
theme->addItem("Theme Geo", QCPColorGradient::gpGeography);
theme->addItem("Theme Hues", QCPColorGradient::gpHues);
theme->addItem("Theme Polar", QCPColorGradient::gpPolar);
theme->addItem("Theme Spect", QCPColorGradient::gpSpectrum);
theme->addItem("Theme Candy", QCPColorGradient::gpCandy);
theme->setSizeAdjustPolicy(QComboBox::AdjustToContents);
qInfo() << "Selecting theme" << currentTheme << theme->itemText(currentTheme);
theme->setCurrentIndex(currentTheme);
layout->addRow("Theme",theme);
connect(length, &QSlider::valueChanged, configDialog, [=](const int &val) {
prepareWf(val);
});
connect(bottom, &QSlider::valueChanged, configDialog, [=](const int &val) {
this->plotFloor = val;
this->setRange(plotFloor,plotCeiling);
});
connect(top, &QSlider::valueChanged, configDialog, [=](const int &val) {
this->plotCeiling = val;
this->setRange(plotFloor,plotCeiling);
});
connect(ref, &QSlider::valueChanged, configDialog, [=](const int &val) {
currentRef = (val/5) * 5; // rounded to "nearest 5"
queue->add(priorityImmediate,queueItem(sub?funcScopeSubRef:funcScopeMainRef,QVariant::fromValue(currentRef),false,sub));
});
connect(speed, &QComboBox::currentIndexChanged, configDialog, [=](const int &val) {
queue->add(priorityImmediate,queueItem(sub?funcScopeSubSpeed:funcScopeMainSpeed,speed->itemData(val),false,sub));
});
connect(theme, &QComboBox::currentIndexChanged, configDialog, [=](const int &val) {
currentTheme = val;
colorMap->setGradient(static_cast<QCPColorGradient::GradientPreset>(currentTheme));
emit updateTheme(sub,val);
});
configDialog->show();
}
void spectrumScope::wfTheme(int num)
{
currentTheme = num;
colorMap->setGradient(static_cast<QCPColorGradient::GradientPreset>(num));
}

Wyświetl plik

@ -36,7 +36,7 @@ public:
void setRange(int floor, int ceiling);
void wfInterpolate(bool en) { colorMap->setInterpolate(en); }
void wfAntiAliased(bool en) { colorMap->setAntialiased(en); }
void wfTheme(int num) { colorMap->setGradient(static_cast<QCPColorGradient::GradientPreset>(num));}
void wfTheme(int num);
void setUnderlayMode(underlay_t un) { underlayMode = un; clearPeaks();}
void overflow(bool en) {ovfIndicator->setVisible(en);}
void resizePlasmaBuffer(int size);
@ -98,18 +98,18 @@ signals:
void updateScopeMode(spectrumMode_t index);
void updateSpan(centerSpanData s);
void showStatusBarText(QString text);
void updateTheme(bool sub, int value);
private slots:
void updatedScopeMode(int index);
void updatedSpan(int index);
void updatedTheme(int index);
void updatedEdge(int index);
void updatedMode(int index);
void updatedSpeed(int index);
void holdPressed(bool en);
void toFixedPressed();
void customSpanPressed();
void configPressed();
// Mouse interaction with scope/waterfall
void scopeClick(QMouseEvent *);
@ -152,14 +152,16 @@ private:
QComboBox* filterCombo;
QComboBox* antennaCombo;
QPushButton* holdButton;
QComboBox* speedCombo;
QCheckBox* rxCheckBox;
QComboBox* themeCombo;
QPushButton* configButton;
QSpacerItem* controlSpacer;
QSpacerItem* midSpacer;
int currentTheme = 1;
int currentRef = 0;
uchar currentSpeed = 0;
colorPrefsType colors;
freqt freq;
modeInfo mode;

Wyświetl plik

@ -5,14 +5,14 @@
static const tciCommandStruct tci_commands[] =
{
{
{ "vfo_limits", funcNone, 'l', 'l'},
{ "if_limits", funcNone, 'l', 'l'},
{ "trx_count", funcNone, 'u'},
{ "channel_count", funcNone, 'u'},
{ "device", funcNone, 't'},
{ "receive_only", funcNone, 'u'},
{ "modulations_list", funcNone },
{ "modulations_list", funcNone, 's'},
{ "tx_enable", funcNone, 'u','u'},
{ "ready", funcNone, },
{ "tx_footswitch", funcNone, 'u','b'},
@ -31,7 +31,7 @@ static const tciCommandStruct tci_commands[] =
{ "trx_count", funcNone, 'u'},
{ "trx_count", funcNone, 'u'},
{ "", funcNone, 0x0 },
};
};
tciServer::tciServer(quint16 port, QObject *parent) :
QObject(parent),
@ -86,7 +86,7 @@ void tciServer::onNewConnection()
pSocket->sendTextMessage(QString("audio_samplerate:48000;\n"));
pSocket->sendTextMessage(QString("mute:false;\n"));
pSocket->sendTextMessage(QString("vfo:0,0,%0;").arg(queue->getCache(funcSelectedFreq,false).value.value<freqt>().Hz));
pSocket->sendTextMessage(QString("modulation:0,%0;").arg(queue->getCache(funcSelectedMode,false).value.value<modeInfo>().name));
pSocket->sendTextMessage(QString("modulation:0,%0;").arg(queue->getCache(funcSelectedMode,false).value.value<modeInfo>().name.toLower()));
pSocket->sendTextMessage(QString("start;\n"));
pSocket->sendTextMessage(QString("ready;\n"));
}
@ -132,14 +132,49 @@ void tciServer::processIncomingTextMessage(QString message)
else if (cmd == "audio_samplerate" ) {
}
else if (cmd == "trx" ) {
//if (arg.size() == 1)
//it.value().rxaudio=false;
if (arg.size() == 1) {
it.value().rxaudio=false;
reply = QString("trx:%0,%1;").arg(QString::number(sub)).arg(queue->getCache(funcTransceiverStatus).value.value<bool>()?"true":"false");
}
else if (arg.size() == 2) {
bool on = arg[1]=="true"?1:0;
queue->add(priorityImmediate,queueItem(funcTransceiverStatus,QVariant::fromValue(on),false,sub));
}
}
else if (cmd == "vfo")
{
reply = QString("%0:%1,%2,%3;").arg(cmd).arg(arg[0]).arg(arg[1])
.arg(queue->getCache(sub?funcUnselectedFreq:funcSelectedFreq,sub).value.value<freqt>().Hz);
if (arg.size() == 2) {
reply = QString("%0:%1,%2,%3;").arg(cmd).arg(arg[0]).arg(arg[1])
.arg(queue->getCache(sub?funcUnselectedFreq:funcSelectedFreq,sub).value.value<freqt>().Hz);
}
else if (arg.size() == 3) {
qInfo() << "Freq" << arg[2];
freqt f;
f.Hz = arg[2].toUInt();
f.MHzDouble = f.Hz / (double)1E6;
queue->add(priorityImmediate,queueItem(sub?funcUnselectedFreq:funcSelectedFreq,QVariant::fromValue(f),false,sub));
}
}
else if (cmd == "modulation")
{
if (arg.size() == 1) {
reply = QString("modulation:%0,%1;").arg(QString::number(sub))
.arg(queue->getCache(sub?funcUnselectedMode:funcSelectedMode,sub).value.value<modeInfo>().name.toLower());
}
else if (arg.size() == 2) {
qInfo() << "Mode (TODO)" << arg[1];
reply = QString("modulation:%0,%1;").arg(QString::number(sub))
.arg(queue->getCache(sub?funcUnselectedMode:funcSelectedMode,sub).value.value<modeInfo>().name.toLower());
/*
freqt f;
f.Hz = arg[2].toUInt();
f.MHzDouble = f.Hz / (double)1E6;
queue->add(priorityImmediate,queueItem(sub?funcUnselectedFreq:funcSelectedFreq,QVariant::fromValue(f),false,sub));
*/
}
}
//reply = QString("vfo:0,%0,%1;").arg(QString::number(item.sub)).arg(item.value.value<freqt>().Hz);
if (pClient && !reply.isEmpty()) {
qInfo() << "Reply:" << reply;
@ -217,6 +252,7 @@ void tciServer::receiveCache(cacheItem item)
qInfo() << "Changed Cache" << funcString[item.command];
auto it = clients.begin();
QString reply;
while (it != clients.end())
{
if (it.value().connected)
@ -227,20 +263,26 @@ void tciServer::receiveCache(cacheItem item)
case funcFreqTR:
case funcSelectedFreq:
case funcUnselectedFreq:
it.key()->sendTextMessage(QString("vfo:0,%0,%1;").arg(QString::number(item.sub)).arg(item.value.value<freqt>().Hz));
reply = QString("vfo:0,%0,%1;").arg(QString::number(item.sub)).arg(item.value.value<freqt>().Hz);
break;
case funcModeTR:
case funcSelectedMode:
case funcUnselectedMode:
it.key()->sendTextMessage(QString("modulation:%0,%1;").arg(QString::number(item.sub)).arg(item.value.value<modeInfo>().name));
reply = QString("modulation:%0,%1;").arg(QString::number(item.sub)).arg(item.value.value<modeInfo>().name.toLower());
break;
case funcTransceiverStatus:
reply = QString("trx:%0,%1;").arg(QString::number(item.sub)).arg(item.value.value<bool>()?"true":"false");
break;
default:
break;
}
if (!reply.isEmpty()) {
it.key()->sendTextMessage(reply);
qInfo() << "Sending TCI:" << reply;
}
}
++it;
}
}

Wyświetl plik

@ -729,6 +729,9 @@ void wfmain::rigConnections()
connect(this, SIGNAL(setUTCOffset(timekind)), rig, SLOT(setUTCOffset(timekind)));
*/
connect(this, SIGNAL(setAfGain(unsigned char)), rig, SLOT(setAfGain(unsigned char)));
connect(ui->mainScope, SIGNAL(updateTheme(bool,int)), this, SLOT(receiveTheme(bool,int)));
connect(ui->subScope, SIGNAL(updateTheme(bool,int)), this, SLOT(receiveTheme(bool,int)));
}
//void wfmain::removeRigConnections()
@ -5901,6 +5904,7 @@ void wfmain::changePollTiming(int timing_ms, bool setUI)
void wfmain::connectionHandler(bool connect)
{
queue->clear();
emit sendCloseComm();
haveRigCaps = false;
rigName->setText("NONE");
@ -5917,8 +5921,6 @@ void wfmain::connectionHandler(bool connect)
memWindow = Q_NULLPTR;
}
// Also clear the queue
queue->clear();
}
@ -6521,6 +6523,12 @@ void wfmain::on_dualWatchBtn_toggled(bool en)
queue->add(priorityImmediate,queueItem(funcVFODualWatch,QVariant::fromValue(en),false,false));
}
void wfmain::receiveTheme(bool sub, int theme)
{
if (!sub)
prefs.wftheme = theme;
}
/* USB Hotplug support added at the end of the file for convenience */
#ifdef USB_HOTPLUG

Wyświetl plik

@ -326,6 +326,7 @@ private slots:
void extChangedUdpPref(prefUDPItem i);
void extChangedServerPref(prefServerItem i);
void receiveTheme(bool sub, int theme);
void receiveValue(cacheItem val);
void setAudioDevicesUI();
void updateSizes(int tabIndex);

Wyświetl plik

@ -1287,8 +1287,8 @@
<widget class="QCheckBox" name="monitorCheck">
<property name="minimumSize">
<size>
<width>25</width>
<height>25</height>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
@ -1296,6 +1296,22 @@
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
@ -1624,7 +1640,7 @@
</widget>
</item>
<item>
<widget class="QFrame" name="">
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>