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

📄 confwind.cpp

📁 This a framework to test new ideas in transmission technology. Actual development is a LDPC-coder in
💻 CPP
字号:
/*******************************************************************************//*  Project:        SOFTWARE RADIO - LCM Laboratoire de Communications Mobiles *//*  -------------------------------------------------------------------------- *//*  Filename:       confWind.cpp                                               *//*  Description:    The window to change the configuration of the software     *//*                  radio.                                                    *//*  -------------------------------------------------------------------------- *//*  Date:           April 16 2003                                              *//*  Version:        v1.0                                                       *//*  Author:         Porchet Vincent                                            *//*                  Computer Science (6th semester) - EPFL                *//*******************************************************************************//* Changelog: * 04/03/03 - ineiti - added DOUBLE_COMPLEX *//*******************************************************************************//*  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 <qlabel.h>#include <qlayout.h>#include <qspinbox.h>#include <qlineedit.h>#include <qobject.h>#include <iostream>#include <qstringlist.h>#include "defines.h"#include "confwind.h"#include "config.h"#include "parameter_types.h"#include "parameters.h"#include "global.h"using namespace std;ConfWind::ConfWind( Module *module ) : QMainWindow( 0, 0, WType_Dialog ) {  QWidget * configW = new QWidget( this );  this->setCentralWidget( configW );  int count = module->configList.count();  QGridLayout *configGrid = new QGridLayout( configW, 1, 2 );  int row = 0;  for ( int i = 0;i < count;i++ ) { // each config    Config *config = module->configList.at( i );    if ( !config->isShown() ){      continue;    }    // Put his name    QLabel* label = new QLabel( config->getName(),                                configW );    configGrid->addWidget( label, row, 0 );    // put the input "box" and initialize    int type = config->getConfigType();    QString val = config ->getValue();    bool ok = FALSE;    int value;    QSpinBox *intBox;    QLineEdit *box ;    ComplexLineEdit *cle;    switch ( type ) {    case INT:      intBox = new QSpinBox( -( 1 << 30 ), ( 1 << 30 ), 1, configW );      value = val.toInt( &ok );      if ( ok ) {        intBox->setValue( value );      } else {        cout << "error in confwind : couldn't extract init value (int).\n";      }      configGrid->addWidget( intBox, row, 1 );      connect( intBox, SIGNAL( valueChanged ( int ) ),               config, SLOT( slotValueChanged( int ) ) );      break;    case DOUBLE:      box = new QLineEdit( config 			   ->getValue().stripWhiteSpace(), configW );      configGrid->addWidget( box, row, 1 );      connect( box, SIGNAL( textChanged ( const QString & ) ),               config, SLOT( slotTextChanged( const QString & ) ) );      break;    case STRING128:      box = new QLineEdit( config->getValue(), configW );      configGrid->addWidget( box, row, 1 );      connect( box, SIGNAL( textChanged ( const QString & ) ),               config, SLOT( slotTextChanged( const QString & ) ) );      break;    case COMPLEX:      // A bit more complex, as we have two values. We put them in our      // private-section under real and imag, and then we connect the      // real and imag LineEdit box to slotComplex(Real|Imag), which in      // turn call config->slotTextChanged      cle = new ComplexLineEdit( configW, config );      configGrid->addLayout( cle, row, 1 );      break;    case DOUBLE_COMPLEX:      // Like COMPLEX, but with doubles      cle = new ComplexLineEdit( configW, config );      configGrid->addLayout( cle, row, 1 );      break;    default:      //affiche rien      break;    } //end input box and initialize    row++;  } // end for each config}ComplexLineEdit::ComplexLineEdit( QWidget *p, Config *c ) :   QHBoxLayout( ), config(c){  // Get the real and imaginary part    //  cout << "config->getVal: " << config->getValue() << endl;  QStringList comp( QStringList::split( "/", config->getValue() ) );  real = comp[0];  imag = comp[1];  // Create the two boxes and put them into our layout  QLineEdit *box = new QLineEdit( real, p );  addWidget( box );  connect( box, SIGNAL( textChanged( const QString & ) ), 	   SLOT( slotReal( const QString & ) ) );  box = new QLineEdit( imag, p );  addWidget( box );  connect( box, SIGNAL( textChanged( const QString & ) ), 	   SLOT( slotImag( const QString & ) ) );}void ComplexLineEdit::slotReal( const QString &s ){  real = s;  config->slotTextChanged( QString( real ).append( "/" ).append( imag ) );}void ComplexLineEdit::slotImag( const QString &s ){  imag = s;  config->slotTextChanged( QString( real ).append( "/" ).append( imag ) );}

⌨️ 快捷键说明

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