DataFile: renamed from old multimediaProject class + coding style fixes
This commit is contained in:
112
include/DataFile.h
Normal file
112
include/DataFile.h
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* DataFile.h - class for reading and writing LMMS data files
|
||||
*
|
||||
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2012-2013 Paul Giblock <p/at/pgiblock.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DATA_FILE_H
|
||||
#define DATA_FILE_H
|
||||
|
||||
#include <QtXml/QDomDocument>
|
||||
#include <QTextStream>
|
||||
|
||||
#include "export.h"
|
||||
#include "lmms_basics.h"
|
||||
|
||||
|
||||
class EXPORT DataFile : public QDomDocument
|
||||
{
|
||||
public:
|
||||
enum Types
|
||||
{
|
||||
UnknownType,
|
||||
SongProject,
|
||||
SongProjectTemplate,
|
||||
InstrumentTrackSettings,
|
||||
DragNDropData,
|
||||
ClipboardData,
|
||||
JournalData,
|
||||
EffectSettings,
|
||||
TypeCount
|
||||
} ;
|
||||
typedef Types Type;
|
||||
|
||||
DataFile( const QString& fileName );
|
||||
DataFile( const QByteArray& data );
|
||||
DataFile( Type type );
|
||||
|
||||
virtual ~DataFile();
|
||||
|
||||
QString nameWithExtension( const QString& fn ) const;
|
||||
|
||||
void write( QTextStream& strm );
|
||||
bool writeFile( const QString& fn );
|
||||
|
||||
QDomElement& content()
|
||||
{
|
||||
return m_content;
|
||||
}
|
||||
|
||||
QDomElement& head()
|
||||
{
|
||||
return m_head;
|
||||
}
|
||||
|
||||
Type type() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
static Type type( const QString& typeName );
|
||||
static QString typeName( Type type );
|
||||
|
||||
void cleanMetaNodes( QDomElement de );
|
||||
|
||||
void upgrade();
|
||||
|
||||
void loadData( const QByteArray & _data, const QString & _sourceFile );
|
||||
|
||||
|
||||
struct EXPORT typeDescStruct
|
||||
{
|
||||
Type m_type;
|
||||
QString m_name;
|
||||
} ;
|
||||
static typeDescStruct s_types[TypeCount];
|
||||
|
||||
QDomElement m_content;
|
||||
QDomElement m_head;
|
||||
Type m_type;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
const int LDF_MAJOR_VERSION = 1;
|
||||
const int LDF_MINOR_VERSION = 0;
|
||||
const QString LDF_VERSION_STRING = QString::number( LDF_MAJOR_VERSION ) + "." + QString::number( LDF_MINOR_VERSION );
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -51,7 +51,7 @@ class InstrumentMidiIOView;
|
||||
class knob;
|
||||
class lcdSpinBox;
|
||||
class midiPortMenu;
|
||||
class multimediaProject;
|
||||
class DataFile;
|
||||
class PluginView;
|
||||
class tabWidget;
|
||||
class trackLabelButton;
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
}
|
||||
|
||||
// simple helper for removing midiport-XML-node when loading presets
|
||||
static void removeMidiPortNode( multimediaProject & _mmp );
|
||||
static void removeMidiPortNode( DataFile& dataFile );
|
||||
|
||||
FloatModel * pitchModel()
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "gui_templates.h"
|
||||
#include "tooltip.h"
|
||||
#include "string_pair_drag.h"
|
||||
#include "mmp.h"
|
||||
#include "DataFile.h"
|
||||
|
||||
#include "embed.cpp"
|
||||
|
||||
@@ -515,9 +515,8 @@ void AudioFileProcessorView::dropEvent( QDropEvent * _de )
|
||||
}
|
||||
else if( type == QString( "tco_%1" ).arg( track::SampleTrack ) )
|
||||
{
|
||||
multimediaProject mmp( value.toUtf8() );
|
||||
castModel<audioFileProcessor>()->setAudioFile( mmp.content().
|
||||
firstChild().toElement().attribute( "src" ) );
|
||||
DataFile dataFile( value.toUtf8() );
|
||||
castModel<audioFileProcessor>()->setAudioFile( dataFile.content().firstChild().toElement().attribute( "src" ) );
|
||||
_de->accept();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* LadspaEffect.cpp - class for processing LADSPA effects
|
||||
*
|
||||
* Copyright (c) 2006-2008 Danny McRae <khjklujn/at/users.sourceforge.net>
|
||||
* Copyright (c) 2009-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2009-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <QtGui/QMessageBox>
|
||||
|
||||
#include "LadspaEffect.h"
|
||||
#include "mmp.h"
|
||||
#include "DataFile.h"
|
||||
#include "AudioDevice.h"
|
||||
#include "config_mgr.h"
|
||||
#include "ladspa_2_lmms.h"
|
||||
@@ -104,8 +104,8 @@ LadspaEffect::~LadspaEffect()
|
||||
|
||||
void LadspaEffect::changeSampleRate()
|
||||
{
|
||||
multimediaProject mmp( multimediaProject::EffectSettings );
|
||||
m_controls->saveState( mmp, mmp.content() );
|
||||
DataFile dataFile( DataFile::EffectSettings );
|
||||
m_controls->saveState( dataFile, dataFile.content() );
|
||||
|
||||
LadspaControls * controls = m_controls;
|
||||
m_controls = NULL;
|
||||
@@ -118,7 +118,7 @@ void LadspaEffect::changeSampleRate()
|
||||
controls->effectModelChanged( m_controls );
|
||||
delete controls;
|
||||
|
||||
m_controls->restoreState( mmp.content().firstChild().toElement() );
|
||||
m_controls->restoreState( dataFile.content().firstChild().toElement() );
|
||||
|
||||
// the IDs of re-created controls have been saved and now need to be
|
||||
// resolved again
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "engine.h"
|
||||
#include "knob.h"
|
||||
#include "led_checkbox.h"
|
||||
#include "mmp.h"
|
||||
#include "DataFile.h"
|
||||
#include "InstrumentPlayHandle.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "gui_templates.h"
|
||||
@@ -371,7 +371,7 @@ bool ZynAddSubFxInstrument::handleMidiEvent( const MidiEvent& event, const MidiT
|
||||
void ZynAddSubFxInstrument::reloadPlugin()
|
||||
{
|
||||
// save state of current plugin instance
|
||||
multimediaProject m( multimediaProject::InstrumentTrackSettings );
|
||||
DataFile m( DataFile::InstrumentTrackSettings );
|
||||
saveSettings( m, m.content() );
|
||||
|
||||
// init plugin (will delete current one and create a new instance)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* mmp.cpp - implementation of class multimediaProject
|
||||
* DataFile.cpp - implementation of class DataFile
|
||||
*
|
||||
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2012-2013 Paul Giblock <p/at/pgiblock.net>
|
||||
*
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "mmp.h"
|
||||
#include "DataFile.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
@@ -43,43 +43,39 @@
|
||||
|
||||
|
||||
|
||||
multimediaProject::typeDescStruct
|
||||
multimediaProject::s_types[multimediaProject::NumProjectTypes] =
|
||||
DataFile::typeDescStruct
|
||||
DataFile::s_types[DataFile::TypeCount] =
|
||||
{
|
||||
{ multimediaProject::UnknownType, "unknown" },
|
||||
{ multimediaProject::SongProject, "song" },
|
||||
{ multimediaProject::SongProjectTemplate, "songtemplate" },
|
||||
{ multimediaProject::InstrumentTrackSettings,
|
||||
"instrumenttracksettings" },
|
||||
{ multimediaProject::DragNDropData, "dnddata" },
|
||||
{ multimediaProject::ClipboardData, "clipboard-data" },
|
||||
{ multimediaProject::JournalData, "journaldata" },
|
||||
{ multimediaProject::EffectSettings, "effectsettings" },
|
||||
{ multimediaProject::VideoProject, "videoproject" },
|
||||
{ multimediaProject::BurnProject, "burnproject" },
|
||||
{ multimediaProject::Playlist, "playlist" }
|
||||
{ DataFile::UnknownType, "unknown" },
|
||||
{ DataFile::SongProject, "song" },
|
||||
{ DataFile::SongProjectTemplate, "songtemplate" },
|
||||
{ DataFile::InstrumentTrackSettings, "instrumenttracksettings" },
|
||||
{ DataFile::DragNDropData, "dnddata" },
|
||||
{ DataFile::ClipboardData, "clipboard-data" },
|
||||
{ DataFile::JournalData, "journaldata" },
|
||||
{ DataFile::EffectSettings, "effectsettings" }
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
multimediaProject::multimediaProject( ProjectTypes _project_type ) :
|
||||
QDomDocument( "multimedia-project" ),
|
||||
DataFile::DataFile( Type type ) :
|
||||
QDomDocument( "lmms-project" ),
|
||||
m_content(),
|
||||
m_head(),
|
||||
m_type( _project_type )
|
||||
m_type( type )
|
||||
{
|
||||
appendChild( createProcessingInstruction("xml", "version=\"1.0\""));
|
||||
QDomElement root = createElement( "multimedia-project" );
|
||||
root.setAttribute( "version", MMP_VERSION_STRING );
|
||||
root.setAttribute( "type", typeName( _project_type ) );
|
||||
root.setAttribute( "creator", "Linux MultiMedia Studio (LMMS)" );
|
||||
QDomElement root = createElement( "lmms-project" );
|
||||
root.setAttribute( "version", LDF_VERSION_STRING );
|
||||
root.setAttribute( "type", typeName( type ) );
|
||||
root.setAttribute( "creator", "LMMS" );
|
||||
root.setAttribute( "creatorversion", LMMS_VERSION );
|
||||
appendChild( root );
|
||||
|
||||
m_head = createElement( "head" );
|
||||
root.appendChild( m_head );
|
||||
|
||||
m_content = createElement( typeName( _project_type ) );
|
||||
m_content = createElement( typeName( type ) );
|
||||
root.appendChild( m_content );
|
||||
|
||||
}
|
||||
@@ -87,7 +83,7 @@ multimediaProject::multimediaProject( ProjectTypes _project_type ) :
|
||||
|
||||
|
||||
|
||||
multimediaProject::multimediaProject( const QString & _fileName ) :
|
||||
DataFile::DataFile( const QString & _fileName ) :
|
||||
QDomDocument(),
|
||||
m_content(),
|
||||
m_head()
|
||||
@@ -111,7 +107,7 @@ multimediaProject::multimediaProject( const QString & _fileName ) :
|
||||
|
||||
|
||||
|
||||
multimediaProject::multimediaProject( const QByteArray & _data ) :
|
||||
DataFile::DataFile( const QByteArray & _data ) :
|
||||
QDomDocument(),
|
||||
m_content(),
|
||||
m_head()
|
||||
@@ -122,14 +118,14 @@ multimediaProject::multimediaProject( const QByteArray & _data ) :
|
||||
|
||||
|
||||
|
||||
multimediaProject::~multimediaProject()
|
||||
DataFile::~DataFile()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
QString multimediaProject::nameWithExtension( const QString & _fn ) const
|
||||
QString DataFile::nameWithExtension( const QString & _fn ) const
|
||||
{
|
||||
switch( type() )
|
||||
{
|
||||
@@ -166,7 +162,7 @@ QString multimediaProject::nameWithExtension( const QString & _fn ) const
|
||||
|
||||
|
||||
|
||||
void multimediaProject::write( QTextStream & _strm )
|
||||
void DataFile::write( QTextStream & _strm )
|
||||
{
|
||||
if( type() == SongProject || type() == SongProjectTemplate
|
||||
|| type() == InstrumentTrackSettings )
|
||||
@@ -180,7 +176,7 @@ void multimediaProject::write( QTextStream & _strm )
|
||||
|
||||
|
||||
|
||||
bool multimediaProject::writeFile( const QString& filename )
|
||||
bool DataFile::writeFile( const QString& filename )
|
||||
{
|
||||
const QString fullName = nameWithExtension( filename );
|
||||
const QString fullNameTemp = fullName + ".new";
|
||||
@@ -232,39 +228,42 @@ bool multimediaProject::writeFile( const QString& filename )
|
||||
|
||||
|
||||
|
||||
multimediaProject::ProjectTypes multimediaProject::type(
|
||||
const QString & _type_name )
|
||||
DataFile::Type DataFile::type( const QString& typeName )
|
||||
{
|
||||
for( int i = 0; i < NumProjectTypes; ++i )
|
||||
for( int i = 0; i < TypeCount; ++i )
|
||||
{
|
||||
if( s_types[i].m_name == _type_name )
|
||||
if( s_types[i].m_name == typeName )
|
||||
{
|
||||
return static_cast<multimediaProject::ProjectTypes>( i );
|
||||
return static_cast<DataFile::Type>( i );
|
||||
}
|
||||
}
|
||||
if( _type_name == "channelsettings" )
|
||||
|
||||
// compat code
|
||||
if( typeName == "channelsettings" )
|
||||
{
|
||||
return multimediaProject::InstrumentTrackSettings;
|
||||
return DataFile::InstrumentTrackSettings;
|
||||
}
|
||||
|
||||
return UnknownType;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
QString multimediaProject::typeName( ProjectTypes _project_type )
|
||||
QString DataFile::typeName( Type type )
|
||||
{
|
||||
if( _project_type >= UnknownType && _project_type < NumProjectTypes )
|
||||
if( type >= UnknownType && type < TypeCount )
|
||||
{
|
||||
return s_types[_project_type].m_name;
|
||||
return s_types[type].m_name;
|
||||
}
|
||||
|
||||
return s_types[UnknownType].m_name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void multimediaProject::cleanMetaNodes( QDomElement _de )
|
||||
void DataFile::cleanMetaNodes( QDomElement _de )
|
||||
{
|
||||
QDomNode node = _de.firstChild();
|
||||
while( !node.isNull() )
|
||||
@@ -290,7 +289,7 @@ void multimediaProject::cleanMetaNodes( QDomElement _de )
|
||||
|
||||
|
||||
|
||||
void multimediaProject::upgrade()
|
||||
void DataFile::upgrade()
|
||||
{
|
||||
projectVersion version =
|
||||
documentElement().attribute( "creatorversion" ).
|
||||
@@ -698,8 +697,7 @@ void multimediaProject::upgrade()
|
||||
|
||||
|
||||
|
||||
void multimediaProject::loadData( const QByteArray & _data,
|
||||
const QString & _sourceFile )
|
||||
void DataFile::loadData( const QByteArray & _data, const QString & _sourceFile )
|
||||
{
|
||||
QString errorMsg;
|
||||
int line = -1, col = -1;
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "debug.h"
|
||||
#include "engine.h"
|
||||
#include "Mixer.h"
|
||||
#include "mmp.h"
|
||||
#include "Oscillator.h"
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "Instrument.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "MidiPort.h"
|
||||
#include "mmp.h"
|
||||
#include "DataFile.h"
|
||||
#include "NotePlayHandle.h"
|
||||
#include "ProjectJournal.h"
|
||||
#include "TrackContainer.h"
|
||||
@@ -146,10 +146,10 @@ PresetPreviewPlayHandle::PresetPreviewPlayHandle( const QString & _preset_file,
|
||||
}
|
||||
else
|
||||
{
|
||||
multimediaProject mmp( _preset_file );
|
||||
DataFile dataFile( _preset_file );
|
||||
s_previewTC->previewInstrumentTrack()->
|
||||
loadTrackSpecificSettings(
|
||||
mmp.content().firstChild().toElement() );
|
||||
dataFile.content().firstChild().toElement() );
|
||||
}
|
||||
|
||||
engine::setSuppressMessages( false );
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
#include "ImportFilter.h"
|
||||
#include "MainWindow.h"
|
||||
#include "ProjectRenderer.h"
|
||||
#include "mmp.h"
|
||||
#include "DataFile.h"
|
||||
#include "song.h"
|
||||
|
||||
static inline QString baseName( const QString & _file )
|
||||
@@ -178,15 +178,15 @@ int main( int argc, char * * argv )
|
||||
else if( argc > i+1 && ( QString( argv[i] ) == "--upgrade" ||
|
||||
QString( argv[i] ) == "-u" ) )
|
||||
{
|
||||
multimediaProject mmp( QString( argv[i + 1] ) );
|
||||
DataFile dataFile( QString( argv[i + 1] ) );
|
||||
if (argc > i+2)
|
||||
{
|
||||
mmp.writeFile( argv[i + 2] );
|
||||
dataFile.writeFile( argv[i + 2] );
|
||||
}
|
||||
else
|
||||
{
|
||||
QTextStream ts( stdout );
|
||||
mmp.write( ts );
|
||||
dataFile.write( ts );
|
||||
fflush( stdout );
|
||||
}
|
||||
return( EXIT_SUCCESS );
|
||||
@@ -404,7 +404,7 @@ int main( int argc, char * * argv )
|
||||
srand( getpid() + time( 0 ) );
|
||||
|
||||
// recover a file?
|
||||
QString recoveryFile = QDir(configManager::inst()->workingDir()).absoluteFilePath("recover.mmp");
|
||||
QString recoveryFile = QDir(configManager::inst()->workingDir()).absoluteFilePath("recover.dataFile");
|
||||
if( QFileInfo(recoveryFile).exists() &&
|
||||
QMessageBox::question( engine::mainWindow(), MainWindow::tr( "Project recovery" ),
|
||||
MainWindow::tr( "It looks like the last session did not end properly. "
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
#include "MainWindow.h"
|
||||
#include "FileDialog.h"
|
||||
#include "MidiClient.h"
|
||||
#include "mmp.h"
|
||||
#include "DataFile.h"
|
||||
#include "NotePlayHandle.h"
|
||||
#include "pattern.h"
|
||||
#include "piano_roll.h"
|
||||
@@ -898,10 +898,10 @@ void song::loadProject( const QString & _file_name )
|
||||
m_fileName = _file_name;
|
||||
m_oldFileName = _file_name;
|
||||
|
||||
multimediaProject mmp( m_fileName );
|
||||
DataFile dataFile( m_fileName );
|
||||
// if file could not be opened, head-node is null and we create
|
||||
// new project
|
||||
if( mmp.head().isNull() )
|
||||
if( dataFile.head().isNull() )
|
||||
{
|
||||
createNewProject();
|
||||
return;
|
||||
@@ -910,10 +910,10 @@ void song::loadProject( const QString & _file_name )
|
||||
engine::mixer()->lock();
|
||||
|
||||
// get the header information from the DOM
|
||||
m_tempoModel.loadSettings( mmp.head(), "bpm" );
|
||||
m_timeSigModel.loadSettings( mmp.head(), "timesig" );
|
||||
m_masterVolumeModel.loadSettings( mmp.head(), "mastervol" );
|
||||
m_masterPitchModel.loadSettings( mmp.head(), "masterpitch" );
|
||||
m_tempoModel.loadSettings( dataFile.head(), "bpm" );
|
||||
m_timeSigModel.loadSettings( dataFile.head(), "timesig" );
|
||||
m_masterVolumeModel.loadSettings( dataFile.head(), "mastervol" );
|
||||
m_masterPitchModel.loadSettings( dataFile.head(), "masterpitch" );
|
||||
|
||||
if( m_playPos[Mode_PlaySong].m_timeLine )
|
||||
{
|
||||
@@ -921,16 +921,16 @@ void song::loadProject( const QString & _file_name )
|
||||
m_playPos[Mode_PlaySong].m_timeLine->toggleLoopPoints( 0 );
|
||||
}
|
||||
|
||||
if( !mmp.content().firstChildElement( "track" ).isNull() )
|
||||
if( !dataFile.content().firstChildElement( "track" ).isNull() )
|
||||
{
|
||||
m_globalAutomationTrack->restoreState( mmp.content().
|
||||
m_globalAutomationTrack->restoreState( dataFile.content().
|
||||
firstChildElement( "track" ) );
|
||||
}
|
||||
|
||||
//Backward compatibility for LMMS <= 0.4.15
|
||||
PeakController::initGetControllerBySetting();
|
||||
|
||||
QDomNode node = mmp.content().firstChild();
|
||||
QDomNode node = dataFile.content().firstChild();
|
||||
while( !node.isNull() )
|
||||
{
|
||||
if( node.isElement() )
|
||||
@@ -1022,31 +1022,31 @@ void song::loadProject( const QString & _file_name )
|
||||
// only save current song as _filename and do nothing else
|
||||
bool song::saveProjectFile( const QString & _filename )
|
||||
{
|
||||
multimediaProject mmp( multimediaProject::SongProject );
|
||||
DataFile dataFile( DataFile::SongProject );
|
||||
|
||||
m_tempoModel.saveSettings( mmp, mmp.head(), "bpm" );
|
||||
m_timeSigModel.saveSettings( mmp, mmp.head(), "timesig" );
|
||||
m_masterVolumeModel.saveSettings( mmp, mmp.head(), "mastervol" );
|
||||
m_masterPitchModel.saveSettings( mmp, mmp.head(), "masterpitch" );
|
||||
m_tempoModel.saveSettings( dataFile, dataFile.head(), "bpm" );
|
||||
m_timeSigModel.saveSettings( dataFile, dataFile.head(), "timesig" );
|
||||
m_masterVolumeModel.saveSettings( dataFile, dataFile.head(), "mastervol" );
|
||||
m_masterPitchModel.saveSettings( dataFile, dataFile.head(), "masterpitch" );
|
||||
|
||||
saveState( mmp, mmp.content() );
|
||||
saveState( dataFile, dataFile.content() );
|
||||
|
||||
m_globalAutomationTrack->saveState( mmp, mmp.content() );
|
||||
engine::fxMixer()->saveState( mmp, mmp.content() );
|
||||
m_globalAutomationTrack->saveState( dataFile, dataFile.content() );
|
||||
engine::fxMixer()->saveState( dataFile, dataFile.content() );
|
||||
if( engine::hasGUI() )
|
||||
{
|
||||
engine::getControllerRackView()->saveState( mmp, mmp.content() );
|
||||
engine::getPianoRoll()->saveState( mmp, mmp.content() );
|
||||
engine::automationEditor()->saveState( mmp, mmp.content() );
|
||||
engine::getControllerRackView()->saveState( dataFile, dataFile.content() );
|
||||
engine::getPianoRoll()->saveState( dataFile, dataFile.content() );
|
||||
engine::automationEditor()->saveState( dataFile, dataFile.content() );
|
||||
engine::getProjectNotes()->
|
||||
SerializingObject::saveState( mmp, mmp.content() );
|
||||
SerializingObject::saveState( dataFile, dataFile.content() );
|
||||
m_playPos[Mode_PlaySong].m_timeLine->saveState(
|
||||
mmp, mmp.content() );
|
||||
dataFile, dataFile.content() );
|
||||
}
|
||||
|
||||
saveControllerStates( mmp, mmp.content() );
|
||||
saveControllerStates( dataFile, dataFile.content() );
|
||||
|
||||
return mmp.writeFile( _filename );
|
||||
return dataFile.writeFile( _filename );
|
||||
}
|
||||
|
||||
|
||||
@@ -1054,8 +1054,8 @@ bool song::saveProjectFile( const QString & _filename )
|
||||
// save current song and update the gui
|
||||
bool song::guiSaveProject()
|
||||
{
|
||||
multimediaProject mmp( multimediaProject::SongProject );
|
||||
m_fileName = mmp.nameWithExtension( m_fileName );
|
||||
DataFile dataFile( DataFile::SongProject );
|
||||
m_fileName = dataFile.nameWithExtension( m_fileName );
|
||||
if( saveProjectFile( m_fileName ) && engine::hasGUI() )
|
||||
{
|
||||
textFloat::displayMessage( tr( "Project saved" ),
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
#include "gui_templates.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "MainWindow.h"
|
||||
#include "mmp.h"
|
||||
#include "DataFile.h"
|
||||
#include "pixmap_button.h"
|
||||
#include "ProjectJournal.h"
|
||||
#include "SampleTrack.h"
|
||||
@@ -468,7 +468,7 @@ void trackContentObjectView::dragEnterEvent( QDragEnterEvent * _dee )
|
||||
/*! \brief Handle something being dropped on this trackContentObjectView.
|
||||
*
|
||||
* When something has been dropped on this trackContentObjectView, and
|
||||
* it's a track content object, then use an instance of our mmp reader
|
||||
* it's a track content object, then use an instance of our dataFile reader
|
||||
* to take the xml of the track content object and turn it into something
|
||||
* we can write over our current state.
|
||||
*
|
||||
@@ -481,12 +481,12 @@ void trackContentObjectView::dropEvent( QDropEvent * _de )
|
||||
if( type == ( "tco_" + QString::number( m_tco->getTrack()->type() ) ) )
|
||||
{
|
||||
// value contains our XML-data so simply create a
|
||||
// multimediaProject which does the rest for us...
|
||||
multimediaProject mmp( value.toUtf8() );
|
||||
// DataFile which does the rest for us...
|
||||
DataFile dataFile( value.toUtf8() );
|
||||
// at least save position before getting to moved to somewhere
|
||||
// the user doesn't expect...
|
||||
MidiTime pos = m_tco->startPosition();
|
||||
m_tco->restoreState( mmp.content().firstChild().toElement() );
|
||||
m_tco->restoreState( dataFile.content().firstChild().toElement() );
|
||||
m_tco->movePosition( pos );
|
||||
AutomationPattern::resolveAllIDs();
|
||||
_de->accept();
|
||||
@@ -563,15 +563,15 @@ void trackContentObjectView::mousePressEvent( QMouseEvent * _me )
|
||||
_me->modifiers() & Qt::ControlModifier )
|
||||
{
|
||||
// start drag-action
|
||||
multimediaProject mmp( multimediaProject::DragNDropData );
|
||||
m_tco->saveState( mmp, mmp.content() );
|
||||
DataFile dataFile( DataFile::DragNDropData );
|
||||
m_tco->saveState( dataFile, dataFile.content() );
|
||||
QPixmap thumbnail = QPixmap::grabWidget( this ).scaled(
|
||||
128, 128,
|
||||
Qt::KeepAspectRatio,
|
||||
Qt::SmoothTransformation );
|
||||
new stringPairDrag( QString( "tco_%1" ).arg(
|
||||
m_tco->getTrack()->type() ),
|
||||
mmp.toString(), thumbnail, this );
|
||||
dataFile.toString(), thumbnail, this );
|
||||
}
|
||||
else if( _me->button() == Qt::LeftButton &&
|
||||
/* engine::mainWindow()->isShiftPressed() == false &&*/
|
||||
@@ -976,10 +976,10 @@ void trackContentWidget::removeTCOView( trackContentObjectView * _tcov )
|
||||
if( it != m_tcoViews.end() )
|
||||
{
|
||||
/* QMap<QString, QVariant> map;
|
||||
multimediaProject mmp( multimediaProject::JournalData );
|
||||
_tcov->getTrackContentObject()->saveState( mmp, mmp.content() );
|
||||
DataFile dataFile( DataFile::JournalData );
|
||||
_tcov->getTrackContentObject()->saveState( dataFile, dataFile.content() );
|
||||
map["id"] = _tcov->getTrackContentObject()->id();
|
||||
map["state"] = mmp.toString();
|
||||
map["state"] = dataFile.toString();
|
||||
addJournalEntry( JournalEntry( RemoveTrackContentObject,
|
||||
map ) );*/
|
||||
|
||||
@@ -1127,11 +1127,11 @@ void trackContentWidget::dropEvent( QDropEvent * _de )
|
||||
trackContentObject * tco = getTrack()->createTCO( pos );
|
||||
|
||||
// value contains our XML-data so simply create a
|
||||
// multimediaProject which does the rest for us...
|
||||
multimediaProject mmp( value.toUtf8() );
|
||||
// DataFile which does the rest for us...
|
||||
DataFile dataFile( value.toUtf8() );
|
||||
// at least save position before getting moved to somewhere
|
||||
// the user doesn't expect...
|
||||
tco->restoreState( mmp.content().firstChild().toElement() );
|
||||
tco->restoreState( dataFile.content().firstChild().toElement() );
|
||||
tco->movePosition( pos );
|
||||
|
||||
AutomationPattern::resolveAllIDs();
|
||||
@@ -1227,9 +1227,9 @@ void trackContentWidget::undoStep( JournalEntry & _je )
|
||||
trackContentObject * tco =
|
||||
dynamic_cast<trackContentObject *>(
|
||||
engine::projectJournal()->journallingObject( map["id"].toInt() ) );
|
||||
multimediaProject mmp( multimediaProject::JournalData );
|
||||
tco->saveState( mmp, mmp.content() );
|
||||
map["state"] = mmp.toString();
|
||||
DataFile dataFile( DataFile::JournalData );
|
||||
tco->saveState( dataFile, dataFile.content() );
|
||||
map["state"] = dataFile.toString();
|
||||
_je.data() = map;
|
||||
tco->deleteLater();
|
||||
break;
|
||||
@@ -1238,10 +1238,10 @@ void trackContentWidget::undoStep( JournalEntry & _je )
|
||||
case RemoveTrackContentObject:
|
||||
{
|
||||
trackContentObject * tco = getTrack()->createTCO( MidiTime( 0 ) );
|
||||
multimediaProject mmp(
|
||||
DataFile dataFile(
|
||||
_je.data().toMap()["state"].
|
||||
toString().toUtf8() );
|
||||
tco->restoreState( mmp.content().firstChild().toElement() );
|
||||
tco->restoreState( dataFile.content().firstChild().toElement() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1424,11 +1424,11 @@ void trackOperationsWidget::mousePressEvent( QMouseEvent * _me )
|
||||
_me->modifiers() & Qt::ControlModifier &&
|
||||
m_trackView->getTrack()->type() != track::BBTrack )
|
||||
{
|
||||
multimediaProject mmp( multimediaProject::DragNDropData );
|
||||
m_trackView->getTrack()->saveState( mmp, mmp.content() );
|
||||
DataFile dataFile( DataFile::DragNDropData );
|
||||
m_trackView->getTrack()->saveState( dataFile, dataFile.content() );
|
||||
new stringPairDrag( QString( "track_%1" ).arg(
|
||||
m_trackView->getTrack()->type() ),
|
||||
mmp.toString(), QPixmap::grabWidget(
|
||||
dataFile.toString(), QPixmap::grabWidget(
|
||||
m_trackView->getTrackSettingsWidget() ),
|
||||
this );
|
||||
}
|
||||
@@ -2307,10 +2307,10 @@ void trackView::dropEvent( QDropEvent * _de )
|
||||
if( type == ( "track_" + QString::number( m_track->type() ) ) )
|
||||
{
|
||||
// value contains our XML-data so simply create a
|
||||
// multimediaProject which does the rest for us...
|
||||
multimediaProject mmp( value.toUtf8() );
|
||||
// DataFile which does the rest for us...
|
||||
DataFile dataFile( value.toUtf8() );
|
||||
engine::mixer()->lock();
|
||||
m_track->restoreState( mmp.content().firstChild().toElement() );
|
||||
m_track->restoreState( dataFile.content().firstChild().toElement() );
|
||||
engine::mixer()->unlock();
|
||||
_de->accept();
|
||||
}
|
||||
|
||||
@@ -686,12 +686,11 @@ void MainWindow::createNewProjectFromTemplate( QAction * _idx )
|
||||
|
||||
|
||||
|
||||
void MainWindow::openProject( void )
|
||||
void MainWindow::openProject()
|
||||
{
|
||||
if( mayChangeProject() )
|
||||
{
|
||||
FileDialog ofd( this, tr( "Open project" ), "",
|
||||
tr( "MultiMedia Project (*.mmp *.mmpz *.xml)" ) );
|
||||
FileDialog ofd( this, tr( "Open project" ), "", tr( "LMMS (*.mmp *.mmpz)" ) );
|
||||
|
||||
ofd.setDirectory( configManager::inst()->userProjectsDir() );
|
||||
ofd.setFileMode( FileDialog::ExistingFiles );
|
||||
@@ -754,8 +753,8 @@ bool MainWindow::saveProject( void )
|
||||
bool MainWindow::saveProjectAs( void )
|
||||
{
|
||||
VersionedSaveDialog sfd( this, tr( "Save project" ), "",
|
||||
tr( "MultiMedia Project (*.mmp *.mmpz);;"
|
||||
"MultiMedia Project Template (*.mpt)" ) );
|
||||
tr( "LMMS Project (*.mmp *.mmpz);;"
|
||||
"LMMS Project Template (*.mpt)" ) );
|
||||
QString f = engine::getSong()->projectFileName();
|
||||
if( f != "" )
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include "ImportFilter.h"
|
||||
#include "Instrument.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "mmp.h"
|
||||
#include "DataFile.h"
|
||||
#include "rubberband.h"
|
||||
#include "song.h"
|
||||
#include "string_pair_drag.h"
|
||||
@@ -143,10 +143,10 @@ void TrackContainerView::removeTrackView( trackView * _tv )
|
||||
if( index != -1 )
|
||||
{
|
||||
/* QMap<QString, QVariant> map;
|
||||
multimediaProject mmp( multimediaProject::JournalData );
|
||||
_tv->getTrack()->saveState( mmp, mmp.content() );
|
||||
DataFile dataFile( DataFile::JournalData );
|
||||
_tv->getTrack()->saveState( dataFile, dataFile.content() );
|
||||
map["id"] = _tv->getTrack()->id();
|
||||
map["state"] = mmp.toString();
|
||||
map["state"] = dataFile.toString();
|
||||
addJournalEntry( JournalEntry( RemoveTrack, map ) );*/
|
||||
|
||||
m_trackViews.removeAt( index );
|
||||
@@ -321,9 +321,9 @@ void TrackContainerView::undoStep( JournalEntry & _je )
|
||||
engine::projectJournal()->getJournallingObject(
|
||||
map["id"].toInt() ) );
|
||||
assert( t != NULL );
|
||||
multimediaProject mmp( multimediaProject::JournalData );
|
||||
t->saveState( mmp, mmp.content() );
|
||||
map["state"] = mmp.toString();
|
||||
DataFile dataFile( DataFile::JournalData );
|
||||
t->saveState( dataFile, dataFile.content() );
|
||||
map["state"] = dataFile.toString();
|
||||
_je.data() = map;
|
||||
t->deleteLater();
|
||||
break;
|
||||
@@ -331,9 +331,9 @@ void TrackContainerView::undoStep( JournalEntry & _je )
|
||||
|
||||
case RemoveTrack:
|
||||
{
|
||||
multimediaProject mmp(
|
||||
DataFile dataFile(
|
||||
_je.data().toMap()["state"].toString().utf8() );
|
||||
track::create( mmp.content().firstChild().toElement(),
|
||||
track::create( dataFile.content().firstChild().toElement(),
|
||||
m_tc );
|
||||
break;
|
||||
}
|
||||
@@ -405,12 +405,12 @@ void TrackContainerView::dropEvent( QDropEvent * _de )
|
||||
}
|
||||
else if( type == "presetfile" )
|
||||
{
|
||||
multimediaProject mmp( value );
|
||||
DataFile dataFile( value );
|
||||
InstrumentTrack * it = dynamic_cast<InstrumentTrack *>(
|
||||
track::create( track::InstrumentTrack,
|
||||
m_tc ) );
|
||||
it->setSimpleSerializing();
|
||||
it->loadSettings( mmp.content().toElement() );
|
||||
it->loadSettings( dataFile.content().toElement() );
|
||||
//it->toggledInstrumentTrackButton( true );
|
||||
_de->accept();
|
||||
}
|
||||
@@ -421,8 +421,8 @@ void TrackContainerView::dropEvent( QDropEvent * _de )
|
||||
}
|
||||
else if( type.left( 6 ) == "track_" )
|
||||
{
|
||||
multimediaProject mmp( value.toUtf8() );
|
||||
track::create( mmp.content().firstChild().toElement(), m_tc );
|
||||
DataFile dataFile( value.toUtf8() );
|
||||
track::create( dataFile.content().firstChild().toElement(), m_tc );
|
||||
_de->accept();
|
||||
}
|
||||
engine::mixer()->unlock();
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "Instrument.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "MainWindow.h"
|
||||
#include "mmp.h"
|
||||
#include "DataFile.h"
|
||||
#include "PresetPreviewPlayHandle.h"
|
||||
#include "SamplePlayHandle.h"
|
||||
#include "song.h"
|
||||
@@ -566,10 +566,10 @@ void fileBrowserTreeWidget::handleFile( fileItem * f, InstrumentTrack * _it )
|
||||
|
||||
case fileItem::LoadAsPreset:
|
||||
{
|
||||
multimediaProject mmp( f->fullName() );
|
||||
InstrumentTrack::removeMidiPortNode( mmp );
|
||||
DataFile dataFile( f->fullName() );
|
||||
InstrumentTrack::removeMidiPortNode( dataFile );
|
||||
_it->setSimpleSerializing();
|
||||
_it->loadSettings( mmp.content().toElement() );
|
||||
_it->loadSettings( dataFile.content().toElement() );
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
#include "InstrumentTrack.h"
|
||||
#include "MainWindow.h"
|
||||
#include "MidiEvent.h"
|
||||
#include "mmp.h"
|
||||
#include "DataFile.h"
|
||||
#include "pattern.h"
|
||||
#include "Piano.h"
|
||||
#include "pixmap_button.h"
|
||||
@@ -3586,9 +3586,9 @@ void pianoRoll::getSelectedNotes( NoteVector & _selected_notes )
|
||||
|
||||
void pianoRoll::copy_to_clipboard( const NoteVector & _notes ) const
|
||||
{
|
||||
multimediaProject mmp( multimediaProject::ClipboardData );
|
||||
QDomElement note_list = mmp.createElement( "note-list" );
|
||||
mmp.content().appendChild( note_list );
|
||||
DataFile dataFile( DataFile::ClipboardData );
|
||||
QDomElement note_list = dataFile.createElement( "note-list" );
|
||||
dataFile.content().appendChild( note_list );
|
||||
|
||||
MidiTime start_pos( _notes.front()->pos().getTact(), 0 );
|
||||
for( NoteVector::ConstIterator it = _notes.begin(); it != _notes.end();
|
||||
@@ -3596,11 +3596,11 @@ void pianoRoll::copy_to_clipboard( const NoteVector & _notes ) const
|
||||
{
|
||||
note clip_note( **it );
|
||||
clip_note.setPos( clip_note.pos( start_pos ) );
|
||||
clip_note.saveState( mmp, note_list );
|
||||
clip_note.saveState( dataFile, note_list );
|
||||
}
|
||||
|
||||
QMimeData * clip_content = new QMimeData;
|
||||
clip_content->setData( Clipboard::mimeType(), mmp.toString().toUtf8() );
|
||||
clip_content->setData( Clipboard::mimeType(), dataFile.toString().toUtf8() );
|
||||
QApplication::clipboard()->setMimeData( clip_content,
|
||||
QClipboard::Clipboard );
|
||||
}
|
||||
@@ -3667,10 +3667,9 @@ void pianoRoll::pasteNotes()
|
||||
|
||||
if( !value.isEmpty() )
|
||||
{
|
||||
multimediaProject mmp( value.toUtf8() );
|
||||
DataFile dataFile( value.toUtf8() );
|
||||
|
||||
QDomNodeList list = mmp.elementsByTagName(
|
||||
note::classNodeName() );
|
||||
QDomNodeList list = dataFile.elementsByTagName( note::classNodeName() );
|
||||
|
||||
// remove selection and select the newly pasted notes
|
||||
clearSelectedNotes();
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
#include "lcd_spinbox.h"
|
||||
#include "MainWindow.h"
|
||||
#include "MeterDialog.h"
|
||||
#include "mmp.h"
|
||||
#include "text_float.h"
|
||||
#include "timeline.h"
|
||||
#include "tool_button.h"
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "knob.h"
|
||||
#include "led_checkbox.h"
|
||||
#include "Mixer.h"
|
||||
#include "mmp.h"
|
||||
#include "DataFile.h"
|
||||
#include "Oscillator.h"
|
||||
#include "pixmap_button.h"
|
||||
#include "string_pair_drag.h"
|
||||
@@ -389,10 +389,8 @@ void EnvelopeAndLfoView::dropEvent( QDropEvent * _de )
|
||||
}
|
||||
else if( type == QString( "tco_%1" ).arg( track::SampleTrack ) )
|
||||
{
|
||||
multimediaProject mmp( value.toUtf8() );
|
||||
m_params->m_userWave.setAudioFile(
|
||||
mmp.content().firstChild().toElement().
|
||||
attribute( "src" ) );
|
||||
DataFile dataFile( value.toUtf8() );
|
||||
m_params->m_userWave.setAudioFile( dataFile.content().firstChild().toElement(). attribute( "src" ) );
|
||||
m_userLfoBtn->model()->setValue( true );
|
||||
_de->accept();
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
#include "MainWindow.h"
|
||||
#include "MidiClient.h"
|
||||
#include "MidiPortMenu.h"
|
||||
#include "mmp.h"
|
||||
#include "DataFile.h"
|
||||
#include "NotePlayHandle.h"
|
||||
#include "pattern.h"
|
||||
#include "PluginView.h"
|
||||
@@ -534,9 +534,9 @@ int InstrumentTrack::masterKey( int _midi_key ) const
|
||||
|
||||
|
||||
|
||||
void InstrumentTrack::removeMidiPortNode( multimediaProject & _mmp )
|
||||
void InstrumentTrack::removeMidiPortNode( DataFile & _dataFile )
|
||||
{
|
||||
QDomNodeList n = _mmp.elementsByTagName( "midiport" );
|
||||
QDomNodeList n = _dataFile.elementsByTagName( "midiport" );
|
||||
n.item( 0 ).parentNode().removeChild( n.item( 0 ) );
|
||||
}
|
||||
|
||||
@@ -1368,11 +1368,11 @@ void InstrumentTrackWindow::saveSettingsBtnClicked()
|
||||
!sfd.selectedFiles().isEmpty() &&
|
||||
!sfd.selectedFiles().first().isEmpty() )
|
||||
{
|
||||
multimediaProject mmp( multimediaProject::InstrumentTrackSettings );
|
||||
DataFile dataFile( DataFile::InstrumentTrackSettings );
|
||||
m_track->setSimpleSerializing();
|
||||
m_track->saveSettings( mmp, mmp.content() );
|
||||
m_track->saveSettings( dataFile, dataFile.content() );
|
||||
QString f = sfd.selectedFiles()[0];
|
||||
mmp.writeFile( f );
|
||||
dataFile.writeFile( f );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1496,10 +1496,10 @@ void InstrumentTrackWindow::dropEvent( QDropEvent* event )
|
||||
}
|
||||
else if( type == "presetfile" )
|
||||
{
|
||||
multimediaProject mmp( value );
|
||||
InstrumentTrack::removeMidiPortNode( mmp );
|
||||
DataFile dataFile( value );
|
||||
InstrumentTrack::removeMidiPortNode( dataFile );
|
||||
m_track->setSimpleSerializing();
|
||||
m_track->loadSettings( mmp.content().toElement() );
|
||||
m_track->loadSettings( dataFile.content().toElement() );
|
||||
|
||||
engine::getSong()->setModified();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user