From 8807368377b5a0eb465dcdbe62a867299448ed54 Mon Sep 17 00:00:00 2001 From: Paul Giblock Date: Wed, 3 Sep 2008 00:19:09 +0000 Subject: [PATCH] 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 --- ChangeLog | 8 ++++++++ src/core/automation_pattern.cpp | 29 +++++++++++++++++++++++------ src/gui/main_window.cpp | 4 ++++ 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index ecae20d8d..f9877ec9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,14 @@ Change Piano-Roll paste behavior. Instead of pasting at 0, paste at the quantized location of the time-line's position-indicator. + * src/gui/main_window.cpp: + Display waiting cursor when loading project. Really only helps when + loading a large song while another is loaded. Provides feedback before + the loading dialog appears (I guess this is during project close) + + * src/core/automation_pattern.cpp: + Don't connect to the same model more than once. + 2008-09-01 Paul Giblock * include/track_container.h: diff --git a/src/core/automation_pattern.cpp b/src/core/automation_pattern.cpp index db71d2661..66bb98329 100644 --- a/src/core/automation_pattern.cpp +++ b/src/core/automation_pattern.cpp @@ -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(), 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(), 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 ) diff --git a/src/gui/main_window.cpp b/src/gui/main_window.cpp index c212e79a0..d5fcb5592 100644 --- a/src/gui/main_window.cpp +++ b/src/gui/main_window.cpp @@ -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 ); }