예제 #1
0
void WidgetIrcMain::connectToImpl(const ConnectionInfo& connection)
{
	Session* session = Session::fromConnection(connection, this);
    session->setEncoding(Application::encoding());
    if (session->userName().isEmpty())
        session->setUserName("quazaa");
	if (!session->hasQuit() && session->ensureNetwork())
		session->open();
    tabWidget->addSession(session);

	connect(session, SIGNAL(activeChanged(bool)), this, SLOT(updateSession()));
	connect(session, SIGNAL(connectedChanged(bool)), this, SLOT(updateSession()));
	updateSession(session);

    SessionTabWidget* tab = tabWidget->sessionWidget(session);
    connect(tab, SIGNAL(viewAdded(WidgetIrcMessageView*)), this, SLOT(viewAdded(WidgetIrcMessageView*)));
    connect(tab, SIGNAL(viewRemoved(WidgetIrcMessageView*)), this, SLOT(viewRemoved(WidgetIrcMessageView*)));
    connect(tab, SIGNAL(viewRenamed(WidgetIrcMessageView*)), this, SLOT(viewRenamed(WidgetIrcMessageView*)));
    connect(tab, SIGNAL(viewActivated(WidgetIrcMessageView*)), this, SLOT(viewActivated(WidgetIrcMessageView*)));
    connect(tab, SIGNAL(editSession(Session*)), this, SLOT(editSession(Session*)));

    if (WidgetIrcMessageView* view = tab->viewAt(0)) {
        treeWidget->addView(view);
        treeWidget->setCurrentView(view);
        treeWidget->parentWidget()->show();
        view->applySettings();
    }

    if (!quazaaSettings.WinMain.ChatUserListSplitter.isEmpty())
        tab->restoreSplitter(quazaaSettings.WinMain.ChatUserListSplitter);
}
void SessionWidget::openSyncSession()
{
    clearError();
    session->open();
    session->waitForOpened();
    updateSession();
}
// virtual
BOOL FSFloaterVoiceControls::postBuild()
{
	mAvatarList = getChild<LLAvatarList>("speakers_list");
	mAvatarListRefreshConnection = mAvatarList->setRefreshCompleteCallback(boost::bind(&FSFloaterVoiceControls::onAvatarListRefreshed, this));

	childSetAction("leave_call_btn", boost::bind(&FSFloaterVoiceControls::leaveCall, this));

	mNonAvatarCaller = findChild<LLNonAvatarCaller>("non_avatar_caller");
	mNonAvatarCaller->setVisible(FALSE);

	mVolumeSlider = findChild<LLSliderCtrl>("volume_slider");
	mMuteButton = findChild<LLButton>("mute_btn");

	if (mVolumeSlider && mMuteButton)
	{
		mAvatarList->setCommitCallback(boost::bind(&FSFloaterVoiceControls::onParticipantSelected, this));
		mVolumeSlider->setCommitCallback(boost::bind(&FSFloaterVoiceControls::onVolumeChanged, this));
		mMuteButton->setCommitCallback(boost::bind(&FSFloaterVoiceControls::onMuteChanged, this));
	}

	initAgentData();

	connectToChannel(LLVoiceChannel::getCurrentVoiceChannel());

	updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730)
	
	updateSession();
	return TRUE;
}
// virtual
BOOL LLCallFloater::postBuild()
{
	LLTransientDockableFloater::postBuild();
	mAvatarList = getChild<LLAvatarList>("speakers_list");
	mAvatarListRefreshConnection = mAvatarList->setRefreshCompleteCallback(boost::bind(&LLCallFloater::onAvatarListRefreshed, this));

	childSetAction("leave_call_btn", boost::bind(&LLCallFloater::leaveCall, this));

	mNonAvatarCaller = findChild<LLNonAvatarCaller>("non_avatar_caller");
	mNonAvatarCaller->setVisible(FALSE);

	LLView *anchor_panel = LLBottomTray::getInstance()->getChild<LLView>("speak_flyout_btn");

	setDockControl(new LLDockControl(
		anchor_panel, this,
		getDockTongue(), LLDockControl::TOP));

	initAgentData();

	connectToChannel(LLVoiceChannel::getCurrentVoiceChannel());

	setIsChrome(true);
	//chrome="true" hides floater caption 
	if (mDragHandle)
		mDragHandle->setTitleVisible(TRUE);
	updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730)
	
	updateSession();

	return TRUE;
}
예제 #5
0
void MainWindow::connectToImpl(const ConnectionInfo& connection)
{
    Session* session = Session::fromConnection(connection, this);
    session->setEncoding(Application::encoding());
    session->setUserName("communi");
    if (!session->hasQuit() && session->ensureNetwork())
        session->open();
    tabWidget->addSession(session);
    if (treeWidget)
        treeWidget->setCurrentView(session);

    connect(session, SIGNAL(activeChanged(bool)), this, SLOT(updateSession()));
    connect(session, SIGNAL(connectedChanged(bool)), this, SLOT(updateSession()));
    updateSession(session);

    SessionTabWidget* tab = tabWidget->sessionWidget(session);
    connect(tab, SIGNAL(viewAdded(MessageView*)), this, SLOT(viewAdded(MessageView*)));
    connect(tab, SIGNAL(viewRemoved(MessageView*)), this, SLOT(viewRemoved(MessageView*)));
    connect(tab, SIGNAL(viewRenamed(QString,QString)), this, SLOT(viewRenamed(QString,QString)));
    connect(tab, SIGNAL(viewActivated(MessageView*)), this, SLOT(viewActivated(MessageView*)));
    connect(tab, SIGNAL(editSession(Session*)), this, SLOT(editSession(Session*)));

    QSettings settings;
    if (settings.contains("list"))
        tab->restoreSplitter(settings.value("list").toByteArray());
}
void LLCallFloater::updateState(const LLVoiceChannel::EState& new_state)
{
	LL_DEBUGS("Voice") << "Updating state: " << new_state << ", session name: " << sCurrentVoiceChannel->getSessionName() << LL_ENDL;
	if (LLVoiceChannel::STATE_CONNECTED == new_state)
	{
		updateSession();
	}
	else
	{
		reset(new_state);
	}
}
예제 #7
0
int updateZoom(int session,int uzoom){
	if(session<0||session>sessionCount){
		printf("\nONLY %d sessions are running !!",sessionCount);
		return 0;
	}
	if(zoom[session]==uzoom){
		printf("\nNo change !!\n");
		return 1;
	}
	updateSession(session,page[session],uzoom,width[session],height[session]);
	return 1;
}
SessionWidget::SessionWidget(const QNetworkConfiguration &config, QWidget *parent)
:   QWidget(parent), statsTimer(-1)
{
    setupUi(this);

#ifdef QT_NO_NETWORKINTERFACE
    interfaceName->setVisible(false);
    interfaceNameLabel->setVisible(false);
    interfaceGuid->setVisible(false);
    interfaceGuidLabel->setVisible(false);
#endif

    session = new QNetworkSession(config, this);

    connect(session, SIGNAL(stateChanged(QNetworkSession::State)),
            this, SLOT(updateSession()));
    connect(session, SIGNAL(error(QNetworkSession::SessionError)),
            this, SLOT(updateSessionError(QNetworkSession::SessionError)));

    updateSession();

    sessionId->setText(QString("0x%1").arg(qulonglong(session), 8, 16, QChar('0')));

    configuration->setText(session->configuration().name());

    connect(openSessionButton, SIGNAL(clicked()),
            this, SLOT(openSession()));
    connect(openSyncSessionButton, SIGNAL(clicked()),
            this, SLOT(openSyncSession()));
    connect(closeSessionButton, SIGNAL(clicked()),
            this, SLOT(closeSession()));
    connect(stopSessionButton, SIGNAL(clicked()),
            this, SLOT(stopSession()));
#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
    connect(deleteSessionButton, SIGNAL(clicked()),
            this, SLOT(deleteSession()));
#endif
}
// virtual
BOOL LLCallFloater::postBuild()
{
	mAvatarList = getChild<LLAvatarList>("speakers_list");
	mAvatarListRefreshConnection = mAvatarList->setRefreshCompleteCallback(boost::bind(&LLCallFloater::onAvatarListRefreshed, this));

	childSetAction("leave_call_btn", boost::bind(&LLCallFloater::leaveCall, this));

	mNonAvatarCaller = findChild<LLNonAvatarCaller>("non_avatar_caller");
	mNonAvatarCaller->setVisible(FALSE);

	initAgentData();

	connectToChannel(LLVoiceChannel::getCurrentVoiceChannel());

	updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730)
	
	updateSession();
	return TRUE;
}
void SessionWidget::stopSession()
{
    clearError();
    session->stop();
    updateSession();
}
void SessionWidget::closeSession()
{
    clearError();
    session->close();
    updateSession();
}
void SessionWidget::openSession()
{
    clearError();
    session->open();
    updateSession();
}
예제 #13
0
void SessionWidget::stopSession()
{
    session->stop();
    updateSession();
}
예제 #14
0
void SessionWidget::closeSession()
{
    session->close();
    updateSession();
}
예제 #15
0
void SessionWidget::openSession()
{
    session->open();
    updateSession();
}
예제 #16
0
int main() {
  // Initial setup
  signal(SIGINT, shutDown);
  openPath();
  instructions();
  srand(time(NULL));
  game_state currGame;
  memset(&currGame, 0, sizeof(game_state));

  // Sets up piezobuzzer for sound using designated PWM pin
  pwm = fopen("/sys/devices/bone_capemgr.9/slots", "w");
  fseek(pwm, 0, SEEK_END);
  fprintf(pwm, "am33xx_pwm");
  fprintf(pwm, "bone_pwm_P9_14");
  fflush(pwm);

  // Sets the pointers to the appropriate duty and period files
  dirDuty = fopen("/sys/devices/ocp.3/pwm_test_P9_14.15/duty", "w");
  dirT = fopen("/sys/devices/ocp.3/pwm_test_P9_14.15/period", "w");

  // Main game loop
  while (!currGame.quit) {
    char *playScreen = "                Press button    to start!       ";
    write(fd_lcd, playScreen, SCREEN_SIZE * 3);
    pressAnyButton();
    // usleep necessary here to prevent signal overlap once game begins
    usleep(500000);

    // Initializes the playing screen
    char symbolScreen[SCREEN_SIZE + 1];
    int i;
    for (i = 0; i < SCREEN_SIZE; i++) {
      symbolScreen[i] = ' ';
    }
    symbolScreen[SCREEN_SIZE] = '\0';

    session_state currSession;
    memset(&currSession, 0, sizeof(session_state));
    currSession.misses = -1;

    // Current game session loop
    while (currSession.misses < WRONG_GUESSES) {
      // When software counter resets, update to the next screen frame
      if (currSession.counter == 0) {
        // Respond to player's input
        if (currSession.correctInput && symbolScreen[0] != ' ') {
          currSession.currScore++;
        } else if (!currSession.correctInput) {
          currSession.misses++;
        }

        currSession.inputted = 0;
        currSession.correctInput = 0;

        if (nextScreenFrame(&currSession, symbolScreen) == -1) {
          shutDown();
          return EXIT_FAILURE;
        }
      }
      // Delay inbetween input update
      usleep(DELAY_TIME);

      // Reads the current status of the button inputs
      read(fd_but, currGame.inputs, NUM_BUTTONS * sizeof(int));
      currSession.pressed = 5;
      for (i = 0; i < NUM_BUTTONS; i++) {
        if (currGame.inputs[i] == 1) {
          currSession.pressed = i;
        }
      }

      // Play sound on buzzer which corresponds to the input
      // This is done less often to improve smoothness of gameplay
      if (currSession.counter % 15 == 0) {
        if (currSession.pressed == 0) {
          buzzer(noteA);
        } else if (currSession.pressed == 1) {
          buzzer(noteB);
        } else if (currSession.pressed == 2) {
          buzzer(noteC);
        } else if (currSession.pressed == 3) {
          buzzer(noteD);
        } else if (currSession.pressed == 4) {
          buzzer(noteE);
        } else {
          buzzer(0);
        }
      }

      updateSession(&currSession, symbolScreen[0]);
    }
    printGameOver(currSession.currScore, &(currGame.highScore));
    pressAnyButton();
    usleep(500000);

    // Prompts user to choose to play again
    currGame.quit = wantToQuit();
    usleep(500000);
  }
  shutDown();
  return EXIT_SUCCESS;
}