anpstudio 0.4.0
ANP Studio — Analytic Network Process desktop application
Loading...
Searching...
No Matches
Signals | Public Member Functions | List of all members
Document Class Reference

Owns the root anpcpp::AnpNetwork, undo stack, file path, and dirty flag. More...

#include <document.hpp>

Inherits QObject.

Signals

void sessionChanged ()
 Emitted when the judgment session scope or roster changes.
 
void researcherSessionChanged ()
 Emitted when the Researcher session is replaced (load / new).
 
void linkedFormsChanged ()
 Emitted when the linked Google Forms list changes.
 

Public Member Functions

const QVector< ResearcherNotebook > & researcherNotebooks () const
 
int researcherActiveIndex () const
 
void setResearcherSession (QVector< ResearcherNotebook > notebooks, int activeIndex)
 Replaces the Researcher session (does not emit session changed).
 
void clearResearcherSession ()
 Clears Researcher notebooks without emitting session changed.
 
const QVector< LinkedGoogleForm > & linkedGoogleForms () const
 
void addLinkedGoogleForm (const LinkedGoogleForm &form)
 Appends a linked form and marks dirty.
 
void removeLinkedGoogleForm (const QString &formId)
 Removes by form id.
 
const LinkedGoogleFormlatestLinkedGoogleForm () const
 
anpcpp::AnpNetwork * networkAtPath (const QString &path) const
 Returns the network at a breadcrumb path without changing the view.
 
bool hasParticipants () const
 
const std::vector< anpcpp::JudgmentParticipant > & participants () const
 
const std::vector< anpcpp::JudgmentGroup > & judgmentGroups () const
 
anpcpp::JudgmentSession judgmentSession () const
 
void setJudgmentSession (const anpcpp::JudgmentSession &session)
 Sets the session scope, rebuilds effective judgments on the root network, and marks the document dirty.
 
anpcpp::JudgmentParticipant & addParticipant (const QString &id, const QString &name, const QString &email={})
 Adds (or renames, if id already exists) a participant.
 
void removeParticipant (const QString &id)
 Removes a participant and their judgment tables.
 
anpcpp::JudgmentGroup & setJudgmentGroup (const QString &id, const QString &name, const QStringList &memberIds)
 Adds or updates a named group of participant ids.
 
void removeJudgmentGroup (const QString &id)
 Removes a named group.
 
QByteArray snapshotNetworkJson () const
 Serializes the root ANP network only (no researcher / google_forms).
 
void applyNetworkJson (const QByteArray &bytes)
 Replaces the root network from snapshotNetworkJson bytes.
 
void rebuildEffectiveJudgments ()
 Rebuilds effective judgments from the root network downward.
 
QString activeParticipantId () const
 
bool judgmentReadOnly () const
 

Detailed Description

Owns the root anpcpp::AnpNetwork, undo stack, file path, and dirty flag.

Subnet navigation maintains a stack of AnpNetwork* frames pointing into nodes' owned subnetworks.

File I/O wraps libanpcpp network JSON and may include an optional top-level researcher notebook block (Studio extension; ignored by older tools).

Member Function Documentation

◆ activeParticipantId()

QString Document::activeParticipantId ( ) const
Returns
Active participant id for editing, or empty when the session is an aggregate (Average / Group) — those views are read-only.

◆ addLinkedGoogleForm()

void Document::addLinkedGoogleForm ( const LinkedGoogleForm form)

Appends a linked form and marks dirty.

Emits linkedFormsChanged.

◆ addParticipant()

anpcpp::JudgmentParticipant & Document::addParticipant ( const QString &  id,
const QString &  name,
const QString &  email = {} 
)

Adds (or renames, if id already exists) a participant.

Ensures per-user judgment tables exist and rebuilds effective judgments.

◆ applyNetworkJson()

void Document::applyNetworkJson ( const QByteArray &  bytes)

Replaces the root network from snapshotNetworkJson bytes.

Preserves the undo stack, file path, Researcher notebooks, and linked Google Forms. Resets the subnet view stack to root and refreshes UI.

◆ hasParticipants()

bool Document::hasParticipants ( ) const
inline
Returns
True if the model has any judgment participants defined.

◆ judgmentGroups()

const std::vector< anpcpp::JudgmentGroup > & Document::judgmentGroups ( ) const
inline
Returns
Named judgment groups.

◆ judgmentReadOnly()

bool Document::judgmentReadOnly ( ) const
Returns
True if judgment editors should be read-only: participants exist and the session scope is an aggregate (Average or Group).

◆ judgmentSession()

anpcpp::JudgmentSession Document::judgmentSession ( ) const
inline
Returns
Current document-wide judgment session scope.

◆ latestLinkedGoogleForm()

const LinkedGoogleForm * Document::latestLinkedGoogleForm ( ) const
Returns
Most recently linked form, or nullptr.

◆ linkedGoogleForms()

const QVector< LinkedGoogleForm > & Document::linkedGoogleForms ( ) const
inline
Returns
Google Forms linked to this model (newest last).

◆ networkAtPath()

anpcpp::AnpNetwork * Document::networkAtPath ( const QString &  path) const

Returns the network at a breadcrumb path without changing the view.

Parameters
pathe.g. "Root" or "Root / Node" (same form as networkPathOptions()).
Returns
Network pointer, or nullptr if path is invalid.

◆ participants()

const std::vector< anpcpp::JudgmentParticipant > & Document::participants ( ) const
inline
Returns
Model participants (shared roster owned by the root network).

◆ rebuildEffectiveJudgments()

void Document::rebuildEffectiveJudgments ( )

Rebuilds effective judgments from the root network downward.

Call after any per-participant judgment edit (via *_for network calls). Marks the document dirty and triggers a UI refresh.

◆ researcherActiveIndex()

int Document::researcherActiveIndex ( ) const
inline
Returns
Index of the active notebook (0 if empty).

◆ researcherNotebooks()

const QVector< ResearcherNotebook > & Document::researcherNotebooks ( ) const
inline
Returns
All Researcher notebooks (may be empty).

◆ researcherSessionChanged

void Document::researcherSessionChanged ( )
signal

Emitted when the Researcher session is replaced (load / new).

Not emitted for incremental edits via setResearcherSession().

◆ setJudgmentSession()

void Document::setJudgmentSession ( const anpcpp::JudgmentSession &  session)

Sets the session scope, rebuilds effective judgments on the root network, and marks the document dirty.

Emits sessionChanged.

◆ setResearcherSession()

void Document::setResearcherSession ( QVector< ResearcherNotebook notebooks,
int  activeIndex 
)

Replaces the Researcher session (does not emit session changed).

Callers that edit notebooks should also call setDirty().

◆ snapshotNetworkJson()

QByteArray Document::snapshotNetworkJson ( ) const

Serializes the root ANP network only (no researcher / google_forms).

Used for undo snapshots of remove-participant and bulk judgment imports.


The documentation for this class was generated from the following file: