void ConnectionAutomaton::connect() {
  connectionOutput_.reset(&connection_->getOutput());
  connectionOutput_.get()->onSubscribe(*this);
  // This may call ::onSubscribe in-line, which calls ::request on the provided
  // subscription, which might deliver frames in-line.
  connection_->setInput(*this);

  if (!isServer_) {
    uint32_t keepaliveTime = keepaliveTimer_
        ? keepaliveTimer_->keepaliveTime().count()
        : std::numeric_limits<uint32_t>::max();

    // TODO set correct version
    Frame_SETUP frame(
        FrameFlags_EMPTY,
        0,
        keepaliveTime,
        std::numeric_limits<uint32_t>::max(),
        "",
        "",
        FrameMetadata::empty(),
        folly::IOBuf::create(0));
    onNext(frame.serializeOut());
  }
  stats_.socketCreated();

  if (keepaliveTimer_) {
    keepaliveTimer_->start(this);
  }
}
Beispiel #2
0
MultipleTraces::MultipleTraces(QWidget *parent,VIModel *pObjSubject,VIFunctionalLogic *pFunObj)
    : QMainWindow(parent,Qt::WindowSystemMenuHint)
{
	uiMT.setupUi(this);
	setWindowFlags(Qt::Widget);
	//	qDebug()<<"MultipleTraces Constructor";
    m_obVImodel = pObjSubject;
    m_objFunctionLogic = pFunObj;
	m_lstMultipleTraces.clear();
	m_mapCombinations = m_obVImodel->getPinCombinations();

    //m_lstMultipleTraces = m_obVImodel->getPinCombinations()
	//m_lstMultipleTraces.sort();
	connect(uiMT.objClose,SIGNAL(clicked()),this,SLOT(closeAppMT()));
	connect(uiMT.butNext,SIGNAL(clicked()),this,SLOT(onNext()));
	connect(uiMT.butPrev,SIGNAL(clicked()),this,SLOT(onPrevious()));
	connect(uiMT.butPass,SIGNAL(clicked()),this,SLOT(onPassTraces()));
	connect(uiMT.butFail,SIGNAL(clicked()),this,SLOT(onFailTraces()));
	connect(uiMT.butALL,SIGNAL(clicked()),this,SLOT(onAllTraces()));

	m_nSelectedIndex=0;
	//m_nEndIndex=0;
	uiMT.lblCombinations->setText(QString::number(m_obVImodel->getChipDialog(4),10));
	if(m_obVImodel->getChipDialog(4) > 6)
		uiMT.lblCurrenttoTotal->setText("1 to "+ QString::number(m_obVImodel->getChipDialog(4),10));
	else
		uiMT.lblCurrenttoTotal->setText(QString::number(m_obVImodel->getChipDialog(4),10)+ " to "+ QString::number(m_obVImodel->getChipDialog(4),10));

	initializeWaveProduct();
	isPassFlag=isFailFlag=false;
	//calculateCombinationalTraces(m_obVImodel->getClipLearntFlag());
	//LoadVITraces(m_nSelectedIndex);
}
 void request(uint64_t n) {
   auto sp = s.lock();
   if (sp) {
     // do stuff
     sp->onNext(1);
   }
 }
