1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 17:28:50 -05:00

GLScopeGUI: effective implementation of stream input selection. Fixes #872

This commit is contained in:
f4exb 2021-06-24 22:52:20 +02:00
parent c4cef5fd41
commit bd04ee5a5e
2 changed files with 61 additions and 0 deletions

View File

@ -435,6 +435,51 @@ bool GLScopeGUI::deserialize(const QByteArray& data)
}
}
void GLScopeGUI::setNbStreams(unsigned int nbStreams)
{
QStringList streamNames;
for (unsigned int s = 0; s < nbStreams; s++) {
streamNames.append(tr("%1").arg(s));
}
setStreams(streamNames);
}
void GLScopeGUI::setStreams(const QStringList& streamNames)
{
int traceStreamIndex = ui->traceStream->currentIndex();
int triggerStreamIndex = ui->trigStream->currentIndex();
ui->traceStream->blockSignals(true);
ui->trigStream->blockSignals(true);
ui->traceStream->clear();
ui->trigStream->clear();
for (QString s : streamNames)
{
ui->traceStream->addItem(s);
ui->trigStream->addItem(s);
}
int newTraceStreamIndex = traceStreamIndex < streamNames.size() ? traceStreamIndex : streamNames.size() - 1;
int newTriggerStreamIndex = triggerStreamIndex < streamNames.size() ? triggerStreamIndex: streamNames.size() - 1;
ui->traceStream->setCurrentIndex(newTraceStreamIndex);
if (newTraceStreamIndex != traceStreamIndex) {
changeCurrentTrace();
}
ui->trigStream->setCurrentIndex(newTriggerStreamIndex);
if (newTriggerStreamIndex != triggerStreamIndex) {
changeCurrentTrigger();
}
ui->traceStream->blockSignals(false);
ui->trigStream->blockSignals(false);
}
void GLScopeGUI::on_onlyX_toggled(bool checked)
{
if (checked)
@ -806,6 +851,12 @@ void GLScopeGUI::on_trigDown_clicked(bool checked)
}
}
void GLScopeGUI::on_traceStream_currentIndexChanged(int index)
{
(void) index;
changeCurrentTrace();
}
void GLScopeGUI::on_traceMode_currentIndexChanged(int index)
{
(void) index;
@ -936,6 +987,12 @@ void GLScopeGUI::on_mem_valueChanged(int value)
m_scopeVis->setMemoryIndex(value);
}
void GLScopeGUI::on_trigStream_currentIndexChanged(int index)
{
(void) index;
changeCurrentTrigger();
}
void GLScopeGUI::on_trigMode_currentIndexChanged(int index)
{
(void) index;

View File

@ -53,6 +53,8 @@ public:
bool handleMessage(Message* message);
unsigned int getNbTraces() const { return m_settings.m_tracesData.size(); }
unsigned int getNbTriggers() const { return m_settings.m_triggersData.size(); }
void setNbStreams(unsigned int nbStreams); //!< Set number of streams with default names (indexes)
void setStreams(const QStringList& streamNames); //!< Give streans by their names in a list
// preconfiguration methods
// global (first line):
@ -217,6 +219,7 @@ private slots:
void on_traceDel_clicked(bool checked);
void on_traceUp_clicked(bool checked);
void on_traceDown_clicked(bool checked);
void on_traceStream_currentIndexChanged(int index);
void on_traceMode_currentIndexChanged(int index);
void on_amp_valueChanged(int value);
void on_ofsCoarse_valueChanged(int value);
@ -234,6 +237,7 @@ private slots:
void on_trigDel_clicked(bool checked);
void on_trigUp_clicked(bool checked);
void on_trigDown_clicked(bool checked);
void on_trigStream_currentIndexChanged(int index);
void on_trigMode_currentIndexChanged(int index);
void on_trigCount_valueChanged(int value);
void on_trigPos_toggled(bool checked);