Spectrum Markers: tri-state show marker state

pull/1115/head
f4exb 2022-01-22 06:10:57 +01:00
rodzic 5abca451c9
commit 639373f7eb
11 zmienionych plików z 98 dodań i 50 usunięć

Wyświetl plik

@ -80,7 +80,7 @@ QByteArray SpectrumWaterfallMarker::serialize() const
s.writeS32(4, r);
s.writeS32(5, g);
s.writeS32(6, b);
s.writeBool(7, m_show);
s.writeS32(7, (int) m_show);
return s.final();
}
@ -141,6 +141,8 @@ bool SpectrumAnnotationMarker::deserialize(const QByteArray& data)
if (d.getVersion() == 1)
{
int tmp;
d.readS64(1, &m_startFrequency, 0);
d.readU32(2, &m_bandwidth, 0);
int r, g, b;
@ -150,7 +152,8 @@ bool SpectrumAnnotationMarker::deserialize(const QByteArray& data)
m_markerColor.setGreen(g);
d.readS32(6, &b, 255);
m_markerColor.setBlue(b);
d.readBool(7, &m_show, true);
d.readS32 (7, &tmp, 1);
m_show = (ShowState) tmp;
d.readString(8, &m_text);
return true;

Wyświetl plik

@ -157,12 +157,18 @@ struct SDRBASE_API SpectrumWaterfallMarker
struct SDRBASE_API SpectrumAnnotationMarker
{
enum ShowState
{
Hidden,
ShowTop,
ShowFull
};
qint64 m_startFrequency;
uint32_t m_bandwidth;
QColor m_markerColor;
bool m_show;
ShowState m_show;
QString m_text;
bool m_selected;
float m_startPos;
float m_stopPos;
@ -170,9 +176,8 @@ struct SDRBASE_API SpectrumAnnotationMarker
m_startFrequency(0),
m_bandwidth(0),
m_markerColor("white"),
m_show(true),
m_show(ShowTop),
m_text("Text"),
m_selected(false),
m_startPos(0.0f),
m_stopPos(1.0f)
{}
@ -181,7 +186,7 @@ struct SDRBASE_API SpectrumAnnotationMarker
qint64 startFrequency,
uint32_t bandwidth,
QColor markerColor,
bool show,
ShowState show,
const QString& text
) :
m_startFrequency(startFrequency),

Wyświetl plik

@ -301,7 +301,7 @@ void SpectrumSettings::formatTo(SWGSDRangel::SWGObject *swgObject) const
swgSpectrum->getAnnotationMarkers()->back()->setStartFrequency(marker.m_startFrequency);
swgSpectrum->getAnnotationMarkers()->back()->setBandwidth(marker.m_bandwidth);
swgSpectrum->getAnnotationMarkers()->back()->setMarkerColor(qColorToInt(marker.m_markerColor));
swgSpectrum->getAnnotationMarkers()->back()->setShow(marker.m_show ? 1 : 0);
swgSpectrum->getAnnotationMarkers()->back()->setShow((int) marker.m_show);
}
}
}
@ -447,7 +447,7 @@ void SpectrumSettings::updateFrom(const QStringList& keys, const SWGSDRangel::SW
m_annoationMarkers.back().m_startFrequency = swgAnnotationMarker->getStartFrequency();
m_annoationMarkers.back().m_bandwidth = swgAnnotationMarker->getBandwidth() < 0 ? 0 : swgAnnotationMarker->getBandwidth();
m_annoationMarkers.back().m_markerColor = intToQColor(swgAnnotationMarker->getMarkerColor());
m_annoationMarkers.back().m_show = swgAnnotationMarker->getShow() != 0;
m_annoationMarkers.back().m_show = (SpectrumAnnotationMarker::ShowState) swgAnnotationMarker->getShow();
}
}
}

Wyświetl plik

@ -11804,7 +11804,7 @@ margin-bottom: 20px;
},
"show" : {
"type" : "integer",
"description" : "Boolean - Marker display state\n * 0 - Hidden\n * 1 - Visible\n"
"description" : "SpectrumAnnotationMarker::ShowState - Marker display state\n * 0 - Hidden\n * 1 - Only top marker visible\n * 2 - Fully visible with text and full sized limits\n"
}
},
"description" : "Spectrum annotation marker settings"
@ -51969,7 +51969,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2022-01-15T23:01:29.100+01:00
Generated 2022-01-21T22:15:59.334+01:00
</div>
</div>
</div>

Wyświetl plik

@ -59,9 +59,10 @@ SpectrumAnnotationMarker:
show:
type: integer
description: >
Boolean - Marker display state
SpectrumAnnotationMarker::ShowState - Marker display state
* 0 - Hidden
* 1 - Visible
* 1 - Only top marker visible
* 2 - Fully visible with text and full sized limits
GLSpectrum:
description: GLSpectrumGUI settings

