Added controls for custom scope edges, hide/show scope controls

depending upon the scope mode the radio reports.
knobtest
Elliott Liggett 2022-09-18 13:13:33 -07:00
rodzic bb2593be6f
commit 881823a839
3 zmienionych plików z 90 dodań i 5 usunięć

Wyświetl plik

@ -2158,6 +2158,7 @@ void wfmain::showHideSpectrum(bool show)
ui->wfLengthSlider->setEnabled(show); ui->wfLengthSlider->setEnabled(show);
ui->wfthemeCombo->setVisible(show); ui->wfthemeCombo->setVisible(show);
ui->toFixedBtn->setVisible(show); ui->toFixedBtn->setVisible(show);
ui->customEdgeBtn->setVisible(show);
ui->clearPeakBtn->setVisible(show); ui->clearPeakBtn->setVisible(show);
// And the labels: // And the labels:
@ -3872,6 +3873,7 @@ void wfmain::receiveSpectrumMode(spectrumMode spectMode)
ui->spectrumModeCombo->blockSignals(false); ui->spectrumModeCombo->blockSignals(false);
} }
} }
setUISpectrumControlsToMode(spectMode);
} }
@ -4197,7 +4199,29 @@ void wfmain::on_fCEbtn_clicked()
void wfmain::on_spectrumModeCombo_currentIndexChanged(int index) void wfmain::on_spectrumModeCombo_currentIndexChanged(int index)
{ {
emit setScopeMode(static_cast<spectrumMode>(ui->spectrumModeCombo->itemData(index).toInt())); spectrumMode smode = static_cast<spectrumMode>(ui->spectrumModeCombo->itemData(index).toInt());
emit setScopeMode(smode);
setUISpectrumControlsToMode(smode);
}
void wfmain::setUISpectrumControlsToMode(spectrumMode smode)
{
if((smode==spectModeCenter) || (smode==spectModeScrollC))
{
ui->specEdgeLabel->hide();
ui->scopeEdgeCombo->hide();
ui->customEdgeBtn->hide();
ui->toFixedBtn->show();
ui->specSpanLabel->show();
ui->scopeBWCombo->show();
} else {
ui->specEdgeLabel->show();
ui->scopeEdgeCombo->show();
ui->customEdgeBtn->show();
ui->toFixedBtn->hide();
ui->specSpanLabel->hide();
ui->scopeBWCombo->hide();
}
} }
void wfmain::on_fEnterBtn_clicked() void wfmain::on_fEnterBtn_clicked()
@ -7123,3 +7147,51 @@ void wfmain::messageHandler(QtMsgType type, const QMessageLogContext& context, c
logStringBuffer.push_front(text); logStringBuffer.push_front(text);
logTextMutex.unlock(); logTextMutex.unlock();
} }
void wfmain::on_customEdgeBtn_clicked()
{
double lowFreq = oldLowerFreq;
double highFreq = oldUpperFreq;
QString freqstring = QString("%1, %2").arg(lowFreq).arg(highFreq);
bool ok;
QString userFreq = QInputDialog::getText(this, "Scope Edges",
"Please enter desired scope edges, in MHz, \
with a comma between the low and high range.",
QLineEdit::Normal, freqstring, &ok);
if(!ok)
return;
QString clean = userFreq.trimmed().replace(" ", "");
QStringList freqs = clean.split(",");
if(freqs.length() == 2)
{
lowFreq = QString(freqs.at(0)).toDouble(&ok);
if(ok)
{
highFreq = QString(freqs.at(1)).toDouble(&ok);
if(ok)
{
qDebug(logGui()) << "setting edge to: " << lowFreq << ", " << highFreq << ", edge num: " << ui->scopeEdgeCombo->currentIndex() + 1;
emit setScopeFixedEdge(lowFreq, highFreq, ui->scopeEdgeCombo->currentIndex() + 1);
return;
}
}
goto errMsg;
} else {
goto errMsg;
}
errMsg:
{
QMessageBox URLmsgBox;
URLmsgBox.setText("Error, could not interpret your input.\
<br/>Please make sure to place a comma between the frequencies.\
<br/>For example: '7.200, 7.300'");
URLmsgBox.exec();
return;
}
}

Wyświetl plik

@ -645,6 +645,8 @@ private slots:
void on_audioSystemServerCombo_currentIndexChanged(int index); void on_audioSystemServerCombo_currentIndexChanged(int index);
void on_customEdgeBtn_clicked();
private: private:
Ui::wfmain *ui; Ui::wfmain *ui;
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
@ -786,6 +788,7 @@ private:
bool onFullscreen; bool onFullscreen;
bool freqTextSelected; bool freqTextSelected;
void checkFreqSel(); void checkFreqSel();
void setUISpectrumControlsToMode(spectrumMode smode);
double oldLowerFreq; double oldLowerFreq;
double oldUpperFreq; double oldUpperFreq;

Wyświetl plik

@ -18,7 +18,7 @@
<item> <item>
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>3</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="mainTab"> <widget class="QWidget" name="mainTab">
<attribute name="title"> <attribute name="title">
@ -117,6 +117,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="customEdgeBtn">
<property name="toolTip">
<string>Define a custom (fixed) scope edge</string>
</property>
<property name="text">
<string>Custom Edge</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="toFixedBtn"> <widget class="QPushButton" name="toFixedBtn">
<property name="toolTip"> <property name="toolTip">
@ -3333,8 +3343,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>194</width> <width>204</width>
<height>563</height> <height>582</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
@ -4826,7 +4836,7 @@
<resources/> <resources/>
<connections/> <connections/>
<buttongroups> <buttongroups>
<buttongroup name="underlayButtonGroup"/>
<buttongroup name="buttonGroup"/> <buttongroup name="buttonGroup"/>
<buttongroup name="underlayButtonGroup"/>
</buttongroups> </buttongroups>
</ui> </ui>