⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 channel.cpp

📁 软件无线电的平台
💻 CPP
字号:
/***************************************************************************                 channel.cpp  -  Shows one channel                            -------------------    begin                :  2003    authors              :  Linus Gasser    emails               :  linus.gasser@epfl.ch ***************************************************************************//***************************************************************************                                 Changes                                 ------- date - name - description 03/01/20 - ineiti - begin **************************************************************************//*************************************************************************** *                                                                         * *   This program is free software; you can redistribute it and/or modify  * *   it under the terms of the GNU General Public License as published by  * *   the Free Software Foundation; either version 2 of the License, or     * *   (at your option) any later version.                                   * *                                                                         * ***************************************************************************/#include <qframe.h>#include <qlayout.h>#include <qwidget.h>#include <qlabel.h>#include <qbuttongroup.h>#include <qwt_plot.h>#include "channel.h"#include "serverplug.h"Channel::Channel( QWidget *baseW, ServerPlug *s, int c ) :   QWidget( baseW ), server(s), channel(c) {  filterLen = server->getMaxFilterLength();  QVBoxLayout *vBox = new QVBoxLayout( this );  QGridLayout *gGrid = new QGridLayout( vBox, 2, 2 * filterLen + 1 );  gGrid->setMargin( 2 );    // Insert the QwtPlot  plot = new QwtPlot( this );  plot->setTitle( QString( "Channel %1" ).arg( channel ) );  channel_sig = plot->insertCurve( "Channel", QwtPlot::xBottom, QwtPlot::yRight );  plot->setAxisScale( QwtPlot::yRight, -1, 1 );  plot->enableAxis( QwtPlot::yRight, true );  plot->enableAxis( QwtPlot::yLeft, false );  plot->setGridYAxis( QwtPlot::yRight );  plot->setAxisScale( QwtPlot::xBottom, 0, filterLen - 1 );  plot->setCurveStyle( channel_sig, QwtCurve::Sticks );  plot->setCurveSymbol( channel_sig, QwtSymbol( QwtSymbol::Ellipse, 						QBrush( NoBrush ),						QPen( red, 2 ), QSize( 8, 8 ) ) );  plot->insertLineMarker( "", QwtPlot::yRight );  plot->setCurvePen( channel_sig, QPen( red, 2 ) );  gGrid->addMultiCellWidget( plot, 0, 0, 1, 2 * filterLen );  // And put in the taps  QHBoxLayout *hBox = new QHBoxLayout( vBox );  taps.clear();  for ( int i=0; i<filterLen; i++ ){    QString name;    TapSpinBox *tap = new TapSpinBox( -10, 10, 1, this );    tap->setValue( (!i) * 10 );    connect( tap, SIGNAL( valueChanged( int ) ), SLOT( valueChange( int ) ) );    gGrid->addMultiCellWidget( tap, 1, 1, 2*i, 2*i+1 );    taps.append( tap );  }  valueChange( 0 );  connect( this, SIGNAL( somethingChanged( int, QValueList<double>* ) ), 	   server, SLOT( setChannel( int, QValueList<double>* ) ) );}Channel::~Channel(){}void Channel::valueChange( int i ){  unsigned int t, len;  QValueList<double> *val = new QValueList<double>;  double *x, *y;  len = taps.count();  x = (double*)malloc( len * sizeof( double ) );  y = (double*)malloc( len * sizeof( double ) );  for ( t=0; t<len; t++ ){    x[t] = t;    y[t] = taps.at(t)->value() / 10.;    val->append( y[t] );  }  plot->setCurveData( channel_sig, x, y, len );  plot->replot();    free( x );  free( y );  emit somethingChanged( channel, val );}#if 0  // Initialise the graphical display  showDisp = new Show( blockList.at( block ), this );  showDisp->resize( 500, 300 );  showDisp->show();  showDisp->Update();  vBox.addWidget( showDisp );  // Add the two control-elements  QHBoxLayout hBox( &vBox, -1, "horizontal" );  qcbSPCs = new QComboBox( false, this, "SPC" );  fillSPCs();  connect( qcbSPCs, SIGNAL( activated(int) ), SLOT( newSPC(int) ) );  qcbBlocks = new QComboBox( false, this, "Port-#" );  fillBlocks();  connect( qcbBlocks, SIGNAL( activated(int) ), SLOT( newBlock(int) ) );  qcbType = new QComboBox( false, this, "Type:" );  qcbType->insertStringList( QStringList::split( ",", QString( "Complex,"							    "Real,"							    "Imaginary,"							    "Absolute" ) ) );  connect( qcbType, SIGNAL( activated(int) ), showDisp, SLOT( ShowSig(int) ) );  hBox.addWidget( qcbSPCs, 1, 0 );  hBox.addWidget( qcbBlocks, 1, 0 );  hBox.addWidget( qcbType, 1, 0 );#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -