mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-31 13:00:26 -04:00 
			
		
		
		
	New scope: added change trigger color feature
This commit is contained in:
		
							parent
							
								
									2820efe26b
								
							
						
					
					
						commit
						e32659b86a
					
				| @ -379,6 +379,9 @@ int ScopeVisNG::processTraces(const SampleVector::const_iterator& cbegin, const | ||||
|                 if (projectionType == ProjectionMagLin) { | ||||
|                     v = (itCtl->m_projector->run(*begin) - itData->m_ofs)*itData->m_amp - 1.0f; | ||||
|                 } else if (projectionType == ProjectionMagDB) { | ||||
|                    // there is no processing advantage in direct calculation without projector
 | ||||
| //                    uint32_t magsq = begin->m_real*begin->m_real + begin->m_imag*begin->m_imag;
 | ||||
| //                    v = ((log10f(magsq/1073741824.0f)*0.2f - 2.0f*itData->m_ofs) + 2.0f)*itData->m_amp - 1.0f;
 | ||||
|                     float p = itCtl->m_projector->run(*begin) - (100.0f * itData->m_ofs); | ||||
|                     v = ((p/50.0f) + 2.0f)*itData->m_amp - 1.0f; | ||||
|                 } else { | ||||
| @ -502,6 +505,7 @@ bool ScopeVisNG::handleMessage(const Message& message) | ||||
|             if (triggerIndex == m_focusedTriggerIndex) | ||||
|             { | ||||
|                 computeDisplayTriggerLevels(); | ||||
|                 m_glScope->setFocusedTriggerData(m_triggerConditions[m_focusedTriggerIndex].m_triggerData); | ||||
|                 m_glScope->updateDisplay(); | ||||
|             } | ||||
|         } | ||||
| @ -528,6 +532,7 @@ bool ScopeVisNG::handleMessage(const Message& message) | ||||
|         { | ||||
|             m_focusedTriggerIndex = triggerIndex; | ||||
|             computeDisplayTriggerLevels(); | ||||
|             m_glScope->setFocusedTriggerData(m_triggerConditions[m_focusedTriggerIndex].m_triggerData); | ||||
|             m_glScope->updateDisplay(); | ||||
|         } | ||||
| 
 | ||||
|  | ||||
| @ -70,7 +70,8 @@ public: | ||||
|             setColor(m_traceColor); | ||||
|         } | ||||
| 
 | ||||
|         void setColor(QColor color) { | ||||
|         void setColor(QColor color) | ||||
|         { | ||||
|             m_traceColor = color; | ||||
|             qreal r,g,b,a; | ||||
|             m_traceColor.getRgbF(&r, &g, &b, &a); | ||||
| @ -95,6 +96,10 @@ public: | ||||
|         int m_triggerDelayCoarse; | ||||
|         int m_triggerDelayFine; | ||||
|         uint32_t m_triggerRepeat;        //!< Number of trigger conditions before the final decisive trigger
 | ||||
|         QColor m_triggerColor;           //!< Trigger line display color
 | ||||
|         float m_triggerColorR;           //!< Trigger line display color - red shortcut
 | ||||
|         float m_triggerColorG;           //!< Trigger line display color - green shortcut
 | ||||
|         float m_triggerColorB;           //!< Trigger line display color - blue shortcut
 | ||||
| 
 | ||||
|         TriggerData() : | ||||
|             m_projectionType(ProjectionReal), | ||||
| @ -108,8 +113,21 @@ public: | ||||
|             m_triggerDelayMult(0.0), | ||||
|             m_triggerDelayCoarse(0), | ||||
|             m_triggerDelayFine(0), | ||||
| 			m_triggerRepeat(0) | ||||
|         {} | ||||
| 			m_triggerRepeat(0), | ||||
| 			m_triggerColor(0,255,0) | ||||
|         { | ||||
|             setColor(m_triggerColor); | ||||
|         } | ||||
| 
 | ||||
|         void setColor(QColor color) | ||||
|         { | ||||
|             m_triggerColor = color; | ||||
|             qreal r,g,b,a; | ||||
|             m_triggerColor.getRgbF(&r, &g, &b, &a); | ||||
|             m_triggerColorR = r; | ||||
|             m_triggerColorG = g; | ||||
|             m_triggerColorB = b; | ||||
|         } | ||||
|     }; | ||||
| 
 | ||||
|     static const uint m_traceChunkSize; | ||||
| @ -681,7 +699,8 @@ private: | ||||
|         { | ||||
|         	return (m_tracesData[traceIndex].m_projectionType != traceData.m_projectionType) | ||||
|         			|| (m_tracesData[traceIndex].m_amp != traceData.m_amp) | ||||
| 					|| (m_tracesData[traceIndex].m_ofs != traceData.m_ofs); | ||||
| 					|| (m_tracesData[traceIndex].m_ofs != traceData.m_ofs | ||||
| 					|| (m_tracesData[traceIndex].m_traceColor != traceData.m_traceColor)); | ||||
|         } | ||||
| 
 | ||||
|         void addTrace(const TraceData& traceData, int traceSize) | ||||
|  | ||||
| @ -329,7 +329,11 @@ void GLScopeNG::paintGL() | ||||
| 				float rectW = m_glScopeRect1.width(); | ||||
| 				float rectH = -m_glScopeRect1.height() / 2.0f; | ||||
| 
 | ||||
| 				QVector4D color(0.0f, 1.0f, 0.0f, 0.4f); | ||||
| 				QVector4D color( | ||||
| 				        m_focusedTriggerData.m_triggerColorR, | ||||
| 				        m_focusedTriggerData.m_triggerColorG, | ||||
| 				        m_focusedTriggerData.m_triggerColorB, | ||||
| 				        0.4f); | ||||
| 				QMatrix4x4 mat; | ||||
| 				mat.setToIdentity(); | ||||
| 				mat.translate(-1.0f + 2.0f * rectX, 1.0f - 2.0f * rectY); | ||||
|  | ||||
| @ -67,6 +67,7 @@ public: | ||||
|     void updateDisplay(); | ||||
|     void setDisplayGridIntensity(int intensity); | ||||
|     void setDisplayTraceIntensity(int intensity); | ||||
|     void setFocusedTriggerData(ScopeVisNG::TriggerData& triggerData) { m_focusedTriggerData = triggerData; } | ||||
| 
 | ||||
| signals: | ||||
|     void sampleRateChanged(int); | ||||
| @ -74,6 +75,7 @@ signals: | ||||
| private: | ||||
|     std::vector<ScopeVisNG::TraceData> *m_tracesData; | ||||
|     std::vector<float *> *m_traces; | ||||
|     ScopeVisNG::TriggerData m_focusedTriggerData; | ||||
|     uint32_t m_bufferIndex; | ||||
|     DisplayMode m_displayMode; | ||||
|     QTimer m_timer; | ||||
|  | ||||
| @ -41,6 +41,8 @@ GLScopeNGGUI::GLScopeNGGUI(QWidget* parent) : | ||||
|     ui->trigDelayFine->setMaximum(ScopeVisNG::m_traceChunkSize / 10.0); | ||||
|     ui->traceColor->setStyleSheet("QLabel { background-color : rgb(255,255,64); }"); | ||||
|     m_focusedTraceColor.setRgb(255,255,64); | ||||
|     ui->trigColor->setStyleSheet("QLabel { background-color : rgb(0,255,0); }"); | ||||
|     m_focusedTriggerColor.setRgb(0,255,0); | ||||
| } | ||||
| 
 | ||||
| GLScopeNGGUI::~GLScopeNGGUI() | ||||
| @ -335,7 +337,6 @@ void GLScopeNGGUI::on_traceDelay_valueChanged(int value) | ||||
| 
 | ||||
| void GLScopeNGGUI::on_traceColor_clicked() | ||||
| { | ||||
|     qDebug("GLScopeNGGUI::on_traceColor_clicked"); | ||||
|     QColor newColor = QColorDialog::getColor(); | ||||
|     m_focusedTraceColor = newColor; | ||||
|     int r,g,b,a; | ||||
| @ -419,6 +420,16 @@ void GLScopeNGGUI::on_trigPre_valueChanged(int value) | ||||
|             ui->freerun->isChecked()); // TODO: implement one shot feature
 | ||||
| } | ||||
| 
 | ||||
