128 void setEvents(
const QVector<EventMarker>& events);
134 return m_bShowEpochMarkers;
137 void setClippingVisible(
bool visible);
140 return m_bShowClipping;
143 void setZScoreMode(
bool enabled);
146 return m_bZScoreMode;
155 void setAnnotations(
const QVector<AnnotationSpan>& annotations);
164 void setAnnotationSelectionEnabled(
bool enabled);
166 void setEventsVisible(
bool visible);
167 bool eventsVisible()
const;
169 void setAnnotationsVisible(
bool visible);
170 bool annotationsVisible()
const;
176 return m_scrollSample;
180 return m_samplesPerPixel;
190 void setScrollSample(
float sample);
199 void setSamplesPerPixel(
float spp);
208 void scrollTo(
float targetSample,
int durationMs = 200);
218 void scrollBy(
float deltaSamples,
int durationMs = 200);
227 void zoomTo(
float targetSpp,
int durationMs = 200);
235 void setBackgroundColor(
const QColor& color);
248 void setPrefetchFactor(
float factor);
257 int visibleFirstSample()
const;
265 int visibleSampleCount()
const;
276 void setChannelIndices(
const QVector<int>& indices);
284 int totalLogicalChannels()
const;
292 void setFirstVisibleChannel(
int ch);
295 return m_firstVisibleChannel;
304 void setVisibleChannelCount(
int count);
307 return m_visibleChannelCount;
317 void setFrozen(
bool frozen);
329 void setGridVisible(
bool visible);
332 return m_gridVisible;
342 void setSfreq(
float sfreq);
351 void setFirstFileSample(
int first);
361 void setLastFileSample(
int last);
364 return m_lastFileSample;
375 void setWheelScrollsChannels(
bool channelsMode);
378 return m_wheelScrollsChannels;
381 void setScrollSpeedFactor(
float factor);
384 return m_scrollSpeedFactor;
396 void setHideBadChannels(
bool hide);
399 return m_hideBadChannels;
412 void setCrosshairEnabled(
bool enabled);
415 return m_crosshairEnabled;
425 m_useClockTime = useClock;
430 return m_useClockTime;
448 QImage renderToImage(
const QSize& size = QSize())
const;
458 void setScalebarsVisible(
bool visible);
461 return m_scalebarsVisible;
472 void setButterflyMode(
bool enabled);
475 return m_butterflyMode;
521 const QString& channelName,
const QString& unitLabel);
524 void initialize(QRhiCommandBuffer* cb)
override;
525 void render(QRhiCommandBuffer* cb)
override;
537 void renderFrame(QRhi* rhi, QRhiRenderTarget* target, QRhiCommandBuffer* cb);
540 friend class ::CrosshairOverlay;
548 return m_rulerActive;
552 return m_annSelecting;
555 void resizeEvent(QResizeEvent* event)
override;
556 void wheelEvent(QWheelEvent* event)
override;
557 void mousePressEvent(QMouseEvent* event)
override;
558 void mouseMoveEvent(QMouseEvent* event)
override;
559 void mouseReleaseEvent(QMouseEvent* event)
override;
560 void mouseDoubleClickEvent(QMouseEvent* event)
override;
563 float clampScrollSample(
float sample)
const;
564 void stopScrollAnimations();
567 struct ChannelGpuData
569 std::unique_ptr<QRhiBuffer> vbo;
571 int vboFirstSample = 0;
574 void ensurePipeline(QRhi* rhi, QRhiRenderTarget* target);
575 void rebuildVBOs(QRhi* rhi, QRhiResourceUpdateBatch* batch);
576 void updateUBO(QRhiResourceUpdateBatch* batch);
577 bool isVboDirty()
const;
580 void ensureOverlayPipeline(QRhi* rhi, QRhiRenderTarget* target);
581 void rebuildOverlayImage(
int logicalWidth,
int logicalHeight, qreal devicePixelRatio);
583 std::unique_ptr<QRhiBuffer> m_overlayVbo;
584 std::unique_ptr<QRhiTexture> m_overlayTex;
585 std::unique_ptr<QRhiSampler> m_overlaySampler;
586 std::unique_ptr<QRhiShaderResourceBindings> m_overlaySrb;
587 std::unique_ptr<QRhiGraphicsPipeline> m_overlayPipeline;
588 std::unique_ptr<QRhiBuffer> m_overlayUbo;
589 bool m_overlayVboNeedsUpload =
false;
590 QImage m_overlayImage;
591 bool m_overlayDirty =
true;
592 QSize m_overlayTexSize;
597 static constexpr float kOverlayPrefetchFactor = 1.0f;
598 float m_overlayFirstSample = 0.f;
599 float m_overlayTotalSamples = 0.f;
602 std::unique_ptr<QRhiBuffer> m_ubo;
603 std::unique_ptr<QRhiShaderResourceBindings> m_srb;
604 std::unique_ptr<QRhiGraphicsPipeline> m_pipeline;
605 std::vector<ChannelGpuData> m_gpuChannels;
606 int m_uboStride = 256;
607 bool m_pipelineDirty =
true;
608 bool m_vboDirty =
true;
611 QPointer<ChannelDataModel> m_model;
612 float m_scrollSample = 0.f;
613 float m_samplesPerPixel = 1.f;
614 float m_prefetchFactor = 1.0f;
615 QColor m_bgColor{250, 250, 250};
617 bool m_frozen =
false;
618 bool m_gridVisible =
true;
619 float m_sfreq = 1000.f;
620 int m_firstFileSample = 0;
621 int m_lastFileSample = -1;
622 bool m_wheelScrollsChannels =
true;
623 float m_scrollSpeedFactor = 1.0f;
624 bool m_hideBadChannels =
false;
627 int m_firstVisibleChannel = 0;
628 int m_visibleChannelCount = 12;
631 bool m_dragging =
false;
632 int m_dragStartX = 0;
633 float m_dragStartScroll = 0.f;
636 bool m_leftButtonDown =
false;
638 float m_leftDownScroll = 0.f;
639 bool m_leftDragActivated =
false;
641 struct VelocitySample
646 QVector<VelocitySample> m_velocityHistory;
647 QElapsedTimer m_dragTimer;
648 QPropertyAnimation* m_pInertialAnim =
nullptr;
649 QPointer<QPropertyAnimation> m_pScrollAnim;
650 float m_scrollTarget = 0.f;
654 QVector<int> m_filteredChannels;
657 QVector<EventMarker> m_events;
658 QVector<int> m_epochTriggerSamples;
659 QVector<AnnotationSpan> m_annotations;
660 bool m_annotationSelectionEnabled =
false;
661 bool m_bShowEvents =
true;
662 bool m_bShowAnnotations =
true;
663 bool m_bShowEpochMarkers =
true;
664 bool m_bShowClipping =
true;
665 bool m_bZScoreMode =
false;
668 bool m_annDragging =
false;
669 int m_annDragIndex = -1;
670 bool m_annDragIsStart =
true;
671 int m_annHoverIndex = -1;
672 bool m_annHoverIsStart =
true;
673 static constexpr int kAnnBoundaryHitPx = 5;
676 bool m_annSelecting =
false;
680 int hitTestAnnotationBoundary(
int px,
bool& isStart)
const;
683 int actualChannelAt(
int logicalIdx)
const;
684 QVector<int> effectiveChannelIndices()
const;
687 int m_vboWindowFirst = 0;
688 int m_vboWindowLast = 0;
698 bool m_rulerActive =
false;
699 RulerSnap m_rulerSnap = RulerSnap::Free;
704 int m_rulerRawX1 = 0;
705 int m_rulerRawY1 = 0;
708 bool m_crosshairEnabled =
false;
709 int m_crosshairX = -1;
710 int m_crosshairY = -1;
711 bool m_useClockTime =
false;
712 CrosshairOverlay* m_overlay =
nullptr;
715 bool m_scalebarsVisible =
false;
718 bool m_butterflyMode =
false;
720 struct ButterflyTypeGroup
725 QVector<int> channelIndices;
728 QVector<ButterflyTypeGroup> butterflyTypeGroups()
const;
729 int butterflyLaneCount()
const;