Disallow duplicate automation connections. Busy cursor while loading
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1536 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -94,12 +94,28 @@ automationPattern::~automationPattern()
|
||||
|
||||
void automationPattern::addObject( automatableModel * _obj )
|
||||
{
|
||||
m_objects += _obj;
|
||||
// been empty before?
|
||||
if( m_objects.size() == 1 && !hasAutomation() )
|
||||
bool addIt = true;
|
||||
|
||||
for( objectVector::iterator it = m_objects.begin();
|
||||
it != m_objects.end(); ++it )
|
||||
{
|
||||
// then initialize default-value
|
||||
putValue( 0, _obj->value<float>(), FALSE );
|
||||
if( *it == _obj ) {
|
||||
// Already exists
|
||||
// TODO: Maybe let the user know in some non-annoying way
|
||||
addIt = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( addIt )
|
||||
{
|
||||
m_objects += _obj;
|
||||
// been empty before?
|
||||
if( m_objects.size() == 1 && !hasAutomation() )
|
||||
{
|
||||
// then initialize default-value
|
||||
putValue( 0, _obj->value<float>(), FALSE );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -591,7 +607,8 @@ void automationPatternView::constructContextMenu( QMenu * _cm )
|
||||
if( !m_pat->m_objects.isEmpty() )
|
||||
{
|
||||
_cm->addSeparator();
|
||||
QMenu * m = new QMenu( tr( "Connections" ), _cm );
|
||||
QMenu * m = new QMenu( tr( "%1 Connections" ).
|
||||
arg( m_pat->m_objects.count() ), _cm );
|
||||
for( automationPattern::objectVector::iterator it =
|
||||
m_pat->m_objects.begin();
|
||||
it != m_pat->m_objects.end(); ++it )
|
||||
|
||||
@@ -648,8 +648,10 @@ void mainWindow::openProject( void )
|
||||
if( ofd.exec () == QDialog::Accepted &&
|
||||
!ofd.selectedFiles().isEmpty() )
|
||||
{
|
||||
setCursor( Qt::WaitCursor );
|
||||
engine::getSong()->loadProject(
|
||||
ofd.selectedFiles()[0] );
|
||||
setCursor( Qt::ArrowCursor );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -674,8 +676,10 @@ void mainWindow::updateRecentlyOpenedProjectsMenu( void )
|
||||
void mainWindow::openRecentlyOpenedProject( QAction * _action )
|
||||
{
|
||||
const QString & f = _action->text();
|
||||
setCursor( Qt::WaitCursor );
|
||||
engine::getSong()->loadProject( f );
|
||||
configManager::inst()->addRecentlyOpenedProject( f );
|
||||
setCursor( Qt::ArrowCursor );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user