Use midiPort's loadSettings()/saveSettings() API.
Changed MidiControlListener to use the built-in API to save and restore the midiPort configuration instead and removed the old iterator. Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
This commit is contained in:
committed by
Tobias Doerffel
parent
555d589354
commit
227de591bd
@@ -134,6 +134,11 @@ public:
|
||||
m_controlKeyCount = 0;
|
||||
}
|
||||
|
||||
inline midiPort * getMidiPort( void )
|
||||
{
|
||||
return &m_port;
|
||||
}
|
||||
|
||||
private:
|
||||
static const QString configClass;
|
||||
static QDomElement s_configTree;
|
||||
|
||||
@@ -187,18 +187,10 @@ void MidiControlListener::saveConfiguration( QDomDocument & doc )
|
||||
conf.setAttribute( "useControlKey", m_useControlKey );
|
||||
conf.setAttribute( "channel", m_channel + 1 );
|
||||
|
||||
// get subscribed MIDI device
|
||||
midiPort::map map = m_port.readablePorts();
|
||||
for( midiPort::map::iterator it = map.begin();
|
||||
it != map.end(); ++it )
|
||||
{
|
||||
if( it.value() )
|
||||
{
|
||||
QDomElement device = doc.createElement( "device" );
|
||||
device.appendChild( doc.createTextNode( it.key() ) );
|
||||
conf.appendChild( device );
|
||||
}
|
||||
}
|
||||
// save MIDI device settings
|
||||
QDomElement devices = doc.createElement( "devices" );
|
||||
confRoot.appendChild( devices );
|
||||
m_port.saveSettings( doc, devices );
|
||||
|
||||
// add key actions
|
||||
for( ActionMap::const_iterator it = m_actionMapKeys.begin();
|
||||
@@ -306,14 +298,10 @@ void MidiControlListener::readConfiguration()
|
||||
m_useControlKey = false;
|
||||
}
|
||||
|
||||
for( QDomElement deviceNode = s_configTree.firstChildElement( "device" );
|
||||
!deviceNode.isNull();
|
||||
deviceNode = deviceNode.nextSiblingElement( "device" ) )
|
||||
QDomElement devicesNode = s_configTree.firstChildElement( "devices" );
|
||||
if( !devicesNode.isNull() )
|
||||
{
|
||||
if( deviceNode.text() != "" )
|
||||
{
|
||||
m_port.subscribeReadablePort( deviceNode.text(), true );
|
||||
}
|
||||
m_port.loadSettings( devicesNode );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user