Loading...
Searching...
No Matches

Owns the documents. More...

Inheritance diagram for score::DocumentManager:
score::DocumentList

Detailed Description

Owns the documents.

Public Member Functions

 DocumentManager (score::View *view, QObject *parentPresenter)
 
void init (const score::GUIApplicationContext &ctx)
 
auto recentFiles () const
 
Document * setupDocument (const score::GUIApplicationContext &ctx, score::Document *doc)
 
template<typename... Args>
Document * newDocument (const score::GUIApplicationContext &ctx, Args &&... args)
 
Document * newDocumentFromTemplate (const score::GUIApplicationContext &ctx, const QString &templatePath)
 New untitled document initialized from a template or example .score file.
 
template<typename... Args>
Document * loadDocument (const score::GUIApplicationContext &ctx, Args &&... args)
 
template<typename... Args>
void restoreDocument (const score::GUIApplicationContext &ctx, Args &&... args)
 
void restoreDocuments (const score::GUIApplicationContext &ctx)
 
void setCurrentDocument (const score::GUIApplicationContext &ctx, Document *doc)
 
bool closeDocument (const score::GUIApplicationContext &ctx, Document &)
 
void forceCloseDocument (const score::GUIApplicationContext &ctx, Document &)
 
bool saveDocument (Document &)
 
bool saveDocumentAs (Document &)
 
bool saveDocumentAs (Document &, const QString &path)
 
bool saveStack ()
 
Document * loadStack (const score::GUIApplicationContext &ctx)
 
Document * loadStack (const score::GUIApplicationContext &ctx, const QString &)
 
Document * loadFile (const score::GUIApplicationContext &ctx, std::function< void(Document *)> onDone={})
 
Document * loadFile (const score::GUIApplicationContext &ctx, const QString &filename)
 
Document * openArchive (const score::GUIApplicationContext &ctx, const QString &archive)
 Open a project archive: a zip holding a .score and its media.
 
bool closeAllDocuments (const score::GUIApplicationContext &ctx)
 
void closeRemainingDocuments (const score::GUIApplicationContext *ctx=nullptr)
 
bool preparingNewDocument () const
 
void documentChanged (score::Document *arg_1)
 
- Public Member Functions inherited from score::DocumentList
const std::vector< Document * > & documents () const
 
std::vector< Document * > & documents ()
 
Document * currentDocument () const
 
void setCurrentDocument (Document *d)
 

Static Public Member Functions

static bool checkAndUpdateJson (rapidjson::Value &, const score::GUIApplicationContext &ctx)
 checkAndUpdateJson
 

Additional Inherited Members

- Protected Attributes inherited from score::DocumentList
std::vector< Document * > m_documents
 
Document * m_currentDocument {}
 

Member Function Documentation

◆ checkAndUpdateJson()

bool score::DocumentManager::checkAndUpdateJson ( rapidjson::Value &  obj,
const score::GUIApplicationContext &  ctx 
)
static

checkAndUpdateJson

Returns
boolean indicating if the document is loadable

◆ closeRemainingDocuments()

void score::DocumentManager::closeRemainingDocuments ( const score::GUIApplicationContext *  ctx = nullptr)

Tears down the documents still open without prompting; given ctx, GUI application plug-ins get on_closeDocument() as in forceCloseDocument(). Must run while the application plug-ins still exist (see ~Presenter).

◆ loadFile()

Document * score::DocumentManager::loadFile ( const score::GUIApplicationContext &  ctx,
std::function< void(Document *)>  onDone = {} 
)

Asks the user for a file and opens it.

onDone receives the document, or nullptr if the user cancelled or the file could not be read. The web file dialog answers through a callback, so there is nothing to return by the time this call ends.

◆ openArchive()

Document * score::DocumentManager::openArchive ( const score::GUIApplicationContext &  ctx,
const QString &  archive 
)

Open a project archive: a zip holding a .score and its media.

Asks where the project folder should be created, extracts the archive there and opens the extracted score.


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