Wyświetl plik

@ -1406,7 +1406,11 @@ void GLSpectrum::drawAnnotationMarkers()
for (const auto &marker : m_visibleAnnotationMarkers)
{
QVector4D color(marker->m_markerColor.redF(), marker->m_markerColor.greenF(), marker->m_markerColor.blueF(), 0.5f);
if (marker->m_show == SpectrumAnnotationMarker::Hidden) {
continue;
}
QVector4D color(marker->m_markerColor.redF(), marker->m_markerColor.greenF(), marker->m_markerColor.blueF(), 0.5f);
if (marker->m_bandwidth == 0)
{
@ -1427,7 +1431,7 @@ void GLSpectrum::drawAnnotationMarkers()
m_glShaderSimple.drawSurface(m_glHistogramBoxMatrix, color, q3, 4);
}
if (marker->m_selected)
if (marker->m_show == SpectrumAnnotationMarker::ShowFull)
{
QVector4D color(
marker->m_markerColor.redF(),
@ -2283,7 +2287,6 @@ void GLSpectrum::updateSortedAnnotationMarkers()
if ((startPos > 1.0f) || (stopPos < 0.0f)) // out of range
{
marker->m_selected = false;
continue;
}
@ -2579,18 +2582,19 @@ void GLSpectrum::mousePressEvent(QMouseEvent* event)
for (auto iMarker = m_visibleAnnotationMarkers.rbegin(); iMarker != m_visibleAnnotationMarkers.rend(); ++iMarker)
{
if ((*iMarker)->m_show == SpectrumAnnotationMarker::Hidden) {
continue;
}
qint64 stopFrequency = (*iMarker)->m_startFrequency +
((*iMarker)->m_bandwidth == 0 ? m_frequencyScale.getRange()*0.01f : (*iMarker)->m_bandwidth);
if (((*iMarker)->m_startFrequency < selectedFrequency) && (selectedFrequency <= stopFrequency) && !selected)
{
(*iMarker)->m_selected = true;
(*iMarker)->m_show = (*iMarker)->m_show == SpectrumAnnotationMarker::ShowFull ?
SpectrumAnnotationMarker::ShowTop : SpectrumAnnotationMarker::ShowFull;
selected = true;
}
else
{
(*iMarker)->m_selected = false;
}
}
}

Wyświetl plik

@ -176,7 +176,7 @@ void SpectrumMarkersDialog::displayAnnotationMarker()
ui->aMarkerFrequency->blockSignals(true);
ui->aCenterFrequency->blockSignals(true);
ui->aMarkerColor->blockSignals(true);
ui->aShowMarker->blockSignals(true);
ui->aMarkerShowState->blockSignals(true);
ui->aMarkerText->blockSignals(true);
ui->aMarker->blockSignals(true);
ui->aMarkerAdd->blockSignals(true);
@ -189,7 +189,7 @@ void SpectrumMarkersDialog::displayAnnotationMarker()
ui->aMarker->setEnabled(false);
ui->aMarkerFrequency->setEnabled(false);
ui->aMarkerBandwidth->setEnabled(false);
ui->aShowMarker->setEnabled(false);
ui->aMarkerShowState->setEnabled(false);
ui->aMarkerIndexText->setText("-");
ui->aMarkerText->setText("");
}
@ -198,7 +198,7 @@ void SpectrumMarkersDialog::displayAnnotationMarker()
ui->aMarker->setEnabled(true);
ui->aMarkerFrequency->setEnabled(true);
ui->aMarkerBandwidth->setEnabled(true);
ui->aShowMarker->setEnabled(true);
ui->aMarkerShowState->setEnabled(true);
ui->aMarker->setValue(m_annotationMarkerIndex);
ui->aMarkerIndexText->setText(tr("%1").arg(m_annotationMarkerIndex));
qint64 frequency = m_annotationMarkers[m_annotationMarkerIndex].m_startFrequency +
@ -215,6 +215,7 @@ void SpectrumMarkersDialog::displayAnnotationMarker()
m_annotationMarkers[m_annotationMarkerIndex].m_markerColor.getRgb(&r, &g, &b, &a);
ui->aMarkerColor->setStyleSheet(tr("QLabel { background-color : rgb(%1,%2,%3); }").arg(r).arg(g).arg(b));
ui->aMarkerText->setText(tr("%1").arg(m_annotationMarkers[m_annotationMarkerIndex].m_text));
ui->aMarkerShowState->setCurrentIndex((int) m_annotationMarkers[m_annotationMarkerIndex].m_show);
}
ui->aMarkerToggleFrequency->setChecked(m_annoFreqStartElseCenter);
@ -222,7 +223,7 @@ void SpectrumMarkersDialog::displayAnnotationMarker()
ui->aMarkerFrequency->blockSignals(false);
ui->aCenterFrequency->blockSignals(false);
ui->aMarkerColor->blockSignals(false);
ui->aShowMarker->blockSignals(false);
ui->aMarkerShowState->blockSignals(false);
ui->aMarkerText->blockSignals(false);
ui->aMarker->blockSignals(false);
ui->aMarkerAdd->blockSignals(false);
@ -613,13 +614,20 @@ void SpectrumMarkersDialog::on_aMarkerColor_clicked()
}
}
void SpectrumMarkersDialog::on_aShowMarker_clicked(bool clicked)
void SpectrumMarkersDialog::on_aMarkerShowState_currentIndexChanged(int state)
{
if (m_annotationMarkers.size() == 0) {
return;
}
m_annotationMarkers[m_annotationMarkerIndex].m_show = clicked;
m_annotationMarkers[m_annotationMarkerIndex].m_show = (SpectrumAnnotationMarker::ShowState) state;
}
void SpectrumMarkersDialog::on_aMarkerShowStateAll_clicked()
{
for (auto &marker : m_annotationMarkers) {
marker.m_show = (SpectrumAnnotationMarker::ShowState) ui->aMarkerShowState->currentIndex();
}
}
void SpectrumMarkersDialog::on_aMarkerText_editingFinished()
@ -726,7 +734,7 @@ void SpectrumMarkersDialog::on_aMarkersImport_clicked()
m_annotationMarkers.back().m_startFrequency = cols[startCol].toLongLong();
m_annotationMarkers.back().m_bandwidth = cols[widthCol].toUInt();
m_annotationMarkers.back().m_text = cols[textCol];
m_annotationMarkers.back().m_show = cols[showCol].toInt() != 0;
m_annotationMarkers.back().m_show = (SpectrumAnnotationMarker::ShowState) cols[showCol].toInt();
int r = cols[redCol].toInt();
int g = cols[greenCol].toInt();
int b = cols[blueCol].toInt();

Wyświetl plik

@ -97,7 +97,8 @@ private slots:
void on_aMakerDuplicate_clicked();
void on_aMakersSort_clicked();
void on_aMarkerColor_clicked();
void on_aShowMarker_clicked(bool clicked);
void on_aMarkerShowState_currentIndexChanged(int state);
void on_aMarkerShowStateAll_clicked();
void on_aMarkerText_editingFinished();
void on_aMarker_valueChanged(int value);
void on_aMarkerAdd_clicked();

Wyświetl plik

@ -29,7 +29,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>2</number>
<number>0</number>
</property>
<widget class="QWidget" name="hisTab">
<attribute name="title">
@ -1035,7 +1035,7 @@
<widget class="QLabel" name="aMarkerIndexText">
<property name="minimumSize">
<size>
<width>15</width>
<width>30</width>
<height>0</height>
</size>
</property>
@ -1046,7 +1046,7 @@
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
@ -1216,26 +1216,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="aShowMarker">
<property name="toolTip">
<string>Show this marker</string>
</property>
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="aMarkerText">
<property name="toolTip">
<string>Marker text</string>
</property>
<property name="maxLength">
<number>30</number>
<number>36</number>
</property>
</widget>
</item>
@ -1640,6 +1627,44 @@
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="aMarkerShowState">
<property name="toolTip">
<string>Marker show state</string>
</property>
<item>
<property name="text">
<string>Hidden</string>
</property>
</item>
<item>
<property name="text">
<string>Top</string>
</property>
</item>
<item>
<property name="text">
<string>Full</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QPushButton" name="aMarkerShowStateAll">
<property name="maximumSize">
<size>
<width>30</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Apply current show state to all markers</string>
</property>
<property name="text">
<string>All</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">

Wyświetl plik

@ -59,9 +59,10 @@ SpectrumAnnotationMarker:
show:
type: integer
description: >
Boolean - Marker display state
SpectrumAnnotationMarker::ShowState - Marker display state
* 0 - Hidden
* 1 - Visible
* 1 - Only top marker visible
* 2 - Fully visible with text and full sized limits
GLSpectrum:
description: GLSpectrumGUI settings

Wyświetl plik

@ -11804,7 +11804,7 @@ margin-bottom: 20px;
},
"show" : {
"type" : "integer",
"description" : "Boolean - Marker display state\n * 0 - Hidden\n * 1 - Visible\n"
"description" : "SpectrumAnnotationMarker::ShowState - Marker display state\n * 0 - Hidden\n * 1 - Only top marker visible\n * 2 - Fully visible with text and full sized limits\n"
}
},
"description" : "Spectrum annotation marker settings"
@ -51969,7 +51969,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2022-01-15T23:01:29.100+01:00
Generated 2022-01-21T22:15:59.334+01:00
</div>
</div>
</div>