Beispiel #4
0
void ClientImpl::onMessage(const Message& msg_received, in_addr_t fromIP, uint16_t fromPort) {
  ILOG << "onMessage(): Message(" << msg_received
       << " payload=" << msg_received.payload().length() << " bytes)\n";

  std::lock_guard<std::mutex> lock(mutex_);

  auto notificationIt = notifications_.find(msg_received.token());

  if (notificationIt == notifications_.end()) {
    if (msg_received.hasObserveValue()) {
      // TODO: Send reset message to stop server from sending further notifications
    }
    return;
  }

  auto sp = notificationIt->second.lock();
  if (not sp) {
    if (msg_received.hasObserveValue()) {
      // TODO: Send reset message to stop server from sending further notifications
    }
    return;
  }

  sp->onNext(RestResponse()
                 .withSenderIP(fromIP)
                 .withSenderPort(fromPort)
                 .withCode(msg_received.code())
                 .withPayload(msg_received.payload()));
}
Beispiel #5
0
NewGroupBox::NewGroupBox() : _scroll(this, st::newGroupScroll), _inner(),
	_filter(this, st::contactsFilter, lang(lng_participant_filter)),
	_next(this, lang(lng_create_group_next), st::btnSelectDone),
	_cancel(this, lang(lng_cancel), st::btnSelectCancel),
    _hiding(false),	a_opacity(0, 1) {

	_width = st::participantWidth;
	_height = App::wnd()->height() - st::boxPadding.top() - st::boxPadding.bottom();
	if (_height > st::participantMaxHeight) _height = st::participantMaxHeight;

	resize(_width, _height);

	_scroll.setWidget(&_inner);
	_scroll.setFocusPolicy(Qt::NoFocus);

	connect(&_next, SIGNAL(clicked()), this, SLOT(onNext()));
	connect(&_cancel, SIGNAL(clicked()), this, SIGNAL(closed()));
	connect(&_scroll, SIGNAL(scrolled()), &_inner, SLOT(updateSel()));
	connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
	connect(&_filter, SIGNAL(changed()), this, SLOT(onFilterUpdate()));
	connect(&_filter, SIGNAL(cancelled()), this, SIGNAL(onClose()));
	connect(&_inner, SIGNAL(mustScrollTo(int,int)), &_scroll, SLOT(scrollToY(int,int)));
	connect(&_inner, SIGNAL(selectAllQuery()), &_filter, SLOT(selectAll()));

	showAll();
	_cache = myGrab(this, rect());
	hideAll();
}
void RunnerWindow::createToolbar()
{
	toolbar = new AmeToolBar();
	addToolBar(toolbar);

        prevBtn = new AmeRectButton(AmeSystemIcon::GoPrevious, "Previous", this);
        connect(prevBtn, SIGNAL(clicked()), this, SLOT(onPrev()));

        nextBtn = new AmeRectButton(AmeSystemIcon::GoNext,"Next", this);
        connect(nextBtn, SIGNAL(clicked()), this, SLOT(onNext()));

        iconsBtn = new AmeRectButton(AmeSystemIcon::Icons, "Show as icons", this);
        listBtn = new AmeRectButton(AmeSystemIcon::List, "Show as list", this);
        columnsBtn = new AmeRectButton(AmeSystemIcon::Columns, "Show as list", this);


        toolbar->addWidget(prevBtn);
        toolbar->addWidget(nextBtn);
	toolbar->addSpace(60);
        toolbar->addWidget(iconsBtn);
        toolbar->addWidget(listBtn);
        toolbar->addWidget(columnsBtn);


}
Beispiel #7
0
void Widget::wheelEvent(QWheelEvent *e)
{
    if (e->delta() > 0)
        onPrevious();
    else if (e->delta() < 0)
        onNext();
    QWidget::wheelEvent(e);
}
Beispiel #8
0
void Widget::processRemoteControl(QString command)
{
    if (command == "activate")
        onActivate();
    else if (command == "hide")
        onHide();
    else if (command == "next")
        onNext();
    else if (command == "previous")
        onPrevious();
}
Beispiel #9
0
WindowMain::WindowMain(QWidget *parent) :
	QMainWindow(parent),
	m_ui(new Ui::WindowMain)
{
	/** Initialize the UI */
	m_ui->setupUi(this);

	/** Set the window title */
	setWindowTitle(PACKAGE_STRING);

	/** Connect the actions */
	connect(m_ui->actionAboutQt, SIGNAL(triggered()),
			qApp, SLOT(aboutQt()));
	connect(m_ui->actionAbout, SIGNAL(triggered()),
			this, SLOT(onAbout()));
	connect(m_ui->actionSettings, SIGNAL(triggered()),
			this, SLOT(onSettings()));
	connect(m_ui->actionQuit, SIGNAL(triggered()),
			this, SLOT(close()));
	connect(this, SIGNAL(next()),
			this, SLOT(onNext()));
	connect(this, SIGNAL(done()),
			this, SLOT(onEnd()));

	/** Initialize the settings */
	m_settings = new Settings(this);

	/** Create and setup the drop area */
	m_dropArea = new DropArea();
	connect(m_dropArea, SIGNAL(dropped(QList<QUrl>)),
			this, SLOT(onStart(QList<QUrl>)));
	setCentralWidget(m_dropArea);

	/** Initialize the status bar */
	m_ui->statusBar->setStyleSheet("QStatusBar::item {border: none;}");
	m_ui->statusBar->showMessage(tr("Ready"));

	/** Create the progress bar */
	m_progress = new QProgressBar();

	/** Create the allocine engine */
	m_allocine = new AllocineEngine();
	connect(m_allocine, SIGNAL(found(QList<AllocineResult*>)),
			this, SLOT(onFound(QList<AllocineResult*>)));
	connect(m_allocine, SIGNAL(fetched(AllocineResult*)),
			this, SLOT(onFetched(AllocineResult*)));
	connect(m_allocine, SIGNAL(error(QString)),
			this, SLOT(onError(QString)));

	/** Initialize the processing flag */
	m_processing = false;
}
Beispiel #10
0
void Widget::autoNext()
{
    Q_ASSERT (m_messageQueue.size() >= 2);
    Message&m = m_messageQueue.front();
    // The user already saw it manually.
    if (m.data["manually_shown"]) {
        m_messageQueue.pop_front();
        reverseStart();
    }
    else {
        if ((m_messageQueue.begin()+1)->data["sc"])
            QProcess::startDetached((m_messageQueue.begin()+1)->data["sc"]->toString());
    }
    onNext();
}
Beispiel #11
0
void Widget::onActivate()
{
    if (!m_messageQueue.isEmpty()) {
        if (m_messageQueue.front().data.contains("ac") && m_messageQueue.front().data["ac"]) {
            QProcess::startDetached(m_messageQueue.front().data["ac"]->toString());
            m_messageQueue.front().data["ac"] = "";
        }
    }

    if(m_messageQueue.size() > 1) {
        onNext();
    } else {
        onHide();
    }
}
Beispiel #12
0
int MultipleTraces::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: onNext(); break;
        case 1: onPrevious(); break;
        case 2: closeAppMT(); break;
        case 3: onPassTraces(); break;
        case 4: onFailTraces(); break;
        case 5: onAllTraces(); break;
        default: ;
        }
        _id -= 6;
    }
    return _id;
}
Beispiel #13
0
void ChessWidget::keyReleaseEvent(QKeyEvent * e)
{
  if ( !e )
    return;

  switch ( e->key() )
  {
  case Qt::Key_F2:
    onSave();
    break;

  case Qt::Key_F3:
    onLoad();
    break;

  case Qt::Key_PageUp:
    onNext();
    break;

  case Qt::Key_PageDown:
    onPrev();
    break;

  case Qt::Key_C:
    if ( e->modifiers() & Qt::ControlModifier )
    {
      onPutFEN();
    }
    break;

  case Qt::Key_V:
    if ( e->modifiers() & Qt::ControlModifier )
    {
      onGetFEN();
    }
    break;
  }
}
Beispiel #14
0
 void OnNext(T value) override
 {
     if (onNext) {
         onNext(std::move(value));
     }
 }
