DialogueTable.h header

#include <ew/app/publishing/DialogueTable.h>

Namespace ew::app::publishing

DialogueEdit struct

struct ew::app::publishing::DialogueEdit

What one row of an imported table asks to change.

Members

ew::core::foundation::BranchNodeId ew::app::publishing::DialogueEdit::lineId

The line it names.

ew::core::foundation::ContentId ew::app::publishing::DialogueEdit::sceneId

The scene that line is in.

QString ew::app::publishing::DialogueEdit::text

The words it wants the line to say.

QString ew::app::publishing::DialogueEdit::status

The review state it wants.

QString ew::app::publishing::DialogueEdit::owner

The owner it wants.

QString ew::app::publishing::DialogueEdit::tags

The tags it wants, as written in the cell.

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

Edits compare equal when every field matches.

DialogueRow struct

struct ew::app::publishing::DialogueRow

One line of dialogue as a row a producer can read.

Narrative teams live in spreadsheets, and producers and localisation leads want a flat table, not a graph. A row per line is the interchange format every one of them already has a process for; a graph is not something you can comment on in a shared sheet.

A node with alternate takes contributes one row PER TAKE, each under its own line id, because that is what a take is for: independently recorded, independently translated, independently approved.

Members

QString ew::app::publishing::DialogueRow::lineId

The line's stable id – the node's, or the take's own. The key the import matches on..

QString ew::app::publishing::DialogueRow::sceneId

The scene the line is in, by id. Context for a reader and never matched on.

QString ew::app::publishing::DialogueRow::scene

The scene's title.

QString ew::app::publishing::DialogueRow::node

What the node is called on the canvas.

QString ew::app::publishing::DialogueRow::speaker

Who says it, by name; empty for narration.

QString ew::app::publishing::DialogueRow::text

The words. The column a producer edits, and the reason the round trip exists.

QString ew::app::publishing::DialogueRow::condition

The expression gating this take, or empty. Read-only context: an expression edited in a spreadsheet by somebody who cannot see the variables is a story bug nobody would catch.

QString ew::app::publishing::DialogueRow::status

The line's review state (Gap Work Order 3.10). Writable.

These three belong to the LINE, not to a phrasing of it, so exactly ONE of a node's rows carries them: its own when it has no takes, otherwise its first take's. On the remaining take rows they are empty, and the import ignores them there. Repeated on every take row they were also written back from every take row, so an approval a producer set on the first of a line's three rows was overwritten by the second and third – applied, then silently undone, while the count they were shown said three lines had changed.

QString ew::app::publishing::DialogueRow::owner

Who is answerable for the line. Writable; see status for which row carries it.

QString ew::app::publishing::DialogueRow::tags

The node's tags, comma-separated. Writable; see status for which row carries them.

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

Rows compare equal when every field matches.

DialogueTableRead struct

struct ew::app::publishing::DialogueTableRead

What reading a table found.

Members

std::vector<DialogueEdit> ew::app::publishing::DialogueTableRead::edits

The rows that name a line this project has, with what they want changed.

std::vector<QString> ew::app::publishing::DialogueTableRead::unmatched

The rows that name no line this project has, as the id they carried.

Reported, never dropped. A producer who renamed a line id, or exported from a newer script, has to be told which rows went nowhere – an import that silently ignored half a sheet would be indistinguishable from one that worked.

bool ew::app::publishing::DialogueTableRead::recognised = false

Whether the header row named the columns this reads. False means the whole file was something else, which is a different failure from a file full of unmatched ids.

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

Reads compare equal when every field matches.

Functions

std::vector< ew::core::branching::BranchNode > ew::app::publishing::applyDialogueEdits(const ew::core::branching::BranchScene &scene, const std::vector< DialogueEdit > &edits, std::size_t *changed)

scene with edits applied, or the scene's nodes unchanged when none of them touch it.

Returns the nodes rather than mutating, so the caller can push one undoable command per scene and a half-applied import cannot exist.

std::vector< DialogueRow > ew::app::publishing::dialogueRows(const ew::core::project::Project &project, const ew::core::branching::BranchScene &scene)

Every line in scene, in the scene's own node order.

std::vector< DialogueRow > ew::app::publishing::dialogueRows(const ew::core::project::Project &project)

Every line in every branching scene the project holds, scene by scene.

QStringList ew::app::publishing::dialogueTableColumns()

The columns, in order, with the stable English names the file carries.

Stable and untranslated because the file is an interchange format: a sheet exported by a Spanish build has to import into an English one, and a header that changed with the UI language would make that a silent failure.

QString ew::app::publishing::dialogueTableText(const std::vector< DialogueRow > &rows, QChar separator)

rows as delimited text with a header row, ready to be written to disk.

separator is ',' for CSV and '\t' for TSV.

DialogueTableRead ew::app::publishing::readDialogueTable(const ew::core::project::Project &project, const QString &text, QChar separator)

Reads text as a dialogue table against project.

Columns are located by their header NAMES rather than by position, so a producer who moved a column, or added one of their own for notes, still gets an import that works – which they will do, because it is a spreadsheet.