2 * ControllerConnection.h - declaration of a controller connect, which
3 * provides a definition of the link between a controller and
4 * model, also handles deferred creation of links while
7 * Copyright (c) 2008 Paul Giblock <pgllama/at/gmail.com>
8 * Copyright (c) 2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
10 * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
22 * You should have received a copy of the GNU General Public
23 * License along with this program (see COPYING); if not, write to the
24 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 * Boston, MA 02110-1301 USA.
30 #ifndef _CONTROLLER_CONNECTION_H
31 #define _CONTROLLER_CONNECTION_H
33 #include <QtCore/QObject>
34 #include <QtCore/QVector>
36 #include "Controller.h"
37 #include "JournallingObject.h"
39 class ControllerConnection
;
41 typedef QVector
<ControllerConnection
*> ControllerConnectionVector
;
44 class EXPORT ControllerConnection
: public QObject
, public JournallingObject
49 ControllerConnection( Controller
* _controller
);
50 ControllerConnection( int _controllerId
);
52 virtual ~ControllerConnection();
54 inline Controller
* getController()
59 void setController( Controller
* _controller
);
61 inline void setController( int _controllerId
);
63 float currentValue( int _offset
)
65 return m_controller
->currentValue( _offset
);
68 inline void setTargetName( const QString
& _name
);
70 inline QString
targetName() const
75 inline bool isFinalized()
77 return m_controllerId
< 0;
80 static void finalizeConnections();
82 virtual void saveSettings( QDomDocument
& _doc
, QDomElement
& _this
);
83 virtual void loadSettings( const QDomElement
& _this
);
85 static inline const QString
classNodeName()
90 virtual QString
nodeName() const
92 return classNodeName();
97 void deleteConnection();
100 //virtual controllerDialog * createDialog( QWidget * _parent );
101 Controller
* m_controller
;
102 QString m_targetName
;
105 bool m_ownsController
;
107 static ControllerConnectionVector s_connections
;
110 // The value changed while the mixer isn't running (i.e: MIDI CC)
113 friend class ControllerConnectionDialog
;