Canorus 0.0
Public Member Functions | Static Public Member Functions | List of all members
CAResourceCtl Class Reference

Resource control class. More...

#include <resourcectl.h>

Public Member Functions

 CAResourceCtl ()
 
virtual ~CAResourceCtl ()
 

Static Public Member Functions

static CAResourceimportResource (QString name, QString fileName, bool isLinked=false, CADocument *parent=0, CAResource::CAResourceType t=CAResource::Other)
 
static CAResourcecreateEmptyResource (QString name, CADocument *parent=0, CAResource::CAResourceType t=CAResource::Other)
 
static void deleteResource (CAResource *)
 

Detailed Description

Resource control class.

Copyright (c) 2008-2009, Matevž Jekovec, Canorus development team All Rights Reserved. See AUTHORS for a complete list of authors.

Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE.GPL for details.

Copyright (c) 2008-2009, Matevž Jekovec, Canorus development team All Rights Reserved. See AUTHORS for a complete list of authors.

Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE.GPL for details.

This class is used for creation of new resources out of files on the disk or web URLs.

Resources are rarely created directly (maybe using the plugin interface), but usually are part of the document (eg. audio file of the whole score), sheet (eg. audio file of a theme), staff (eg. svg images in contemporary music), voice etc. You can simply add a resource by calling CADocument::addResource( new CAResource( "/home/user/title.jpeg", "My image") );

CAResourceContainer takes care of creating copies for non-linked resources. It picks a random unique name for a new resource in the system temporary file.

See also
CAResource

Constructor & Destructor Documentation

◆ CAResourceCtl()

CAResourceCtl::CAResourceCtl ( )

Default constructor. Currently empty.

◆ ~CAResourceCtl()

CAResourceCtl::~CAResourceCtl ( )
virtual

Member Function Documentation

◆ createEmptyResource()

CAResource * CAResourceCtl::createEmptyResource ( QString  name,
CADocument parent = 0,
CAResource::CAResourceType  t = CAResource::Other 
)
static

Creates an empty resource file. This function is usually called when launching Midi recorder.

References CADocument::addResource(), CAResource::document(), CAUndo::getAllDocuments(), CADocument::setModified(), and CACanorus::undo().

Referenced by CAMainWin::on_uiMidiRecorder_triggered().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deleteResource()

void CAResourceCtl::deleteResource ( CAResource r)
static

Removes the given resource r from all the undo/redo document instances and destroys it.

References CAResource::document(), CAUndo::getAllDocuments(), CADocument::removeResource(), CADocument::setModified(), and CACanorus::undo().

Referenced by CADocument::clear(), and CAResourceView::contextMenuEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importResource()

CAResource * CAResourceCtl::importResource ( QString  name,
QString  fileName,
bool  isLinked = false,
CADocument parent = 0,
CAResource::CAResourceType  t = CAResource::Other 
)
static

Imports the resource located at fileName and adds it to the document parent and all its undo/redo instances. If the resource is linked, the fileName should be url and a resource is only registered. If the resource is not linked, the fileName should be absolute path to the file, resource is copied and registered.

References CADocument::addResource(), CAUndo::getAllDocuments(), and CACanorus::undo().

Referenced by CACanorusMLImport::importResource().

Here is the call graph for this function:
Here is the caller graph for this function:

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