Beispiel #15
0
	_title->setMaxLength(MaxGroupChannelTitle);

	if (_creating == CreatingGroupChannel) {
		_description.create(this, st::newGroupDescription, lang(lng_create_group_description));
		_description->show();
		_description->setMaxLength(MaxChannelDescription);

		connect(_description, SIGNAL(resized()), this, SLOT(onDescriptionResized()));
		connect(_description, SIGNAL(submitted(bool)), this, SLOT(onNext()));
		connect(_description, SIGNAL(cancelled()), this, SLOT(onClose()));
	}

	connect(_title, SIGNAL(submitted(bool)), this, SLOT(onNameSubmit()));

	addButton(lang(_creating == CreatingGroupChannel ? lng_create_group_create : lng_create_group_next), [this] { onNext(); });
	addButton(lang(_fromTypeChoose ? lng_create_group_back : lng_cancel), [this] { closeBox(); });

	_photo->setClickedCallback(App::LambdaDelayed(st::defaultActiveButton.ripple.hideDuration, this, [this] {
		auto imgExtensions = cImgExtensions();
		auto filter = qsl("Image files (*") + imgExtensions.join(qsl(" *")) + qsl(");;") + filedialogAllFilesFilter();
		_setPhotoFileQueryId = FileDialog::queryReadFile(lang(lng_choose_image), filter);
	}));
	subscribe(FileDialog::QueryDone(), [this](const FileDialog::QueryUpdate &update) {
		notifyFileQueryUpdated(update);
	});

	updateMaxHeight();
}

