octomy::hive::SwarmChipWidget

The swarm status chip in the window header.

SwarmChipWidget

Declared in src/libs/libhive/hive/SwarmChipWidget.hpp
Inherits QPushButton
Group hive

Detailed description

The chip is a pill-shaped QPushButton that has the size of its content, in the family of the identity chips (§SWC). At the left is the honeycomb icon for the current state, cut by the left cap of the pill (§SWC-7). In the middle is the number of peers that the node can reach. At the right is a two-tone spark of the send and receive rates, cut by the right cap (§SWC-6).

setState() gives the chip a SwarmBadgeState, and that state is all that drives it. The Disabled state hides the chip with a fade and a slide (§SWC-4). When the icon for a state does not load, the chip shows the generic swarm icon. usingFallbackIcon() tells which icon it shows.

Property documentation

presence property

presence : qreal

how much of the chip is shown, from 0.0 (gone) to 1.0 (fully shown).

The value sets the opacity of the chip and scales its width, so the chip fades as it becomes narrower (§SWC-4). The Disabled state animates it to 0 and then hides the chip. The next other state shows the chip and animates the value back to 1. A chip that is not visible changes at once, with no animation. A value outside the range is clamped.

Access functions:

  • qreal presence() const
  • void setPresence(qreal presence)

sparkWidth property

sparkWidth : int

This property holds the current width of the spark segment, in pixels.

A change of state animates this value to sparkWidthTarget(): the full strip, 64 pixels, in the Connected and Degraded states, and 0 in every other state (§SWC-6). An empty strip only uses space and attention.

Access functions:

  • int sparkWidth() const
  • void setSparkWidth(int width)