add model.displayName and add midi-seq support to midiController
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1078 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
29
ChangeLog
29
ChangeLog
@@ -1,3 +1,32 @@
|
||||
2008-06-05 Paul Giblock <drfaygo/at/gmail/dot/com>
|
||||
|
||||
* include/knob.h:
|
||||
* include/automatable_slider.h:
|
||||
* include/controller_connection.h:
|
||||
* include/midi_controller.h:
|
||||
* include/automatable_model.h:
|
||||
* include/automatable_button.h:
|
||||
* include/tempo_sync_knob.h:
|
||||
* include/controller_connection_dialog.h:
|
||||
* include/pixmap_button.h:
|
||||
* include/automatable_model_view.h:
|
||||
* include/mv_base.h:
|
||||
* include/volume_knob.h:
|
||||
* src/gui/automatable_model_view.cpp:
|
||||
* src/gui/controller_connection_dialog.cpp:
|
||||
* src/gui/widgets/knob.cpp:
|
||||
* src/gui/widgets/automatable_slider.cpp:
|
||||
* src/gui/widgets/group_box.cpp:
|
||||
* src/gui/widgets/lcd_spinbox.cpp:
|
||||
* src/gui/widgets/tempo_sync_knob.cpp:
|
||||
* src/gui/widgets/automatable_button.cpp:
|
||||
* src/core/midi/midi_controller.cpp:
|
||||
* src/core/automatable_model.cpp:
|
||||
* src/core/controller_connection.cpp:
|
||||
- add support for sequenced midi in midi-controllers
|
||||
- add displayName field to model / autoModel for descriptive model trees
|
||||
- use displayName for midiController and contextMenus
|
||||
|
||||
2008-06-05 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* include/track.h:
|
||||
|
||||
@@ -38,7 +38,8 @@ class EXPORT automatableButton : public QPushButton, public boolModelView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
automatableButton( QWidget * _parent, const QString & _name );
|
||||
automatableButton( QWidget * _parent, const QString & _name
|
||||
= QString::null );
|
||||
virtual ~automatableButton();
|
||||
|
||||
inline void setCheckable( bool _on )
|
||||
@@ -82,7 +83,8 @@ class EXPORT automatableButtonGroup : public QWidget, public intModelView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
automatableButtonGroup( QWidget * _parent, const QString & _name );
|
||||
automatableButtonGroup( QWidget * _parent, const QString & _name
|
||||
= QString::null );
|
||||
virtual ~automatableButtonGroup();
|
||||
|
||||
void addButton( automatableButton * _btn );
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#include <QtCore/QPointer>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QString>
|
||||
|
||||
|
||||
class track;
|
||||
@@ -84,6 +85,7 @@ public:
|
||||
const float _max = 0,
|
||||
const float _step = 0,
|
||||
::model * _parent = NULL,
|
||||
const QString & _display_name = QString::null,
|
||||
bool _default_constructed = FALSE );
|
||||
|
||||
virtual ~automatableModel();
|
||||
@@ -248,6 +250,17 @@ public:
|
||||
return( 0 );
|
||||
}*/
|
||||
|
||||
virtual QString displayName( void ) const
|
||||
{
|
||||
return m_displayName;
|
||||
}
|
||||
|
||||
virtual void setDisplayName( const QString & _display_name )
|
||||
{
|
||||
m_displayName = _display_name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public slots:
|
||||
virtual void reset( void );
|
||||
@@ -275,6 +288,7 @@ private:
|
||||
// most objects will need this temporarily
|
||||
float m_oldValue;
|
||||
bool m_journalEntryReady;
|
||||
QString m_displayName;
|
||||
|
||||
typedef QVector<automatableModel *> autoModelVector;
|
||||
autoModelVector m_linkedModels;
|
||||
@@ -320,9 +334,10 @@ class floatModel : public automatableModel
|
||||
public:
|
||||
floatModel( float _val = 0, float _min = 0, float _max = 0,
|
||||
float _step = 0, ::model * _parent = NULL,
|
||||
const QString & _display_name = QString::null,
|
||||
bool _default_constructed = FALSE ) :
|
||||
automatableModel( Float, _val, _min, _max, _step,
|
||||
_parent, _default_constructed )
|
||||
_parent, _display_name, _default_constructed )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -336,9 +351,10 @@ class intModel : public automatableModel
|
||||
public:
|
||||
intModel( int _val = 0, int _min = 0, int _max = 0,
|
||||
::model * _parent = NULL,
|
||||
const QString & _display_name = QString::null,
|
||||
bool _default_constructed = FALSE ) :
|
||||
automatableModel( Integer, _val, _min, _max, 1,
|
||||
_parent, _default_constructed )
|
||||
_parent, _display_name, _default_constructed )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -352,9 +368,10 @@ class boolModel : public automatableModel
|
||||
public:
|
||||
boolModel( const bool _val = FALSE,
|
||||
::model * _parent = NULL,
|
||||
const QString & _display_name = QString::null,
|
||||
bool _default_constructed = FALSE ) :
|
||||
automatableModel( Bool, _val, FALSE, TRUE, 1,
|
||||
_parent, _default_constructed )
|
||||
_parent, _display_name, _default_constructed )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,8 @@ public:
|
||||
return( castModel<automatableModel>() );
|
||||
}
|
||||
|
||||
virtual void setModel( model * _model, bool _old_model_valid = TRUE );
|
||||
|
||||
template<typename T>
|
||||
inline T value( void ) const
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ class automatableSlider : public QSlider, public intModelView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
automatableSlider( QWidget * _parent, const QString & _name );
|
||||
automatableSlider( QWidget * _parent, const QString & _name = QString::null );
|
||||
virtual ~automatableSlider();
|
||||
|
||||
bool showStatus( void )
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "journalling_object.h"
|
||||
|
||||
class controllerConnection;
|
||||
class QString;
|
||||
|
||||
typedef QVector<controllerConnection *> controllerConnectionVector;
|
||||
|
||||
@@ -65,6 +66,13 @@ public:
|
||||
return m_controller->currentValue( _offset );
|
||||
}
|
||||
|
||||
inline void setTargetName( const QString & _name );
|
||||
|
||||
inline QString targetName( void ) const
|
||||
{
|
||||
return m_targetName;
|
||||
}
|
||||
|
||||
inline bool isFinalized( void )
|
||||
{
|
||||
return m_controllerId < 0;
|
||||
@@ -78,9 +86,10 @@ public:
|
||||
|
||||
protected:
|
||||
//virtual controllerDialog * createDialog( QWidget * _parent );
|
||||
|
||||
controller * m_controller;
|
||||
int m_controllerId;
|
||||
QString m_targetName;
|
||||
int m_controllerId;
|
||||
|
||||
bool m_ownsController;
|
||||
|
||||
static controllerConnectionVector s_connections;
|
||||
|
||||
@@ -51,7 +51,7 @@ class controllerConnectionDialog : public QDialog
|
||||
Q_OBJECT
|
||||
public:
|
||||
controllerConnectionDialog( QWidget * _parent,
|
||||
controllerConnection * _connection = NULL );
|
||||
const automatableModel * _target_model );
|
||||
virtual ~controllerConnectionDialog();
|
||||
|
||||
controller * chosenController( void )
|
||||
@@ -66,8 +66,12 @@ public slots:
|
||||
void userToggled( void );
|
||||
void autoDetectToggled( void );
|
||||
|
||||
protected slots:
|
||||
void midiValueChanged( void );
|
||||
|
||||
void activatedReadablePort( QAction * _item );
|
||||
void updateReadablePortsMenu( void );
|
||||
|
||||
private:
|
||||
|
||||
groupBox * m_midiGroupBox;
|
||||
@@ -75,6 +79,7 @@ private:
|
||||
lcdSpinBox * m_midiControllerSpinBox;
|
||||
ledCheckBox * m_midiAutoDetectCheckBox;
|
||||
boolModel m_midiAutoDetect;
|
||||
QMenu * m_readablePorts;
|
||||
|
||||
groupBox * m_userGroupBox;
|
||||
comboBox * m_userController;
|
||||
@@ -82,6 +87,7 @@ private:
|
||||
QLineEdit * m_mappingFunction;
|
||||
|
||||
controller * m_controller;
|
||||
const automatableModel * m_targetModel;
|
||||
|
||||
// Temporary midiController
|
||||
autoDetectMidiController * m_midiController;
|
||||
|
||||
@@ -63,7 +63,7 @@ class EXPORT knob : public QWidget, public floatModelView
|
||||
Q_PROPERTY(QColor outerColor READ outerColor WRITE setOuterColor)
|
||||
|
||||
public:
|
||||
knob( int _knob_num, QWidget * _parent, const QString & _name );
|
||||
knob( int _knob_num, QWidget * _parent, const QString & _name = QString::null );
|
||||
virtual ~knob();
|
||||
|
||||
// TODO: remove
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#define _MIDI_CONTROLLER_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtCore/QMap>
|
||||
|
||||
#include "mv_base.h"
|
||||
#include "automatable_model.h"
|
||||
@@ -41,6 +42,8 @@ class midiController : public controller, public midiEventProcessor
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef QMap<QString, bool> midiPortMap;
|
||||
|
||||
midiController( model * _parent );
|
||||
virtual ~midiController();
|
||||
|
||||
@@ -76,10 +79,18 @@ public:
|
||||
return &m_midiController;
|
||||
}
|
||||
|
||||
virtual midiPort * getMidiPort( void )
|
||||
{
|
||||
return m_midiPort;
|
||||
}
|
||||
|
||||
// Used by controllerConnectionDialog to copy
|
||||
virtual void setReadablePorts( const midiPortMap & _map );
|
||||
|
||||
public slots:
|
||||
virtual controllerDialog * createDialog( QWidget * _parent );
|
||||
void updateMidiPort();
|
||||
void updateMidiPort( void );
|
||||
void updateReadablePorts( void );
|
||||
|
||||
protected:
|
||||
|
||||
@@ -90,9 +101,11 @@ protected:
|
||||
intModel m_midiController;
|
||||
|
||||
midiPort * m_midiPort;
|
||||
midiPortMap m_readablePorts;
|
||||
|
||||
float m_lastValue;
|
||||
|
||||
friend class controllerConnectionDialog;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -55,21 +55,16 @@ public:
|
||||
|
||||
virtual QString displayName( void ) const
|
||||
{
|
||||
printf("displayName() Returned: %s\n", qPrintable(m_displayName) );
|
||||
return m_displayName;
|
||||
return QString();
|
||||
}
|
||||
|
||||
void setDisplayName( const QString & _displayName )
|
||||
{
|
||||
printf("setDisplayName() 1: %s ", qPrintable(_displayName));
|
||||
m_displayName = _displayName;
|
||||
printf("setDisplayName() 2: %s\n", qPrintable(m_displayName));
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
bool m_defaultConstructed;
|
||||
QString m_displayName;
|
||||
|
||||
signals:
|
||||
// emitted if actual data of the model (e.g. values) have changed
|
||||
|
||||
@@ -35,7 +35,7 @@ class EXPORT pixmapButton : public automatableButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
pixmapButton( QWidget * _parent, const QString & _name );
|
||||
pixmapButton( QWidget * _parent, const QString & _name = QString::null );
|
||||
virtual ~pixmapButton();
|
||||
|
||||
void setActiveGraphic( const QPixmap & _pm );
|
||||
|
||||
@@ -57,7 +57,8 @@ public:
|
||||
|
||||
tempoSyncKnobModel( const float _val, const float _min,
|
||||
const float _max, const float _step,
|
||||
const float _scale, ::model * _parent );
|
||||
const float _scale, ::model * _parent,
|
||||
const QString & _display_name = QString::null );
|
||||
virtual ~tempoSyncKnobModel();
|
||||
|
||||
virtual void saveSettings( QDomDocument & _doc,
|
||||
@@ -106,7 +107,7 @@ class tempoSyncKnob : public knob
|
||||
Q_OBJECT
|
||||
public:
|
||||
tempoSyncKnob( int _knob_num, QWidget * _parent,
|
||||
const QString & _name );
|
||||
const QString & _name = QString::null );
|
||||
virtual ~tempoSyncKnob();
|
||||
|
||||
const QString & getSyncDescription( void );
|
||||
|
||||
@@ -34,7 +34,7 @@ class EXPORT volumeKnob : public knob
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
volumeKnob( int _knob_num, QWidget * _parent, const QString & _name );
|
||||
volumeKnob( int _knob_num, QWidget * _parent, const QString & _name = QString::null );
|
||||
virtual ~volumeKnob();
|
||||
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ automatableModel::automatableModel( DataType _type,
|
||||
const float _max,
|
||||
const float _step,
|
||||
::model * _parent,
|
||||
const QString & _display_name,
|
||||
bool _default_constructed ) :
|
||||
model( _parent, _default_constructed ),
|
||||
m_dataType( _type ),
|
||||
@@ -59,6 +60,7 @@ automatableModel::automatableModel( DataType _type,
|
||||
m_maxValue( _max ),
|
||||
m_step( _step ),
|
||||
m_range( _max - _min ),
|
||||
m_displayName( _display_name ),
|
||||
m_journalEntryReady( FALSE ),
|
||||
m_controllerConnection( NULL ),
|
||||
m_automationPattern( NULL ),
|
||||
@@ -157,9 +159,9 @@ void automatableModel::loadSettings( const QDomElement & _this,
|
||||
node = node.namedItem( _name );
|
||||
if( node.isElement() )
|
||||
{
|
||||
//m_controllerConnection = new controllerConnection( (controller*)NULL );
|
||||
setControllerConnection( new controllerConnection( (controller*)NULL ) );
|
||||
m_controllerConnection->loadSettings( node.toElement() );
|
||||
//m_controllerConnection->setTargetName( displayName() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,6 +117,16 @@ void controllerConnection::setController( controller * _controller )
|
||||
|
||||
|
||||
|
||||
inline void controllerConnection::setTargetName( const QString & _name )
|
||||
{
|
||||
m_targetName = _name;
|
||||
if( m_controller )
|
||||
{
|
||||
// m_controller->getMidiPort()->setName( _name );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* A connection may not be finalized. This means, the connection should exist,
|
||||
|
||||
@@ -45,10 +45,17 @@ midiController::midiController( model * _parent ) :
|
||||
m_midiChannel( 0, 0, MIDI_CHANNEL_COUNT, this ),
|
||||
m_midiController( 0, 0, MIDI_CONTROLLER_COUNT, this ),
|
||||
m_midiPort( engine::getMixer()->getMIDIClient()->addPort(
|
||||
this, tr( "unnamed_channel" ) ) ),
|
||||
this, tr( "unnamed_midi_controller" ) ) ),
|
||||
m_lastValue( 0.0f )
|
||||
{
|
||||
m_midiPort->setMode( midiPort::Input );
|
||||
|
||||
midiClient * mc = engine::getMixer()->getMIDIClient();
|
||||
if( mc->isRaw() == FALSE )
|
||||
{
|
||||
updateReadablePorts();
|
||||
}
|
||||
|
||||
connect( &m_midiChannel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateMidiPort() ) );
|
||||
connect( &m_midiController, SIGNAL( dataChanged() ),
|
||||
@@ -117,12 +124,73 @@ void midiController::processInEvent( const midiEvent & _me,
|
||||
|
||||
|
||||
|
||||
void midiController::setReadablePorts( const midiPortMap & _map )
|
||||
{
|
||||
m_readablePorts.clear();
|
||||
|
||||
for( midiPortMap::const_iterator it = _map.constBegin();
|
||||
it != _map.constEnd(); ++it )
|
||||
{
|
||||
engine::getMixer()->getMIDIClient()->subscribeReadablePort(
|
||||
m_midiPort, it.key(), !( *it ) );
|
||||
}
|
||||
|
||||
m_readablePorts = _map;
|
||||
}
|
||||
|
||||
|
||||
void midiController::updateReadablePorts( void )
|
||||
{
|
||||
// first save all selected ports
|
||||
QStringList selected_ports;
|
||||
|
||||
for( midiPortMap::const_iterator i = m_readablePorts.constBegin();
|
||||
i != m_readablePorts.constEnd(); ++i )
|
||||
{
|
||||
selected_ports.push_back( i.key() );
|
||||
++i;
|
||||
}
|
||||
|
||||
m_readablePorts.clear();
|
||||
const QStringList & wp = engine::getMixer()->getMIDIClient()->
|
||||
readablePorts();
|
||||
|
||||
// now insert new ports and restore selections
|
||||
for( QStringList::const_iterator it = wp.begin(); it != wp.end(); ++it )
|
||||
{
|
||||
m_readablePorts[ *it ] = ( selected_ports.indexOf( *it ) != -1 );
|
||||
}
|
||||
//emit readablePortsChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void midiController::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
{
|
||||
controller::saveSettings( _doc, _this );
|
||||
|
||||
m_midiChannel.saveSettings( _doc, _this, "channel" );
|
||||
m_midiController.saveSettings( _doc, _this, "controller" );
|
||||
|
||||
if( m_readablePorts.size() )
|
||||
{
|
||||
QString rp;
|
||||
for( midiPortMap::const_iterator it = m_readablePorts.constBegin();
|
||||
it != m_readablePorts.constEnd(); ++it )
|
||||
{
|
||||
if( *it )
|
||||
{
|
||||
rp += it.key() + ",";
|
||||
}
|
||||
}
|
||||
// cut off comma
|
||||
if( rp.length() > 0 )
|
||||
{
|
||||
rp.truncate( rp.length() - 1 );
|
||||
}
|
||||
_this.setAttribute( "inports", rp );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -135,6 +203,24 @@ void midiController::loadSettings( const QDomElement & _this )
|
||||
m_midiChannel.loadSettings( _this, "channel" );
|
||||
m_midiController.loadSettings( _this, "controller" );
|
||||
|
||||
midiClient * mc = engine::getMixer()->getMIDIClient();
|
||||
if( mc->isRaw() == FALSE )
|
||||
{
|
||||
//updateReadablePorts();
|
||||
|
||||
QStringList rp = _this.attribute( "inports" ).split( ',' );
|
||||
for( midiPortMap::iterator it = m_readablePorts.begin();
|
||||
it != m_readablePorts.end(); ++it )
|
||||
{
|
||||
if( rp.indexOf( it.key() ) != -1 )
|
||||
{
|
||||
*it = TRUE;
|
||||
|
||||
engine::getMixer()->getMIDIClient()->subscribeReadablePort(
|
||||
m_midiPort, it.key(), !( *it ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
updateMidiPort();
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
void automatableModelView::addDefaultActions( QMenu * _menu )
|
||||
{
|
||||
automatableModel * _model = modelUntyped();
|
||||
printf( "addDefaultActions for %s\n", qPrintable(_model->displayName()) );
|
||||
|
||||
automatableModelViewSlots * amvSlots =
|
||||
new automatableModelViewSlots( this, _menu );
|
||||
@@ -112,6 +111,15 @@ void automatableModelView::addDefaultActions( QMenu * _menu )
|
||||
|
||||
|
||||
|
||||
void automatableModelView::setModel( model * _model, bool _old_model_valid )
|
||||
{
|
||||
modelView::setModel( _model, _old_model_valid );
|
||||
//setAccessibleName( _model->displayName();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
automatableModelViewSlots::automatableModelViewSlots(
|
||||
automatableModelView * _amv,
|
||||
QObject * _parent ) :
|
||||
@@ -134,9 +142,7 @@ void automatableModelViewSlots::execConnectionDialog( void )
|
||||
|
||||
m->displayName();
|
||||
controllerConnectionDialog * d = new controllerConnectionDialog(
|
||||
(QWidget*)engine::getMainWindow(),
|
||||
/* m->displayName(), */
|
||||
m->getControllerConnection() );
|
||||
(QWidget*)engine::getMainWindow(), m );
|
||||
|
||||
d->exec();
|
||||
|
||||
|
||||
@@ -38,8 +38,11 @@
|
||||
#include "combobox.h"
|
||||
#include "group_box.h"
|
||||
#include "midi_controller.h"
|
||||
#include "midi_client.h"
|
||||
#include "midi_port.h"
|
||||
#include "midi.h"
|
||||
#include "song.h"
|
||||
#include "tool_button.h"
|
||||
|
||||
#include "gui_templates.h"
|
||||
#include "embed.h"
|
||||
@@ -86,6 +89,7 @@ public:
|
||||
midiController * c = new midiController( _parent );
|
||||
c->midiChannelModel()->setValue( m_midiChannel.value() );
|
||||
c->midiControllerModel()->setValue( m_midiController.value() );
|
||||
c->setReadablePorts( m_readablePorts );
|
||||
|
||||
return c;
|
||||
}
|
||||
@@ -111,12 +115,14 @@ public slots:
|
||||
|
||||
|
||||
controllerConnectionDialog::controllerConnectionDialog( QWidget * _parent,
|
||||
controllerConnection * _connection
|
||||
const automatableModel * _target_model
|
||||
) :
|
||||
QDialog( _parent ),
|
||||
m_controller( NULL ),
|
||||
m_midiController( NULL ),
|
||||
m_midiAutoDetect( FALSE )
|
||||
m_readablePorts( NULL ),
|
||||
m_midiAutoDetect( FALSE ),
|
||||
m_targetModel( _target_model )
|
||||
{
|
||||
setWindowIcon( embed::getIconPixmap( "setup_audio" ) );
|
||||
setWindowTitle( tr( "Connection Settings" ) );
|
||||
@@ -154,6 +160,26 @@ controllerConnectionDialog::controllerConnectionDialog( QWidget * _parent,
|
||||
connect( &m_midiAutoDetect, SIGNAL( dataChanged() ),
|
||||
this, SLOT( autoDetectToggled() ) );
|
||||
|
||||
// when using with non-raw-clients we can provide buttons showing
|
||||
// our port-menus when being clicked
|
||||
midiClient * mc = engine::getMixer()->getMIDIClient();
|
||||
if( mc->isRaw() == FALSE )
|
||||
{
|
||||
m_readablePorts = new QMenu( this );
|
||||
m_readablePorts->setFont( pointSize<9>(
|
||||
m_readablePorts->font() ) );
|
||||
connect( m_readablePorts, SIGNAL( triggered( QAction * ) ),
|
||||
this, SLOT( activatedReadablePort( QAction * ) ) );
|
||||
|
||||
toolButton * rp_btn = new toolButton( m_midiGroupBox );
|
||||
rp_btn->setText( tr( "MIDI-devices to receive "
|
||||
"MIDI-events from" ) );
|
||||
rp_btn->setIcon( embed::getIconPixmap( "midi_in" ) );
|
||||
rp_btn->setGeometry( 200, 24, 40, 40 );
|
||||
rp_btn->setMenu( m_readablePorts );
|
||||
rp_btn->setPopupMode( QToolButton::InstantPopup );
|
||||
}
|
||||
|
||||
|
||||
// User stuff
|
||||
m_userGroupBox = new groupBox( tr( "USER CONTROLLER" ), this );
|
||||
@@ -207,40 +233,51 @@ controllerConnectionDialog::controllerConnectionDialog( QWidget * _parent,
|
||||
|
||||
|
||||
// TODO, handle by making this a model for the Dialog "view"
|
||||
if( _connection && _connection->getController()->type() !=
|
||||
controller::DummyController && engine::getSong() )
|
||||
controllerConnection * cc = NULL;
|
||||
if( m_targetModel )
|
||||
{
|
||||
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() );
|
||||
cc = m_targetModel->getControllerConnection();
|
||||
|
||||
if( idx >= 0 )
|
||||
if( cc && cc->getController()->type() !=
|
||||
controller::DummyController && engine::getSong() )
|
||||
{
|
||||
if ( cc->getController()->type() ==
|
||||
controller::MidiController )
|
||||
{
|
||||
m_userGroupBox->model()->setValue( TRUE );
|
||||
m_userController->model()->setValue( idx );
|
||||
m_midiGroupBox->model()->setValue( TRUE );
|
||||
// ensure controller is created
|
||||
midiToggled();
|
||||
|
||||
midiController * cont =
|
||||
(midiController*)( cc->getController() );
|
||||
m_midiChannelSpinBox->model()->setValue(
|
||||
cont->midiChannelModel()->value() );
|
||||
m_midiControllerSpinBox->model()->setValue(
|
||||
cont->midiControllerModel()->value() );
|
||||
|
||||
// update menuupdateReadablePortsMenu
|
||||
m_midiController->setReadablePorts( static_cast<midiController*>( cc->getController() )->m_readablePorts );
|
||||
updateReadablePortsMenu();
|
||||
}
|
||||
else
|
||||
{
|
||||
int idx = engine::getSong()->controllers().indexOf(
|
||||
cc->getController() );
|
||||
|
||||
if( idx >= 0 )
|
||||
{
|
||||
m_userGroupBox->model()->setValue( TRUE );
|
||||
m_userController->model()->setValue( idx );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if( !cc )
|
||||
{
|
||||
m_midiGroupBox->model()->setValue( TRUE );
|
||||
}
|
||||
|
||||
|
||||
show();
|
||||
}
|
||||
|
||||
@@ -262,8 +299,11 @@ void controllerConnectionDialog::selectController( void )
|
||||
{
|
||||
if( m_midiControllerSpinBox->model()->value() > 0 )
|
||||
{
|
||||
m_controller = m_midiController->copyToMidiController(
|
||||
midiController * mc;
|
||||
mc = m_midiController->copyToMidiController(
|
||||
engine::getSong() );
|
||||
mc->getMidiPort()->setName( m_targetModel->displayName() );
|
||||
m_controller = mc;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -299,8 +339,11 @@ void controllerConnectionDialog::midiToggled( void )
|
||||
m_midiControllerSpinBox->setModel(
|
||||
m_midiController->midiControllerModel() );
|
||||
|
||||
|
||||
connect( m_midiController, SIGNAL( valueChanged() ),
|
||||
this, SLOT( midiValueChanged() ) );
|
||||
|
||||
updateReadablePortsMenu();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -353,6 +396,40 @@ void controllerConnectionDialog::midiValueChanged( void )
|
||||
|
||||
|
||||
|
||||
|
||||
void controllerConnectionDialog::activatedReadablePort( QAction * _item )
|
||||
{
|
||||
// make sure, MIDI-port is configured for input
|
||||
if( _item->isChecked() == TRUE &&
|
||||
m_midiController->m_midiPort->mode() != midiPort::Input &&
|
||||
m_midiController->m_midiPort->mode() != midiPort::Duplex )
|
||||
{
|
||||
//mio->m_receiveEnabledModel.setValue( TRUE );
|
||||
}
|
||||
engine::getMixer()->getMIDIClient()->subscribeReadablePort(
|
||||
m_midiController->m_midiPort, _item->text(), !_item->isChecked() );
|
||||
m_midiController->m_readablePorts[_item->text()] = _item->isChecked();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void controllerConnectionDialog::updateReadablePortsMenu( void )
|
||||
{
|
||||
if( m_readablePorts )
|
||||
{
|
||||
m_readablePorts->clear();
|
||||
for( midiController::midiPortMap::const_iterator it =
|
||||
m_midiController->m_readablePorts.begin();
|
||||
it != m_midiController->m_readablePorts.end(); ++it )
|
||||
{
|
||||
QAction * a = m_readablePorts->addAction( it.key() );
|
||||
a->setCheckable( TRUE );
|
||||
a->setChecked( *it );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "controller_connection_dialog.moc"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
automatableButton::automatableButton( QWidget * _parent,
|
||||
const QString & _name ) :
|
||||
QPushButton( _parent ),
|
||||
boolModelView( new boolModel( FALSE, NULL, TRUE ) ),
|
||||
boolModelView( new boolModel( FALSE, NULL, _name, TRUE ) ),
|
||||
m_group( NULL )
|
||||
{
|
||||
setAccessibleName( _name );
|
||||
@@ -100,19 +100,22 @@ void automatableButton::contextMenuEvent( QContextMenuEvent * _me )
|
||||
mouseReleaseEvent( NULL );
|
||||
|
||||
QWidget * target;
|
||||
QString targetName;
|
||||
automationPattern * pattern;
|
||||
if ( m_group != NULL )
|
||||
{
|
||||
target = m_group;
|
||||
targetName = target->accessibleName();
|
||||
pattern = m_group->model()->getAutomationPattern();
|
||||
}
|
||||
else
|
||||
{
|
||||
target = this;
|
||||
targetName = model()->displayName();
|
||||
pattern = model()->getAutomationPattern();
|
||||
}
|
||||
|
||||
captionMenu contextMenu( target->accessibleName() );
|
||||
captionMenu contextMenu( targetName );
|
||||
addDefaultActions( &contextMenu );
|
||||
contextMenu.exec( QCursor::pos() );
|
||||
}
|
||||
@@ -174,7 +177,7 @@ void automatableButton::toggle( void )
|
||||
automatableButtonGroup::automatableButtonGroup( QWidget * _parent,
|
||||
const QString & _name ) :
|
||||
QWidget( _parent ),
|
||||
intModelView( new intModel( 0, 0, 0, NULL, TRUE ) )
|
||||
intModelView( new intModel( 0, 0, 0, NULL, _name, TRUE ) )
|
||||
{
|
||||
hide();
|
||||
setAccessibleName( _name );
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
automatableSlider::automatableSlider( QWidget * _parent, const QString & _name ) :
|
||||
QSlider( _parent ),
|
||||
intModelView( new intModel( 0, 0, 0, NULL, TRUE ) ),
|
||||
intModelView( new intModel( 0, 0, 0, NULL, _name, TRUE ) ),
|
||||
m_showStatus( FALSE )
|
||||
{
|
||||
setAccessibleName( _name );
|
||||
@@ -63,7 +63,7 @@ automatableSlider::~automatableSlider()
|
||||
|
||||
void automatableSlider::contextMenuEvent( QContextMenuEvent * _me )
|
||||
{
|
||||
captionMenu contextMenu( accessibleName() );
|
||||
captionMenu contextMenu( model()->displayName() );
|
||||
addDefaultActions( &contextMenu );
|
||||
contextMenu.exec( QCursor::pos() );
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ groupBox::groupBox( const QString & _caption, QWidget * _parent ) :
|
||||
m_led->setActiveGraphic( embed::getIconPixmap( "led_green" ) );
|
||||
m_led->setInactiveGraphic( embed::getIconPixmap( "led_off" ) );
|
||||
|
||||
setModel( new boolModel( FALSE, NULL, FALSE ) );
|
||||
setModel( new boolModel( FALSE, NULL, _caption, FALSE ) );
|
||||
setAutoFillBackground( TRUE );
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ textFloat * knob::s_textFloat = NULL;
|
||||
|
||||
knob::knob( int _knob_num, QWidget * _parent, const QString & _name ) :
|
||||
QWidget( _parent ),
|
||||
floatModelView( new knobModel( 0, 0, 0, 1, NULL, TRUE ) ),
|
||||
floatModelView( new knobModel( 0, 0, 0, 1, NULL, _name, TRUE ) ),
|
||||
m_mouseOffset( 0.0f ),
|
||||
m_buttonPressed( FALSE ),
|
||||
m_knobPixmap( NULL ),
|
||||
@@ -78,9 +78,6 @@ knob::knob( int _knob_num, QWidget * _parent, const QString & _name ) :
|
||||
setAcceptDrops( TRUE );
|
||||
|
||||
setAccessibleName( _name );
|
||||
printf("knob's Display name: %s\n", qPrintable(_name));
|
||||
model()->setDisplayName( _name );
|
||||
printf("knob-model's Display name: %s\n", qPrintable( model()->displayName() ));
|
||||
|
||||
if( m_knobNum != knobStyled ) {
|
||||
m_knobPixmap = new QPixmap( embed::getIconPixmap( QString( "knob0" +
|
||||
@@ -400,7 +397,7 @@ void knob::contextMenuEvent( QContextMenuEvent * )
|
||||
// an QApplication::restoreOverrideCursor()-call...
|
||||
mouseReleaseEvent( NULL );
|
||||
|
||||
captionMenu contextMenu( accessibleName() );
|
||||
captionMenu contextMenu( model()->displayName() );
|
||||
addDefaultActions( &contextMenu );
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction( embed::getIconPixmap( "help" ), tr( "&Help" ),
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
lcdSpinBox::lcdSpinBox( int _num_digits, QWidget * _parent,
|
||||
const QString & _name ) :
|
||||
QWidget( _parent ),
|
||||
intModelView( new intModel( 0, 0, 0, NULL, TRUE ) ),
|
||||
intModelView( new intModel( 0, 0, 0, NULL, _name, TRUE ) ),
|
||||
m_label(),
|
||||
m_numDigits( _num_digits ),
|
||||
m_origMousePos()
|
||||
@@ -69,7 +69,7 @@ lcdSpinBox::lcdSpinBox( int _num_digits, QWidget * _parent,
|
||||
lcdSpinBox::lcdSpinBox( int _num_digits, const QString & _lcd_style,
|
||||
QWidget * _parent, const QString & _name ) :
|
||||
QWidget( _parent ),
|
||||
intModelView( new intModel( 0, 0, 0, NULL, TRUE ) ),
|
||||
intModelView( new intModel( 0, 0, 0, NULL, _name, TRUE ) ),
|
||||
m_label(),
|
||||
m_numDigits( _num_digits ),
|
||||
m_origMousePos()
|
||||
@@ -276,7 +276,7 @@ void lcdSpinBox::contextMenuEvent( QContextMenuEvent * _me )
|
||||
// an QApplication::restoreOverrideCursor()-call...
|
||||
mouseReleaseEvent( NULL );
|
||||
|
||||
captionMenu contextMenu( accessibleName() );
|
||||
captionMenu contextMenu( model()->displayName() );
|
||||
addDefaultActions( &contextMenu );
|
||||
contextMenu.exec( QCursor::pos() );
|
||||
}
|
||||
|
||||
@@ -41,8 +41,9 @@
|
||||
|
||||
tempoSyncKnobModel::tempoSyncKnobModel( const float _val, const float _min,
|
||||
const float _max, const float _step,
|
||||
const float _scale, ::model * _parent ) :
|
||||
knobModel( _val, _min, _max, _step, _parent ),
|
||||
const float _scale, ::model * _parent,
|
||||
const QString & _display_name = QString::null ) :
|
||||
knobModel( _val, _min, _max, _step, _parent, _display_name ),
|
||||
m_tempoSyncMode( SyncNone ),
|
||||
m_tempoLastSyncMode( SyncNone ),
|
||||
m_scale( _scale ),
|
||||
|
||||
Reference in New Issue
Block a user