LMMS
Loading...
Searching...
No Matches
lmms::DataFile Class Reference

#include <DataFile.h>

Inheritance diagram for lmms::DataFile:

Public Types

enum class  Type {
  Unknown , SongProject , SongProjectTemplate , InstrumentTrackSettings ,
  DragNDropData , ClipboardData , JournalData , EffectSettings ,
  MidiClip
}

Public Member Functions

 DataFile (const QString &fileName)
 DataFile (const QByteArray &data)
 DataFile (Type type)
virtual ~DataFile ()=default
bool validate (QString extension)
 validate performs basic validation, compared to file extension.
QString nameWithExtension (const QString &fn) const
void write (QTextStream &strm)
bool writeFile (const QString &fn, bool withResources=false)
bool copyResources (const QString &resourcesDir)
 Copies resources to the resourcesDir and changes the DataFile to use local paths to them.
bool hasLocalPlugins (QDomElement parent=QDomElement(), bool firstCall=true) const
 This recursive method will go through all XML nodes of the DataFile and check whether any of them have local paths. If they are not on our list of elements that can have local paths we return true, indicating that we potentially have plugins with local paths that would be a security issue. The Song class can then abort loading this project.
QDomElement & content ()
QDomElement & head ()
Type type () const
unsigned int legacyFileVersion ()

Private Types

using UpgradeMethod = void(DataFile::*)()
using ResourcesMap = std::map<QString, std::vector<QString>>

Private Member Functions

void cleanMetaNodes (QDomElement de)
void mapSrcAttributeInElementsWithResources (const QMap< QString, QString > &map)
void upgrade_0_2_1_20070501 ()
void upgrade_0_2_1_20070508 ()
void upgrade_0_3_0_rc2 ()
void upgrade_0_3_0 ()
void upgrade_0_4_0_20080104 ()
void upgrade_0_4_0_20080118 ()
void upgrade_0_4_0_20080129 ()
void upgrade_0_4_0_20080409 ()
void upgrade_0_4_0_20080607 ()
void upgrade_0_4_0_20080622 ()
void upgrade_0_4_0_beta1 ()
void upgrade_0_4_0_rc2 ()
void upgrade_1_0_99 ()
void upgrade_1_1_0 ()
void upgrade_1_1_91 ()
void upgrade_1_2_0_rc3 ()
void upgrade_1_3_0 ()
void upgrade_noHiddenClipNames ()
void upgrade_automationNodes ()
void upgrade_extendedNoteRange ()
 Note range has been extended to match MIDI specification.
void upgrade_defaultTripleOscillatorHQ ()
 TripleOscillator switched to using high-quality, alias-free oscillators by default.
void upgrade_mixerRename ()
void upgrade_bbTcoRename ()
void upgrade_sampleAndHold ()
void upgrade_midiCCIndexing ()
void upgrade_loopsRename ()
void upgrade_noteTypes ()
void upgrade_fixCMTDelays ()
void upgrade_fixBassLoopsTypo ()
void findProblematicLadspaPlugins ()
void upgrade_noHiddenAutomationTracks ()
void upgrade ()
void loadData (const QByteArray &_data, const QString &_sourceFile)

Static Private Member Functions

static Type type (const QString &typeName)
static QString typeName (Type type)

Private Attributes

QString m_fileName
 The origin file name or "" if this DataFile didn't originate from a file.
QDomElement m_content
QDomElement m_head
Type m_type
unsigned int m_fileVersion

Static Private Attributes

static const std::vector< UpgradeMethodUPGRADE_METHODS
static const std::vector< ProjectVersionUPGRADE_VERSIONS
static const ResourcesMap ELEMENTS_WITH_RESOURCES

Member Typedef Documentation

◆ ResourcesMap

using lmms::DataFile::ResourcesMap = std::map<QString, std::vector<QString>>
private

◆ UpgradeMethod

using lmms::DataFile::UpgradeMethod = void(DataFile::*)()
private

Member Enumeration Documentation

◆ Type

enum class lmms::DataFile::Type
strong
Enumerator
Unknown 
SongProject 
SongProjectTemplate 
InstrumentTrackSettings 
DragNDropData 
ClipboardData 
JournalData 
EffectSettings 
MidiClip 

Constructor & Destructor Documentation

◆ DataFile() [1/3]

lmms::DataFile::DataFile ( const QString & fileName)

◆ DataFile() [2/3]

lmms::DataFile::DataFile ( const QByteArray & data)

◆ DataFile() [3/3]

lmms::DataFile::DataFile ( Type type)

◆ ~DataFile()

virtual lmms::DataFile::~DataFile ( )
virtualdefault

Member Function Documentation

◆ cleanMetaNodes()

void lmms::DataFile::cleanMetaNodes ( QDomElement de)
private

◆ content()

QDomElement & lmms::DataFile::content ( )
inline

◆ copyResources()

bool lmms::DataFile::copyResources ( const QString & resourcesDir)

Copies resources to the resourcesDir and changes the DataFile to use local paths to them.

