ObjectAudiences.h header
#include <ew/app/ObjectAudiences.h>
Namespace ew::app
Enumerations
enum class AudienceSweep { UnrestrictedOnly, Everything }
Which existing objects a bulk visibility change should touch.
Functions
std::unique_ptr< ew::core::undo::Command > ew::app::content::buildApplyAudienceToAllCommand(ew::core::project::Project &project, const std::set< QString > &audiences, AudienceSweep sweep)
Builds one undoable command that sets audiences as the visible-audience set of the objects in project selected by sweep – the retroactive half of Project::defaultAudiences, which governs only newly created objects.
This exists because per-object visibility is subtractive: an unrestricted object is visible to EVERY audience, so an export for a readership includes everything nobody has restricted. In a project of hundreds of objects that makes "only these few things are for readers" unreachable by hand. Sweeping a default across everything inverts the model – content is then PROMOTED to a readership instead of hidden from one.
The result is a single CompositeCommand, so the whole sweep is one undo step rather than hundreds (and one entry in the change log). Returns null when the sweep would change nothing, so a caller can report "nothing to do" instead of pushing an empty command that still marks the project modified and clears the redo stack.
int ew::app::content::countAudienceSweepTargets(const ew::core::project::Project &project, const std::set< QString > &audiences, AudienceSweep sweep)
How many objects buildApplyAudienceToAllCommand would change, for a confirmation prompt that states the scale before the writer commits to it.