Porównaj commity

...

3 Commity

Autor SHA1 Wiadomość Data
Phil Taylor de61545bd9 Change redraw speed indicator 2024-01-22 12:23:51 +00:00
Phil Taylor 8fb00e30ca Add redraw speed indicator 2024-01-22 12:19:31 +00:00
Phil Taylor 0d15e97efd Code cleanup and add experimental detach scope option 2024-01-21 20:36:52 +00:00
5 zmienionych plików z 83 dodań i 37 usunięć

Wyświetl plik

@ -259,7 +259,7 @@ void audioDevices::enumerate()
#endif
qInfo(logAudio()) << "Found:" << devicecount << " audio device(s) (*=default)";
for (unsigned int i = 1; i < devicecount; i++) {
for (unsigned int i = 0; i < devicecount; i++) {
#if (RTAUDIO_VERSION_MAJOR > 5)
info = audio->getDeviceInfo(devices[i]);
@ -356,6 +356,11 @@ QStringList audioDevices::getOutputs()
int audioDevices::findInput(QString type, QString name)
{
if (type != "Server" && system == tciAudio)
{
return 0;
}
int ret = -1;
int def = -1;
int usb = -1;
@ -373,7 +378,7 @@ int audioDevices::findInput(QString type, QString name)
{
def = f;
}
if (inputs[f]->name.toUpper().contains("USB")) {
if (inputs[f]->name.contains("USB",Qt::CaseInsensitive)) {
// This is a USB device...
usb = f;
}
@ -408,6 +413,11 @@ int audioDevices::findInput(QString type, QString name)
int audioDevices::findOutput(QString type, QString name)
{
if (type != "Server" && system == tciAudio)
{
return 0;
}
int ret = -1;
int def = -1;
int usb = -1;
@ -425,7 +435,7 @@ int audioDevices::findOutput(QString type, QString name)
{
def = f;
}
if (outputs[f]->name.toUpper().contains("USB")) {
if (outputs[f]->name.contains("USB",Qt::CaseInsensitive)) {
// This is a USB device...
usb = f;
}

Wyświetl plik

@ -2801,7 +2801,7 @@ void rigCommander::receiveCommand(funcs func, QVariant value, bool sub)
{
spectrumBounds s = value.value<spectrumBounds>();
uchar range=1;
for (bandType band: rigCaps.bands)
for (const bandType& band: rigCaps.bands)
{
if (band.range != 0.0 && s.start > band.range)
range++;

Wyświetl plik

@ -11,7 +11,6 @@ spectrumScope::spectrumScope(QWidget *parent)
this->setObjectName("Spectrum Scope");
this->setTitle("Band");
this->defaultStyleSheet = this->styleSheet();
queue = cachingQueue::getInstance();
spectrum = new QCustomPlot();
mainLayout = new QHBoxLayout(this);
@ -31,11 +30,11 @@ spectrumScope::spectrumScope(QWidget *parent)
displaySpacer = new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Fixed);
displayLayout->addSpacerItem(displaySpacer);
controlLayout = new QHBoxLayout();
enableCheckBox = new QCheckBox("Enable");
enableCheckBox->setTristate(true);
enableCheckBox->setToolTip("Checked=WF enable, Unchecked=WF disable, Partial=Enable WF but no local display");
enableCheckBox->setCheckState(Qt::CheckState::Checked);
controlLayout = new QHBoxLayout();
detachButton = new QPushButton("Detach");
detachButton->setCheckable(true);
detachButton->setToolTip("Detach/re-attach scope from main window");
detachButton->setChecked(false);
//scopeModeLabel = new QLabel("Spectrum Mode:");
scopeModeCombo = new QComboBox();
scopeModeCombo->setAccessibleDescription("Spectrum Mode");
@ -96,7 +95,7 @@ spectrumScope::spectrumScope(QWidget *parent)
layout->addLayout(displayLayout);
layout->addLayout(controlLayout);
controlLayout->addWidget(enableCheckBox);
controlLayout->addWidget(detachButton);
controlLayout->addWidget(scopeModeCombo);
controlLayout->addWidget(spanCombo);
controlLayout->addWidget(edgeCombo);
@ -162,6 +161,15 @@ spectrumScope::spectrumScope(QWidget *parent)
ovfIndicator->setText(" OVF ");
ovfIndicator->position->setCoords(0.01f,0.0f);
redrawSpeed = new QCPItemText(spectrum);
redrawSpeed->setVisible(true);
redrawSpeed->setColor(Qt::gray);
redrawSpeed->setFont(QFont(font().family(), 8));
redrawSpeed->setPositionAlignment(Qt::AlignRight | Qt::AlignTop);
redrawSpeed->position->setType(QCPItemPosition::ptAxisRectRatio);
redrawSpeed->setText("0ms/0ms");
redrawSpeed->position->setCoords(1.0f,0.0f);
spectrum->addGraph(); // primary
spectrum->addGraph(0, 0); // secondary, peaks, same axis as first.
spectrum->addLayer( "Top Layer", spectrum->layer("main"));
@ -337,6 +345,7 @@ spectrumScope::spectrumScope(QWidget *parent)
// Connections
connect(detachButton,SIGNAL(toggled(bool)), this, SLOT(detachScope(bool)));
connect(scopeModeCombo,SIGNAL(currentIndexChanged(int)),this,SLOT(updatedScopeMode(int)));
connect(spanCombo,SIGNAL(currentIndexChanged(int)),this,SLOT(updatedSpan(int)));
connect(confButton,SIGNAL(clicked()), this, SLOT(configPressed()),Qt::QueuedConnection);
@ -505,8 +514,9 @@ bool spectrumScope::update(scopeData data)
return false;
}
qint64 spectime = 0;
QElapsedTimer elapsed;
elapsed.start();
bool updateRange = false;
@ -556,7 +566,6 @@ bool spectrumScope::update(scopeData data)
y2[i] = (unsigned char)spectrumPeaks.at(i);
}
}
plasmaMutex.lock();
spectrumPlasma.push_front(data.data);
if(spectrumPlasma.size() > (int)spectrumPlasmaSize)
@ -574,6 +583,7 @@ bool spectrumScope::update(scopeData data)
spectrum->graph(0)->setData(x, y, true);
#endif
if((freq.MHzDouble < data.endFreq) && (freq.MHzDouble > data.startFreq))
{
freqIndicatorLine->start->setCoords(freq.MHzDouble, 0);
@ -657,7 +667,6 @@ bool spectrumScope::update(scopeData data)
//qDebug() << "Default" << pbtDefault << "Inner" << PBTInner << "Outer" << PBTOuter << "Pass" << passbandWidth << "Center" << passbandCenterFrequency << "CW" << cwPitch;
}
#if QCUSTOMPLOT_VERSION < 0x020000
if (underlayMode == underlayPeakHold) {
spectrum->graph(1)->setData(x, y2); // peaks
@ -683,12 +692,13 @@ bool spectrumScope::update(scopeData data)
}
#endif
if(updateRange)
spectrum->yAxis->setRange(plotFloor, plotCeiling);
spectrum->xAxis->setRange(data.startFreq, data.endFreq);
elapsed.start();
spectrum->replot();
spectime = elapsed.elapsed();
if(specLen == spectWidth)
{
@ -711,7 +721,9 @@ bool spectrumScope::update(scopeData data)
waterfall->yAxis->setRange(0,wfLength - 1);
waterfall->xAxis->setRange(0, spectWidth-1);
elapsed.start();
waterfall->replot();
redrawSpeed->setText(QString("%0ms/%1ms").arg(spectime).arg(elapsed.elapsed()));
/*
#if defined (USB_CONTROLLER)
@ -1673,3 +1685,25 @@ void spectrumScope::setRefLimits(int lower, int upper)
{
configRef->setRange(lower,upper);
}
void spectrumScope::detachScope(bool state)
{
if (state)
{
windowLabel = new QLabel("Detached to window");
detachButton->setText("Attach");
qInfo(logGui()) << "Detaching scope" << (sub?"Sub":"Main");
this->parentWidget()->layout()->replaceWidget(this,windowLabel);
this->setParent(NULL);
this-> setWindowFlags(Qt::Window | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint);
this->move(screen()->geometry().center() - frameGeometry().center());
this->repaint();
} else {
detachButton->setText("Detach");
qInfo(logGui()) << "Attaching scope" << (sub?"Sub":"Main");
windowLabel->parentWidget()->layout()->replaceWidget(windowLabel,this);
windowLabel->setParent(NULL);
delete windowLabel;
this->repaint();
}
}

Wyświetl plik

@ -112,6 +112,7 @@ signals:
void dataChanged(modeInfo m);
private slots:
void detachScope(bool state);
void updatedScopeMode(int index);
void updatedSpan(int index);
void updatedEdge(int index);
@ -142,6 +143,8 @@ private:
QString defaultStyleSheet;
QMutex mutex;
QWidget* originalParent = Q_NULLPTR;
QLabel* windowLabel = Q_NULLPTR;
QCustomPlot* spectrum = Q_NULLPTR;
QCustomPlot* waterfall = Q_NULLPTR;
freqCtrl* freqDisplay;
@ -153,7 +156,7 @@ private:
QVBoxLayout* rhsLayout;
QHBoxLayout* displayLayout;
QHBoxLayout* controlLayout;
QCheckBox* enableCheckBox;
QPushButton* detachButton;
QLabel* scopeModeLabel;
QComboBox* scopeModeCombo;
QLabel* spanLabel;
@ -221,6 +224,7 @@ private:
QCPItemRect* pbtIndicator;
QCPItemText* oorIndicator;
QCPItemText* ovfIndicator;
QCPItemText* redrawSpeed;
QByteArray spectrumPeaks;
QVector <double> spectrumPlasmaLine;
QVector <QByteArray> spectrumPlasma;

Wyświetl plik

@ -1,7 +1,6 @@
#include "wfmain.h"
#include "ui_wfmain.h"
#include "commhandler.h"
#include "rigidentities.h"
#include "logcategories.h"
@ -3592,14 +3591,13 @@ void wfmain::setDefaultColors(int presetNumber)
p->plotBackground = QColor(Qt::black);
p->tuningLine = QColor(Qt::blue);
p->passband = QColor(Qt::blue);
p->pbt = QColor("#32ff0000");
p->meterLevel = QColor("#148CD2").darker();
p->meterAverage = QColor("#3FB7CD");
p->meterPeakLevel = QColor("#3CA0DB").lighter();
p->pbt = QColor(0x32,0xff,0x00,0x00);
p->meterLevel = QColor(0x14,0x8c,0xd2).darker();
p->meterAverage = QColor(0x2f,0xb7,0xcd);
p->meterPeakLevel = QColor(0x3c,0xa0,0xdb).lighter();
p->meterPeakScale = QColor(Qt::red);
p->meterLowerLine = QColor("#eff0f1");
p->meterLowText = QColor("#eff0f1");
p->meterLowerLine = QColor(0xed,0xf0,0xf1);
p->meterLowText = QColor(0xef,0xf0,0xf1);
p->wfBackground = QColor(Qt::black);
p->wfAxis = QColor(Qt::white);
@ -3623,18 +3621,18 @@ void wfmain::setDefaultColors(int presetNumber)
p->gridColor = QColor(0,0,0,255);
p->spectrumFill = QColor("transparent");
p->spectrumLine = QColor(Qt::yellow);
p->underlayLine = QColor("#9633ff55");
p->underlayLine = QColor(0x96,0x33,0xff,0xff);
p->underlayFill = QColor(20+200/4.0*1,70*(1.6-1/4.0), 150, 150);
p->tuningLine = QColor("#ff55ffff");
p->passband = QColor("#32ffffff");
p->pbt = QColor("#32ff0000");
p->tuningLine = QColor(0xff,0x55,0xff,0xff);
p->passband = QColor(0x32,0xff,0xff,0xff);
p->pbt = QColor(0x32,0xff,0x00,0x00);
p->meterLevel = QColor("#148CD2").darker();
p->meterAverage = QColor("#3FB7CD");
p->meterLevel = QColor(0x14,0x8c,0xd2).darker();
p->meterAverage = QColor(0x3f,0xb7,0xcd);
p->meterPeakScale = QColor(Qt::red);
p->meterPeakLevel = QColor("#3CA0DB").lighter();
p->meterLowerLine = QColor("#eff0f1");
p->meterLowText = QColor("#eff0f1");
p->meterPeakLevel = QColor(0x3c,0xa0,0xdb).lighter();
p->meterLowerLine = QColor(0xef,0xf0,0xf1);
p->meterLowText = QColor(0xef,0xf0,0xf1);
p->wfBackground = QColor(Qt::black);
p->wfAxis = QColor(Qt::white);
@ -3656,11 +3654,11 @@ void wfmain::setDefaultColors(int presetNumber)
p->spectrumLine = QColor(Qt::black);
p->underlayLine = QColor(Qt::blue);
p->tuningLine = QColor(Qt::darkBlue);
p->passband = QColor("#64000080");
p->pbt = QColor("#32ff0000");
p->passband = QColor(0x64,0x00,0x00,0x80);
p->pbt = QColor(0x32,0xff,0x00,0x00);
p->meterAverage = QColor("#3FB7CD");
p->meterPeakLevel = QColor("#3CA0DB");
p->meterAverage = QColor(0x3f,0xb7,0xcd);
p->meterPeakLevel = QColor(0x3c,0xa0,0xdb);
p->meterPeakScale = QColor(Qt::darkRed);
p->meterLowerLine = QColor(Qt::black);
p->meterLowText = QColor(Qt::black);