◆ findProblematicLadspaPlugins()

void lmms::DataFile::findProblematicLadspaPlugins ( )
private

◆ hasLocalPlugins()

bool lmms::DataFile::hasLocalPlugins ( QDomElement parent = QDomElement(),
bool firstCall = true ) const

This recursive method will go through all XML nodes of the DataFile and check whether any of them have local paths. If they are not on our list of elements that can have local paths we return true, indicating that we potentially have plugins with local paths that would be a security issue. The Song class can then abort loading this project.

Parameters
parentThe parent node being iterated. When called without arguments, this will be an empty element that will be ignored (since the second parameter will be true).
firstCallDefaults to true, and indicates to this recursive method whether this is the first call. If it is it will use the root element as the parent.

◆ head()

QDomElement & lmms::DataFile::head ( )
inline

◆ legacyFileVersion()

unsigned int lmms::DataFile::legacyFileVersion ( )

◆ loadData()

void lmms::DataFile::loadData ( const QByteArray & _data,
const QString & _sourceFile )
private

◆ mapSrcAttributeInElementsWithResources()

void lmms::DataFile::mapSrcAttributeInElementsWithResources ( const QMap< QString, QString > & map)
private

◆ nameWithExtension()

QString lmms::DataFile::nameWithExtension ( const QString & fn) const

◆ type() [1/2]

Type lmms::DataFile::type ( ) const
inline

◆ type() [2/2]

DataFile::Type lmms::DataFile::type ( const QString & typeName)
staticprivate

◆ typeName()

QString lmms::DataFile::typeName ( Type type)
staticprivate

◆ upgrade()

void lmms::DataFile::upgrade ( )
private

◆ upgrade_0_2_1_20070501()

void lmms::DataFile::upgrade_0_2_1_20070501 ( )
private

◆ upgrade_0_2_1_20070508()

void lmms::DataFile::upgrade_0_2_1_20070508 ( )
private

◆ upgrade_0_3_0()

void lmms::DataFile::upgrade_0_3_0 ( )
private

◆ upgrade_0_3_0_rc2()

void lmms::DataFile::upgrade_0_3_0_rc2 ( )
private

◆ upgrade_0_4_0_20080104()

void lmms::DataFile::upgrade_0_4_0_20080104 ( )
private

◆ upgrade_0_4_0_20080118()

void lmms::DataFile::upgrade_0_4_0_20080118 ( )
private

◆ upgrade_0_4_0_20080129()

void lmms::DataFile::upgrade_0_4_0_20080129 ( )
private

◆ upgrade_0_4_0_20080409()

void lmms::DataFile::upgrade_0_4_0_20080409 ( )
private

◆ upgrade_0_4_0_20080607()

void lmms::DataFile::upgrade_0_4_0_20080607 ( )
private

◆ upgrade_0_4_0_20080622()

void lmms::DataFile::upgrade_0_4_0_20080622 ( )
private

◆ upgrade_0_4_0_beta1()

void lmms::DataFile::upgrade_0_4_0_beta1 ( )
private

◆ upgrade_0_4_0_rc2()

void lmms::DataFile::upgrade_0_4_0_rc2 ( )
private

◆ upgrade_1_0_99()

void lmms::DataFile::upgrade_1_0_99 ( )
private

◆ upgrade_1_1_0()

void lmms::DataFile::upgrade_1_1_0 ( )
private

◆ upgrade_1_1_91()

void lmms::DataFile::upgrade_1_1_91 ( )
private

◆ upgrade_1_2_0_rc3()

void lmms::DataFile::upgrade_1_2_0_rc3 ( )
private

◆ upgrade_1_3_0()

void lmms::DataFile::upgrade_1_3_0 ( )
private

◆ upgrade_automationNodes()

void lmms::DataFile::upgrade_automationNodes ( )
private

◆ upgrade_bbTcoRename()

void lmms::DataFile::upgrade_bbTcoRename ( )
private

◆ upgrade_defaultTripleOscillatorHQ()

void lmms::DataFile::upgrade_defaultTripleOscillatorHQ ( )
private

TripleOscillator switched to using high-quality, alias-free oscillators by default.

Older projects were made without this feature and would sound differently if loaded with the new default setting. This upgrade routine preserves their old behavior.

◆ upgrade_extendedNoteRange()

void lmms::DataFile::upgrade_extendedNoteRange ( )
private

Note range has been extended to match MIDI specification.

The non-standard note range previously affected all MIDI-based instruments except OpulenZ, and made them sound an octave lower than they should (#1857).

◆ upgrade_fixBassLoopsTypo()

void lmms::DataFile::upgrade_fixBassLoopsTypo ( )
private

◆ upgrade_fixCMTDelays()

void lmms::DataFile::upgrade_fixCMTDelays ( )
private

◆ upgrade_loopsRename()

void lmms::DataFile::upgrade_loopsRename ( )
private

◆ upgrade_midiCCIndexing()

void lmms::DataFile::upgrade_midiCCIndexing ( )
private

Update MIDI CC indexes, so that they are counted from 0. Older releases of LMMS count the CCs from 1.

◆ upgrade_mixerRename()

void lmms::DataFile::upgrade_mixerRename ( )
private

◆ upgrade_noHiddenAutomationTracks()

void lmms::DataFile::upgrade_noHiddenAutomationTracks ( )
private

◆ upgrade_noHiddenClipNames()

void lmms::DataFile::upgrade_noHiddenClipNames ( )
private

◆ upgrade_noteTypes()

void lmms::DataFile::upgrade_noteTypes ( )
private

◆ upgrade_sampleAndHold()

void lmms::DataFile::upgrade_sampleAndHold ( )
private

◆ validate()

bool lmms::DataFile::validate ( QString extension)

validate performs basic validation, compared to file extension.

◆ write()

void lmms::DataFile::write ( QTextStream & strm)

◆ writeFile()

bool lmms::DataFile::writeFile ( const QString & fn,
bool withResources = false )

Member Data Documentation

◆ ELEMENTS_WITH_RESOURCES

const DataFile::ResourcesMap lmms::DataFile::ELEMENTS_WITH_RESOURCES
staticprivate
Initial value:
= {
{ "sampleclip", {"src"} },
{ "audiofileprocessor", {"src"} },
}

◆ m_content

QDomElement lmms::DataFile::m_content
private

◆ m_fileName

QString lmms::DataFile::m_fileName
private

The origin file name or "" if this DataFile didn't originate from a file.

◆ m_fileVersion

unsigned int lmms::DataFile::m_fileVersion
private

◆ m_head

QDomElement lmms::DataFile::m_head
private

◆ m_type

Type lmms::DataFile::m_type
private

◆ UPGRADE_METHODS

const std::vector< DataFile::UpgradeMethod > lmms::DataFile::UPGRADE_METHODS
staticprivate
Initial value:
= {
}
void upgrade_0_4_0_rc2()
Definition DataFile.cpp:1059
void upgrade_1_1_0()
Definition DataFile.cpp:1126
void upgrade_0_4_0_20080118()
Definition DataFile.cpp:919
void upgrade_0_4_0_20080607()
Definition DataFile.cpp:986
void upgrade_loopsRename()
Definition DataFile.cpp:2007
void upgrade_extendedNoteRange()
Note range has been extended to match MIDI specification.
Definition DataFile.cpp:1812
void findProblematicLadspaPlugins()
Definition DataFile.cpp:2036
void upgrade_mixerRename()
Definition DataFile.cpp:1844
void upgrade_automationNodes()
Definition DataFile.cpp:1724
void upgrade_1_1_91()
Definition DataFile.cpp:1140
void upgrade_1_3_0()
Definition DataFile.cpp:1314
void upgrade_0_4_0_20080104()
Definition DataFile.cpp:903
void upgrade_0_2_1_20070501()
Definition DataFile.cpp:680
void upgrade_sampleAndHold()
Definition DataFile.cpp:1938
void upgrade_0_4_0_20080129()
Definition DataFile.cpp:941
void upgrade_1_0_99()
Definition DataFile.cpp:1085
void upgrade_defaultTripleOscillatorHQ()
TripleOscillator switched to using high-quality, alias-free oscillators by default.
Definition DataFile.cpp:1826
void upgrade_0_4_0_20080409()
Definition DataFile.cpp:957
void upgrade_0_4_0_20080622()
Definition DataFile.cpp:998
void upgrade_0_3_0()
Definition DataFile.cpp:876
void upgrade_noteTypes()
Definition DataFile.cpp:1751
void upgrade_0_2_1_20070508()
Definition DataFile.cpp:798
void upgrade_fixBassLoopsTypo()
Definition DataFile.cpp:2069
void upgrade_1_2_0_rc3()
Definition DataFile.cpp:1221
void upgrade_midiCCIndexing()
Definition DataFile.cpp:2016
void upgrade_bbTcoRename()
Definition DataFile.cpp:1904
void upgrade_0_4_0_beta1()
Definition DataFile.cpp:1020
void upgrade_noHiddenClipNames()
Definition DataFile.cpp:1695
void upgrade_fixCMTDelays()
Definition DataFile.cpp:1768
void upgrade_0_3_0_rc2()
Definition DataFile.cpp:860
void upgrade_noHiddenAutomationTracks()
Definition DataFile.cpp:1650

◆ UPGRADE_VERSIONS

const std::vector< ProjectVersion > lmms::DataFile::UPGRADE_VERSIONS
staticprivate
Initial value:
= {
"0.2.1-20070501" , "0.2.1-20070508" , "0.3.0-rc2",
"0.3.0" , "0.4.0-20080104" , "0.4.0-20080118",
"0.4.0-20080129" , "0.4.0-20080409" , "0.4.0-20080607",
"0.4.0-20080622" , "0.4.0-beta1" , "0.4.0-rc2",
"1.0.99-0" , "1.1.0-0" , "1.1.91-0",
"1.2.0-rc3" , "1.3.0"
}

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