Ensure correct TCOs after cloning tracks into the BB editor
Previously BBTrackContainerView::dropEvent always deleted the TCOs of dropped tracks. It made dropped tracks unusable. As of this commit, the function checks for correct TCOs. If incorrect TCOs exist, the function remove them and add empty ones.
This commit is contained in:
@@ -258,7 +258,25 @@ void BBTrackContainerView::dropEvent(QDropEvent* de)
|
||||
DataFile dataFile( value.toUtf8() );
|
||||
Track * t = Track::create( dataFile.content().firstChild().toElement(), model() );
|
||||
|
||||
t->deleteTCOs();
|
||||
// Ensure BB TCOs exist
|
||||
bool hasValidBBTCOs = false;
|
||||
if (t->getTCOs().size() == m_bbtc->numOfBBs())
|
||||
{
|
||||
hasValidBBTCOs = true;
|
||||
for (int i = 0; i < t->getTCOs().size(); ++i)
|
||||
{
|
||||
if (t->getTCOs()[i]->startPosition() != MidiTime(i, 0))
|
||||
{
|
||||
hasValidBBTCOs = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!hasValidBBTCOs)
|
||||
{
|
||||
t->deleteTCOs();
|
||||
t->createTCOsForBB(m_bbtc->numOfBBs() - 1);
|
||||
}
|
||||
m_bbtc->updateAfterTrackAdd();
|
||||
|
||||
de->accept();
|
||||
|
||||
Reference in New Issue
Block a user