diff --git a/include/LadspaControl.h b/include/LadspaControl.h index 1b0eae471..8180ce721 100644 --- a/include/LadspaControl.h +++ b/include/LadspaControl.h @@ -3,7 +3,7 @@ * * Copyright (c) 2008-2014 Tobias Doerffel * Copyright (c) 2006-2008 Danny McRae - * + * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * * This program is free software; you can redistribute it and/or @@ -23,8 +23,8 @@ * */ -#ifndef _LADSPA_CONTROL_H -#define _LADSPA_CONTROL_H +#ifndef LADSPA_CONTROL_H +#define LADSPA_CONTROL_H #include @@ -70,8 +70,7 @@ public: return m_port; } - virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent, - const QString & _name ); + virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent, const QString & _name ); virtual void loadSettings( const QDomElement & _this, const QString & _name ); inline virtual QString nodeName() const { @@ -90,6 +89,19 @@ protected slots: void tempoKnobChanged(); void linkStateChanged(); +protected: + virtual void saveSettings( QDomDocument& doc, QDomElement& element ) + { + Q_UNUSED(doc) + Q_UNUSED(element) + } + + virtual void loadSettings( const QDomElement& element ) + { + Q_UNUSED(element) + } + + private: bool m_link; diff --git a/include/SerializingObject.h b/include/SerializingObject.h index e647ad31f..28442e2bd 100644 --- a/include/SerializingObject.h +++ b/include/SerializingObject.h @@ -52,7 +52,7 @@ public: void setHook( SerializingObjectHook * _hook ); - SerializingObjectHook * getHook() + SerializingObjectHook* hook() { return m_hook; } @@ -60,8 +60,8 @@ public: protected: // to be implemented by sub-objects - virtual void saveSettings( QDomDocument & _doc, QDomElement & _this ); - virtual void loadSettings( const QDomElement & _this ); + virtual void saveSettings( QDomDocument& doc, QDomElement& element ) = 0; + virtual void loadSettings( const QDomElement& element ) = 0; private: diff --git a/include/TempoSyncKnobModel.h b/include/TempoSyncKnobModel.h index 54a2befe6..0bb9c261f 100644 --- a/include/TempoSyncKnobModel.h +++ b/include/TempoSyncKnobModel.h @@ -53,11 +53,8 @@ public: const QString & _display_name = QString() ); virtual ~TempoSyncKnobModel(); - virtual void saveSettings( QDomDocument & _doc, - QDomElement & _this, - const QString & _name ); - virtual void loadSettings( const QDomElement & _this, - const QString & _name ); + virtual void saveSettings( QDomDocument & _doc, QDomElement & _this, const QString& name = "value" ); + virtual void loadSettings( const QDomElement & _this, const QString& name = "value" ); TempoSyncMode syncMode() const { diff --git a/include/track.h b/include/track.h index 5fc92f2f2..273c77710 100644 --- a/include/track.h +++ b/include/track.h @@ -277,6 +277,17 @@ protected: return "trackcontentwidget"; } + virtual void saveSettings( QDomDocument& doc, QDomElement& element ) + { + Q_UNUSED(doc) + Q_UNUSED(element) + } + + virtual void loadSettings( const QDomElement& element ) + { + Q_UNUSED(element) + } + virtual void undoStep( JournalEntry & _je ); virtual void redoStep( JournalEntry & _je ); @@ -544,6 +555,17 @@ protected: virtual void undoStep( JournalEntry & _je ); virtual void redoStep( JournalEntry & _je ); + virtual void saveSettings( QDomDocument& doc, QDomElement& element ) + { + Q_UNUSED(doc) + Q_UNUSED(element) + } + + virtual void loadSettings( const QDomElement& element ) + { + Q_UNUSED(element) + } + virtual QString nodeName() const { return "trackview"; diff --git a/plugins/ladspa_browser/ladspa_browser.h b/plugins/ladspa_browser/ladspa_browser.h index 5d2a9b943..b105862da 100644 --- a/plugins/ladspa_browser/ladspa_browser.h +++ b/plugins/ladspa_browser/ladspa_browser.h @@ -1,6 +1,6 @@ /* * ladspa_browser.h - dialog to display information about installed LADSPA - * plugins + * plugins * * Copyright (c) 2006-2008 Danny McRae * Copyright (c) 2009 Tobias Doerffel @@ -68,6 +68,18 @@ public: virtual QString nodeName() const; + virtual void saveSettings( QDomDocument& doc, QDomElement& element ) + { + Q_UNUSED(doc) + Q_UNUSED(element) + } + + virtual void loadSettings( const QDomElement& element ) + { + Q_UNUSED(element) + } + + } ; diff --git a/src/core/SerializingObject.cpp b/src/core/SerializingObject.cpp index 2ed0e1c7a..da1b7a5cb 100644 --- a/src/core/SerializingObject.cpp +++ b/src/core/SerializingObject.cpp @@ -47,41 +47,46 @@ SerializingObject::~SerializingObject() -QDomElement SerializingObject::saveState( QDomDocument & _doc, - QDomElement & _parent ) +QDomElement SerializingObject::saveState( QDomDocument& doc, QDomElement& parent ) { - QDomElement _this = _doc.createElement( nodeName() ); - _parent.appendChild( _this ); - saveSettings( _doc, _this ); - if( getHook() ) + QDomElement element = doc.createElement( nodeName() ); + parent.appendChild( element ); + + saveSettings( doc, element ); + + if( hook() ) { - getHook()->saveSettings( _doc, _this ); + hook()->saveSettings( doc, element ); } - return _this; + + return element; } -void SerializingObject::restoreState( const QDomElement & _this ) +void SerializingObject::restoreState( const QDomElement& element ) { - loadSettings( _this ); - if( getHook() ) + loadSettings( element ); + + if( hook() ) { - getHook()->loadSettings( _this ); + hook()->loadSettings( element ); } } -void SerializingObject::setHook( SerializingObjectHook * _hook ) +void SerializingObject::setHook( SerializingObjectHook* hook ) { if( m_hook ) { m_hook->m_hookedIn = NULL; } - m_hook = _hook; + + m_hook = hook; + if( m_hook ) { m_hook->m_hookedIn = this; @@ -91,16 +96,18 @@ void SerializingObject::setHook( SerializingObjectHook * _hook ) -void SerializingObject::saveSettings( QDomDocument &/* _doc*/, - QDomElement &/* _this*/ ) +void SerializingObject::saveSettings( QDomDocument& doc, QDomElement& element ) { + Q_UNUSED(doc) + Q_UNUSED(element) } -void SerializingObject::loadSettings( const QDomElement & /* _this*/ ) +void SerializingObject::loadSettings( const QDomElement& element ) { + Q_UNUSED(element) }