1 /************************************************************************
3 * Copyright 2010-2011 Jakob Leben (jakob.leben@gmail.com)
5 * This file is part of Qt GUI for SuperCollider.
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ************************************************************************/
25 #include "../QcHelper.h"
31 // FIXME: Due to Qt bug #22829, moc can not process headers that include
32 // boost/type_traits/detail/has_binary_operator.hp from boost 1.48, so
33 // we have to wrap the shm interface into a separate class.
40 using QtCollider::ScopeShm
;
42 class QcScopeShm
: public QWidget
, QcHelper
45 Q_PROPERTY( int serverPort READ serverPort WRITE setServerPort
);
46 Q_PROPERTY( int bufferNumber READ dummyInt WRITE setBufferNumber
);
47 Q_PROPERTY( float xOffset READ dummyFloat WRITE setXOffset
);
48 Q_PROPERTY( float yOffset READ dummyFloat WRITE setYOffset
);
49 Q_PROPERTY( float xZoom READ dummyFloat WRITE setXZoom
);
50 Q_PROPERTY( float yZoom READ dummyFloat WRITE setYZoom
);
51 Q_PROPERTY( int style READ style WRITE setStyle
);
52 Q_PROPERTY( VariantList waveColors READ dummyVariantList WRITE setWaveColors
);
53 Q_PROPERTY( QColor background READ background WRITE setBackground
);
54 Q_PROPERTY( int updateInterval READ updateInterval WRITE setUpdateInterval
);
55 Q_PROPERTY( bool running READ running
);
60 int serverPort() const { return _srvPort
; }
61 void setServerPort( int );
62 void setBufferNumber( int );
63 void setXOffset( float f
) { xOffset
= f
; }
64 void setYOffset( float f
) { yOffset
= f
; }
65 void setXZoom( float f
) { xZoom
= f
; }
66 void setYZoom( float f
) { yZoom
= f
; }
67 int style() const { return _style
; }
68 void setStyle( int i
) { _style
= i
; }
69 void setWaveColors( const VariantList
& colors
);
70 QColor
background() const { return _bkg
; }
71 void setBackground( const QColor
&c
) { _bkg
= c
; update(); }
72 int updateInterval() const;
73 void setUpdateInterval( int i
);
74 bool running() const { return _running
; }
75 QSize
sizeHint() const { return QSize( 500, 300 ); }
76 QSize
minimumSizeHint() const { return QSize( 50, 50 ); }
81 void resizeEvent ( QResizeEvent
* );
82 void paintEvent ( QPaintEvent
* );
86 void connectSharedMemory( int port
);
87 void initScopeReader( ScopeShm
*, int index
);
88 void paint1D( bool overlapped
, int channels
, int maxFrames
, int frames
, const QRect
&area
, QPainter
& );
89 void paint2D( int channels
, int maxFrames
, int frames
, const QRect
&area
, QPainter
& );
98 uint _availableFrames
;
106 QList
<QColor
> colors
;