Ksetiwatch API Documentation


sigmsg.cpp

Go to the documentation of this file.
00001 /***************************************************************************/
00015 #include <stdlib.h>
00016 
00017 #include <qlayout.h>
00018 #include <qarray.h>
00019 
00020 #include <ktextbrowser.h>
00021 
00022 #include "sigmsg.h"
00023 #include "gaussianplot.h"
00024 #include "pulseplot.h"
00025 #include "tripletplot.h"
00026 
00027 /*------------------------------------------------------------------------ */
00028 SigMsg::SigMsg(const SpikeScore& score, const QString& text,
00029                QWidget *parent, const char *name )
00030        : SigMsgTmpl(parent,name, false, WDestructiveClose)
00031 {
00032 setText(text);
00033 
00034 QArray<double> d(256);
00035 srand((unsigned int)(100000*score.power));
00036 
00037 for(int i=0; i<256; i++)
00038   {
00039   d[i] = (double)(100.0*rand()/(RAND_MAX+1.0));
00040   }
00041 int index = 16 + (int)((224.0*rand()/(RAND_MAX+1.0)));
00042 d[index] = 20.0*(score.power*131072.0)/(8.0*score.fft_len);
00043 
00044 SetiGraph* plot = new SetiGraph(0, false, false, this);
00045 plot->setBackgroundColor(black);
00046 plot->setMinimumSize(150,100);
00047 plot->showInfoText(false);
00048 plot->setCurve(d);
00049 SigMsgTmplLayout->addWidget(plot, 0, 0);
00050 }
00051 
00052 /*------------------------------------------------------------------------ */
00053 SigMsg::SigMsg(const GaussianScore& score, const QString& text,
00054                QWidget *parent, const char *name )
00055        : SigMsgTmpl(parent,name, false, WDestructiveClose)
00056 {
00057 setText(text);
00058 
00059 GaussianPlot* plot = new GaussianPlot(this);
00060 plot->showInfoText(false);
00061 plot->showNewGaussianData(score);
00062 SigMsgTmplLayout->addWidget(plot, 0, 0);
00063 }
00064 
00065 /*------------------------------------------------------------------------ */
00066 SigMsg::SigMsg(const PulseScore& score, const QString& text,
00067                QWidget *parent, const char *name )
00068        : SigMsgTmpl(parent,name, false, WDestructiveClose)
00069 {
00070 setText(text);
00071 
00072 PulsePlot* plot = new PulsePlot(this);
00073 plot->showInfoText(false);
00074 plot->showNewPulseData(score);
00075 SigMsgTmplLayout->addWidget(plot, 0, 0);
00076 }
00077 
00078 /*------------------------------------------------------------------------ */
00079 SigMsg::SigMsg(const TripletScore& score, const QString& text,
00080                QWidget *parent, const char *name )
00081        : SigMsgTmpl(parent,name, false, WDestructiveClose)
00082 {
00083 setText(text);
00084 
00085 TripletPlot* plot = new TripletPlot(this);
00086 plot->showInfoText(false);
00087 plot->showNewTripletData(score);
00088 SigMsgTmplLayout->addWidget(plot, 0, 0);
00089 }
00090 
00091 /*------------------------------------------------------------------------ */
00092 SigMsg::~SigMsg()
00093 {
00094 }
00095 
00096 /*------------------------------------------------------------------------ */
00097 void SigMsg::setText(const QString& text)
00098 {
00099 QFontMetrics fm(font());
00100 
00101 TextBox->setText(text);
00102 TextBox->setMinimumSize( 5*fm.width("012345meww"), 8*fm.lineSpacing() );
00103 }
00104 
00105 #include "sigmsg.moc"
KDE Logo
This file is part of the documentation for Ksetiwatch API Version 2.6.1.
Documentation copyright © 2000-2003 Gordon Machel.
Generated on Fri Jun 6 00:28:16 2003 by doxygen 1.2.18, written by Dimitri van Heesch, © 1997-2002