Example #1
0
// NPP_ call translator
DWORD nsPluginThread::callNPP(npapiAction aAction, DWORD aP1, DWORD aP2, 
                              DWORD aP3, DWORD aP4, DWORD aP5, 
                              DWORD aP6, DWORD aP7)
{
  // don't enter untill thread is ready
  while (isBusy()) {
    Sleep(0);
  }

  mP1 = aP1;
  mP2 = aP2;
  mP3 = aP3;
  mP4 = aP4;
  mP5 = aP5;
  mP6 = aP6;
  mP7 = aP7;

  doAction(aAction);

  // don't return untill thread is ready
  while (isBusy()) {
    Sleep(0);
  }

  return NPERR_NO_ERROR;
}
Example #2
0
BtStatus handle_profile_disconnect(bt_addr_struct *bd_addr, PROFILE_enum id)
{
	int     state = PROFILE_STATE_DISCONNECTED;
    dev_op *devOp = getDeviceOpList(bd_addr);
	profile_op_queue_t *opNode = NULL;

	if(devOp == NULL)
	{
		ALOGW("%s null devOp list!\n", __FUNCTION__);
		return BT_STATUS_FAILED;
	}
	
	ALOGI("%s addr:[0x%lX:0x%X:0x%X], profile[%d], old[%d]!\n",
		  __FUNCTION__, bd_addr->lap, bd_addr->uap, bd_addr->nap, id, state);
	memcpy(&devOp->bd_addr, bd_addr, sizeof(bt_addr_struct));
	memcpy(&g_cur_dev, bd_addr, sizeof(bt_addr_struct));
	removeOp(bd_addr, id, PROFILE_OP_CONNECT);
	state = getProfileState(bd_addr, id);
	if(((state == PROFILE_STATE_CONNECTED) && !isBusy(bd_addr))
		|| ((state == PROFILE_STATE_CONNECTING) && isBusy(bd_addr)))
	{
		disconnect_profile_int(bd_addr, id);
	}
	else
	{
		insertOp(bd_addr, id, PROFILE_OP_DISCONNECT);
	}
	/*
	if((state == PROFILE_STATE_CONNECTING)
	   || (state == PROFILE_STATE_CONNECTED))
	{
		disconnect_profile_int(bd_addr, id);
	}*/
	return BT_STATUS_SUCCESS;
}
Example #3
0
void AB2KSounds::playFileName(const char * fname, bool wait_for_end)
{
  // this is pre-emptive.   If anything else is going on, we cause it to quit.
  if(isBusy()) smod->println("q");

  smod->print("P"); smod->println(fname); 
  while(!isBusy()) delay(1); // wait for the sound to start. 

  if(wait_for_end) {
    while(isBusy()) delay(1); 
  }
  flushInput(); 
}
Example #4
0
void GLWidget::wheelEvent(QWheelEvent *event)
{
    
      if(isBusy())
        return;

    if(cameraZoomIsEnabled_)
    {
        // Ratio to apply
        double ratio = pow( 0.8f, (double) event->delta() / (double) 120.0f);

        // Clamp to avoid getting too far out
        double x = camera2D_.zoom() / ratio;
        if(x<0.01)
            x = 0.01;
        if(x>1e5)
            x = 1e5;
        ratio = camera2D_.zoom() / x;

        // 3D
        camera_.setR( camera_.r() * ratio );

        // 2D
        ratio = 1/ratio;
        camera2D_.setZoom( camera2D_.zoom() * ratio );
        camera2D_.setX( mouse_Event_X_ + ratio * ( camera2D_.x() - mouse_Event_X_ ) );
        camera2D_.setY( mouse_Event_Y_ + ratio * ( camera2D_.y() - mouse_Event_Y_ ) );

        autoCenterScene_ = false;
        emit viewChanged(mouse_Event_X_, mouse_Event_Y_);
    }
}
void VimeoPlaylistDialog::createNewPlaylist() {
    if (isBusy()) {
        return;
    }
    
    QVariantMap playlist;
    playlist["name"] = m_titleEdit->text();
    
    QString description = m_descriptionEdit->toPlainText();
    
    if (!description.isEmpty()) {
        playlist["description"] = description;
    }
        
    if (!m_passwordEdit->text().isEmpty()) {
        playlist["privacy"] = "password";
        playlist["password"] = m_passwordEdit->text();
    }
        
    m_playlist = new VimeoPlaylist(playlist, this);
    connect(m_playlist, SIGNAL(statusChanged(QVimeo::ResourcesRequest::Status)),
                this, SLOT(onPlaylistStatusChanged(QVimeo::ResourcesRequest::Status)));
    
    m_playlist->addVideo(m_video);
}
void RKConsole::tryNextInBatch (bool add_new_line) {
	RK_TRACE (APP);
	if (add_new_line) {
		if (RKSettingsModuleConsole::maxConsoleLines ()) {
			uint c = (uint) doc->numLines();
			setUpdatesEnabled (false);
			for (uint ui = c; ui > RKSettingsModuleConsole::maxConsoleLines (); --ui) {
				editInterface(doc)->removeText (0, 0,0, editInterface(doc)->textLine(0).length());
			}
			setUpdatesEnabled (true);
		}
		editInterface(doc)->insertText (doc->numLines ()-1, 0, prefix);		// somehow, it seems to be safer to do this after removing superfluous lines, than before
		cursorAtTheEnd ();
	}

	if (!commands_batch.isEmpty()) {
		// If we were not finished executing a batch of commands, we execute the next one.
		setCurrentCommand (currentCommand () + commands_batch.first ());
		commands_batch.pop_front ();
		if (!commands_batch.isEmpty ()){
			submitCommand ();
			return;
		}
		// We would put this here if we would want the last line to be executed. We generally don't want this, as there is an empty last item, if there is a newline at the end.
		//TODO: deal with this kind of situation better.
		//commands_batch.erase(commands_batch.begin());
	}

	current_command = 0;
	interrupt_command_action->setEnabled (isBusy ());
}
Example #7
0
void OwncloudSetupWizard::slotCreateOCLocalhost()
{
  if( isBusy() ) {
    qDebug() << "Can not install now, busy. Come back later.";
    return;
  }

  qDebug() << "Install OC on localhost";

  QStringList args;

  args << QLatin1String("install");
  args << QLatin1String("--server-type") << QLatin1String("local");
  args << QLatin1String("--root_helper") << QLatin1String("kdesu -c");

  const QString adminUser = _ocWizard->field(QLatin1String("OCUser")).toString();
  const QString adminPwd  = _ocWizard->field(QLatin1String("OCPasswd")).toString();

  args << QLatin1String("--admin-user") << adminUser;
  args << QLatin1String("--admin-password") << adminPwd;

  runOwncloudAdmin( args );

  // define
  _ocWizard->setField( QLatin1String("OCUrl"), QLatin1String( "http://localhost/owncloud/") );
}
Example #8
0
void OwncloudSetupWizard::slotInstallOCServer()
{
  if( isBusy() ) {
    qDebug() << "Can not install now, busy. Come back later.";
    return;
  }

  const QString server = _ocWizard->field(QLatin1String("ftpUrl")).toString();
  const QString user   = _ocWizard->field(QLatin1String("ftpUser")).toString();
  const QString passwd = _ocWizard->field(QLatin1String("ftpPasswd")).toString();
  const QString adminUser = _ocWizard->field(QLatin1String("OCUser")).toString();
  const QString adminPwd  = _ocWizard->field(QLatin1String("OCPasswd")).toString();

  qDebug() << "Install OC on " << server << " as user " << user;

  QStringList args;
  args << QLatin1String("install");
  args << QLatin1String("--server-type") << QLatin1String("ftp");
  args << QLatin1String("--server")   << server;
  args << QLatin1String("--ftp-user")     << user;
  if( ! passwd.isEmpty() ) {
    args << QLatin1String("--ftp-password") << passwd;
  }
  args << QLatin1String("--admin-user") << adminUser;
  args << QLatin1String("--admin-password") << adminPwd;

  runOwncloudAdmin( args );
  _ocWizard->setField( QLatin1String("OCUrl"), QString::fromLatin1( "%1/owncloud/")
                       .arg(_ocWizard->field(QLatin1String("myOCDomain")).toString() ));
}
Example #9
0
int readRegADS(char rAddr) {
	UCB0I2CRead(2, &result[0], rAddr);
	while (isBusy())
		;

	return result[0] << 8 | result[1];
}
Example #10
0
void WT588D::play(uint8_t nr) const {
  nr = constrain(nr, 0, MAX_TRACK_VALUE);
  sendCommand(nr, true);
  while (!isBusy()) {

  }
}
Example #11
0
void FlashDev::BulkErase (void)
{
	while (isBusy ()) { };
	WriteEnable ();
	u16 d = 0xC7;
//	while (spi.isBusy());
	spi.Write (&d, 1, Spi::Flash);
}
Example #12
0
void FlashDev::PageProgram2 (u32 addr, u16* src, u16 len)
{
	while (isBusy ()) { };
	WriteEnable ();
	u64 d = ((u64)addr & 0x00ffffff) | 0x02000000LL;
//	while (spi.isBusy());
	spi.Write2 (&d, 4,src,len, Spi::Flash);
}
Example #13
0
void FlashDev::SectorErase (u32 addr)
{
	while (isBusy ()) { };
	WriteEnable ();
	u32 d = addr | 0xD8000000L;
//	while (spi.isBusy());
	spi.Write (&d, 4, Spi::Flash);
}
Example #14
0
void FlashDev::PageProgram2 (u32 addr, u16 data)
{
	while (isBusy ()) { };
	WriteEnable ();
	u64 d = (((u64)addr & 0x00ffffff) << 8) | 0x0200000000LL | (data & 0xff);
//	while (spi.isBusy());
	spi.Write (&d, 5, Spi::Flash);
}
Example #15
0
void FlashDev::PageProgram (u32 addr, u16 data)
{
	while (isBusy ()) { };
	WriteEnable ();
	u64 d = ((u64)addr<<16) | 0x020000000000LL | data;
//	while (spi.isBusy());
	spi.Write (&d, 6, Spi::Flash);
}
Example #16
0
bool FlycamOne::takePhoto()
{
	if (isBusy() || m_camMode != CamMode_Photo)
	{
		return false;
	}
	setCommand(Command_StartStop);
	return true;
}
Example #17
0
bool FlycamOne::stopRecording()
{
	if (isBusy() || isRecording() == false || m_camMode == CamMode_Photo)
	{
		return false;
	}
	setCommand(Command_StartStop);
	return true;
}
Example #18
0
void AB2KSounds::stop()
{
  if(isBusy()) {
    while(smod->available()) smod->read();      
    smod->println("q");
    char lb[20]; 
    smod->readBytesUntil('\n', lb, 20);
  }
}
void SoundCloudPlaylistWindow::downloadTrack() {
    if ((!isBusy()) && (m_view->currentIndex().isValid())) {
        QString id = m_view->currentIndex().data(SoundCloudTrackModel::IdRole).toString();
        QString title = m_view->currentIndex().data(SoundCloudTrackModel::TitleRole).toString();
        
        SoundCloudDownloadDialog *dialog = new SoundCloudDownloadDialog(id, title, this);
        dialog->open();
    }
}
void SoundCloudPlaylistWindow::queueTrack() {
    if (isBusy()) {
        return;
    }
    
    if (SoundCloudTrack *track = m_model->get(m_view->currentIndex().row())) {
        AudioPlayer::instance()->addTrack(track);
        QMaemo5InformationBox::information(this, tr("'%1' added to playback queue").arg(track->title()));
    }
}
void SoundCloudPlaylistWindow::showContextMenu(const QPoint &pos) {
    if ((!isBusy()) && (m_view->currentIndex().isValid())) {
        if (m_favouriteAction) {
            m_favouriteAction->setText(m_view->currentIndex().data(SoundCloudTrackModel::FavouriteRole).toBool()
                                              ? tr("Unfavourite") : tr("Favourite"));
        }
        
        m_contextMenu->popup(pos, m_queueAction);
    }
}
Example #22
0
void RubiksCube::Scramble()
{
	//printf("Scramble();\n");
	if(!isBusy())
	{
		//printf("Not Busy\n");
		Scrambling=true;
		scramblecount=20;
	}
}
void SoundCloudPlaylistWindow::showTrack(const QModelIndex &index) {
    if (isBusy()) {
        return;
    }
    
    if (SoundCloudTrack *track = m_model->get(index.row())) {
        SoundCloudTrackWindow *window = new SoundCloudTrackWindow(track, this);
        window->show();
    }
}
Example #24
0
void PreviewThread::setPath(QString path)
// ----------------------------------------------------------------------------
//    Record the path where we will save the picture and trigger save
// ----------------------------------------------------------------------------
{
    QMutexLocker locker(&mutex);
    this->path = path;
    if (!image.isNull() && !isBusy())
        emit imageAvailable();
}
Example #25
0
int writeRegCDC(char rAddr, int value) {

	unsigned char cmd[2];
	cmd[0] = rAddr;
	cmd[1] = value;
	I2CWrite(2, &cmd[0]);
	while (isBusy())
		;

	return 1;
}
Example #26
0
Encode_Status VaapiEncoderBase::encode(const SharedPtr<VideoFrame>& frame)
{
    if (!frame || !frame->surface)
        return ENCODE_INVALID_PARAMS;
    if (isBusy())
        return ENCODE_IS_BUSY;
    SurfacePtr surface = createSurface(frame);
    if (!surface)
        return ENCODE_INVALID_PARAMS;
    return doEncode(surface, frame->timeStamp, frame->flags & VIDEO_FRAME_FLAGS_KEY);
}
Example #27
0
bool resolveRAW(instruction_t *instr, int current_cycle){
    int i;
    for(i = 0; i < 3; i++){
        //If the tom_cdb_cycle variable has not been set, still busy
        if(isBusy(instr->Q[i], current_cycle)){
            return false;
        }
    }
    //All elements of Q have their tom_cdb_cycle set, we are good to go.
    return true;
}
void SoundCloudPlaylistWindow::playTrack(const QModelIndex &index) {
    if (isBusy()) {
        return;
    }
    
    if (SoundCloudTrack *track = m_model->get(index.row())) {
        AudioPlayer::instance()->playTrack(track);
        NowPlayingWindow *window = new NowPlayingWindow(this);
        window->show();
    }
}
void VimeoUserWindow::setUserSubscription() {
    if (isBusy()) {
        return;
    }
    
    if (m_user->isSubscribed()) {
        m_user->unsubscribe();
    }
    else {
        m_user->subscribe();
    }
}
Example #30
0
void RenderAf::solvingFinished()
{
	// If render was busy but has no tasks after solve it is not busy now
	// Needed not to reset busy render status if it run one task after other

	if( isBusy() && ( m_tasks.size() == 0))
	{
		setBusy( false);
		m_task_start_finish_time = time( NULL);
		store();
	}
}