mirror of
https://github.com/LMMS/lmms.git
synced 2026-04-23 15:38:59 -04:00
Basic controller deletion support
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1491 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
15
ChangeLog
15
ChangeLog
@@ -1,3 +1,18 @@
|
||||
2008-08-26 Paul Giblock <drfaygo/at/gmail/dot/com>
|
||||
|
||||
* include/controller_connection.h:
|
||||
* include/controller.h:
|
||||
* include/controller_rack_view.h:
|
||||
* include/automatable_model.h:
|
||||
* include/controller_view.h:
|
||||
* src/gui/widgets/controller_rack_view.cpp:
|
||||
* src/gui/widgets/controller_view.cpp:
|
||||
* src/core/automatable_model.cpp:
|
||||
* src/core/controller_connection.cpp:
|
||||
* src/core/controller.cpp:
|
||||
Add basic support for delete. The controller dialogs probably leak, and
|
||||
peakController isn't handled yet.
|
||||
|
||||
2008-08-24 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* CMakeLists.txt:
|
||||
|
||||
@@ -219,7 +219,7 @@ public slots:
|
||||
virtual void reset( void );
|
||||
virtual void copyValue( void );
|
||||
virtual void pasteValue( void );
|
||||
|
||||
void unlinkControllerConnection( void );
|
||||
|
||||
protected:
|
||||
virtual void redoStep( journalEntry & _je );
|
||||
|
||||
@@ -149,9 +149,6 @@ signals:
|
||||
// The value changed while the mixer isn't running (i.e: MIDI CC)
|
||||
void valueChanged( void );
|
||||
|
||||
// Allow all attached models to unlink
|
||||
void destroying( void );
|
||||
|
||||
friend class controllerDialog;
|
||||
|
||||
} ;
|
||||
|
||||
@@ -82,6 +82,9 @@ public:
|
||||
virtual void loadSettings( const QDomElement & _this );
|
||||
virtual QString nodeName( void ) const;
|
||||
|
||||
public slots:
|
||||
void deleteConnection( void );
|
||||
|
||||
protected:
|
||||
//virtual controllerDialog * createDialog( QWidget * _parent );
|
||||
controller * m_controller;
|
||||
|
||||
@@ -49,16 +49,13 @@ public:
|
||||
|
||||
|
||||
public slots:
|
||||
//void moveUp( effectView * _view );
|
||||
//void moveDown( effectView * _view );
|
||||
//void deletePlugin( effectView * _view );
|
||||
void deleteController( controllerView * _view );
|
||||
|
||||
|
||||
private slots:
|
||||
virtual void update( void );
|
||||
void addController( void );
|
||||
|
||||
|
||||
private:
|
||||
/*virtual void modelChanged( void );
|
||||
|
||||
|
||||
@@ -59,15 +59,13 @@ public:
|
||||
|
||||
public slots:
|
||||
void editControls( void );
|
||||
//void deletePlugin( void );
|
||||
void deleteController( void );
|
||||
//void displayHelp( void );
|
||||
void closeControls( void );
|
||||
|
||||
|
||||
signals:
|
||||
//void moveUp( effectView * _plugin );
|
||||
//void moveDown( effectView * _plugin );
|
||||
//void deletePlugin( effectView * _plugin );
|
||||
void deleteController( controllerView * _view );
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
@@ -413,6 +413,9 @@ void automatableModel::setControllerConnection( controllerConnection * _c )
|
||||
QObject::connect( m_controllerConnection,
|
||||
SIGNAL( valueChanged() ),
|
||||
this, SIGNAL( dataChanged() ) );
|
||||
QObject::connect( m_controllerConnection,
|
||||
SIGNAL( destroyed() ),
|
||||
this, SLOT( unlinkControllerConnection() ) );
|
||||
emit dataChanged();
|
||||
}
|
||||
}
|
||||
@@ -420,6 +423,19 @@ void automatableModel::setControllerConnection( controllerConnection * _c )
|
||||
|
||||
|
||||
|
||||
void automatableModel::unlinkControllerConnection( void )
|
||||
{
|
||||
if( m_controllerConnection )
|
||||
{
|
||||
m_controllerConnection->disconnect( this );
|
||||
}
|
||||
|
||||
m_controllerConnection = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void automatableModel::setInitValue( const float _value )
|
||||
{
|
||||
m_initValue = _value;
|
||||
|
||||
@@ -74,7 +74,7 @@ controller::~controller()
|
||||
engine::getSong()->removeController( this );
|
||||
}
|
||||
|
||||
// TODO: Remove connections
|
||||
// Remove connections by destroyed signal
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -97,22 +97,29 @@ void controllerConnection::setController( controller * _controller )
|
||||
|
||||
if( !_controller )
|
||||
{
|
||||
m_controller = controller::create( controller::DummyController, NULL );
|
||||
m_controller = controller::create( controller::DummyController, NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_controller = _controller;
|
||||
}
|
||||
m_controllerId = -1;
|
||||
m_controllerId = -1;
|
||||
|
||||
if( _controller->type() != controller::DummyController )
|
||||
if( _controller->type() != controller::DummyController )
|
||||
{
|
||||
QObject::connect( _controller, SIGNAL( valueChanged() ),
|
||||
this, SIGNAL( valueChanged() ) );
|
||||
}
|
||||
QObject::connect( _controller, SIGNAL( valueChanged() ),
|
||||
this, SIGNAL( valueChanged() ) );
|
||||
}
|
||||
|
||||
m_ownsController =
|
||||
( _controller->type() == controller::MidiController );
|
||||
|
||||
// If we don't own the controller, allow deletion of controller
|
||||
// to delete the connection
|
||||
if( !m_ownsController ) {
|
||||
QObject::connect( _controller, SIGNAL( destroyed() ),
|
||||
this, SLOT( deleteConnection() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +201,10 @@ void controllerConnection::loadSettings( const QDomElement & _this )
|
||||
}
|
||||
|
||||
|
||||
|
||||
void controllerConnection::deleteConnection( void )
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
QString controllerConnection::nodeName( void ) const
|
||||
{
|
||||
|
||||
@@ -149,23 +149,16 @@ void controllerRackView::moveDown( effectView * _view )
|
||||
}*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
void controllerRackView::deletePlugin( effectView * _view )
|
||||
void controllerRackView::deleteController( controllerView * _view )
|
||||
{
|
||||
|
||||
effect * e = _view->getEffect();
|
||||
m_effectViews.erase( qFind( m_effectViews.begin(), m_effectViews.end(),
|
||||
_view ) );
|
||||
controller * c = _view->getController();
|
||||
m_controllerViews.erase( qFind( m_controllerViews.begin(),
|
||||
m_controllerViews.end(), _view ) );
|
||||
delete _view;
|
||||
fxChain()->m_effects.erase( qFind( fxChain()->m_effects.begin(),
|
||||
fxChain()->m_effects.end(),
|
||||
e ) );
|
||||
delete e;
|
||||
delete c;
|
||||
update();
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -188,6 +181,11 @@ void controllerRackView::update( void )
|
||||
for( i = 0; i < s->m_controllers.size(); ++i )
|
||||
{
|
||||
controllerView * v = new controllerView( s->m_controllers[i], w );
|
||||
|
||||
connect( v, SIGNAL( deleteController( controllerView * ) ),
|
||||
this, SLOT( deleteController( controllerView * ) ),
|
||||
Qt::QueuedConnection );
|
||||
|
||||
m_controllerViews.append( v );
|
||||
v->move( 0, i*32 );
|
||||
v->show();
|
||||
|
||||
@@ -124,15 +124,13 @@ void controllerView::closeControls( void )
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void controllerView::contextMenuEvent( QContextMenuEvent * )
|
||||
void controllerView::deleteController()
|
||||
{
|
||||
emit( deleteController( this ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void controllerView::paintEvent( QPaintEvent * )
|
||||
{
|
||||
QPainter p( this );
|
||||
@@ -178,6 +176,33 @@ void controllerView::modelChanged( void )
|
||||
}
|
||||
|
||||
|
||||
|
||||
void controllerView::contextMenuEvent( QContextMenuEvent * )
|
||||
{
|
||||
QPointer<captionMenu> contextMenu = new captionMenu(
|
||||
getModel()->displayName() );
|
||||
/*
|
||||
contextMenu->addAction( embed::getIconPixmap( "arp_up" ),
|
||||
tr( "Move &up" ),
|
||||
this, SLOT( moveUp() ) );
|
||||
contextMenu->addAction( embed::getIconPixmap( "arp_down" ),
|
||||
tr( "Move &down" ),
|
||||
this, SLOT( moveDown() ) );
|
||||
contextMenu->addSeparator();
|
||||
*/
|
||||
contextMenu->addAction( embed::getIconPixmap( "cancel" ),
|
||||
tr( "&Remove this plugin" ),
|
||||
this, SLOT( deleteController() ) );
|
||||
contextMenu->addSeparator();
|
||||
contextMenu->addAction( embed::getIconPixmap( "help" ),
|
||||
tr( "&Help" ),
|
||||
this, SLOT( displayHelp() ) );
|
||||
contextMenu->exec( QCursor::pos() );
|
||||
delete contextMenu;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include "moc_controller_view.cxx"
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user