summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/graphwindow.cpp
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/gui/graphwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/graphwindow.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/noncore/net/wellenreiter/gui/graphwindow.cpp b/noncore/net/wellenreiter/gui/graphwindow.cpp
index c620fe2..7e1f378 100644
--- a/noncore/net/wellenreiter/gui/graphwindow.cpp
+++ b/noncore/net/wellenreiter/gui/graphwindow.cpp
@@ -38,31 +38,31 @@ void MFrequencySpectrum::drawLine( QPainter* p, int x, int y, int width, const Q
38{ 38{
39 p->setPen( c.light() ); 39 p->setPen( c.light() );
40 p->drawPoint( x++, y ); 40 p->drawPoint( x++, y );
41 p->setPen( c ); 41 p->setPen( c );
42 p->drawLine( x, y, x+width-2, y ); 42 p->drawLine( x, y, x+width-2, y );
43 p->setPen( c.dark() ); 43 p->setPen( c.dark() );
44 p->drawPoint( x+width-1, y ); 44 p->drawPoint( x+width-1, y );
45} 45}
46 46
47 47
48void MFrequencySpectrum::drawBar( QPainter* p, int x, int y, int width, int height, int maxheight ) 48void MFrequencySpectrum::drawBar( QPainter* p, int x, int y, int width, int height, int maxheight )
49{ 49{
50/* int h1 = 133; int h2 = 0; 50 int h1 = 133; int h2 = 0;
51 int s1 = 200; int s2 = 255; 51 int s1 = 200; int s2 = 255;
52 int v1 = 140; int v2 = 255; */ 52 int v1 = 140; int v2 = 255;
53 53
54 int h1 = 196; int h2 = 194; 54 /*int h1 = 196; int h2 = 194;
55 int s1 = 85; int s2 = 15; 55 int s1 = 85; int s2 = 15;
56 int v1 = 95; int v2 = 237; 56 int v1 = 95; int v2 = 237;*/
57 57
58 QColor c( 120, 60, 200 ); 58 QColor c( 120, 60, 200 );
59 for ( int i = 0; i < height; ++i ) 59 for ( int i = 0; i < height; ++i )
60 { 60 {
61 int h = (h2-h1)*i/maxheight + h1; 61 int h = (h2-h1)*i/maxheight + h1;
62 int s = (s2-s1)*i/maxheight + s1; 62 int s = (s2-s1)*i/maxheight + s1;
63 int v = (v2-v1)*i/maxheight + v1; 63 int v = (v2-v1)*i/maxheight + v1;
64 drawLine( p, x, y-i, width, QColor( h,s,v, QColor::Hsv ) ); 64 drawLine( p, x, y-i, width, QColor( h,s,v, QColor::Hsv ) );
65 } 65 }
66 66
67 /*for ( int i = height; i < maxheight; ++i ) 67 /*for ( int i = height; i < maxheight; ++i )
68 drawLine( p, x, y-i, width, QColor( 47, 68, 76 ) );*/ 68 drawLine( p, x, y-i, width, QColor( 47, 68, 76 ) );*/
@@ -116,44 +116,44 @@ void Legende::drawContents( QPainter* p )
116 int width = ( contentsRect().width() - 2 * xmargin ) / _channels; 116 int width = ( contentsRect().width() - 2 * xmargin ) / _channels;
117 117
118 for ( int i = 0; i < _channels; ++i ) 118 for ( int i = 0; i < _channels; ++i )
119 p->drawText( xmargin + (width*i), 12, QString().sprintf( "%02d", i+1 ) ); 119 p->drawText( xmargin + (width*i), 12, QString().sprintf( "%02d", i+1 ) );
120} 120}
121 121
122 122
123MGraphWindow::MGraphWindow( QWidget* parent, const char* name, WFlags f ) 123MGraphWindow::MGraphWindow( QWidget* parent, const char* name, WFlags f )
124 :QVBox( parent, name, f ) 124 :QVBox( parent, name, f )
125{ 125{
126 spectrum = new MFrequencySpectrum( 14, this ); 126 spectrum = new MFrequencySpectrum( 14, this );
127 legende = new Legende( 14, this ); 127 legende = new Legende( 14, this );
128 startTimer( 50 ); 128 startTimer( 50 ); //FIXME: tweak
129 129
130 //testGraph(); 130 //testGraph();
131 131
132}; 132};
133 133
134 134
135void MGraphWindow::testGraph() 135void MGraphWindow::testGraph()
136{ 136{
137 static int i = 0; 137 static int i = 0;
138 spectrum->setValue( i++, 100 ); 138 spectrum->setValue( i++, 100 );
139 if ( i == 14 ) i = 0; 139 if ( i == 14 ) i = 0;
140 QTimer::singleShot( 2000, this, SLOT( testGraph() ) ); 140 QTimer::singleShot( 2000, this, SLOT( testGraph() ) );
141 141
142} 142}
143 143
144 144
145void MGraphWindow::timerEvent( QTimerEvent* e ) 145void MGraphWindow::timerEvent( QTimerEvent* e )
146{ 146{
147 for ( int i = 0; i < 14; i++ ) 147 for ( int i = 0; i < 14; i++ )
148 { 148 {
149 spectrum->decrease( i, 4 ); 149 spectrum->decrease( i, 1 ); //TODO: make this customizable?
150 } 150 }
151 spectrum->repaint(); 151 spectrum->repaint();
152} 152}
153 153
154 154
155void MGraphWindow::traffic( int channel, int signal ) 155void MGraphWindow::traffic( int channel, int signal )
156{ 156{
157 spectrum->setValue( channel-1, signal ); 157 spectrum->setValue( channel-1, signal );
158} 158}
159 159