• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ossia / score / 41391215711

02 Nov 2026 04:56AM UTC coverage: 51.66% (-0.6%) from 52.268%
41391215711

push

github

jcelerier
Port probes: what goes through a port or a cable, on hover

Resting the cursor on a port or a cable opens a probe: levels and a trace
for audio, the latest decoded messages for MIDI, the latest values with a
trail for numbers, colour, position, orientation, gain and angle views for
values with a unit, a thumbnail for textures. On a cable it shows what the
source produces, near its end what the process there receives.

The data comes from Execution::PortTap: while a probe is open, a node of
the execution graph gets the port's edges and copies what arrives into a
monitor, without allocation or lock for audio; TapTicker gives taps the
token the graph needs to run them. Probes only tap with execution updates
enabled, refresh at the UI event rate, and open only when previews are
enabled. Nothing touches the document.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KdPgufUMRpkKzaYvUs9iHW

96 of 644 new or added lines in 9 files covered. (14.91%)

3455 existing lines in 31 files now uncovered.

187161 of 362292 relevant lines covered (51.66%)

305640.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

49.44
/src/plugins/score-lib-process/Process/Dataflow/PortProbe.cpp
1
#include "PortProbe.hpp"
2

3
#include <Process/Dataflow/CableItem.hpp>
4
#include <Process/Dataflow/Port.hpp>
5
#include <Process/Dataflow/PortItem.hpp>
6
#include <Process/PreviewSettings.hpp>
7
#include <Process/ProcessContext.hpp>
8

9
#include <score/application/GUIApplicationContext.hpp>
10

11
#include <QCursor>
12
#include <QGraphicsScene>
13
#include <QGraphicsView>
14

15
namespace Process
16
{
NEW
17
PortProbeItem::~PortProbeItem() = default;
×
18
PortProbeFactory::~PortProbeFactory() = default;
3,993 ✔
19
PortProbeFactoryList::~PortProbeFactoryList() = default;
7,986 ✔
20

21
PortProbeHover& PortProbeHover::instance()
122 ✔
22
{
23
  static auto* hover = new PortProbeHover;
122 ✔
24
  return *hover;
122 ✔
NEW
25
}
×
26

27
PortProbeHover::PortProbeHover()
2 ✔
28
{
1 ✔
29
  m_openTimer.setSingleShot(true);
1 ✔
30
  m_openTimer.setInterval(300);
1 ✔
31
  connect(&m_openTimer, &QTimer::timeout, this, [this] { open(); });
1 ✔
32
  m_closeTimer.setSingleShot(true);
1 ✔
33
  m_closeTimer.setInterval(250);
1 ✔
34
  connect(&m_closeTimer, &QTimer::timeout, this, [this] { closeUnlessHeld(); });
1 ✔
35
  m_checkTimer.setInterval(500);
1 ✔
36
  connect(&m_checkTimer, &QTimer::timeout, this, [this] { checkHovered(); });
1 ✔
NEW
37
}
×
38

39
void PortProbeHover::enter(
61 ✔
40
    const Process::Port& port, const Process::Context& ctx, QGraphicsScene& scene,
41
    QPointF scenePos)
42
{
43
  if(!Process::PreviewSettings::instance().enabled())
61 ✔
NEW
44
    return;
×
45
  m_closeTimer.stop();
61 ✔
46
  if(m_port == &port && m_item)
61 ✔
NEW
47
    return;
×
48
  if(m_port != &port)
61 ✔
49
  {
50
    disconnect(m_portDestroyed);
1 ✔
51
    // A probe on a removed port would tap what no longer runs
52
    m_portDestroyed
2 ✔
53
        = connect(&port, &QObject::destroyed, this, [this] { close(); });
3 ✔
54
  }
1 ✔
55
  m_port = &port;
61 ✔
56
  m_context = &ctx;
61 ✔
57
  m_scene = &scene;
61 ✔
58
  m_pos = scenePos;
61 ✔
59
  m_openTimer.start();
61 ✔
60
}
61 ✔
61

62
void PortProbeHover::leave()
61 ✔
63
{
64
  m_openTimer.stop();
61 ✔
65
  if(m_item)
61 ✔
NEW
66
    m_closeTimer.start();
×
67
}
61 ✔
68

NEW
69
void PortProbeHover::open()
×
70
{
NEW
71
  if(!m_port || !m_scene || !m_context)
×
NEW
72
    return;
×
73
  // Another port: the previous probe goes
NEW
74
  delete m_item.data();
×
NEW
75
  m_item = nullptr;
×
76

NEW
77
  for(auto& factory : m_context->app.interfaces<PortProbeFactoryList>())
×
78
  {
NEW
79
    if(auto* item = factory.make(*m_port, *m_context))
×
80
    {
NEW
81
      m_scene->addItem(item);
×
NEW
82
      item->setZValue(1e6);
×
NEW
83
      item->setPos(m_pos + QPointF{12, 12});
×
NEW
84
      m_item = item;
×
NEW
85
      m_missed = 0;
×
NEW
86
      m_checkTimer.start();
×
NEW
87
      break;
×
88
    }
89
  }
NEW
90
}
×
91

92
void PortProbeHover::close()
1 ✔
93
{
94
  m_openTimer.stop();
1 ✔
95
  m_closeTimer.stop();
1 ✔
96
  m_checkTimer.stop();
1 ✔
97
  m_missed = 0;
1 ✔
98
  disconnect(m_portDestroyed);
1 ✔
99
  delete m_item.data();
1 ✔
100
  m_item = nullptr;
1 ✔
101
  m_port = nullptr;
1 ✔
102
}
1 ✔
103

NEW
104
void PortProbeHover::closeUnlessHeld()
×
105
{
NEW
106
  if(!m_item || m_item->isUnderMouse())
×
NEW
107
    return;
×
NEW
108
  close();
×
NEW
109
}
×
110

NEW
111
void PortProbeHover::checkHovered()
×
112
{
NEW
113
  if(!m_item || !m_scene || !m_port)
×
114
  {
NEW
115
    close();
×
NEW
116
    return;
×
117
  }
118
  // On the way from the port to the probe
NEW
119
  if(m_closeTimer.isActive())
×
NEW
120
    return;
×
NEW
121
  for(QGraphicsView* view : m_scene->views())
×
122
  {
NEW
123
    const QPoint local = view->viewport()->mapFromGlobal(QCursor::pos());
×
NEW
124
    if(!view->viewport()->rect().contains(local))
×
NEW
125
      continue;
×
NEW
126
    for(QGraphicsItem* item : view->items(local))
×
127
    {
NEW
128
      if(item == m_item.data() || m_item->isAncestorOf(item)
×
NEW
129
         || qgraphicsitem_cast<Dataflow::PortItem*>(item)
×
NEW
130
         || qgraphicsitem_cast<Dataflow::CableItem*>(item))
×
131
      {
NEW
132
        m_missed = 0;
×
NEW
133
        return;
×
134
      }
135
    }
136
  }
137
  // Twice in a row: a cursor that just crosses an empty space keeps it
NEW
138
  if(++m_missed >= 2)
×
NEW
139
    close();
×
NEW
140
}
×
141
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc