Move pre-1.1 mixer check to DataFile::upgrade() (#2924)

This commit is contained in:
grejppi
2016-07-20 23:19:08 +03:00
committed by GitHub
parent c9c8ac26b1
commit ddc2591611
3 changed files with 19 additions and 11 deletions

View File

@@ -122,6 +122,7 @@ private:
void upgrade_0_4_0_20080622();
void upgrade_0_4_0_beta1();
void upgrade_0_4_0_rc2();
void upgrade_1_1_0();
void upgrade_1_1_91();
void upgrade();

View File

@@ -794,6 +794,20 @@ void DataFile::upgrade_0_4_0_rc2()
}
void DataFile::upgrade_1_1_0()
{
QDomNodeList list = elementsByTagName("fxchannel");
for (int i = 1; !list.item(i).isNull(); ++i)
{
QDomElement el = list.item(i).toElement();
QDomElement send = createElement("send");
send.setAttribute("channel", "0");
send.setAttribute("amount", "1");
el.appendChild(send);
}
}
void DataFile::upgrade_1_1_91()
{
// Upgrade to version 1.1.91 from some version less than 1.1.91
@@ -881,6 +895,10 @@ void DataFile::upgrade()
{
upgrade_0_4_0_rc2();
}
if( version < ProjectVersion("1.1.0", CompareType::Release) )
{
upgrade_1_1_0();
}
if( version < ProjectVersion("1.1.91", CompareType::Release) )
{
upgrade_1_1_91();

View File

@@ -737,7 +737,6 @@ void FxMixer::loadSettings( const QDomElement & _this )
{
clear();
QDomNode node = _this.firstChild();
bool thereIsASend = false;
while( ! node.isNull() )
{
@@ -764,7 +763,6 @@ void FxMixer::loadSettings( const QDomElement & _this )
QDomElement chDataItem = chData.at(i).toElement();
if( chDataItem.nodeName() == QString( "send" ) )
{
thereIsASend = true;
int sendTo = chDataItem.attribute( "channel" ).toInt();
allocateChannelsTo( sendTo ) ;
FxRoute * fxr = createChannelSend( num, sendTo, 1.0f );
@@ -777,15 +775,6 @@ void FxMixer::loadSettings( const QDomElement & _this )
node = node.nextSibling();
}
// check for old format. 65 fx channels and no explicit sends.
if( ! thereIsASend && m_fxChannels.size() == 65 ) {
// create a send from every channel into master
for( int i=1; i<m_fxChannels.size(); ++i )
{
createChannelSend( i, 0 );
}
}
emit dataChanged();
}