/* * 1 - if request is not submitted since local server can handle it * 0 - if request is submitted successfully * -1 - in case of error submitting request * - out of memory * - invalid arguments * - other system limitations */ int clusterMapGet(clusterMap_t clusterMap, void* luaContext, void* keyContext, char* server, char* key ) { clusterMapImpl_t* pCM = CLUSTER_MAP(clusterMap); request_t* newRequest = 0; externalServer_t* pEServer = 0; int returnValue = 0; IfTrue(pCM && server && key && luaContext, ERR, "Null argument found"); newRequest = createRequest(key, luaContext, keyContext); IfTrue(newRequest, ERR, "Error allocting memory for new request"); pEServer = mapGetElement(pCM->serverMap, server); if (!pEServer) { pEServer = externalServerCreate(server, pCM); IfTrue(pEServer, ERR, "Error creating server entry for server %s", server); mapPutElement(pCM->serverMap, server, pEServer); } externalServerSubmit(pEServer, newRequest); goto OnSuccess; OnError: if (newRequest) { deleteRequest(newRequest); newRequest = 0; } returnValue = -1; OnSuccess: return returnValue; }
void BedCorrelationItemView::slotDelete() { QModelIndexList selected = selectedIndexes(); if (selected.isEmpty()) { return; } QStringList names; for (QModelIndexList::iterator it = selected.begin(); it != selected.end(); it++) { BedCorrelationItem* itm = (BedCorrelationItem*) ((BedCorrelationItemModel*) model())->itemFromIndex(*it); if (itm) { names << tr("Name: %1, ID: %2") .arg(itm->getBedCorrelation()->getName()) .arg(itm->getBedCorrelation()->getId()); } } if (QMessageBox::Yes == QMessageBox::warning(this, tr("Really Delete?"), tr("Really delete this BedCorrelations?\n%1") .arg(names.join(", ")), QMessageBox::Yes | QMessageBox::No)) { emit deleteRequest(selected); } }
void sendCallback(int fd, short eventType, void* args) { struct worker* worker = args; struct timeval timestamp, timediff, timeadd; gettimeofday(×tamp, NULL); timersub(×tamp, &(worker->last_write_time), &timediff); double diff = timediff.tv_usec * 1e-6 + timediff.tv_sec; struct int_dist* interarrival_dist = worker->config->interarrival_dist; int interarrival_time = 0; //Null interarrival_dist means no waiting if(interarrival_dist != NULL){ if(worker->interarrival_time <= 0){ interarrival_time = getIntQuantile(interarrival_dist); //In microseconds // printf("new interarrival_time %d\n", interarrival_time); worker->interarrival_time = interarrival_time; } else { interarrival_time = worker->interarrival_time; } if( interarrival_time/1.0e6 > diff){ return; } } worker->interarrival_time = -1; timeadd.tv_sec = 0; timeadd.tv_usec = interarrival_time; timeradd(&(worker->last_write_time), &timeadd, &(worker->last_write_time)); struct request* request = NULL; if(worker->incr_fix_queue_tail != worker->incr_fix_queue_head) { request = worker->incr_fix_queue[worker->incr_fix_queue_head]; worker->incr_fix_queue_head = (worker->incr_fix_queue_head + 1) % INCR_FIX_QUEUE_SIZE; // printf("fixing\n"); } else { // printf(")preload %d warmup key %d\n", worker->config->pre_load, worker->warmup_key); if(worker->config->pre_load == 1 && worker->warmup_key < 0) { return; } else { request = generateRequest(worker->config, worker); } } if(request->header.opcode == OP_SET){ // printf("Generated SET request of size %d\n", request->value_size); } if( !pushRequest(worker, request) ) { //Queue is full, bail // printf("Full queue\n"); deleteRequest(request); return; } sendRequest(request); }//End sendCallback()
void AdminMainWidget::populateList(const QVector<LinQedInUser>& results) const{ users->clear(); int height=0; foreach(LinQedInUser user,results){ QListWidgetItem* item=new QListWidgetItem; BasicUserViewer* buv=new BasicUserViewer(user,dynamic_cast<QWidget*>(parent())); connect(buv,SIGNAL(deleteRequest(QString)),this,SLOT(deleteUser(QString))); connect(buv,SIGNAL(changePlanRequest(const QString&,int)),this,SLOT(changePlan(const QString&,int))); item->setSizeHint(buv->size()); buv->setStyleSheet("BasicUserViewer{border-bottom:2px solid black;}"); users->addItem(item); users->setItemWidget(item,buv); height+=buv->height(); }//foreach
/** * creates a request object which encapsulates all the information * necessary for making a request */ static request_t* createRequest(char* virtualKey, void* luaContext, void* keyContext) { request_t* pRequest = ALLOCATE_1(request_t); IfTrue(pRequest, ERR, "Error allocating memory"); pRequest->key = strdup(virtualKey); IfTrue(pRequest->key, ERR, "Error copying key"); pRequest->luaContext = luaContext; pRequest->keyContext = keyContext; goto OnSuccess; OnError: if (pRequest) { deleteRequest(pRequest); pRequest = 0; } OnSuccess: return pRequest; }
ColorView::ColorView(QWidget* p, ColorItemModel* model) : TreeView(p), _project(0) { setModel(model); connect(model, SIGNAL(reloaded()), this, SLOT(slotReloaded())); setContextMenuPolicy(Qt::CustomContextMenu); connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(slotCustomContextMenuRequested(const QPoint&))); connect(static_cast<ProfileLogger*> (QApplication::instance()), SIGNAL(currentProjectChanged(Project*)), this, SLOT(slotCurrentProjectChanged(Project*))); connect(this, SIGNAL(activated(const QModelIndex&)), this, SLOT(slotIndexActivated(const QModelIndex&))); connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(slotIndexActivated(const QModelIndex&))); connect(this, SIGNAL(reloadRequest()), model, SLOT(reload())); connect(model, SIGNAL(selectItemRequest(const QModelIndex&)), this, SLOT(slotSelectItemRequested(const QModelIndex&))); connect(this, SIGNAL(editRequest(const QModelIndex&)), model, SLOT(slotEditRequested(const QModelIndex&))); connect(this, SIGNAL(deleteRequest(QModelIndexList)), model, SLOT(slotDeleteRequested(QModelIndexList))); }
static void connectionContextDelete(connectionContext_t* pContext, int move) { if (pContext) { externalServer_t* pServer = pContext->pExternalServer; clusterMapImpl_t* pCMap = pServer->pClusterMap; request_t* pRequest = 0; LOG(DEBUG, "deleting connection context"); while ((pRequest = listRemoveLast(pContext->currentRequests)) != 0) { if (move) { //move the existing requests to another socket listAddFirst(pServer->unassignedRequests, pRequest); }else { //report error pCMap->resultHandler(pRequest->luaContext, pRequest->keyContext, -1, NULL); deleteRequest(pRequest); } } if (pContext->connection) { connectionClose(pContext->connection); } if (pContext->readStream) { dataStreamDelete(pContext->readStream); pContext->readStream = 0; } if (pContext->writeStream) { dataStreamDelete(pContext->writeStream); pContext->writeStream = 0; } if (pContext->parser) { responseParserDelete(pContext->parser); pContext->parser = 0; } if (pContext->currentRequests) { listFree(pContext->currentRequests); pContext->currentRequests = 0; } if (pContext->fallocator) { fallocatorDelete(pContext->fallocator); } FREE(pContext); } }
BedCorrelationItemView::BedCorrelationItemView(QWidget* p, BedCorrelationItemModel* model) : TreeView(p), _profileCorrelation(0) { // setSortingEnabled(true); setEnabled(false); setModel(model); connect(model, SIGNAL(reloaded()), this, SLOT(slotReloaded())); setContextMenuPolicy(Qt::CustomContextMenu); connect(this, SIGNAL(activated(const QModelIndex&)), this, SLOT(slotIndexActivated(const QModelIndex&))); connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(slotIndexActivated(const QModelIndex&))); connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(slotCustomContextMenuRequested(const QPoint&))); connect(this, SIGNAL(reloadRequest()), model, SLOT(reload())); connect(this, SIGNAL(createBedCorrelationRequest()), model, SLOT(slotCreate())); connect(this, SIGNAL(editRequest(const QModelIndex&)), model, SLOT(slotEdit(const QModelIndex&))); connect(this, SIGNAL(deleteRequest(QModelIndexList)), model, SLOT(slotDelete(QModelIndexList))); }
void ColorView::slotDelete() { QModelIndexList selected = selectedIndexes(); QStringList names; for (QModelIndexList::iterator it = selected.begin(); it != selected.end(); it++) { ColorItem* itm = (ColorItem*) ((ColorItemModel*) model())->itemFromIndex(*it); if (itm) { names << itm->getColor()->getName(); } } if (QMessageBox::Yes == QMessageBox::warning(this, tr("Really Delete?"), tr("Really delete this Datasets?\n%1") .arg(names.join(", ")), QMessageBox::Yes | QMessageBox::No)) { emit deleteRequest(selected); } }
void Request::replyFinished() { if (clock.isValid()) { setDuration(clock.elapsed()); clock.invalidate(); // initialize to get new request replyNumber++; appendLog(QString("%1: REPLY %2 FINISHED"+CRLF).arg(QDateTime::currentDateTime().toString("dd MMM yyyy hh:mm:ss,zzz")).arg(replyNumber)); replyInProgress = false; m_header.append(QString("%1 **************************"+CRLF).arg(replyNumber)); emit itemChanged(QVector<int>(1, headerRole)); m_params.clear(); appendAnswer(QString("%1 **************************"+CRLF).arg(replyNumber)); } else { appendLog(QString("%1: Reply finished but not yet started"+CRLF).arg(QDateTime::currentDateTime().toString("dd MMM yyyy hh:mm:ss,zzz"))); } if (m_networkStatus == "disconnected" && m_status == "OK") emit deleteRequest(this); }
void receiveCallback(int fd, short eventType, void* args) { struct worker* worker = args; struct request* request = getNextRequest(worker); if(request == NULL) { printf("Error: Tried to get a null request\n"); return; } struct timeval readTimestamp, timediff; gettimeofday(&readTimestamp, NULL); timersub(&readTimestamp, &(request->send_time), &timediff); double diff = timediff.tv_usec * 1e-6 + timediff.tv_sec; receiveResponse(request, diff); deleteRequest(request); worker->received_warmup_keys++; if(worker->config->pre_load == 1 && worker->config->dep_dist != NULL && worker->received_warmup_keys == worker->config->keysToPreload){ printf("You are warmed up, sir\n"); exit(0); } }//End receiveCallback()
Status WriteCmd::explain(OperationContext* txn, const std::string& dbname, const BSONObj& cmdObj, ExplainCommon::Verbosity verbosity, BSONObjBuilder* out) const { // For now we only explain update and delete write commands. if ( BatchedCommandRequest::BatchType_Update != _writeType && BatchedCommandRequest::BatchType_Delete != _writeType ) { return Status( ErrorCodes::IllegalOperation, "Only update and delete write ops can be explained" ); } // Parse the batch request. BatchedCommandRequest request( _writeType ); std::string errMsg; if ( !request.parseBSON( cmdObj, &errMsg ) || !request.isValid( &errMsg ) ) { return Status( ErrorCodes::FailedToParse, errMsg ); } // Note that this is a runCommmand, and therefore, the database and the collection name // are in different parts of the grammar for the command. But it's more convenient to // work with a NamespaceString. We built it here and replace it in the parsed command. // Internally, everything work with the namespace string as opposed to just the // collection name. NamespaceString nsString(dbname, request.getNS()); request.setNS(nsString.ns()); // Do the validation of the batch that is shared with non-explained write batches. Status isValid = WriteBatchExecutor::validateBatch( request ); if (!isValid.isOK()) { return isValid; } // Explain must do one additional piece of validation: For now we only explain // singleton batches. if ( request.sizeWriteOps() != 1u ) { return Status( ErrorCodes::InvalidLength, "explained write batches must be of size 1" ); } // Get a reference to the singleton batch item (it's the 0th item in the batch). BatchItemRef batchItem( &request, 0 ); if ( BatchedCommandRequest::BatchType_Update == _writeType ) { // Create the update request. UpdateRequest updateRequest( txn, nsString ); updateRequest.setQuery( batchItem.getUpdate()->getQuery() ); updateRequest.setUpdates( batchItem.getUpdate()->getUpdateExpr() ); updateRequest.setMulti( batchItem.getUpdate()->getMulti() ); updateRequest.setUpsert( batchItem.getUpdate()->getUpsert() ); updateRequest.setUpdateOpLog( true ); UpdateLifecycleImpl updateLifecycle( true, updateRequest.getNamespaceString() ); updateRequest.setLifecycle( &updateLifecycle ); updateRequest.setExplain(); // Explained updates can yield. updateRequest.setYieldPolicy(PlanExecutor::YIELD_AUTO); // Use the request to create an UpdateExecutor, and from it extract the // plan tree which will be used to execute this update. UpdateExecutor updateExecutor( &updateRequest, &txn->getCurOp()->debug() ); Status prepStatus = updateExecutor.prepare(); if ( !prepStatus.isOK() ) { return prepStatus; } // Explains of write commands are read-only, but we take an exclusive lock so // that timing info is more accurate. Lock::DBLock dlk(txn->lockState(), nsString.db(), MODE_IX); Client::Context ctx(txn, nsString); Status prepInLockStatus = updateExecutor.prepareInLock(ctx.db()); if ( !prepInLockStatus.isOK() ) { return prepInLockStatus; } // Executor registration and yield policy is handled internally by the update executor. PlanExecutor* exec = updateExecutor.getPlanExecutor(); // Explain the plan tree. return Explain::explainStages( exec, verbosity, out ); } else { invariant( BatchedCommandRequest::BatchType_Delete == _writeType ); // Create the delete request. DeleteRequest deleteRequest( txn, nsString ); deleteRequest.setQuery( batchItem.getDelete()->getQuery() ); deleteRequest.setMulti( batchItem.getDelete()->getLimit() != 1 ); deleteRequest.setUpdateOpLog(true); deleteRequest.setGod( false ); deleteRequest.setExplain(); // Explained deletes can yield. deleteRequest.setYieldPolicy(PlanExecutor::YIELD_AUTO); // Use the request to create a DeleteExecutor, and from it extract the // plan tree which will be used to execute this update. DeleteExecutor deleteExecutor( &deleteRequest ); Status prepStatus = deleteExecutor.prepare(); if ( !prepStatus.isOK() ) { return prepStatus; } // Explains of write commands are read-only, but we take a write lock so that timing // info is more accurate. Lock::DBLock dlk(txn->lockState(), nsString.db(), MODE_IX); Client::Context ctx(txn, nsString); Status prepInLockStatus = deleteExecutor.prepareInLock(ctx.db()); if ( !prepInLockStatus.isOK()) { return prepInLockStatus; } // Executor registration and yield policy is handled internally by the delete executor. PlanExecutor* exec = deleteExecutor.getPlanExecutor(); // Explain the plan tree. return Explain::explainStages( exec, verbosity, out ); } }
static void readAvailableImpl(connection_t connection){ connectionContext_t* pCContext = connectionGetContext(connection); u_int32_t bytesRead = 0; int returnValue = 0; LOG(DEBUG, "got something to read on socket"); //if it is one of the pooled connections if (pCContext->status == status_pooled) { LOG(DEBUG, "socket was pooled..closing on read"); //socket is closed externalServer_t* pServer = pCContext->pExternalServer; listRemove(pServer->freeConnections, pCContext); connectionContextDelete(pCContext, 0); goto OnSuccess; } if (pCContext->status == status_waiting_read) { pCContext->status = status_active; }else { LOG(ERR, "Invalid connection state"); goto OnError; } returnValue = connectionRead(pCContext->connection, pCContext->fallocator, pCContext->readStream, 8 * 1024 , &bytesRead); LOG(DEBUG, "connection read status %d bytesRead %d", returnValue, bytesRead); IfTrue(returnValue >= 0, INFO, "Socket closed"); doParseMore: returnValue = responseParserParse(pCContext->parser, pCContext->readStream); LOG(DEBUG, "response parser status %d", returnValue); IfTrue(returnValue >= 0, INFO, "Parsing Error %d", returnValue); if (returnValue == 1) { LOG(DEBUG, "need to wait for read"); pCContext->status = status_waiting_read; connectionWaitForRead(pCContext->connection, getGlobalEventBase()); goto OnSuccess; } char* key = 0; dataStream_t value = 0; u_int32_t flags = 0; returnValue = responseParserGetResponse(pCContext->parser, pCContext->readStream, &key, &value, &flags); LOG(DEBUG, "got resposonse %d key %s", returnValue, key); if (returnValue == 0) { externalServer_t* pServer = pCContext->pExternalServer; clusterMapImpl_t* pCM = pServer->pClusterMap; request_t* pRequest = 0; tryNext: pRequest = listRemoveFirst(pCContext->currentRequests); if (pRequest) { if (0 == strcmp(pRequest->key, key)) { //we got the response for the key LOG(DEBUG, "giving callback for success result"); pCM->resultHandler(pRequest->luaContext, pRequest->keyContext, 0, value); dataStreamDelete(value); value = 0; fallocatorFree(pCContext->fallocator, key); key = 0; deleteRequest(pRequest); pRequest = 0; goto doParseMore; }else { //this key is different from the key we expected //the request for current key failed, so notify LOG(DEBUG, "giving callback for fail result"); pCM->resultHandler(pRequest->luaContext, pRequest->keyContext, -1, NULL); deleteRequest(pRequest); pRequest = 0; //move on to the next key, may be its her response goto tryNext; } }else { // no more request in the currentRequests list? // what this means is that we got a response for a key // which we didn't asked for... // that is strange.., some server issue..we can't do much dataStreamDelete(value); value = 0; fallocatorFree(pCContext->fallocator, key); key = 0; // now so just close this connection externalServer_t* pServer = pCContext->pExternalServer; listRemove(pServer->activeConnections, pCContext); connectionContextDelete(pCContext, 0); pCContext = 0; } }else { LOG(DEBUG, "end of results from response parser"); // we go END response from parser externalServer_t* pServer = pCContext->pExternalServer; clusterMapImpl_t* pCM = pServer->pClusterMap; request_t* pRequest = 0; //anything pending in the currentRequests..not found while ((pRequest = listRemoveLast(pCContext->currentRequests)) != 0) { //report error pCM->resultHandler(pRequest->luaContext, pRequest->keyContext, -1, NULL); deleteRequest(pRequest); } // add this connections to free connections list listRemove(pServer->activeConnections, pCContext); connectionSubmitRequests(pServer, pCContext); } goto OnSuccess; OnError: if (pCContext) { externalServer_t* pServer = pCContext->pExternalServer; listRemove(pServer->activeConnections, pCContext); connectionContextDelete(pCContext, 1); pCContext = 0; } OnSuccess: return; }
void SM_Delete::item(const SM_Items::Data &source) { queries.setRawHeader(SM_SettingsManager().accessToken(), request); deleteRequest(queries.constructDeleteFileUrl(source.self)); }
ZoneViewlet::ZoneViewlet(QMainWindow *mainWindow, QObject *parent): QObject(parent) { // Initialize zones menu and associated actions zonesMenu = synthclone::getChild<QMenu>(mainWindow, "zonesMenu"); applyEffectsAction = synthclone::getChild<QAction> (mainWindow, "applyEffectsZonesAction"); connect(applyEffectsAction, SIGNAL(triggered()), SIGNAL(applyEffectsRequest())); buildTargetsAction = synthclone::getChild<QAction> (mainWindow, "buildTargetsAction"); connect(buildTargetsAction, SIGNAL(triggered()), SIGNAL(buildTargetsRequest())); clearEffectJobsAction = synthclone::getChild<QAction> (mainWindow, "clearEffectJobsAction"); connect(clearEffectJobsAction, SIGNAL(triggered()), SIGNAL(clearEffectJobsRequest())); clearSamplerJobsAction = synthclone::getChild<QAction> (mainWindow, "clearSamplerJobsAction"); connect(clearSamplerJobsAction, SIGNAL(triggered()), SIGNAL(clearSamplerJobsRequest())); clearSamplerJobsButton = synthclone::getChild<QPushButton> (mainWindow, "clearSamplerJobsButton"); connect(clearSamplerJobsButton, SIGNAL(clicked()), SIGNAL(clearSamplerJobsRequest())); clearSelectionAction = synthclone::getChild<QAction> (mainWindow, "clearZonesSelectionAction"); connect(clearSelectionAction, SIGNAL(triggered()), SIGNAL(clearSelectionRequest())); copyAction = synthclone::getChild<QAction>(mainWindow, "copyZonesAction"); connect(copyAction, SIGNAL(triggered()), SIGNAL(copyRequest())); cutAction = synthclone::getChild<QAction>(mainWindow, "cutZonesAction"); connect(cutAction, SIGNAL(triggered()), SIGNAL(cutRequest())); deleteAction = synthclone::getChild<QAction> (mainWindow, "deleteZonesAction"); connect(deleteAction, SIGNAL(triggered()), SIGNAL(deleteRequest())); insertAction = synthclone::getChild<QAction> (mainWindow, "insertZoneAction"); connect(insertAction, SIGNAL(triggered()), SIGNAL(insertRequest())); invertSelectionAction = synthclone::getChild<QAction> (mainWindow, "invertZoneSelectionAction"); connect(invertSelectionAction, SIGNAL(triggered()), SIGNAL(invertSelectionRequest())); pasteAction = synthclone::getChild<QAction>(mainWindow, "pasteZonesAction"); connect(pasteAction, SIGNAL(triggered()), SIGNAL(pasteRequest())); playDrySampleAction = synthclone::getChild<QAction> (mainWindow, "playDrySampleZonesAction"); connect(playDrySampleAction, SIGNAL(triggered()), SIGNAL(playDrySampleRequest())); playWetSampleAction = synthclone::getChild<QAction>(mainWindow, "playWetSampleZonesAction"); connect(playWetSampleAction, SIGNAL(triggered()), SIGNAL(playWetSampleRequest())); removeEffectJobAction = synthclone::getChild<QAction>(mainWindow, "removeEffectJobZonesAction"); connect(removeEffectJobAction, SIGNAL(triggered()), SIGNAL(removeEffectJobRequest())); removeSamplerJobAction = synthclone::getChild<QAction> (mainWindow, "removeSamplerJobZonesAction"); connect(removeSamplerJobAction, SIGNAL(triggered()), SIGNAL(removeSamplerJobRequest())); sampleAction = synthclone::getChild<QAction> (mainWindow, "getSampleZonesAction"); connect(sampleAction, SIGNAL(triggered()), SIGNAL(sampleRequest())); selectAllAction = synthclone::getChild<QAction> (mainWindow, "selectAllZonesAction"); connect(selectAllAction, SIGNAL(triggered()), SIGNAL(selectAllRequest())); initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_AFTERTOUCH, "aftertouchColumnShowAction"); initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_CHANNEL, "channelColumnShowAction"); initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_CHANNEL_PRESSURE, "channelPressureColumnShowAction"); initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_DRY_SAMPLE, "drySampleColumnShowAction"); initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_NOTE, "noteColumnShowAction"); initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_RELEASE_TIME, "releaseTimeColumnShowAction"); initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_SAMPLE_TIME, "sampleTimeColumnShowAction"); initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_STATUS, "statusColumnShowAction"); initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_VELOCITY, "velocityColumnShowAction"); initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_WET_SAMPLE, "wetSampleColumnShowAction"); initializeControlColumnShowActions("controlColumnsMenu1", 0, 0x10); initializeControlColumnShowActions("controlColumnsMenu2", 0x10, 0x20); initializeControlColumnShowActions("controlColumnsMenu3", 0x20, 0x30); initializeControlColumnShowActions("controlColumnsMenu4", 0x30, 0x40); initializeControlColumnShowActions("controlColumnsMenu5", 0x40, 0x50); initializeControlColumnShowActions("controlColumnsMenu6", 0x50, 0x60); initializeControlColumnShowActions("controlColumnsMenu7", 0x60, 0x70); initializeControlColumnShowActions("controlColumnsMenu8", 0x70, 0x80); menuViewlet = new MenuViewlet(zonesMenu); // Setup zones table view connect(&tableDelegate, SIGNAL(aftertouchChangeRequest(int, synthclone::MIDIData)), SIGNAL(aftertouchChangeRequest(int, synthclone::MIDIData))); connect(&tableDelegate, SIGNAL(channelChangeRequest(int, synthclone::MIDIData)), SIGNAL(channelChangeRequest(int, synthclone::MIDIData))); connect(&tableDelegate, SIGNAL(channelPressureChangeRequest(int, synthclone::MIDIData)), SIGNAL(channelPressureChangeRequest(int, synthclone::MIDIData))); connect(&tableDelegate, SIGNAL(controlValueChangeRequest(int, synthclone::MIDIData, synthclone::MIDIData)), SIGNAL(controlValueChangeRequest(int, synthclone::MIDIData, synthclone::MIDIData))); connect(&tableDelegate, SIGNAL(noteChangeRequest(int, synthclone::MIDIData)), SIGNAL(noteChangeRequest(int, synthclone::MIDIData))); connect(&tableDelegate, SIGNAL(releaseTimeChangeRequest(int, synthclone::SampleTime)), SIGNAL(releaseTimeChangeRequest(int, synthclone::SampleTime))); connect(&tableDelegate, SIGNAL(sampleTimeChangeRequest(int, synthclone::SampleTime)), SIGNAL(sampleTimeChangeRequest(int, synthclone::SampleTime))); connect(&tableDelegate, SIGNAL(velocityChangeRequest(int, synthclone::MIDIData)), SIGNAL(velocityChangeRequest(int, synthclone::MIDIData))); itemPrototype = new StandardItem(); connect(&tableModel, SIGNAL(sortRequest(int, bool)), SLOT(handleSortRequest(int, bool))); tableModel.setColumnCount(ZONETABLECOLUMN_BASE_TOTAL); tableModel.setRowCount(0); tableModel.setItemPrototype(itemPrototype); tableModel.setHeaderData(ZONETABLECOLUMN_AFTERTOUCH, Qt::Horizontal, tr("Aftertouch"), Qt::DisplayRole); tableModel.setHeaderData(ZONETABLECOLUMN_CHANNEL, Qt::Horizontal, tr("Channel"), Qt::DisplayRole); tableModel.setHeaderData(ZONETABLECOLUMN_CHANNEL_PRESSURE, Qt::Horizontal, tr("Channel Pressure"), Qt::DisplayRole); tableModel.setHeaderData(ZONETABLECOLUMN_DRY_SAMPLE, Qt::Horizontal, tr("Dry Sample"), Qt::DisplayRole); tableModel.setHeaderData(ZONETABLECOLUMN_NOTE, Qt::Horizontal, tr("Note"), Qt::DisplayRole); tableModel.setHeaderData(ZONETABLECOLUMN_RELEASE_TIME, Qt::Horizontal, tr("Release Time"), Qt::DisplayRole); tableModel.setHeaderData(ZONETABLECOLUMN_SAMPLE_TIME, Qt::Horizontal, tr("Sample Time"), Qt::DisplayRole); tableModel.setHeaderData(ZONETABLECOLUMN_STATUS, Qt::Horizontal, tr("Status"), Qt::DisplayRole); tableModel.setHeaderData(ZONETABLECOLUMN_VELOCITY, Qt::Horizontal, tr("Velocity"), Qt::DisplayRole); tableModel.setHeaderData(ZONETABLECOLUMN_WET_SAMPLE, Qt::Horizontal, tr("Wet Sample"), Qt::DisplayRole); for (synthclone::MIDIData i = 0; i < 0x80; i++) { int column = ZONETABLECOLUMN_CONTROL_0 + i; tableModel.setHeaderData(column, Qt::Horizontal, synthclone::getMIDIControlString(i), Qt::DisplayRole); } tableView = synthclone::getChild<QTableView>(mainWindow, "zoneTableView"); tableView->installEventFilter(&contextMenuEventFilter); tableView->setItemDelegate(&tableDelegate); tableView->setModel(&tableModel); connect(tableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), SLOT(handleSelectionChange(QItemSelection, QItemSelection))); connect(&contextMenuEventFilter, SIGNAL(contextMenuRequest(int, int)), SLOT(handleContextMenuRequest(int, int))); emitZoneSelectRequest = true; }
Status WriteCmd::explain(OperationContext* txn, const std::string& dbname, const BSONObj& cmdObj, ExplainCommon::Verbosity verbosity, BSONObjBuilder* out) const { // For now we only explain update and delete write commands. if ( BatchedCommandRequest::BatchType_Update != _writeType && BatchedCommandRequest::BatchType_Delete != _writeType ) { return Status( ErrorCodes::IllegalOperation, "Only update and delete write ops can be explained" ); } // Parse the batch request. BatchedCommandRequest request( _writeType ); std::string errMsg; if ( !request.parseBSON( cmdObj, &errMsg ) || !request.isValid( &errMsg ) ) { return Status( ErrorCodes::FailedToParse, errMsg ); } // Note that this is a runCommmand, and therefore, the database and the collection name // are in different parts of the grammar for the command. But it's more convenient to // work with a NamespaceString. We built it here and replace it in the parsed command. // Internally, everything work with the namespace string as opposed to just the // collection name. NamespaceString nsString(dbname, request.getNS()); request.setNSS(nsString); // Do the validation of the batch that is shared with non-explained write batches. Status isValid = WriteBatchExecutor::validateBatch( request ); if (!isValid.isOK()) { return isValid; } // Explain must do one additional piece of validation: For now we only explain // singleton batches. if ( request.sizeWriteOps() != 1u ) { return Status( ErrorCodes::InvalidLength, "explained write batches must be of size 1" ); } // Get a reference to the singleton batch item (it's the 0th item in the batch). BatchItemRef batchItem( &request, 0 ); if ( BatchedCommandRequest::BatchType_Update == _writeType ) { // Create the update request. UpdateRequest updateRequest( nsString ); updateRequest.setQuery( batchItem.getUpdate()->getQuery() ); updateRequest.setUpdates( batchItem.getUpdate()->getUpdateExpr() ); updateRequest.setMulti( batchItem.getUpdate()->getMulti() ); updateRequest.setUpsert( batchItem.getUpdate()->getUpsert() ); updateRequest.setUpdateOpLog( true ); UpdateLifecycleImpl updateLifecycle( true, updateRequest.getNamespaceString() ); updateRequest.setLifecycle( &updateLifecycle ); updateRequest.setExplain(); // Explained updates can yield. updateRequest.setYieldPolicy(PlanExecutor::YIELD_AUTO); OpDebug* debug = &txn->getCurOp()->debug(); ParsedUpdate parsedUpdate( txn, &updateRequest ); Status parseStatus = parsedUpdate.parseRequest(); if ( !parseStatus.isOK() ) { return parseStatus; } // Explains of write commands are read-only, but we take write locks so // that timing info is more accurate. AutoGetDb autoDb( txn, nsString.db(), MODE_IX ); Lock::CollectionLock colLock( txn->lockState(), nsString.ns(), MODE_IX ); // We check the shard version explicitly here rather than using Client::Context, // as Context can do implicit database creation if the db does not exist. We want // explain to be a no-op that reports a trivial EOF plan against non-existent dbs // or collections. ensureShardVersionOKOrThrow( nsString.ns() ); // Get a pointer to the (possibly NULL) collection. Collection* collection = NULL; if ( autoDb.getDb() ) { collection = autoDb.getDb()->getCollection( txn, nsString.ns() ); } PlanExecutor* rawExec; uassertStatusOK(getExecutorUpdate(txn, collection, &parsedUpdate, debug, &rawExec)); boost::scoped_ptr<PlanExecutor> exec(rawExec); // Explain the plan tree. Explain::explainStages( exec.get(), verbosity, out ); return Status::OK(); } else { invariant( BatchedCommandRequest::BatchType_Delete == _writeType ); // Create the delete request. DeleteRequest deleteRequest( nsString ); deleteRequest.setQuery( batchItem.getDelete()->getQuery() ); deleteRequest.setMulti( batchItem.getDelete()->getLimit() != 1 ); deleteRequest.setUpdateOpLog(true); deleteRequest.setGod( false ); deleteRequest.setExplain(); // Explained deletes can yield. deleteRequest.setYieldPolicy(PlanExecutor::YIELD_AUTO); ParsedDelete parsedDelete(txn, &deleteRequest); Status parseStatus = parsedDelete.parseRequest(); if (!parseStatus.isOK()) { return parseStatus; } // Explains of write commands are read-only, but we take write locks so that timing // info is more accurate. AutoGetDb autoDb(txn, nsString.db(), MODE_IX); Lock::CollectionLock colLock(txn->lockState(), nsString.ns(), MODE_IX); // We check the shard version explicitly here rather than using Client::Context, // as Context can do implicit database creation if the db does not exist. We want // explain to be a no-op that reports a trivial EOF plan against non-existent dbs // or collections. ensureShardVersionOKOrThrow( nsString.ns() ); // Get a pointer to the (possibly NULL) collection. Collection* collection = NULL; if (autoDb.getDb()) { collection = autoDb.getDb()->getCollection(txn, nsString.ns()); } PlanExecutor* rawExec; uassertStatusOK(getExecutorDelete(txn, collection, &parsedDelete, &rawExec)); boost::scoped_ptr<PlanExecutor> exec(rawExec); // Explain the plan tree. Explain::explainStages(exec.get(), verbosity, out); return Status::OK(); } }
//main driver function int main(int argc, char **argv) { int listenfd, connfd, port; socklen_t clientlen; struct sockaddr_in clientaddr; struct hostent; unsigned int secretKey; if (argc != 3) { fprintf(stderr, "usage: %s <port> <secretKey>\n", argv[0]); exit(0); } port = atoi(argv[1]); secretKey = atoi(argv[2]); listenfd = Open_listenfd(port); while (1) { clientlen = sizeof(clientaddr); connfd = Accept(listenfd, (SA *)&clientaddr, &clientlen); int requestType = -1; int status = -1; rio_t rio; Rio_readinitb(&rio, connfd); int KeyCheck = checkKey(&rio, secretKey); if (KeyCheck == 0) { requestType = getRequest(&rio); if (requestType == 0) { printf("Request Type = get\n"); status = retrieveFile(&rio, connfd); } else if (requestType == 1) { printf("Request Type = put\n"); status = store(&rio, connfd); } else if (requestType == 2) { printf("Request Type = del\n"); status = deleteRequest(&rio, connfd); } else if (requestType == 3) { printf("Request Type = list\n"); status = listFilesRequest(&rio, connfd); } else { printf("Request Type = invalid"); } } if (status == 0) { printf("Operation Status = Success\n"); } else { printf("Operation Status = error\n"); } printf("-------------------------------\n"); Close(connfd); } exit(0); }
void YouTube::deleteFromPlaylist(const QString &playlistId, const QString &playlistVideoId) { QUrl url("http://gdata.youtube.com/feeds/api/playlists/" + playlistId + "/" + playlistVideoId); deleteRequest(url); connect(this, SIGNAL(postSuccessful()), this, SIGNAL(deletedFromPlaylist())); }
void LocalCalendar::deleteWidget() { emit deleteRequest( this ); }
/*! * \~english * Reimplemented QDataTable function. * \~russian * Переопределяет функцию QDataTable. Если контейнер wJournal, может испускаеть сигналы insertRequest(), updateRequest(), deleteRequest(), viewRequest() * \~ */ void wDBTable::contentsContextMenuEvent ( QContextMenuEvent * e ) { Q3Table::contentsContextMenuEvent( e ); QString str, ctype; if ( containerType() == "wDocument" || containerType() == "wCatalogue" ) { // Переопределяем всплывающее по правой кнопке мыши меню для табличной части документа // Во-первых, для его локализации // Во-вторых, чтобы добавляемая в табличную часть строка всегда вставлялась самой последней. enum { IdInsert=0, IdUpdate, IdDelete, }; QPointer<Q3PopupMenu> popupForDoc = new Q3PopupMenu( this ); int id[ 3 ]; id[ IdInsert ] = popupForDoc->insertItem( tr( "New" ) ); id[ IdUpdate ] = popupForDoc->insertItem( tr( "Edit" ) ); id[ IdDelete ] = popupForDoc->insertItem( tr( "Delete" ) ); if ( !sqlCursor() || isReadOnly() || !numCols() ) { popupForDoc->setItemEnabled(id[ IdInsert ], false ); popupForDoc->setItemEnabled(id[ IdUpdate ], false ); popupForDoc->setItemEnabled(id[ IdDelete ], false ); } int r = popupForDoc->exec( e->globalPos() ); delete (Q3PopupMenu*) popupForDoc; if(r==id[IdInsert]) { beginInsert(); } else if(r==id[IdUpdate]) { keyPressEvent( new QKeyEvent( QEvent::KeyPress, Qt::Key_F2, 0, Qt::NoButton)); } else if(r==id[IdDelete]) { Q3DataTable::deleteCurrent(); } } if ( containerType() == "wJournal" ) { //id = currentRecord()->value(0).toLongLong(); enum { IdInsert=0, IdUpdate, IdDelete, IdView, IdRefresh }; QPointer<Q3PopupMenu> popup = new Q3PopupMenu( this ); int id[ 5 ]; id[ IdInsert ] = popup->insertItem( tr( "New" ) ); id[ IdUpdate ] = popup->insertItem( tr( "Edit" ) ); id[ IdDelete ] = popup->insertItem( tr( "Delete" ) ); id[ IdView ] = popup->insertItem( tr( "View" ) ); id[ IdRefresh ] = popup->insertItem( tr( "Refresh" ) ); int r = popup->exec( e->globalPos() ); delete (Q3PopupMenu*) popup; if(r==id[IdInsert]) emit(insertRequest()); else if(r==id[IdUpdate]) emit(updateRequest()); else if(r==id[IdDelete]) emit(deleteRequest()); else if(r==id[IdView]) emit(viewRequest()); if(r==id[IdRefresh]) { //recalculate(); refresh(); } } e->accept(); }
void GraphicsStateItem::onDeleteAction(){ emit deleteRequest(this); }
void BasicUserViewer::emitDeleteRequest() const{emit deleteRequest(username->text());}
foreach (QStringList line, tasks) { int m_id = line.value(0).toInt(); QString m_title = line.value(1); if (m_title.size() > 15) m_title = m_title.left(12) + "..."; QString m_content = line.value(2); if (m_content.size() > 40) m_content = m_content.left(37) + "..."; QString m_priority = line.value(3); QBrush brush(Qt::black); if (m_priority == "Très élevée") brush.setColor(Qt::red); else if (m_priority == "Élevée") brush.setColor(QColor(255, 108, 0)); else if (m_priority == "Normale") brush.setColor(Qt::darkGreen); else if (m_priority == "Faible") brush.setColor(QColor(11, 58, 234)); else if (m_priority == "Très faible") brush.setColor(Qt::darkBlue); int newRowCount = mainTable->rowCount() + 1; Pair newPair; newPair.first = newRowCount - 1; newPair.second = m_id; pairs << newPair; QTableWidgetItem *itemNumber = new QTableWidgetItem(QString::number(newRowCount)); itemNumber->setFlags(itemNumber->flags() & ~Qt::ItemIsEditable); EditWidget *editTaskWidget = new EditWidget; editTaskWidget->setRow(newRowCount - 1); connect(editTaskWidget, SIGNAL(editRequest()), this, SLOT(slotEditTask())); connect(editTaskWidget, SIGNAL(deleteRequest()), this, SLOT(slotDeleteTask())); QTableWidgetItem *itemTitle = new QTableWidgetItem(m_title); itemTitle->setFlags(itemTitle->flags() & ~Qt::ItemIsEditable); QTableWidgetItem *itemContent = new QTableWidgetItem(m_content); itemContent->setFlags(itemContent->flags() & ~Qt::ItemIsEditable); QTableWidgetItem *itemPriority = new QTableWidgetItem(m_priority); itemPriority->setFlags(itemPriority->flags() & ~Qt::ItemIsEditable); itemPriority->setForeground(brush); mainTable->setRowCount(newRowCount); mainTable->setItem(newRowCount - 1, 0, itemNumber); mainTable->setCellWidget(newRowCount - 1, 1, editTaskWidget); mainTable->setItem(newRowCount - 1, 2, itemTitle); mainTable->setItem(newRowCount - 1, 3, itemContent); mainTable->setItem(newRowCount - 1, 4, itemPriority); }
void YouTube::deletePlaylist(const QString &playlistId) { QUrl url("http://gdata.youtube.com/feeds/api/users/" + currentUser + "/playlists/" + playlistId); deleteRequest(url); connect(this, SIGNAL(postSuccessful()), this, SIGNAL(playlistDeleted())); }
void WebdavCalendar::deleteWidget() { emit deleteRequest( this ); }
void YouTube::unsubscribeToChannel(const QString &subscriptionId) { QUrl url("http://gdata.youtube.com/feeds/api/users/" + currentUser + "/subscriptions/" + subscriptionId); deleteRequest(url); connect(this, SIGNAL(postSuccessful()), this, SIGNAL(unsubscribed())); }
void YouTube::deleteFromFavourites(const QString &favouriteId) { QUrl url("http://gdata.youtube.com/feeds/api/users/" + currentUser + "/favorites/" + favouriteId); deleteRequest(url); connect(this, SIGNAL(postSuccessful()), this, SIGNAL(deletedFromFavourites())); }