TimelineGrouping.h header

#include <ew/app/TimelineGrouping.h>

Namespace ew::app

ArrangedTimelineLane struct

struct ew::app::ArrangedTimelineLane

One lane after the persisted arrangement (TL-46) has been applied: the lane, plus whether it is persistently hidden. The panel draws these in order and skips a hidden one, but still lists it so the reader can bring it back.

Members

TimelineLane ew::app::ArrangedTimelineLane::lane

The grouped lane being arranged.

bool ew::app::ArrangedTimelineLane::hidden = false

Whether this lane is persistently hidden by the arrangement (still listed so it can return).

bool ew::app::ArrangedTimelineLane::collapsed = false

Whether this lane is drawn collapsed to a single row.

bool operator==(const ArrangedTimelineLane &, const ArrangedTimelineLane &)=default

Compares equal when the lane and its hidden and collapsed flags all match.

TimelineLane struct

struct ew::app::TimelineLane

One lane produced by grouping the timeline's events (TL-43): a display label – which doubles as the lane's stable identity within a grouping – and the indices of the events that fall in it, in input order and de-duplicated. The panel turns each lane into a labelled horizontal track (TL-44); visibleTimelineLanes decides which of them the active filter draws (TL-45).

Members

QString ew::app::TimelineLane::label

The lane header text, and the key the filter switches on/off.

std::vector<int> ew::app::TimelineLane::eventIndices

Indices into the grouping input (ascending, each at most once), the events on this lane.

bool operator==(const TimelineLane &, const TimelineLane &)=default

Lanes compare equal when their label and event indices match.

TimelineLaneOrderEntry struct

struct ew::app::TimelineLaneOrderEntry

One lane's desired place when rewriting an arrangement (TL-46): its label and whether it should be hidden. The CALLER lists these in the order it wants the lanes drawn.

Members

QString ew::app::TimelineLaneOrderEntry::label

Label identifying the lane to place.

bool ew::app::TimelineLaneOrderEntry::hidden = false

Whether the lane should be hidden.

bool ew::app::TimelineLaneOrderEntry::collapsed = false

Whether the lane should be drawn collapsed.

bool operator==(const TimelineLaneOrderEntry &, const TimelineLaneOrderEntry &)=default

Compares equal when the label and its hidden and collapsed flags all match.

Functions

std::vector< ArrangedTimelineLane > ew::app::arrangeTimelineLanes(const std::vector< TimelineLane > &lanes, const std::vector< ew::core::TimelineLaneArrangement > &arrangements, ew::core::TimelineGroupBy dimension)

Applies the persisted lane arrangement (TL-46) to lanes for the dimension actually in force. arrangements is the whole project's arrangement (entries for every dimension); only those whose groupBy equals dimension apply, in their vector order. Output rule – every input lane appears EXACTLY ONCE and none is invented: first the lanes whose label matches an applicable arrangement entry, in the entries' order, each carrying that entry's hidden flag; then the remaining lanes in their natural input order, none hidden. An arrangement entry whose label is not among lanes is skipped (a lane that no longer exists cannot be arranged), and a duplicate label in the arrangement is honoured once. So the arrangement reorders and hides without ever dropping or duplicating a lane – the same no-lane-lost guarantee groupTimelineEvents gives.

std::vector< TimelineLane > ew::app::groupTimelineEvents(const std::vector< std::vector< QString > > &eventKeys, const QString &ungroupedLabel)

Groups events into lanes (TL-43 – "lanes are a grouping *choice*, not a fixed structure"). eventKeys carries, per event in order, the grouping values for the chosen dimension: a character / location / tag / timeline name. An event legitimately has several values (two participants -> two characters), so it lands in EACH matching lane (TL-47 – never make the author duplicate the event to say so); an event with no value (its key list is empty or holds only empty strings – e.g. no location set) goes to a single trailing lane labelled ungroupedLabel, so grouping never silently drops an event (TL-45 / TL-48). Lanes appear in first-value-appearance order for a stable result; the ungrouped lane, when present, is always last. Within one event a repeated value counts once (it cannot appear twice on its own lane).

std::vector< ew::core::TimelineLaneArrangement > ew::app::setTimelineLaneArrangementFor(const std::vector< ew::core::TimelineLaneArrangement > &existing, ew::core::TimelineGroupBy dimension, const std::vector< TimelineLaneOrderEntry > &orderedLanes)

Rewrites the arrangement for dimension from an explicit ordered orderedLanes list, preserving every entry for OTHER dimensions untouched (so a character arrangement is not lost when a location arrangement is edited). The new entries for dimension are appended in orderedLanes order. This is the producer the menu uses: it reads the current lane order, moves or hides one lane in that list, and calls this to get the arrangement to persist – the inverse of arrangeTimelineLanes, and round-trip-stable with it. An orderedLanes entry with an empty label is dropped (a lane must have a label to be identified).

std::vector< TimelineLane > ew::app::visibleTimelineLanes(const std::vector< TimelineLane > &lanes, const std::set< QString > &hiddenLabels)

The subset of lanes the filter leaves visible (TL-45): every lane whose label is not in hiddenLabels, order preserved. An empty hiddenLabels shows every lane (no filter). Kept pure and tested so "what the filter hides" is a machine-checkable fact, not a paint-time guess – an event that survives only on hidden lanes disappears, one still on a shown lane stays (TL-47).