| void GLScopeNGGUI::on_trigColor_clicked() | ||||
| { | ||||
|     QColor newColor = QColorDialog::getColor(); | ||||
|     m_focusedTriggerColor = newColor; | ||||
|     int r,g,b,a; | ||||
|     m_focusedTriggerColor.getRgb(&r, &g, &b, &a); | ||||
|     ui->trigColor->setStyleSheet(tr("QLabel { background-color : rgb(%1,%2,%3); }").arg(r).arg(g).arg(b)); | ||||
|     changeCurrentTrigger(); | ||||
| } | ||||
| 
 | ||||
| void GLScopeNGGUI::on_trigOneShot_toggled(bool checked) | ||||
| { | ||||
| 	m_scopeVis->configure(m_traceLenMult*ScopeVisNG::m_traceChunkSize, | ||||
| @ -722,6 +733,7 @@ void GLScopeNGGUI::fillTriggerData(ScopeVisNG::TriggerData& triggerData) | ||||
|     triggerData.m_triggerDelay = (int) (m_traceLenMult * ScopeVisNG::m_traceChunkSize * triggerData.m_triggerDelayMult); | ||||
|     triggerData.m_triggerDelayCoarse = ui->trigDelayCoarse->value(); | ||||
|     triggerData.m_triggerDelayFine = ui->trigDelayFine->value(); | ||||
|     triggerData.setColor(m_focusedTriggerColor); | ||||
| } | ||||
| 
 | ||||
| void GLScopeNGGUI::setTriggerUI(ScopeVisNG::TriggerData& triggerData) | ||||
| @ -775,6 +787,11 @@ void GLScopeNGGUI::setTriggerUI(ScopeVisNG::TriggerData& triggerData) | ||||
|     ui->trigDelayFine->setValue(triggerData.m_triggerDelayFine); | ||||
|     setTrigDelayDisplay(); | ||||
| 
 | ||||
|     m_focusedTriggerColor = triggerData.m_triggerColor; | ||||
|     int r, g, b, a; | ||||
|     m_focusedTriggerColor.getRgb(&r, &g, &b, &a); | ||||
|     ui->trigColor->setStyleSheet(tr("QLabel { background-color : rgb(%1,%2,%3); }").arg(r).arg(g).arg(b)); | ||||
| 
 | ||||
|     ui->trigMode->blockSignals(oldStateTrigMode); | ||||
|     ui->trigCount->blockSignals(oldStateTrigCount); | ||||
|     ui->trigPos->blockSignals(oldStateTrigPos); | ||||
|  | ||||
| @ -61,6 +61,7 @@ private: | ||||
|     int m_timeOffset; | ||||
|     int m_traceLenMult; | ||||
|     QColor m_focusedTraceColor; | ||||
|     QColor m_focusedTriggerColor; | ||||
| 
 | ||||
|     static const double amps[11]; | ||||
| 
 | ||||
| @ -123,6 +124,7 @@ private slots: | ||||
|     void on_trigDelayCoarse_valueChanged(int value); | ||||
|     void on_trigDelayFine_valueChanged(int value); | ||||
|     void on_trigPre_valueChanged(int value); | ||||
|     void on_trigColor_clicked(); | ||||
|     void on_trigOneShot_toggled(bool checked); | ||||
|     void on_freerun_toggled(bool checked); | ||||
| }; | ||||
|  | ||||
| @ -6,7 +6,7 @@ | ||||
|    <rect> | ||||
|     <x>0</x> | ||||
|     <y>0</y> | ||||
|     <width>692</width> | ||||
|     <width>731</width> | ||||
|     <height>120</height> | ||||
|    </rect> | ||||
|   </property> | ||||
| @ -1515,6 +1515,25 @@ kS/s</string> | ||||
|        </property> | ||||
|       </spacer> | ||||
|      </item> | ||||
|      <item> | ||||
|       <widget class="ClickableLabel" name="trigColor"> | ||||
|        <property name="minimumSize"> | ||||
|         <size> | ||||
|          <width>16</width> | ||||
|          <height>16</height> | ||||
|         </size> | ||||
|        </property> | ||||
|        <property name="maximumSize"> | ||||
|         <size> | ||||
|          <width>16</width> | ||||
|          <height>16</height> | ||||
|         </size> | ||||
|        </property> | ||||
|        <property name="text"> | ||||
|         <string/> | ||||
|        </property> | ||||
|       </widget> | ||||
|      </item> | ||||
|      <item> | ||||
|       <widget class="ButtonSwitch" name="trigOneShot"> | ||||
|        <property name="minimumSize"> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user