Loading...
Searching...
No Matches
score::GUIApplicationPlugin Class Reference

Used to extend the software with application-wide data. More...

Inheritance diagram for score::GUIApplicationPlugin:
Audio::ApplicationPlugin Clap::ApplicationPlugin Curve::ApplicationPlugin Engine::ApplicationPlugin Explorer::ApplicationPlugin Gfx::ApplicationPlugin JS::ApplicationPlugin Jit::ApplicationPlugin Process::ProjectFilesApplicationPlugin Recording::ApplicationPlugin RemoteControl::ApplicationPlugin Scenario::ScenarioApplicationPlugin Transport::ApplicationPlugin score::CoreApplicationPlugin score::UndoApplicationPlugin vst::GUIApplicationPlugin

Detailed Description

Used to extend the software with application-wide data.

This class's goal is to :

  • Instantiate some elements that are deeply intertwined with Qt : menus, toolbars
  • Answer to specific application-level events : creation, loading of a new document, etc.

It is instatiated exactly once and is accessible via the application context, score::ApplicationContext :

auto& plugin = context.applicationPlugin<MyApplicationPlugin>();
T & applicationPlugin() const
Access a specific application plug-in instance.
Definition GUIApplicationContext.hpp:69

The loading procedure is as follows :

  • prepareNewDocument is called for all plug-ins.
  • Creation of a Document.
  • Creation of a DocumentModel
  • on_initDocument is called for all plug-ins.
  • New document case :
  • The document delegate is created
  • on_newDocument is called for all plug-ins.
  • Loaded / restored document case :
  • The document delegate is loaded
  • The SerializableDocumentPlugin are loaded (see score::DocumentPluginFactory)
  • on_loadedDocument is called for all plug-ins.

Finally, on_createdDocument is called for all plug-ins. If the document becomes visible, on_documentChanged is called for all plug-ins.

Public Types

using GUIElements = score::GUIElements
 

Public Member Functions

 GUIApplicationPlugin (const score::GUIApplicationContext &presenter)
 
virtual GUIElements makeGUIElements ()
 makeGUIElements
 
virtual void initialize ()
 initialize
 
DocumentcurrentDocument () const
 currentDocument
 
virtual bool handleLoading ()
 afterStartup Returns true if the start-up was handled by this plug-in.
 
virtual void afterStartup ()
 afterStartup Called after all the documents have been created / loaded
 
virtual void on_initDocument (score::Document &doc)
 on_initDocument Will be called after the document has been created, for new, load, and restore, and before anything is loaded.
 
virtual void on_closeDocument (score::Document &doc)
 on_closeDocument Will be called before closing the document.
 
virtual void on_documentSaveAs (score::Document &doc, const QString &newFileName)
 on_documentSaveAs Called just before a document is written to newFileName, while it still knows where it used to live.
 
virtual void on_newDocument (score::Document &doc)
 on_newDocument Will be called only when a new, empty document is created; classes inheriting from SerializableDocumentPlugin should be instantiated and added to the document at this point.
 
virtual void on_loadedDocument (score::Document &doc)
 on_loadedDocument Will be called only after a document has been loaded
 
virtual void on_createdDocument (score::Document &doc)
 on_createdDocument Will be called after either on_newDocument or on_loadedDocument was called on every plug-in.
 
virtual void prepareNewDocument ()
 prepareNewDocument Will be called just before a document switch. It is possible to check if we are in the process of document switching via DocumentManager::preparingNewDocument.
 
virtual void on_documentChanged (score::Document *olddoc, score::Document *newdoc)
 on_documentChanged Will be called after a document switch. If newdoc isn't null, it means that it is currently being focused by score.
 
virtual void on_activeWindowChanged ()
 on_activeWindowChanged Can be used to check if the focus moves out of the main window.
 
virtual void on_keyPressEvent (QKeyEvent &event)
 on_keyPressEvent Called with key events in the main document view.
 
virtual void on_keyReleaseEvent (QKeyEvent &event)
 on_keyPressEvent Called with key events in the main document view.
 

Public Attributes

const GUIApplicationContextcontext
 

Member Function Documentation

◆ afterStartup()

void score::GUIApplicationPlugin::afterStartup ( )
virtual

afterStartup Called after all the documents have been created / loaded

Reimplemented in Engine::ApplicationPlugin, and JS::ApplicationPlugin.

◆ currentDocument()

Document * score::GUIApplicationPlugin::currentDocument ( ) const

currentDocument

Returns
Shortcut to get the active (visible) document.

◆ initialize()

void score::GUIApplicationPlugin::initialize ( )
virtual

initialize

This method will be called once every class has been loaded from every plug-in.

Reimplemented in Clap::ApplicationPlugin, Engine::ApplicationPlugin, Jit::ApplicationPlugin, Scenario::ScenarioApplicationPlugin, and vst::GUIApplicationPlugin.

◆ makeGUIElements()

GUIElements score::GUIApplicationPlugin::makeGUIElements ( )
virtual

makeGUIElements

This function allows a plug-in to provide custom elements to put in toolbars, menus, etc.

When returned here, they will afterwards be available through an score::ApplicationContext.

See also
score::GUIElements

Reimplemented in Process::ProjectFilesApplicationPlugin, Audio::ApplicationPlugin, Engine::ApplicationPlugin, and Scenario::ScenarioApplicationPlugin.

◆ on_createdDocument()

void score::GUIApplicationPlugin::on_createdDocument ( score::Document doc)
virtual

on_createdDocument Will be called after either on_newDocument or on_loadedDocument was called on every plug-in.

Reimplemented in Engine::ApplicationPlugin, Gfx::ApplicationPlugin, JS::ApplicationPlugin, RemoteControl::ApplicationPlugin, and Transport::ApplicationPlugin.

◆ on_documentChanged()

void score::GUIApplicationPlugin::on_documentChanged ( score::Document olddoc,
score::Document newdoc 
)
virtual

on_documentChanged Will be called after a document switch. If newdoc isn't null, it means that it is currently being focused by score.

Reimplemented in Engine::ApplicationPlugin.

◆ on_documentSaveAs()

void score::GUIApplicationPlugin::on_documentSaveAs ( score::Document doc,
const QString &  newFileName 
)
virtual

on_documentSaveAs Called just before a document is written to newFileName, while it still knows where it used to live.

This is the moment at which everything the document stores relatively to its own folder becomes wrong – media paths above all – so it is the moment to either re-anchor those references or collect what they point at. Doing it here rather than after the save means the very same serialization writes the corrected document out.

Reimplemented in Process::ProjectFilesApplicationPlugin.

◆ on_initDocument()

void score::GUIApplicationPlugin::on_initDocument ( score::Document doc)
virtual

on_initDocument Will be called after the document has been created, for new, load, and restore, and before anything is loaded.

Reimplemented in Engine::ApplicationPlugin.

◆ on_keyPressEvent()

void score::GUIApplicationPlugin::on_keyPressEvent ( QKeyEvent &  event)
virtual

on_keyPressEvent Called with key events in the main document view.

Reimplemented in Curve::ApplicationPlugin.

◆ on_keyReleaseEvent()

void score::GUIApplicationPlugin::on_keyReleaseEvent ( QKeyEvent &  event)
virtual

on_keyPressEvent Called with key events in the main document view.

Reimplemented in Curve::ApplicationPlugin.

◆ on_loadedDocument()

void score::GUIApplicationPlugin::on_loadedDocument ( score::Document doc)
virtual

on_loadedDocument Will be called only after a document has been loaded

Reimplemented in Process::ProjectFilesApplicationPlugin.

◆ on_newDocument()

void score::GUIApplicationPlugin::on_newDocument ( score::Document doc)
virtual

on_newDocument Will be called only when a new, empty document is created; classes inheriting from SerializableDocumentPlugin should be instantiated and added to the document at this point.

Reimplemented in JS::ApplicationPlugin.

◆ prepareNewDocument()

void score::GUIApplicationPlugin::prepareNewDocument ( )
virtual

prepareNewDocument Will be called just before a document switch. It is possible to check if we are in the process of document switching via DocumentManager::preparingNewDocument.

Reimplemented in Engine::ApplicationPlugin.


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