void GroupInfoBox::setInnerFocus() {
Beispiel #16
0
void ChessWidget::createMenu()
{
  QMenu * gameMenu = menuBar()->addMenu(tr("&Game"));

  onNewAction_ = new QAction(tr("&New"), this);
  onNewAction_->setStatusTip(tr("Start new game"));

  onLoadAction_ = new QAction(tr("&Load"), this);
  onLoadAction_->setStatusTip(tr("Load previously saved game"));

  onSaveAction_ = new QAction(tr("&Save"), this);
  onSaveAction_->setStatusTip(tr("Save current game"));

  onPrevAction_ = new QAction(tr("&Undo move"), this);
  onPrevAction_->setStatusTip(tr("Undo last move. (only step of one color will be undone)"));

  onNextAction_ = new QAction(tr("&Redo move"), this);
  onNextAction_->setStatusTip(tr("Restore undone move"));

  onGoAction_ = new QAction(tr("&Go"), this);
  onGoAction_->setStatusTip(tr("Lets program make move"));

  onTurnBoardAction_ = new QAction(tr("&Turn board"), this);
  onTurnBoardAction_->setStatusTip(tr("Turn board to play another color"));
  onTurnBoardAction_->setCheckable(true);
  onTurnBoardAction_->setChecked(false);

  onHumanVsHumanAction_ = new QAction(tr("&Human vs. Human"), this);
  onHumanVsHumanAction_->setStatusTip(tr("Switch to Human with Human mode"));
  onHumanVsHumanAction_->setCheckable(true);
  onHumanVsHumanAction_->setChecked(false);

  QSettings settings(tr("Dimock"), tr("qchess"));
  onOpenBookAction_ = new QAction(tr("&Open book"), this);
  onOpenBookAction_->setStatusTip(tr("Use open book"));
  onOpenBookAction_->setCheckable(true);
  onOpenBookAction_->setChecked( settings.value(tr("open_book"), true).toBool() );

  onSettingsAction_ = new QAction(tr("Settin&gs"), this);
  onSettingsAction_->setStatusTip(tr("Change game settings"));

  gameMenu->addAction(onNewAction_);
  gameMenu->addAction(onLoadAction_);
  gameMenu->addAction(onSaveAction_);
  gameMenu->addAction(onPrevAction_);
  gameMenu->addAction(onNextAction_);
  gameMenu->addAction(onGoAction_);
  gameMenu->addAction(onTurnBoardAction_);
  gameMenu->addAction(onOpenBookAction_);
  gameMenu->addSeparator();
  gameMenu->addAction(onHumanVsHumanAction_);
  gameMenu->addSeparator();
  gameMenu->addAction(onSettingsAction_);

  connect(onNewAction_, SIGNAL(triggered()), this, SLOT(onNew()));
  connect(onLoadAction_, SIGNAL(triggered()), this, SLOT(onLoad()));
  connect(onSaveAction_, SIGNAL(triggered()), this, SLOT(onSave()));
  connect(onPrevAction_, SIGNAL(triggered()), this, SLOT(onPrev()));
  connect(onNextAction_, SIGNAL(triggered()), this, SLOT(onNext()));
  connect(onGoAction_, SIGNAL(triggered()), this, SLOT(onGo()));
  connect(onTurnBoardAction_, SIGNAL(toggled(bool)), this, SLOT(onTurnBoard(bool)));
  connect(onHumanVsHumanAction_, SIGNAL(toggled(bool)), this, SLOT(onHumanWithHumanMode(bool)));
  connect(onOpenBookAction_, SIGNAL(toggled(bool)), this, SLOT(onUseOpenBook(bool)));
  connect(onSettingsAction_, SIGNAL(triggered()), this, SLOT(onSettings()));
}