RPCServer::RPCServer(int port){ QSettings settings; bool ok = false; while(!ok){ ok = listen(QHostAddress::Any, port); if(!ok && port < rpcMaxPort){ /* Try going for higher ports until we can listen to one */ qDebug("RPCServer: Failed to bind to port %d. Trying higher ports...",port); port++; }else{ qDebug("RPCServer: Listening on port %d",port); settings.setValue("RPCServer/serverPort",port); } } if(!ok){ qDebug("RPCServer: All ports exhausted. Binding failed."); return; } attachSlot(QString("reconstructionStarted()"),this,SLOT(reconstructionStarted(quint64))); attachSlot(QString("reconstructionStopped()"),this,SLOT(reconstructionStopped(quint64))); attachSlot(QString("identificationKeySent(int)"),this,SLOT(receiveIdentificationKey(quint64,int))); QObject::connect(this,SIGNAL(clientConnected(quint64)),this,SLOT(onClientConnected(quint64))); QObject::connect(this,SIGNAL(clientDisconnected(quint64)),this,SLOT(onClientDisconnected(quint64))); }
void SignalProxy::initClient() { attachSlot("__objectRenamed__", this, SLOT(objectRenamed(QByteArray, QString, QString))); }
AttachForm::AttachForm(QWidget *parent, const char *name, bool modal, Qt::WFlags f) : QDialog( parent, name, modal, f ), mNumSims(0), mLibReturnStatus(REG_SUCCESS), mSimGSHSelected(kNULL), mSimName(kNULL), mSimGSH(kNULL), mTable(kNULL), mFilterLineEdit(kNULL), mAttachButton(kNULL), mCancelButton(kNULL) { struct registry_contents content; int i, count; QString lString; bool ok; REG_DBGCON("AttachForm"); // set up arrays for ReG lib call // max list can be is REG_MAX_NUM_STEERED_SIM mSimName = new char *[REG_MAX_NUM_STEERED_SIM]; mSimGSH = new char *[REG_MAX_NUM_STEERED_SIM]; for (i=0; i<REG_MAX_NUM_STEERED_SIM; i++){ mSimName[i] = new char[REG_MAX_STRING_LENGTH + 1]; mSimGSH[i] = new char[REG_MAX_STRING_LENGTH + 1]; } SteererConfig *lConfig = ((SteererMainWindow *)parent)->getConfig(); // #ifdef REG_WSRF if( !(lConfig->mRegistrySecurity.passphrase[0]) ){ // Get the passphrase for the user's key if registry is using // SSL if( lConfig->mRegistrySecurity.use_ssl == REG_TRUE){ lString = QInputDialog::getText("RealityGrid Steerer", "Enter passphrase for X.509 key:", QLineEdit::Password, QString::null, &ok, this ); if ( !ok ) return; // Cancel if user didn't press OK } else{ lString = QInputDialog::getText("RealityGrid Steerer", "Enter passphrase for registry:", QLineEdit::Password, QString::null, &ok, this ); if ( !ok ) return; // Cancel if user didn't press OK } strncpy(lConfig->mRegistrySecurity.passphrase, lString.ascii(), REG_MAX_STRING_LENGTH); } // Now find out what's in the registry... //..._secure only available in steering library >= 2.0 mLibReturnStatus = Get_registry_entries_secure(lConfig->mTopLevelRegistry, &(lConfig->mRegistrySecurity), &content); // #else // mLibReturnStatus = Get_registry_entries((char *)(lConfig->mTopLevelRegistry.ascii()), // &content); // #endif // defined REG_WSRF if(mLibReturnStatus != REG_SUCCESS) return; count = 0; for (i=0; i<content.numEntries; i++){ if(!strcmp(content.entries[i].service_type, "SWS") || !strcmp(content.entries[i].service_type, "SGS")){ sprintf(mSimName[count], "%s %s %s", content.entries[i].application, content.entries[i].user, content.entries[i].start_date_time); sprintf(mSimGSH[count], "%s", content.entries[i].gsh); count++; } } Delete_registry_table(&content); mNumSims = count; // only continue if there is some info to show if(mNumSims>0) { this->setCaption( "Grid Attach" ); resize( 520, 350 ); // create the layouts for the form Q3VBoxLayout *lFormLayout = new Q3VBoxLayout(this, 10, 10, "attachformlayout"); Q3HBoxLayout *lFilterLayout = new Q3HBoxLayout(6, "filterlayout"); Q3VBoxLayout *lListLayout = new Q3VBoxLayout(6, "attachlistlayout"); Q3HBoxLayout *lButtonLayout = new Q3HBoxLayout(6, "attachbuttonlayout"); QSpacerItem* lSpacer = new QSpacerItem( 200, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); // create the list box for the applications on the grid lListLayout->addWidget(new TableLabel("Steerable Applications", this)); mTable = new Q3Table(0, 2, this); mTable->setSelectionMode( Q3Table::Single ); mTable->verticalHeader()->hide(); mTable->setLeftMargin(0); mTable->horizontalHeader()->setLabel(0, "Application"); mTable->horizontalHeader()->setLabel(1, "Handle"); connect(mTable, SIGNAL(valueChanged(int, int)), this, SLOT(editHandleSlot(int, int))); // populate the list box - each listboxitem holds array index // information - this is what is used by the calling code // (via aSimIndexSelected) to identify the aSimGSH selected for (int i=0; i<mNumSims; i++) { REG_DBGMSG1("mSimName ", mSimName[i]); REG_DBGMSG1("mSimGSH ", mSimGSH[i]); mTable->insertRows(mTable->numRows(),1); mTable->setItem(mTable->numRows()-1, 0, new Q3TableItem(mTable, Q3TableItem::Never, QString(mSimName[i]))); mTable->setItem(mTable->numRows()-1, 1, new Q3TableItem(mTable, Q3TableItem::WhenCurrent, QString(mSimGSH[i]))); } mTable->adjustColumn(0); mTable->adjustColumn(1); // We checked that mNumSims was > 0 earlier... mTable->selectRow(0); mFilterLineEdit = new QLineEdit(this, "containsfilter"); connect(mFilterLineEdit, SIGNAL(returnPressed()), this, SLOT(filterSlot())); // Initialize the filter with the user's username - might be handy mFilterLineEdit->setText(QString(getenv("USER"))); mFilterLineEdit->selectAll(); lFilterLayout->addWidget(new QLabel("Contains", this)); lFilterLayout->addWidget(mFilterLineEdit); lListLayout->addWidget(mTable); lListLayout->addLayout(lFilterLayout); mAttachButton = new QPushButton("Attach", this, "attachbutton"); mAttachButton->setMinimumSize(mAttachButton->sizeHint()); mAttachButton->setMaximumSize(mAttachButton->sizeHint()); mAttachButton->setAutoDefault(FALSE); QToolTip::add(mAttachButton, "Attach to selected application"); connect(mAttachButton, SIGNAL(clicked()), this, SLOT(attachSlot())); mCancelButton = new QPushButton("Cancel", this, "cancelbutton"); mCancelButton->setMinimumSize(mCancelButton->sizeHint()); mCancelButton->setMaximumSize(mCancelButton->sizeHint()); mCancelButton->setAutoDefault(FALSE); connect(mCancelButton, SIGNAL(clicked()), this, SLOT( reject())); lButtonLayout->addItem(lSpacer); lButtonLayout->addWidget(mCancelButton); lButtonLayout->addWidget(mAttachButton); lFormLayout->addLayout(lListLayout); lFormLayout->addLayout(lButtonLayout); }