PropertyCleanup.h header

#include <ew/app/PropertyCleanup.h>

Namespace ew::app

PropertyCleanupChoice struct

struct ew::app::PropertyCleanupChoice

A writer's answer for one item, matched back to it by category and key.

Members

ew::core::foundation::CategoryId ew::app::entity::PropertyCleanupChoice::categoryId

The category the property is declared on today – with key, which item this answers.

QString ew::app::entity::PropertyCleanupChoice::key

The property's storage key.

PropertyDecision ew::app::entity::PropertyCleanupChoice::decision =

What to do with it.

ew::core::foundation::CategoryId ew::app::entity::PropertyCleanupChoice::keepOn

For PropertyDecision::KeepOnCategory, which category to leave it on. A null id, or the category it is already on, means leave it exactly where it is.

ew::core::foundation::ContentId ew::app::entity::PropertyCleanupChoice::keepOnEntity

For PropertyDecision::KeepOnEntity, the entity the writer picked. May be null when the property already has holders and the writer is content with those.

The property goes to this entity AND to every entity already holding a value, never to the pick alone. A writer choosing one character for a property another character has quietly filled in would otherwise send that second value dark – still stored, shown by nothing.

PropertyCleanupItem struct

struct ew::app::PropertyCleanupItem

One property the writer is asked about, with everything the question needs.

Members

ew::core::foundation::CategoryId ew::app::entity::PropertyCleanupItem::categoryId

The category that declares it today.

QString ew::app::entity::PropertyCleanupItem::categoryName

That category's name, for the row.

QString ew::app::entity::PropertyCleanupItem::key

The property's storage key.

QString ew::app::entity::PropertyCleanupItem::label

Its display label.

std::vector<ew::core::foundation::ContentId> ew::app::entity::PropertyCleanupItem::holders

The entities holding a non-empty value for it. Empty is the common case and the reason this wizard exists: the old behaviour scattered one-off notes across whole categories and nobody ever filled most of them in.

std::vector<ew::core::foundation::CategoryId> ew::app::entity::PropertyCleanupItem::categoryChoices

The categories it could be kept on: the one declaring it, then each ancestor, nearest first. What the "keep on category" selector offers.

Enumerations

enum class PropertyDecision { Undecided, Remove, KeepOnCategory, KeepOnEntity }

What a writer decided to do with one property the automatic tidy-up would not touch.

Functions

std::unique_ptr< ew::core::undo::Command > ew::app::entity::buildPropertyCleanupCommand(ew::core::project::Project &project, const std::vector< PropertyCleanupChoice > &choices)

A command applying choices to project as ONE undoable step, or nullptr when nothing was decided.

Undecided items are skipped rather than defaulted: an unanswered question is not an instruction, and quietly picking for the writer is the behaviour this wizard exists to end.

No VALUE is read, written or deleted by any of the three outcomes – only where a definition lives changes. A removed property's values stay exactly where they are, which is what makes the removal reversible by undo rather than merely regrettable.

std::vector< ew::core::foundation::ContentId > ew::app::entity::cleanupTargetCandidates(const ew::core::project::Project &project, const PropertyCleanupItem &item)

The entities "Keep on one entity" may offer for item, in id order.

The entities item's own CATEGORY reaches, plus any holder the scope somehow misses – a holder has a VALUE for the property and must never become unpickable. The picker used to list every entity in the project, so a note declared on "Peoples & Races" was chosen from a list holding every age, item and map beside the peoples, once per row.

Falls back to every entity when the category holds none at all, so the choice is never a dead end: an entity's OWN property shows on it whatever category it is filed in.

std::vector< PropertyCleanupItem > ew::app::entity::planPropertyCleanup(const ew::core::project::Project &project)

Every property in project that the automatic migration leaves for the writer to judge.

That is every property a category declares which is NOT plainly shared – fewer than two entities hold a value for it. A property two or more entities use is evidence of a real shared schema and is not worth asking about; a property nobody uses, or exactly one entity uses, is what the old bug produced by the hundred.

Ordered by category name then label, because this list is READ before it is answered.