128 void setEvents(
const QVector<EventMarker> &events);
134 void setClippingVisible(
bool visible);
137 void setZScoreMode(
bool enabled);
146 void setAnnotations(
const QVector<AnnotationSpan> &annotations);
153 void setAnnotationSelectionEnabled(
bool enabled);
155 void setEventsVisible(
bool visible);
156 bool eventsVisible()
const;
158 void setAnnotationsVisible(
bool visible);
159 bool annotationsVisible()
const;
173 void setScrollSample(
float sample);
182 void setSamplesPerPixel(
float spp);
191 void scrollTo(
float targetSample,
int durationMs = 200);
200 void zoomTo(
float targetSpp,
int durationMs = 200);
208 void setBackgroundColor(
const QColor &color);
218 void setPrefetchFactor(
float factor);
225 int visibleFirstSample()
const;
231 int visibleSampleCount()
const;
242 void setChannelIndices(
const QVector<int> &indices);
248 int totalLogicalChannels()
const;
256 void setFirstVisibleChannel(
int ch);
265 void setVisibleChannelCount(
int count);
273 void setFrozen(
bool frozen);
280 void setGridVisible(
bool visible);
288 void setSfreq(
float sfreq);
297 void setFirstFileSample(
int first);
307 void setLastFileSample(
int last);
318 void setWheelScrollsChannels(
bool channelsMode);
321 void setScrollSpeedFactor(
float factor);
333 void setHideBadChannels(
bool hide);
344 void setCrosshairEnabled(
bool enabled);
359 void setScalebarsVisible(
bool visible);
368 void setButterflyMode(
bool enabled);
414 const QString &channelName,
const QString &unitLabel);
417 void initialize(QRhiCommandBuffer *cb)
override;
418 void render(QRhiCommandBuffer *cb)
override;
423 friend class ::CrosshairOverlay;
432 void resizeEvent(QResizeEvent *event)
override;
433 void wheelEvent(QWheelEvent *event)
override;
434 void mousePressEvent(QMouseEvent *event)
override;
435 void mouseMoveEvent(QMouseEvent *event)
override;
436 void mouseReleaseEvent(QMouseEvent *event)
override;
437 void mouseDoubleClickEvent(QMouseEvent *event)
override;
441 struct ChannelGpuData {
442 std::unique_ptr<QRhiBuffer> vbo;
444 int vboFirstSample = 0;
447 void ensurePipeline();
448 void rebuildVBOs(QRhiResourceUpdateBatch *batch);
449 void updateUBO(QRhiResourceUpdateBatch *batch);
450 bool isVboDirty()
const;
453 void ensureOverlayPipeline();
454 void rebuildOverlayImage(
int logicalWidth,
int logicalHeight, qreal devicePixelRatio);
456 std::unique_ptr<QRhiBuffer> m_overlayVbo;
457 std::unique_ptr<QRhiTexture> m_overlayTex;
458 std::unique_ptr<QRhiSampler> m_overlaySampler;
459 std::unique_ptr<QRhiShaderResourceBindings> m_overlaySrb;
460 std::unique_ptr<QRhiGraphicsPipeline> m_overlayPipeline;
461 std::unique_ptr<QRhiBuffer> m_overlayUbo;
462 bool m_overlayVboNeedsUpload =
false;
463 QImage m_overlayImage;
464 bool m_overlayDirty =
true;
465 QSize m_overlayTexSize;
470 static constexpr float kOverlayPrefetchFactor = 1.0f;
471 float m_overlayFirstSample = 0.f;
472 float m_overlayTotalSamples = 0.f;
477 float sampleFirst = 0.f;
478 float samplesPerPixel = 0.f;
479 int firstChannel = 0;
480 int visibleCount = 0;
483 void scheduleTileRebuild();
484 static TileResult buildTile(ChannelDataModel *model,
486 float samplesPerPixel,
487 int firstVisibleChannel,
488 int visibleChannelCount,
489 int viewWidth,
int viewHeight,
494 bool hideBadChannels,
495 const QVector<int> &channelIndices,
496 const QVector<EventMarker> &events,
497 const QVector<AnnotationSpan> &annotations,
498 const QVector<int> &epochMarkers,
501 bool isTileFresh()
const;
504 float m_tileSampleFirst = 0.f;
505 float m_tileSamplesPerPixel = 0.f;
506 int m_tileFirstChannel = -1;
507 int m_tileVisibleCount = 0;
508 bool m_tileDirty =
true;
510 QFutureWatcher<TileResult> m_tileWatcher;
511 bool m_tileRebuildPending =
false;
513 std::unique_ptr<QRhiBuffer> m_ubo;
514 std::unique_ptr<QRhiShaderResourceBindings> m_srb;
515 std::unique_ptr<QRhiGraphicsPipeline> m_pipeline;
516 std::vector<ChannelGpuData> m_gpuChannels;
517 int m_uboStride = 256;
518 bool m_pipelineDirty =
true;
519 bool m_vboDirty =
true;
522 QPointer<ChannelDataModel> m_model;
523 float m_scrollSample = 0.f;
524 float m_samplesPerPixel = 1.f;
525 float m_prefetchFactor = 1.0f;
526 QColor m_bgColor { 250, 250, 250 };
528 bool m_frozen =
false;
529 bool m_gridVisible =
true;
530 float m_sfreq = 1000.f;
531 int m_firstFileSample = 0;
532 int m_lastFileSample = -1;
533 bool m_wheelScrollsChannels =
true;
534 float m_scrollSpeedFactor = 1.0f;
535 bool m_hideBadChannels =
false;
538 int m_firstVisibleChannel = 0;
539 int m_visibleChannelCount = 12;
542 bool m_dragging =
false;
543 int m_dragStartX = 0;
544 float m_dragStartScroll = 0.f;
547 bool m_leftButtonDown =
false;
549 float m_leftDownScroll = 0.f;
550 bool m_leftDragActivated =
false;
552 struct VelocitySample {
int x; qint64 t; };
553 QVector<VelocitySample> m_velocityHistory;
554 QElapsedTimer m_dragTimer;
555 QPropertyAnimation* m_pInertialAnim =
nullptr;
559 QVector<int> m_filteredChannels;
562 QVector<EventMarker> m_events;
563 QVector<int> m_epochTriggerSamples;
564 QVector<AnnotationSpan> m_annotations;
565 bool m_annotationSelectionEnabled =
false;
566 bool m_bShowEvents =
true;
567 bool m_bShowAnnotations =
true;
568 bool m_bShowEpochMarkers =
true;
569 bool m_bShowClipping =
true;
570 bool m_bZScoreMode =
false;
573 bool m_annDragging =
false;
574 int m_annDragIndex = -1;
575 bool m_annDragIsStart =
true;
576 int m_annHoverIndex = -1;
577 bool m_annHoverIsStart =
true;
578 static constexpr int kAnnBoundaryHitPx = 5;
581 bool m_annSelecting =
false;
585 int hitTestAnnotationBoundary(
int px,
bool &isStart)
const;
588 int actualChannelAt(
int logicalIdx)
const;
589 QVector<int> effectiveChannelIndices()
const;
592 int m_vboWindowFirst = 0;
593 int m_vboWindowLast = 0;
598 bool m_rulerActive =
false;
599 RulerSnap m_rulerSnap = RulerSnap::Free;
604 int m_rulerRawX1 = 0;
605 int m_rulerRawY1 = 0;
608 bool m_crosshairEnabled =
false;
609 int m_crosshairX = -1;
610 int m_crosshairY = -1;
611 bool m_useClockTime =
false;
612 CrosshairOverlay* m_overlay =
nullptr;
615 bool m_scalebarsVisible =
false;
618 bool m_butterflyMode =
false;
620 struct ButterflyTypeGroup {
624 QVector<int> channelIndices;
627 QVector<ButterflyTypeGroup> butterflyTypeGroups()
const;
628 int butterflyLaneCount()
const;