Allow editing of connections though context menu
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1043 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -8,11 +8,13 @@
|
||||
* include/controller.h:
|
||||
* include/midi_controller.h:
|
||||
* include/controller_connection_dialog.h:
|
||||
* src/gui/widgets/knob.cpp:
|
||||
* src/gui/controller_connection_dialog.cpp:
|
||||
* src/core/midi/midi_controller.cpp:
|
||||
* src/core/controller.cpp:
|
||||
* Makefile.am:
|
||||
- Add midi-controller support
|
||||
- Allow editing of connection through context menu
|
||||
- Code clean-up
|
||||
|
||||
* include/midi.h:
|
||||
|
||||
@@ -50,7 +50,8 @@ class controllerConnectionDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
controllerConnectionDialog( QWidget * _parent);
|
||||
controllerConnectionDialog( QWidget * _parent,
|
||||
controllerConnection * _connection = NULL );
|
||||
virtual ~controllerConnectionDialog();
|
||||
|
||||
controller * chosenController( void )
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <QtGui/QScrollArea>
|
||||
|
||||
#include "controller_connection_dialog.h"
|
||||
#include "controller_connection.h"
|
||||
#include "lcd_spinbox.h"
|
||||
#include "led_checkbox.h"
|
||||
#include "combobox.h"
|
||||
@@ -109,7 +110,8 @@ public slots:
|
||||
|
||||
|
||||
|
||||
controllerConnectionDialog::controllerConnectionDialog( QWidget * _parent
|
||||
controllerConnectionDialog::controllerConnectionDialog( QWidget * _parent,
|
||||
controllerConnection * _connection
|
||||
) :
|
||||
QDialog( _parent ),
|
||||
m_controller( NULL ),
|
||||
@@ -124,6 +126,7 @@ controllerConnectionDialog::controllerConnectionDialog( QWidget * _parent
|
||||
vlayout->setSpacing( 10 );
|
||||
vlayout->setMargin( 10 );
|
||||
|
||||
|
||||
// Midi stuff
|
||||
m_midiGroupBox = new groupBox( tr( "MIDI CONTROLLER" ), this );
|
||||
m_midiGroupBox->setGeometry( 2, 2, 240, 64 );
|
||||
@@ -158,6 +161,9 @@ controllerConnectionDialog::controllerConnectionDialog( QWidget * _parent
|
||||
connect( m_userGroupBox->model(), SIGNAL( dataChanged() ),
|
||||
this, SLOT( userToggled() ) );
|
||||
|
||||
m_userController = new comboBox( m_userGroupBox, "Controller" );
|
||||
m_userController->setGeometry( 10, 20, 200, 22 );
|
||||
|
||||
m_mappingFunction = new QLineEdit( this );
|
||||
m_mappingFunction->setGeometry( 2, 140, 240, 16 );
|
||||
m_mappingFunction->setText( "input" );
|
||||
@@ -167,9 +173,6 @@ controllerConnectionDialog::controllerConnectionDialog( QWidget * _parent
|
||||
|
||||
resize( 256, 196 );
|
||||
|
||||
m_userController = new comboBox( m_userGroupBox, "Controller" );
|
||||
m_userController->setGeometry( 10, 20, 200, 22 );
|
||||
|
||||
for( int i = 0; i < engine::getSong()->controllers().size(); ++i )
|
||||
{
|
||||
controller * c = engine::getSong()->controllers().at( i );
|
||||
@@ -202,6 +205,38 @@ controllerConnectionDialog::controllerConnectionDialog( QWidget * _parent
|
||||
btn_layout->addWidget( cancel_btn );
|
||||
btn_layout->addSpacing( 10 );
|
||||
|
||||
|
||||
// TODO, handle by making this a model for the Dialog "view"
|
||||
if( _connection && _connection->getController()->type() !=
|
||||
controller::DummyController && engine::getSong() )
|
||||
{
|
||||
if ( _connection->getController()->type() ==
|
||||
controller::MidiController )
|
||||
{
|
||||
m_midiGroupBox->model()->setValue( TRUE );
|
||||
// ensure controller is created
|
||||
midiToggled();
|
||||
|
||||
midiController * cont =
|
||||
(midiController*)( _connection->getController() );
|
||||
m_midiChannelSpinBox->model()->setValue(
|
||||
cont->midiChannelModel()->value() );
|
||||
m_midiControllerSpinBox->model()->setValue(
|
||||
cont->midiControllerModel()->value() );
|
||||
}
|
||||
else
|
||||
{
|
||||
int idx = engine::getSong()->controllers().indexOf(
|
||||
_connection->getController() );
|
||||
|
||||
if( idx >= 0 )
|
||||
{
|
||||
m_userGroupBox->model()->setValue( TRUE );
|
||||
m_userController->model()->setValue( idx );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
show();
|
||||
}
|
||||
|
||||
@@ -691,7 +691,9 @@ void knob::connectToController( void )
|
||||
// TODO[pg]: Display a dialog with list of controllers currently in the song
|
||||
// in addition to any system MIDI controllers
|
||||
|
||||
controllerConnectionDialog * d = new controllerConnectionDialog( engine::getMainWindow() );
|
||||
controllerConnectionDialog * d = new controllerConnectionDialog(
|
||||
engine::getMainWindow(),
|
||||
model()->getControllerConnection() );
|
||||
|
||||
d->exec();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user