Controllers are rendered more dynamically
ControllerRackView now uses a layout to organize the ControllerViews. The ControllerViews in turn use layouts to organize their widgets (labels and push button). ControllerView now inherits from QFrame instead of QWidget. The (static) background image for controllers was deleted because the ControllerView can now be resized dynamically. Song: Added specific signals for added and removed controllers. Also removed a TODO by putting the functionality to remove all controllers in a method (removeAllControllers). Deleted Controllers now don't unregister from Song during deletion. This has to be done by the client (Hollywood principle - "Don't call us, we call you."). TODO: For some strange reason I cannot programmatically resize the controller rack to make it fit the controllers on my screen.
This commit is contained in:
@@ -34,8 +34,10 @@
|
||||
|
||||
class QPushButton;
|
||||
class QScrollArea;
|
||||
class QVBoxLayout;
|
||||
|
||||
class ControllerView;
|
||||
class Controller;
|
||||
|
||||
|
||||
class ControllerRackView : public QWidget, public SerializingObject
|
||||
@@ -56,12 +58,13 @@ public:
|
||||
|
||||
public slots:
|
||||
void deleteController( ControllerView * _view );
|
||||
void onControllerAdded( Controller * );
|
||||
void onControllerRemoved( Controller * );
|
||||
|
||||
protected:
|
||||
virtual void closeEvent( QCloseEvent * _ce );
|
||||
|
||||
private slots:
|
||||
virtual void update();
|
||||
void addController();
|
||||
|
||||
|
||||
@@ -69,8 +72,12 @@ private:
|
||||
QVector<ControllerView *> m_controllerViews;
|
||||
|
||||
QScrollArea * m_scrollArea;
|
||||
QVBoxLayout * m_scrollAreaLayout;
|
||||
QPushButton * m_addButton;
|
||||
|
||||
// Stores the index of where to insert the next ControllerView.
|
||||
// Needed so that the StretchItem always stays at the last position.
|
||||
int m_nextIndex;
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#ifndef CONTROLLER_VIEW_H
|
||||
#define CONTROLLER_VIEW_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QFrame>
|
||||
|
||||
#include "AutomatableModel.h"
|
||||
#include "Controller.h"
|
||||
@@ -39,7 +39,7 @@ class QMdiSubWindow;
|
||||
class LedCheckBox;
|
||||
|
||||
|
||||
class ControllerView : public QWidget, public ModelView
|
||||
class ControllerView : public QFrame, public ModelView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -70,15 +70,14 @@ signals:
|
||||
|
||||
protected:
|
||||
virtual void contextMenuEvent( QContextMenuEvent * _me );
|
||||
virtual void paintEvent( QPaintEvent * _pe );
|
||||
virtual void modelChanged();
|
||||
virtual void mouseDoubleClickEvent( QMouseEvent * event );
|
||||
|
||||
|
||||
private:
|
||||
QPixmap m_bg;
|
||||
QMdiSubWindow * m_subWindow;
|
||||
ControllerDialog * m_controllerDlg;
|
||||
QLabel * m_nameLabel;
|
||||
bool m_show;
|
||||
|
||||
} ;
|
||||
|
||||
@@ -323,6 +323,8 @@ private:
|
||||
void saveControllerStates( QDomDocument & doc, QDomElement & element );
|
||||
void restoreControllerStates( const QDomElement & element );
|
||||
|
||||
void removeAllControllers();
|
||||
|
||||
|
||||
AutomationTrack * m_globalAutomationTrack;
|
||||
|
||||
@@ -376,6 +378,8 @@ signals:
|
||||
void lengthChanged( int tacts );
|
||||
void tempoChanged( bpm_t newBPM );
|
||||
void timeSignatureChanged( int oldTicksPerTact, int ticksPerTact );
|
||||
void controllerAdded( Controller * );
|
||||
void controllerRemoved( Controller * );
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user