void ClientWidget::loadEnv() { qList << "get_full_client_list" << "get_client_stats" << "get_client_account_list" << "check_if_owner_has_something" << "delete_owner" << "delete_account"; socket = new QuerySocket( this ); connect( socket, SIGNAL( canGetData() ), this, SLOT( chooseLoadData() ) ); connect( socket, SIGNAL( errorRaised() ), this, SLOT( loadError() ) ); connect( socket, SIGNAL( stateChanged( QAbstractSocket::SocketState ) ), this, SLOT( enableActions() ) ); sSocket = new QuerySocket( this ); connect( sSocket, SIGNAL( canGetData() ), this, SLOT( loadStats() ) ); connect( sSocket, SIGNAL( errorRaised() ), this, SLOT( loadError() ) ); connect( sSocket, SIGNAL( stateChanged( QAbstractSocket::SocketState ) ), this, SLOT( enableActions() ) ); }
AddClientDialog::AddClientDialog(QWidget *parent, Qt::WFlags flags) : QDialog(parent, flags) { setupUi(this); info = new ConnectionInfoWidget(this); gridLayout_3->addWidget(info, 1, 0, 1, 1); accountGroupBox->hide(); layout()->setSizeConstraint( QLayout::SetFixedSize ); currencyShortLabel->setText(tr("Code: ")); QRegExp regexp("[1-9][0-9][0-9]{1,1}"); numberLineEdit->setValidator(new QRegExpValidator(regexp, this)); connect( nameLineEdit, SIGNAL( textChanged(const QString &)), this, SLOT( enableOkButton() ) ); connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( okButton, SIGNAL( clicked() ), this, SLOT( okButtonClicked() ) ); connect( moreButton, SIGNAL( toggled(bool) ), this, SLOT( changeMoreButtonText() ) ); connect( moreButton, SIGNAL( toggled(bool) ), this, SLOT( moreButtonClicked() ) ); connect( currencyComboBox, SIGNAL( currentIndexChanged(int)), this, SLOT( changeShortLabelText() )); connect( numberLineEdit, SIGNAL( textChanged(const QString &) ), this, SLOT( enableOkButton() )); qList << "get_currency_list" << "create_client" << "create_client_with_account"; tcs = new ThreadControl( this ); connect( tcs, SIGNAL(canGetData()), this, SLOT(loadQuery())); connect( tcs, SIGNAL(errorRaised(QString)), this, SLOT(loadError(QString))); loadCurrencyRequest(); }
void AddCourseDialog::loadEnv() { qList << "get_currency_properties" << "create_course" << "create_sale_course_for_course"; tcs = new ThreadControl( this ); connect( tcs, SIGNAL( errorRaised(QString) ), this, SLOT( loadError(QString) ) ); connect( tcs, SIGNAL( canGetData() ), this, SLOT( loadQuery() ) ); }
void CoefficientDialog::loadEnv() { qList << "get_coefficient_page_info" << "get_account_coefficient_list" << "assign_deal_coefficient"; socket = new QuerySocket( this ); connect( socket, SIGNAL( errorRaised() ), this, SLOT( loadError() ) ); connect( socket, SIGNAL( canGetData() ), this, SLOT( loadQuery() ) ); }
void ContractorWidget::loadEnv() { qList << "get_full_contractor_list" << "get_contractor_account_list" << "delete_contractor"; socket = new QuerySocket( this ); connect( socket, SIGNAL( errorRaised() ), this, SLOT( loadError() ) ); connect( socket, SIGNAL( canGetData() ), this, SLOT( chooseQuery() ) ); }
void QuerySocket::setConnection(QString host, int port, QString str) { data = ""; dataList.clear(); error = ""; dataRead = false; query = str; connectToHost(QHostAddress::LocalHost, port); nextBlockSize = 0; if( autoRead ) return; if (!this->waitForConnected()) { error = this->errorString(); emit errorRaised(); return; } for(;;) { while (this->bytesAvailable() < (int)sizeof(qint64)) { if (!this->waitForReadyRead()) { error = this->errorString(); emit errorRaised(); return; } } quint64 blockSize; QDataStream in(this); in.setVersion(QDataStream::Qt_4_0); in >> blockSize; if( blockSize == 0xFFFF ) break; while (this->bytesAvailable() < blockSize) { if (!this->waitForReadyRead()) { error = this->errorString(); emit errorRaised(); return; } } QString str; in >> str; dataList << str; data = dataList.join( "\n" ); } error = ""; dataRead = true; emit canGetData(); }
void TransactionWidget::loadEnv() { qList << "get_account_header" << "get_account_statement"; qList << "clear_deal_coefficients" << "get_account_passive"; qList << "get_account_statement_for_the_date" << "get_account_statement_for_the_period"; qList << "get_account_saldo_info"; // << "get_account_initial_saldo"; tcs = new ThreadControl( this ); connect( tcs, SIGNAL( canGetData() ), this, SLOT( loadQuery() ) ); connect( tcs, SIGNAL( stateChanged( bool ) ), this, SLOT( enableActions( bool ) ) ); connect( tcs, SIGNAL( stateChanged( bool ) ), this, SLOT( changeState( bool ) ) ); }
AddCurrencyDialog::AddCurrencyDialog(QWidget *parent, Qt::WFlags flags) : QDialog(parent, flags) { setupUi(this); progressBar->hide(); QIcon okIcon(style()->standardPixmap(QStyle::SP_DialogApplyButton)); errorIcon = style()->standardPixmap(QStyle::SP_MessageBoxCritical); warningLabel->setPixmap( okIcon.pixmap( QSize(22,22) ) ); QRegExp regexp("^0{0,1}[0-9]{1,2}$"); debetLineEdit->setValidator(new QRegExpValidator(regexp, this)); creditLineEdit->setValidator(new QRegExpValidator(regexp, this)); unknownLineEdit->setValidator(new QRegExpValidator(regexp, this)); transitLineEdit->setValidator(new QRegExpValidator(regexp, this)); QRegExp regexp1("^1{1,1}0{1,1}[0-9]{3,3}$"); numberLineEdit->setValidator(new QRegExpValidator(regexp1, this)); connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( checkBox, SIGNAL( stateChanged(int) ), this, SLOT( enableNumberLineEdit() ) ); connect( checkBox, SIGNAL( stateChanged(int) ), this, SLOT( enableOkButton() ) ); QList<QLineEdit*> list = this->findChildren<QLineEdit *>(); for(int i = 0; i < list.count(); i++) connect( list[i], SIGNAL( textChanged( const QString &) ), this, SLOT( enableOkButton() ) ); connect( okButton, SIGNAL( clicked() ), this, SLOT( okClicked() ) ); socket.setConnection( host, port, "check_if_major_currency_exists(@result)"); progressBar->show(); connect( &socket, SIGNAL( canGetData() ), this, SLOT( checkData() ) ); connect( &socket, SIGNAL( errorRaised() ), this, SLOT( loadError() ) ); connect( &qSocket, SIGNAL( canGetData() ), this, SLOT( checkAnswer() ) ); connect( &qSocket, SIGNAL( errorRaised() ), this, SLOT( loadError() ) ); }
void EditAccountDialog::loadEnv() { QRegExp regexp("[1-9][0-9][0-9][0-9]{1,4}"); numberLineEdit->setValidator(new QRegExpValidator(regexp, this)); qList << "get_account_properties" << "update_account" << "change_account_owner"; tcs = new ThreadControl( this ); connect( tcs, SIGNAL( canGetData() ), this, SLOT( chooseQuery() ) ); connect( tcs, SIGNAL( errorRaised( const QString & ) ), this, SLOT( loadError( const QString & ) ) ); connect( tcs, SIGNAL( stateChanged( bool ) ), this, SLOT( stateChanged( bool ) ) ); connect( okButton, SIGNAL( clicked() ), this, SLOT( okButtonClicked() ) ); connect( ownerButton, SIGNAL( clicked() ), this, SLOT( showOwner() ) ); }
void CoefficientDialog::saveTransactionRequest( quint64 dealId, quint64 coefId ) { if( qList.count() < 3 ) return; QuerySocket *scket; if( socket->state() != QAbstractSocket::UnconnectedState ) { scket = new QuerySocket( this ); connect( socket, SIGNAL( errorRaised() ), this, SLOT( loadError() ) ); connect( socket, SIGNAL( canGetData() ), this, SLOT( loadQuery() ) ); } else scket = socket; QString query = qList[2] + "('" + QString::number( dealId ) + "', '" + QString::number( coefId ) + "')"; socket->setConnection( host, port, query ); info->showProgressBar( true ); }
void canMessageNotification(canBASE_t *node, uint32 messageBox) { /* enter user code between the USER CODE BEGIN and USER CODE END. */ /* USER CODE BEGIN (15) */ /* node 1 - transfer request */ uint8 tx_done = 0; if(node==canREG1) { tx_done=1; /* confirm transfer request */ } /* node 2 - receive complete */ unsigned char rec_frame[8] = { 0 }; if(node==canREG2) { while(!canIsRxMessageArrived(canREG2, canMESSAGE_BOX1)); canGetData(canREG2, canMESSAGE_BOX1, rec_frame); } /* USER CODE END */ }
void QuerySocket::readServer() { dataList.clear(); QDataStream in(this); in.setVersion( QDataStream::Qt_4_0 ); for(;;) { if( nextBlockSize == 0 ) { if( this->bytesAvailable() < sizeof( qint64 ) ) break; in >> nextBlockSize; } if( nextBlockSize == 0xFFFF ) { closeConnection(); break; } if( this->bytesAvailable() < nextBlockSize ) break; QString str; in >> str; dataList << str; nextBlockSize = 0; } data = dataList.join( "\n" ); error = ""; dataRead = true; emit canGetData(); }
void AddRuleDialog::loadEnv() { socket = new QuerySocket(this); connect( socket, SIGNAL( errorRaised() ), this, SLOT( loadError() ) ); connect( socket, SIGNAL( canGetData() ), this, SLOT( checkAnswer() ) ); }