diff --git a/audiodevices.cpp b/audiodevices.cpp index 346da99..d9d5fd0 100644 --- a/audiodevices.cpp +++ b/audiodevices.cpp @@ -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; } diff --git a/rigcommander.cpp b/rigcommander.cpp index a06a520..cec094c 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -2801,7 +2801,7 @@ void rigCommander::receiveCommand(funcs func, QVariant value, bool sub) { spectrumBounds s = value.value(); uchar range=1; - for (bandType band: rigCaps.bands) + for (const bandType& band: rigCaps.bands) { if (band.range != 0.0 && s.start > band.range) range++; diff --git a/spectrumscope.cpp b/spectrumscope.cpp index 275cf73..2bfb008 100644 --- a/spectrumscope.cpp +++ b/spectrumscope.cpp @@ -31,11 +31,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 +96,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); @@ -337,6 +337,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); @@ -1673,3 +1674,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(); + } +} diff --git a/spectrumscope.h b/spectrumscope.h index 65c007e..bae2db7 100644 --- a/spectrumscope.h +++ b/spectrumscope.h @@ -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; diff --git a/wfmain.cpp b/wfmain.cpp index 833fa33..f7f82d7 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -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);