|
Canorus 0.0
|
Base class for import filters. More...
#include <import.h>

Signals | |
| void | documentImported (CADocument *) |
| void | sheetImported (CASheet *) |
| void | staffImported (CAStaff *) |
| void | voiceImported (CAVoice *) |
| void | lyricsContextImported (CALyricsContext *) |
| void | functionMarkContextImported (CAFunctionMarkContext *) |
| void | importDone (int status) |
Public Member Functions | |
| CAImport (QTextStream *stream=0) | |
| CAImport (const QString stream) | |
| virtual | ~CAImport () |
| void | setStreamFromFile (const QString filename) |
| QString | fileName () |
| virtual const QString | readableStatus () |
| void | importDocument () |
| void | importSheet () |
| void | importStaff () |
| void | importVoice () |
| void | importLyricsContext () |
| void | importFunctionMarkContext () |
| CADocument * | importedDocument () |
| CASheet * | importedSheet () |
| CAStaff * | importedStaff () |
| CAVoice * | importedVoice () |
| CALyricsContext * | importedLyricsContext () |
| CAFunctionMarkContext * | importedFunctionMarkContext () |
Public Member Functions inherited from CAFile | |
| CAFile () | |
| virtual | ~CAFile () |
| const int | status () |
| const int | progress () |
| virtual const QString | readableStatus ()=0 |
| void | setStreamFromFile (const QString filename) |
| void | setStreamToFile (const QString filename) |
| void | setStreamFromDevice (QIODevice *device) |
| void | setStreamToDevice (QIODevice *device) |
| void | setStreamToString () |
| QString | getStreamAsString () |
Protected Member Functions | |
| virtual CADocument * | importDocumentImpl () |
| virtual CASheet * | importSheetImpl () |
| virtual CAStaff * | importStaffImpl () |
| virtual CAVoice * | importVoiceImpl () |
| virtual CALyricsContext * | importLyricsContextImpl () |
| virtual CAFunctionMarkContext * | importFunctionMarkContextImpl () |
| QTextStream & | in () |
Protected Member Functions inherited from CAFile | |
| void | setStatus (const int status) |
| void | setProgress (const int progress) |
| QTextStream * | stream () |
| virtual void | setStream (QTextStream *stream) |
| QFile * | file () |
| void | setFile (QFile *file) |
Protected Attributes | |
| QString | _fileName |
Private Types | |
| enum | CAImportPart { Undefined , Document , Sheet , Staff , Voice , LyricsContext , FunctionMarkContext } |
Private Member Functions | |
| void | setImportedDocument (CADocument *doc) |
| void | setImportedSheet (CASheet *sheet) |
| void | setImportedStaff (CAStaff *staff) |
| void | setImportedVoice (CAVoice *voice) |
| void | setImportedLyricsContext (CALyricsContext *lc) |
| void | setImportedFunctionMarkContext (CAFunctionMarkContext *fmc) |
| void | run () |
| void | setImportPart (CAImportPart part) |
| CAImportPart | importPart () |
Base class for import filters.
Copyright (c) 2007, 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 inherits CAFile and is the base class for any specific import filter (eg. LilyPond, CanorusML, MusicXML etc.).
If a developer wants to write a new import filter, he should: 1) Create a new class with the base class CAImport 2) Implement CAImport constructors and at least importDocumentImpl() function which returns the new CADocument. 3) Register the filter (put a new fileformat to CAFileFormats and add the filter to open/save dialogs in CACanorus)
Optionally: Developer should change the current status and progress while operations are in progress. He should also rewrite the readableStatus() function.
The following example illustrates the usage of import class:
In Python the example is even more direct using the string as an input method:
|
private |
| CAImport::CAImport | ( | QTextStream * | stream = 0 | ) |
References _fileName, setImportedDocument(), setImportedFunctionMarkContext(), setImportedLyricsContext(), setImportedSheet(), setImportedStaff(), setImportedVoice(), setImportPart(), CAFile::setStream(), CAFile::stream(), and Undefined.

| CAImport::CAImport | ( | const QString | stream | ) |
References setImportedDocument(), setImportedFunctionMarkContext(), setImportedLyricsContext(), setImportedSheet(), setImportedStaff(), setImportedVoice(), setImportPart(), CAFile::setStream(), CAFile::stream(), and Undefined.

|
virtual |
|
signal |
| QString CAImport::fileName | ( | ) |
References _fileName.
Referenced by CAMXLImport::importDocumentImpl(), CAMidiImport::importMidiEvents(), CACanorusMLImport::importResource(), CALilyPondImport::importSheetImpl(), and CAMidiImport::importSheetImpl().

|
signal |
| void CAImport::importDocument | ( | ) |
References Document, setImportPart(), and CAFile::setStatus().
Referenced by CACanImport::importDocumentImpl(), CAMainWin::openDocument(), CAAutoRecovery::openRecovery(), and CAMainWin::sourceViewCommit().


