void MainForm::initTimerAndThread(){ // qDebug()<<"initTimerAndThread"<<endl; isPlay=false; playTimer=new QTimer; connect(playTimer, SIGNAL(timeout()), this, SLOT(playSound())); transcationCreate=new QTimer; connect(transcationCreate, SIGNAL(timeout()), this, SLOT(createTranstration())); pollTimer=new QTimer; connect(pollTimer, SIGNAL(timeout()), this, SLOT(pollForDataOnBus())); reqThread= new ModbusRequestThread; //transcationDone connect(reqThread,SIGNAL(transcationDone(Transcation*)),this,SLOT(transcationIsDone(Transcation*))); transitionIndex=0; }
MainWindow::MainWindow( QWidget * _parent ) : QMainWindow( _parent ), ui( new Ui::MainWindowClass ), m_modbus( NULL ) { ui->setupUi(this); connect( ui->serialSettingsWidget, SIGNAL(serialPortActive(bool)), this , SLOT(onSerialPortActive(bool))); connect( ui->tcpSettingsWidget, SIGNAL(tcpPortActive(bool)), this, SLOT(onTcpPortActive(bool))); connect( ui->slaveID, SIGNAL( valueChanged( int ) ), this, SLOT( updateRequestPreview() ) ); connect( ui->functionCode, SIGNAL( currentIndexChanged( int ) ), this, SLOT( updateRequestPreview() ) ); connect( ui->startAddr, SIGNAL( valueChanged( int ) ), this, SLOT( updateRequestPreview() ) ); connect( ui->numCoils, SIGNAL( valueChanged( int ) ), this, SLOT( updateRequestPreview() ) ); connect( ui->functionCode, SIGNAL( currentIndexChanged( int ) ), this, SLOT( updateRegisterView() ) ); connect( ui->numCoils, SIGNAL( valueChanged( int ) ), this, SLOT( updateRegisterView() ) ); connect( ui->startAddr, SIGNAL( valueChanged( int ) ), this, SLOT( updateRegisterView() ) ); connect( ui->sendBtn, SIGNAL( clicked() ), this, SLOT( sendModbusRequest() ) ); connect( ui->clearBusMonTable, SIGNAL( clicked() ), this, SLOT( clearBusMonTable() ) ); connect( ui->actionAbout_QModBus, SIGNAL( triggered() ), this, SLOT( aboutQModBus() ) ); connect( ui->functionCode, SIGNAL( currentIndexChanged( int ) ), this, SLOT( enableHexView() ) ); updateRegisterView(); updateRequestPreview(); enableHexView(); ui->regTable->setColumnWidth( 0, 150 ); m_statusInd = new QWidget; m_statusInd->setFixedSize( 16, 16 ); m_statusText = new QLabel; QTimer * t = new QTimer( this ); connect( t, SIGNAL(timeout()), this, SLOT(pollForDataOnBus())); t->start( 5 ); }