static void receiver_cb (SockMuxReceiver *rec, guint message_id, const guint8 *data, guint size, gpointer userdata) { GChecksum *checksum2 = g_checksum_new(G_CHECKSUM_SHA1); if (userdata != rec) { g_error("userdata = %p, rec = %p", userdata, rec); quit(); return; } if (message_id != step) { g_error("message_id = %d, step = %d", message_id, step); quit(); return; } g_message("%s() - rec %p, message_id 0x%0x, size %d", __func__, rec, message_id, size); g_checksum_update(checksum2, data, size); if (!g_str_equal(g_checksum_get_string(checksum), g_checksum_get_string(checksum2))) { g_error("Checksum mismatch! Expected '%s', got '%s'", g_checksum_get_string(checksum), g_checksum_get_string(checksum2)); quit(); return; } g_checksum_free(checksum2); trigger(); }
void RS_ActionDrawLineRectangle::coordinateEvent(RS_CoordinateEvent* e) { if (!e) return; RS_Vector mouse = e->getCoordinate(); switch (getStatus()) { case SetCorner1: pPoints->corner1 = mouse; graphicView->moveRelativeZero(mouse); setStatus(SetCorner2); break; case SetCorner2: pPoints->corner2 = mouse; trigger(); setStatus(SetCorner1); break; default: break; } }
void RS_ActionModifyScale::mouseReleaseEvent(QMouseEvent* e) { if (e->button()==Qt::LeftButton) { RS_Vector mouse = snapPoint(e); switch (getStatus()) { case SetReferencePoint: setStatus(ShowDialog); if (RS_DIALOGFACTORY->requestScaleDialog(data)) { data.referencePoint = referencePoint; trigger(); finish(); } break; default: break; } } else if (e->button()==Qt::RightButton) { deletePreview(); init(getStatus()-1); } }
void TestShuttle() { gSystem->Load("libSHUTTLE"); gSystem->Load("libRLDAP"); gSystem->Load("libTest"); AliLog::SetGlobalDebugLevel(1); AliShuttleConfig config("pcalice290.cern.ch", 389, "o=alice,dc=cern,dc=ch"); config.Print(); AliShuttleTrigger trigger(&config); AliShuttle* shuttle = trigger.GetShuttle(); TestITSPreprocessor *itsPrep = new AliITSPreprocessor("ITS",shuttle); trigger.CollectNew(); /* TTimeStamp currentTime; shuttle.Process(1, currentTime.GetSec() - 18 * 3600, currentTime.GetSec());*/ }
void loadgamerest() { if(demoplayback || !f) return; if(gzgeti()!=ents.length()) return loadgameout(); loopv(ents) { ents[i].spawned = gzgetc(f)!=0; if(ents[i].type==CARROT && !ents[i].spawned) trigger(ents[i].attr1, ents[i].attr2, true); }; restoreserverstate(ents); gzread(f, player1, sizeof(dynent)); player1->lastaction = lastmillis; int nmonsters = gzgeti(); dvector &monsters = getmonsters(); if(nmonsters!=monsters.length()) return loadgameout(); loopv(monsters) { gzread(f, monsters[i], sizeof(dynent)); monsters[i]->enemy = player1; // lazy, could save id of enemy instead monsters[i]->lastaction = monsters[i]->trigger = lastmillis+500; // also lazy, but no real noticable effect on game if(monsters[i]->state==CS_DEAD) monsters[i]->lastaction = 0; }; restoremonsterstate(); int nplayers = gzgeti(); loopi(nplayers) if(!gzget()) { dynent *d = getclient(i); assert(d); gzread(f, d, sizeof(dynent)); }; conoutf("savegame restored"); if(demoloading) startdemo(); else stop(); };
void CNotificationManager::showStateNotification(libnutcommon::DeviceState state) { if (!m_NotificationsEnabled) return; CUIDevice * uiDevice = qobject_cast<CUIDevice *>(sender()); if (!uiDevice) return; QString message; switch (state) { case libnutcommon::DS_UP: message = tr("%2 is now up and running on network: %1") .arg(currentNetwork(uiDevice->device())); break; case libnutcommon::DS_UNCONFIGURED: message = tr("%2 got carrier (to network: %1) but needs configuration.\n\nClick here to open the device details.") .arg(currentNetwork(uiDevice->device())); break; case libnutcommon::DS_ACTIVATED: message = tr("%1 is now activated and waits for carrier."); break; case libnutcommon::DS_DEACTIVATED: message = tr("%1 is now deactivated"); break; default: return; } { QSystemTrayIcon * trayIcon = m_UIDeviceIcons.value(uiDevice, NULL); message = message.arg(trayIcon && trayIcon->isVisible() ? tr("Device") : uiDevice->device()->getName()); } if (state == libnutcommon::DS_UNCONFIGURED) showMessage(QString(), message, uiDevice->m_ShowEnvironmentsAction, SLOT(trigger()), uiDevice); else showMessage(QString(), message, NULL, NULL, uiDevice); }
void RS_ActionModifyTrim::mouseReleaseEvent(RS_MouseEvent* e) { if (RS2::qtToRsButtonState(e->button())==RS2::LeftButton) { RS_Vector mouse = graphicView->toGraph(e->x(), e->y()); RS_Entity* se = catchEntity(e); switch (getStatus()) { case ChooseLimitEntity: limitCoord = mouse; limitEntity = se; if (limitEntity!=NULL /*&& limitEntity->isAtomic()*/) { limitEntity->setHighlighted(true); graphicView->drawEntity(limitEntity); setStatus(ChooseTrimEntity); } break; case ChooseTrimEntity: trimCoord = mouse; trimEntity = se; if (trimEntity!=NULL && trimEntity->isAtomic()) { trigger(); } break; default: break; } } else if (RS2::qtToRsButtonState(e->button())==RS2::RightButton) { deletePreview(); deleteSnapper(); if (limitEntity!=NULL) { limitEntity->setHighlighted(false); graphicView->drawEntity(limitEntity); } init(getStatus()-1); } }
void RS_ActionDrawLineTangent2::mouseReleaseEvent(QMouseEvent* e) { if (e->button()==Qt::RightButton) { deletePreview(); if(getStatus()>=0){ init(getStatus()-1); if(circle1!=NULL){ circle1->setHighlighted(false); graphicView->redraw(RS2::RedrawDrawing); deletePreview(); } } return; } switch (getStatus()) { case SetCircle1: { circle1 = catchEntity(e, circleType, RS2::ResolveAll); if(circle1==NULL) return; if(circle1->rtti()!=RS2::EntityCircle && circle1->rtti()!=RS2::EntityEllipse && circle1->rtti()!=RS2::EntityArc ) { circle1=NULL; return; } circle1->setHighlighted(true); setStatus(getStatus()+1); graphicView->redraw(RS2::RedrawDrawing); } break; case SetCircle2: if(valid) trigger(); break; } }
void RS_ActionDrawEllipseFociPoint::coordinateEvent(RS_CoordinateEvent* e) { if (e==NULL) { return; } RS_Vector mouse = e->getCoordinate(); switch (getStatus()) { case SetFocus1: graphicView->moveRelativeZero(mouse); focus1=mouse; setStatus(SetFocus2); break; case SetFocus2: c=0.5*focus1.distanceTo(mouse); if(c>RS_TOLERANCE){ graphicView->moveRelativeZero(mouse); focus2=mouse; center=(focus1+focus2)*0.5; major=focus1-center; major /= c ; setStatus(SetPoint); } break; case SetPoint: point=mouse; d=0.5*(focus1.distanceTo(point)+focus2.distanceTo(point)); if (d > c+ RS_TOLERANCE) { graphicView->moveRelativeZero(mouse); trigger(); } break; default: break; } }
void Cascade::press(int x,int y) { int xpos, ypos; if(help) help->deactivate(); if(state) { /* Already pressed */ if(x<0 || x>=gtwidth()+2 || y<0 || y>=gtheight()+2) { /* Mouse is outside our window */ popgrab(); } else { greedygrab(0); } return; } trigger(); if(!gtmom()->is_menu) { calcpos(gtouter()->gtwin(),&xpos,&ypos); m->stx(xpos); m->sty(ypos+gth()+2); } else { calcpos(gtouter()->gtwin(),&xpos,&ypos); m->stx(xpos+gtw()+2); m->sty(ypos); } grab(this,0); state=1; m->enable(); }
void RS_ActionDrawCircleTan1_2P::mouseReleaseEvent(QMouseEvent* e) { // Proceed to next status if (e->button()==Qt::LeftButton) { switch (getStatus()) { case SetCircle1: { RS_Entity* en = catchCircle(e); if (!en) return; circle = static_cast<RS_AtomicEntity*>(en); circle->setHighlighted(true); graphicView->redraw(RS2::RedrawDrawing); setStatus(getStatus()+1); } break; case SetPoint1: case SetPoint2: { RS_CoordinateEvent ce(snapPoint(e)); coordinateEvent(&ce); } break; case SetCenter: pPoints->coord=graphicView->toGraph(e->x(),e->y()); if(preparePreview()) trigger(); break; default: break; } } else if (e->button()==Qt::RightButton) { // Return to last status: if(getStatus()>0){ deletePreview(); } init(getStatus()-1); } }
void AISyncServer::remove(AISyncClient* client) { #ifdef SYNC_TESTSUITE sanity_check(); #endif client_list_t::iterator client_iter = mClients.begin(); synceventset_t remaining_ready_events = (synceventset_t)-1; // All clients are ready. synceventset_t remaining_pending_events = 0; // At least one client is ready (waiting for the other clients thus). client_list_t::iterator found_client = mClients.end(); while (client_iter != mClients.end()) { if (client_iter->mClientPtr == client) { found_client = client_iter; } else { remaining_ready_events &= client_iter->mReadyEvents; remaining_pending_events |= client_iter->mReadyEvents; } ++client_iter; } llassert(found_client != mClients.end()); // This must be the same as client->mReadyEvents. llassert(found_client->mReadyEvents == client->mReadyEvents); mClients.erase(found_client); synceventset_t old_ready_events = mReadyEvents; mReadyEvents = remaining_ready_events; mPendingEvents = remaining_pending_events; trigger(old_ready_events); client->mServer.reset(); client->deregistered(); #ifdef SYNC_TESTSUITE sanity_check(); #endif }
static void trystart() { int f; switch(f = fork()) { case -1: write_log(fdlogwf, WARNING, "unable to fork for ", service, ", sleeping 60 seconds\n"); deepsleep(60); trigger(); return; case 0: sig_uncatch(sig_child); sig_unblock(sig_child); execvp(cmd[0], cmdp); write_log(fdlogwf, FATAL, "unable to start ", cmd[0], "\n"); _exit(1); } flagpaused = 0; pid = f; pidchange(); announce(); deepsleep(1); }
void RS_ActionDrawLinePolygonCorCor::coordinateEvent(RS_CoordinateEvent* e) { if (e==NULL) { return; } RS_Vector mouse = e->getCoordinate(); switch (getStatus()) { case SetCorner1: corner1 = mouse; setStatus(SetCorner2); graphicView->moveRelativeZero(mouse); break; case SetCorner2: corner2 = mouse; trigger(); break; default: break; } }
void Scheduler::terminate() { if(m_use_external_clock) { /* If we're set to use an external trigger, we need to generate the * necessary triggers internally to wind down all of the tasks to * allow for a clean exit. */ const units::Nanoseconds s_period = get_period(); while(sched_unwind_tics) { usleep(s_period / 1000); trigger(); } } else { this->lock(); m_sched_impl->sync.condition_satisfied(); m_sched_impl->sync.release(); this->unlock(); } }
void ActionButton::setAction(Action *AAction) { if (FAction != AAction) { if (FAction) { disconnect(FAction,0,this,0); } FAction = AAction; onActionChanged(); if (FAction) { connect(this,SIGNAL(clicked()),FAction,SLOT(trigger())); connect(FAction,SIGNAL(changed()),SLOT(onActionChanged())); connect(FAction,SIGNAL(actionDestroyed(Action *)),SLOT(onActionDestroyed(Action *))); setActionString(AAction->data(Action::DR_UserDefined + 1).toString()); } emit actionChanged(); } }
bool KDEIntegration::registerGlobalShortcut(const QString &id, const QKeySequence &key, QAction *action) { #ifdef USE_KDE5 QAction *act = _shortcuts.value(id); if (!act) { act = new QAction(action->text(), this); act->setObjectName(id); _shortcuts.insert(id, act); } KGlobalAccel::setGlobalShortcut(act, key); #else //KGlobalAccel::setGlobalShortcut() KAction *act = _shortcuts.value(id); if (!act) { act = new KAction(action->text(), this); act->setObjectName(id); _shortcuts.insert(id, act); } act->setGlobalShortcut(KShortcut(key)); #endif connect(act, SIGNAL(triggered()), action, SLOT(trigger()), Qt::UniqueConnection); return true; }
void RS_ActionDrawCircleTan1_2P::coordinateEvent(RS_CoordinateEvent* e) { RS_Vector mouse = e->getCoordinate(); pPoints->coord=mouse; switch(getStatus()){ case SetPoint1: pPoints->points.clear(); pPoints->points.push_back(mouse); setStatus(getStatus()+1); break; case SetPoint2: // pPoints->points.reserve(1); pPoints->points.push_back(mouse); if(getCenters()) { if(pPoints->centers.size()==1) trigger(); else setStatus(getStatus()+1); } break; } }
void tst_QScriptEngineDebugger::debuggerSignals() { #if defined(Q_OS_WINCE) && _WIN32_WCE < 0x600 QSKIP("skipped due to high mem usage until task 261062 is fixed", SkipAll); #endif QScriptEngine engine; QScriptEngineDebugger debugger; debugger.attachTo(&engine); debugger.setAutoShowStandardWindow(false); QSignalSpy evaluationSuspendedSpy(&debugger, SIGNAL(evaluationSuspended())); QSignalSpy evaluationResumedSpy(&debugger, SIGNAL(evaluationResumed())); QObject::connect(&debugger, SIGNAL(evaluationSuspended()), debugger.action(QScriptEngineDebugger::ContinueAction), SLOT(trigger())); engine.evaluate("123"); QCOMPARE(evaluationSuspendedSpy.count(), 0); QCOMPARE(evaluationResumedSpy.count(), 0); engine.evaluate("debugger"); QCoreApplication::processEvents(); QCOMPARE(evaluationSuspendedSpy.count(), 1); QCOMPARE(evaluationResumedSpy.count(), 1); }
void RS_ActionDrawCircleTan2::mouseReleaseEvent(QMouseEvent* e) { // Proceed to next status if (e->button()==Qt::LeftButton) { switch (getStatus()) { case SetCircle1: case SetCircle2: { RS_Entity* en = catchCircle(e); if (en==nullptr) return; circles.resize(getStatus()); circles.push_back(static_cast<RS_AtomicEntity*>(en)); if(getStatus()==SetCircle1 || getCenters()){ circles.at(circles.size()-1)->setHighlighted(true); graphicView->redraw(RS2::RedrawDrawing); setStatus(getStatus()+1); } } break; case SetCenter: coord= graphicView->toGraph(e->x(), e->y()); if( preparePreview()) trigger(); break; default: break; } } else if (e->button()==Qt::RightButton) { // Return to last status: if(getStatus()>0){ circles[getStatus()-1]->setHighlighted(false); circles.pop_back(); graphicView->redraw(RS2::RedrawDrawing); deletePreview(); } init(getStatus()-1); } }
void LC_ActionDrawCircle2PR::coordinateEvent(RS_CoordinateEvent* e) { if (e==NULL) { return; } RS_Vector mouse = e->getCoordinate(); switch (getStatus()) { case SetPoint1: point1 = mouse; graphicView->moveRelativeZero(mouse); setStatus(SetPoint2); break; case SetPoint2: if(mouse.distanceTo(point1) <= 2.*data->radius){ point2 = mouse; graphicView->moveRelativeZero(mouse); setStatus(SelectCenter); }else{ RS_DIALOGFACTORY->commandMessage(tr("radius=%1 is too small for points selected\ndistance between points=%2 is larger than diameter=%3"). arg(data->radius).arg(point1.distanceTo(point2)).arg(2.*data->radius)); } break; case SelectCenter: { bool showPreview=preparePreview(mouse); if(showPreview || data->isValid()) trigger(); else RS_DIALOGFACTORY->commandMessage(tr("Select from two possible circle centers")); } break; default: break; } }
void BitcoinGUI::createTrayIcon() { QMenu *trayIconMenu; #ifndef Q_WS_MAC trayIcon = new QSystemTrayIcon(this); trayIconMenu = new QMenu(this); trayIcon->setContextMenu(trayIconMenu); trayIcon->setToolTip("Bitcoin client"); trayIcon->setIcon(QIcon(":/icons/toolbar")); connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason))); trayIcon->show(); #else // Note: On Mac, the dock icon is used to provide the tray's functionality. MacDockIconHandler *dockIconHandler = MacDockIconHandler::instance(); connect(dockIconHandler, SIGNAL(dockIconClicked()), openBitcoinAction, SLOT(trigger())); trayIconMenu = dockIconHandler->dockMenu(); #endif // Configuration of the tray icon (or dock icon) icon menu trayIconMenu->addAction(openBitcoinAction); trayIconMenu->addSeparator(); trayIconMenu->addAction(messageAction); #ifndef FIRST_CLASS_MESSAGING trayIconMenu->addSeparator(); #endif trayIconMenu->addAction(receiveCoinsAction); trayIconMenu->addAction(sendCoinsAction); trayIconMenu->addSeparator(); trayIconMenu->addAction(optionsAction); #ifndef Q_WS_MAC // This is built-in on Mac trayIconMenu->addSeparator(); trayIconMenu->addAction(quitAction); #endif notificator = new Notificator(tr("bitcoin-qt"), trayIcon); }
void RS_ActionModifyStretch::coordinateEvent(RS_CoordinateEvent* e) { if (e==NULL) { return; } RS_Vector mouse = e->getCoordinate(); switch (getStatus()) { case SetFirstCorner: firstCorner = mouse; setStatus(SetSecondCorner); break; case SetSecondCorner: secondCorner = mouse; deletePreview(); setStatus(SetReferencePoint); break; case SetReferencePoint: referencePoint = mouse; graphicView->moveRelativeZero(referencePoint); setStatus(SetTargetPoint); break; case SetTargetPoint: targetPoint = mouse; graphicView->moveRelativeZero(targetPoint); trigger(); //finish(); break; default: break; } }
OpenFileDlg::OpenFileDlg(QWidget *parent, CR3View * docView): QDialog(parent), m_ui(new Ui::OpenFileDlg), m_docview(docView) { m_ui->setupUi(this); addAction(m_ui->actionGoToBegin); addAction(m_ui->actionNextPage); addAction(m_ui->actionPrevPage); addAction(m_ui->actionGoToFirstPage); addAction(m_ui->actionGoToLastPage); QAction *actionRemoveFile = m_ui->actionRemoveFile; QShortcut* kbd = new QShortcut(Qt::Key_AltGr, this); // quick hack to delete files on K4NT with KBD key connect(kbd, SIGNAL(activated()), actionRemoveFile, SLOT(trigger())); addAction(actionRemoveFile); QAction *actionSelect = m_ui->actionSelectFile; actionSelect->setShortcut(Qt::Key_Select); addAction(actionSelect); folder = QIcon(":/icons/folder_sans_32.png"); file = QIcon(":/icons/book_text_32.png"); arrowUp = QIcon(":/icons/arrow_full_up_32.png"); m_ui->FileList->setItemDelegate(new FileListDelegate()); QString lastPathName; QString lastName; if(!docView->GetLastPathName(&lastPathName)) #ifdef i386 CurrentDir = "/home/"; #else CurrentDir = "/mnt/us/documents/"; #endif else {
void RS_ActionDrawLine::coordinateEvent(RS_CoordinateEvent* e) { RS_DEBUG->print("RS_ActionDrawLine::coordinateEvent"); if (e==NULL) { RS_DEBUG->print("RS_ActionDrawLine::coordinateEvent: event was NULL"); return; } RS_Vector mouse = e->getCoordinate(); if(pPoints->data.startpoint.valid == false && getStatus()==SetEndpoint) setStatus(SetStartpoint); switch (getStatus()) { case SetStartpoint: pPoints->data.startpoint = mouse; addHistory(mouse); pPoints->start = pPoints->data.startpoint; setStatus(SetEndpoint); graphicView->moveRelativeZero(mouse); updateMouseButtonHints(); break; case SetEndpoint: if((mouse-pPoints->data.startpoint).squared() > RS_TOLERANCE2) { //refuse zero length lines pPoints->data.endpoint = mouse; addHistory(mouse); trigger(); pPoints->data.startpoint = pPoints->data.endpoint; if(pPoints->history.size()>=2) updateMouseButtonHints(); } //graphicView->moveRelativeZero(mouse); break; default: break; } RS_DEBUG->print("RS_ActionDrawLine::coordinateEvent: OK"); }
void RS_ActionDrawLineHorVert::mouseReleaseEvent(QMouseEvent* e) { if (e->button()==Qt::LeftButton) { RS_Vector mouse = snapPoint(e); switch (getStatus()) { case SetStartpoint: p1 = mouse; setStatus(SetEndpoint); break; case SetEndpoint: p2 = mouse; trigger(); setStatus(SetStartpoint); break; default: break; } } else if (e->button()==Qt::RightButton) { deletePreview(); init(getStatus()-1); } }
void RS_ActionDrawCircle2P::coordinateEvent(RS_CoordinateEvent* e) { if (e==NULL) { return; } RS_Vector mouse = e->getCoordinate(); switch (getStatus()) { case SetPoint1: point1 = mouse; graphicView->moveRelativeZero(mouse); setStatus(SetPoint2); break; case SetPoint2: point2 = mouse; graphicView->moveRelativeZero(mouse); trigger(); break; default: break; } }
void SignalBase::operator()( qi::AutoAnyReference p1, qi::AutoAnyReference p2, qi::AutoAnyReference p3, qi::AutoAnyReference p4, qi::AutoAnyReference p5, qi::AutoAnyReference p6, qi::AutoAnyReference p7, qi::AutoAnyReference p8) { qi::AutoAnyReference* vals[8]= {&p1, &p2, &p3, &p4, &p5, &p6, &p7, &p8}; std::vector<qi::AnyReference> params; for (unsigned i = 0; i < 8; ++i) if (vals[i]->isValid()) params.push_back(*vals[i]); qi::Signature signature = qi::makeTupleSignature(params); if (signature != _p->signature) { qiLogError() << "Dropping emit: signature mismatch: " << signature.toString() <<" " << _p->signature.toString(); return; } trigger(params, _p->defaultCallType); }
double DAQManager::getVoltage(){ float64 sum; int32 read; #ifdef _WIN32 DAQmxStartTask(adcTaskHandle); trigger(); while(!dataAcquired); dataAcquired=0; DAQmxStopTask(adcTaskHandle); #elif __APPLE__ /*bool32 isDone; DAQmxBaseIsTaskDone(adcTaskHandle,&isDone);*/ DAQmxBaseReadAnalogF64(adcTaskHandle, SAMPLE_COUNT, 10.0, DAQmx_Val_GroupByScanNumber, data, SAMPLE_COUNT, &read, NULL); /*while(!isDone); DAQmxBaseStopTask(adcTaskHandle); DAQmxBaseClearTask(adcTaskHandle);*/ #endif sum = 0; for (int i = 0; i < SAMPLE_COUNT; ++i){ sum += voltageData[i]; } return sum / SAMPLE_COUNT; }
void Inspector::update(double deltaTime){ BasicButton::update(deltaTime); refreshList(); //check if we need scrollBar and make one if we do if (scrollBar){ if (listSize.y>listDisplaySize){ trigger(scrollBar); placeScrollBar(); }else { scrollBar->remove(); scrollBar=NULL; } scrollBar->bHidden=!bOpen; } else{ if (listSize.y>listDisplaySize){ createScrollBar(); scrollBar->bHidden=!bOpen; } } }