|
inlineprotectedvirtual |
Reimplemented in CACanImport, CACanorusMLImport, CAMidiImport, CAMusicXmlImport, and CAMXLImport.
References CAFile::setStatus().
Referenced by run().


|
signal |
|
inline |
References _importedDocument.
Referenced by CACanImport::importDocumentImpl(), CAMainWin::openDocument(), CAAutoRecovery::openRecovery(), and CAMainWin::sourceViewCommit().

|
inline |
References _importedFunctionMarkContext.
|
inline |
References _importedLyricsContext.
Referenced by CAMainWin::sourceViewCommit().

|
inline |
References _importedSheet.
|
inline |
References _importedStaff.
|
inline |
References _importedVoice.
Referenced by CAMainWin::sourceViewCommit().

| void CAImport::importFunctionMarkContext | ( | ) |
References FunctionMarkContext, setImportPart(), and CAFile::setStatus().

|
inlineprotectedvirtual |
References CAFile::setStatus().
Referenced by run().


| void CAImport::importLyricsContext | ( | ) |
References LyricsContext, setImportPart(), and CAFile::setStatus().
Referenced by CAMainWin::sourceViewCommit().


|
inlineprotectedvirtual |
Reimplemented in CALilyPondImport.
References CAFile::setStatus().
Referenced by run().


|
inlineprivate |
| void CAImport::importSheet | ( | ) |
References setImportPart(), CAFile::setStatus(), and Sheet.

|
inlineprotectedvirtual |
Reimplemented in CALilyPondImport, and CAMidiImport.
References CAFile::setStatus().
Referenced by run().


| void CAImport::importStaff | ( | ) |
References setImportPart(), CAFile::setStatus(), and Staff.

|
inlineprotectedvirtual |
References CAFile::setStatus().
Referenced by run().


| void CAImport::importVoice | ( | ) |
References setImportPart(), CAFile::setStatus(), and Voice.
Referenced by CAMainWin::sourceViewCommit().


|
inlineprotectedvirtual |
Reimplemented in CALilyPondImport.
References CAFile::setStatus().
Referenced by run().


|
inlineprotected |
|
signal |
|
virtual |
Implements CAFile.
Reimplemented in CALilyPondImport, CAMidiImport, and CAMusicXmlImport.
References CAFile::status().
Referenced by CAMusicXmlImport::readableStatus().


|
private |
Executed when a new thread is dispatched. It looks which part of the document should be imported and starts the procedure. It emits the appropriate signal when the procedure is finished.
References Document, documentImported(), FunctionMarkContext, functionMarkContextImported(), importDocumentImpl(), importDone(), importFunctionMarkContextImpl(), importLyricsContextImpl(), importPart(), importSheetImpl(), importStaffImpl(), importVoiceImpl(), LyricsContext, lyricsContextImported(), setImportedDocument(), setImportedFunctionMarkContext(), setImportedLyricsContext(), setImportedSheet(), setImportedStaff(), setImportedVoice(), CAFile::setStatus(), Sheet, sheetImported(), Staff, staffImported(), CAFile::status(), CAFile::stream(), Undefined, Voice, and voiceImported().

|
inlineprivate |
References _importedDocument.
Referenced by CAImport(), and run().

|
inlineprivate |
References _importedFunctionMarkContext.
Referenced by CAImport(), and run().

|
inlineprivate |
References _importedLyricsContext.
Referenced by CAImport(), and run().

|
inlineprivate |
References _importedSheet.
Referenced by CAImport(), and run().

|
inlineprivate |
References _importedStaff.
Referenced by CAImport(), and run().

|
inlineprivate |
References _importedVoice.
Referenced by CAImport(), and run().

|
inlineprivate |
References _importPart.
Referenced by CAImport(), importDocument(), importFunctionMarkContext(), importLyricsContext(), importSheet(), importStaff(), and importVoice().

| void CAImport::setStreamFromFile | ( | const QString | filename | ) |
Extends CAFile::setStreamFromFile by storing the filename in a public variable for use in the pmidi midi file parser.
References _fileName, and CAFile::setStreamFromFile().
Referenced by CAMXLImport::importDocumentImpl(), CAMXLImport::openContainer(), CAMainWin::openDocument(), and CAAutoRecovery::openRecovery().


|
signal |
|
signal |
|
signal |
|
protected |
|
private |
Referenced by importedDocument(), and setImportedDocument().
|
private |
Referenced by importedFunctionMarkContext(), and setImportedFunctionMarkContext().
|
private |
Referenced by importedLyricsContext(), and setImportedLyricsContext().
|
private |
Referenced by importedSheet(), and setImportedSheet().
|
private |
Referenced by importedStaff(), and setImportedStaff().
|
private |
Referenced by importedVoice(), and setImportedVoice().
|
private |
Referenced by importPart(), and setImportPart().