bool com_ximeta_driver_NDASLogicalDevice::IsMounted()
{
	if (!fUnitDevice) {
		return false;
	}
	
	// Update Status.
	updateStatus();
	
	switch(Status()) {
		case kNDASUnitStatusConnectedRO:
		case kNDASUnitStatusConnectedRW:
		case kNDASUnitStatusReconnectRO:
		case kNDASUnitStatusReconnectRW:
		{
			return true;
		}
			break;
		default:
			return false;
	}
}
Example #2
0
ContactUser::ContactUser(UserIdentity *ident, int id, QObject *parent)
    : QObject(parent)
    , identity(ident)
    , uniqueID(id)
    , m_connection(0)
    , m_outgoingSocket(0)
    , m_lastReceivedChatID(0)
    , m_contactRequest(0)
    , m_settings(0)
    , m_conversation(0)
{
    Q_ASSERT(uniqueID >= 0);

    m_settings = new SettingsObject(QStringLiteral("contacts.%1").arg(uniqueID));
    connect(m_settings, &SettingsObject::modified, this, &ContactUser::onSettingsModified);

    m_conversation = new ConversationModel(this);
    m_conversation->setContact(this);

    loadContactRequest();
    updateStatus();
}
void VehicleControlDeviceImplementation::storeObject(CreatureObject* player, bool force) {
	ManagedReference<TangibleObject*> controlledObject = this->controlledObject.get();

	if (controlledObject == NULL)
		return;

	/*if (!controlledObject->isInQuadTree())
		return;*/

	if (!force && (player->isInCombat() || player->isDead()))
		return;

	if (player->isRidingMount() && player->getParent() == controlledObject) {

		if (!force && !player->checkCooldownRecovery("mount_dismount"))
			return;

		player->executeObjectControllerAction(STRING_HASHCODE("dismount"));

		if (player->isRidingMount())
			return;
	}

	Locker crossLocker(controlledObject, player);

	Reference<Task*> decayTask = controlledObject->getPendingTask("decay");

	if (decayTask != NULL) {
		decayTask->cancel();
		controlledObject->removePendingTask("decay");
	}

	controlledObject->destroyObjectFromWorld(true);

	if (controlledObject->isCreatureObject())
		(cast<CreatureObject*>(controlledObject.get()))->setCreatureLink(NULL);

	updateStatus(0);
}
Example #4
0
void DuktoProtocol::sendMetaData()
{
    // Impostazione buffer di invio
#if defined(Q_OS_WIN)
    int v = 49152;
    ::setsockopt(mCurrentSocket->socketDescriptor(), SOL_SOCKET, SO_SNDBUF, (char*)&v, sizeof(v));
#endif

    // Header
    //  - N. entità (file, cartelle, ecc...)
    //  - Dimensione totale
    //  - Nome primo file
    //  - Dimensione primo (e unico) file (-1 per una cartella)

    QByteArray header;
    qint64 tmp;

    // N. entità
    tmp = mFilesToSend.count();
    header.append((char*) &tmp, sizeof(tmp));
    // Dimensione totale
    mTotalSize = computeTotalSize(mFilesToSend);
    header.append((char*) &mTotalSize, sizeof(mTotalSize));

    // Primo elemento
    header.append(nextElementHeader());

    // Invio header
    mCurrentSocket->write(header);

    // Inizializzazione variabili
    mTotalSize += header.size();
    mSentData = 0;
    mSentBuffer = 0;

    // Aggiornamento interfaccia utente
    updateStatus();
}
Example #5
0
/* Clickski! */
int evtMouseDown(struct pgEvent *evt) {
   int lx,ly;
   light *p;
   int i;
   
   /* What light was it in? */
   lx = (evt->e.pntr.x - bx) / lightw;
   ly = (evt->e.pntr.y - by) / lighth;

   if (evt->e.pntr.x < bx || lx >= boardwidth ||
       evt->e.pntr.y < by || ly >= boardwidth)
     return 0;

   invertLight(lx,ly);
   invertLight(lx-1,ly);
   invertLight(lx+1,ly);
   invertLight(lx,ly-1);
   invertLight(lx,ly+1);
   SOLUTION(lx,ly) ^= 1;
   
   /* Update the screen */
   pgWriteCmd(evt->from,PGCANVAS_INCREMENTAL,0);
   moves++;
   updateStatus();

   /* A win condition? */
   for (i=boardsize,p=board;i;i--,p++)
     if (*p)
       return 0; /* Nope. */
   
   /* Yep! */
   pgMessageDialogFmt("Blackout!",0,
		      "You completed level %d!\n\n"
		      "Moves: %d",level,moves);
   startLevel(level+1);
   
   return 0;
}
Example #6
0
int
CClientApp::mainLoop()
{
	// create socket multiplexer.  this must happen after daemonization
	// on unix because threads evaporate across a fork().
	CSocketMultiplexer multiplexer;

	// start client, etc
	appUtil().startNode();
	
	// init ipc client after node start, since create a new screen wipes out
	// the event queue (the screen ctors call adoptBuffer).
	if (argsBase().m_enableIpc) {
		initIpcClient();
	}

	// load all available plugins.
	ARCH->plugin().init(s_clientScreen->getEventTarget());

	// run event loop.  if startClient() failed we're supposed to retry
	// later.  the timer installed by startClient() will take care of
	// that.
	DAEMON_RUNNING(true);
	EVENTQUEUE->loop();
	DAEMON_RUNNING(false);

	// close down
	LOG((CLOG_DEBUG1 "stopping client"));
	stopClient();
	updateStatus();
	LOG((CLOG_NOTE "stopped client"));

	if (argsBase().m_enableIpc) {
		cleanupIpcClient();
	}

	return kExitSuccess;
}
Example #7
0
Bladerf1OutputGui::Bladerf1OutputGui(DeviceUISet *deviceUISet, QWidget* parent) :
	QWidget(parent),
	ui(new Ui::Bladerf1OutputGui),
	m_deviceUISet(deviceUISet),
	m_doApplySettings(true),
	m_forceSettings(true),
	m_settings(),
	m_deviceSampleSink(NULL),
	m_sampleRate(0),
	m_lastEngineState(DSPDeviceSinkEngine::StNotStarted)
{
    m_deviceSampleSink = (Bladerf1Output*) m_deviceUISet->m_deviceSinkAPI->getSampleSink();

	ui->setupUi(this);
	ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
	ui->centerFrequency->setValueRange(7, BLADERF_FREQUENCY_MIN_XB200/1000, BLADERF_FREQUENCY_MAX/1000);

    ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow));
    ui->sampleRate->setValueRange(8, BLADERF_SAMPLERATE_MIN, BLADERF_SAMPLERATE_REC_MAX);

	ui->bandwidth->clear();

	for (unsigned int i = 0; i < BladerfBandwidths::getNbBandwidths(); i++)
	{
		ui->bandwidth->addItem(QString::number(BladerfBandwidths::getBandwidth(i)));
	}

	connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
	connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
	m_statusTimer.start(500);

    CRightClickEnabler *startStopRightClickEnabler = new CRightClickEnabler(ui->startStop);
    connect(startStopRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(openDeviceSettingsDialog(const QPoint &)));

	displaySettings();

	connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
}
Example #8
0
Frontend::Frontend(QWidget* parent)
	: QWidget(parent)
{
	instructions = new QLabel;
	convert = new QPushButton(tr("&Convert"));
	status = new QLabel;

	instructions->setText(tr("Instructions will go here."));
	instructions->setWordWrap(true);

	QVBoxLayout* layout = new QVBoxLayout;
	layout->addWidget(instructions);
	layout->addWidget(convert);
	layout->addWidget(status);
	setLayout(layout);

	transcoder = new Transcoder(QString("test.flv"));

	// when user clicks "Convert", start transcoding
	connect(convert, SIGNAL(released()), this, SLOT(transcode()));
	connect(transcoder, SIGNAL(statusUpdate(QString)),
		this, SLOT(updateStatus(QString)));
}
Example #9
0
void NetworkManager::requestFinished(QNetworkReply *reply)
{
	if (!m_useSimpleMode)
	{
		m_replies.remove(reply);

		if (m_replies.isEmpty())
		{
			killTimer(m_updateTimer);

			m_updateTimer = 0;

			updateStatus();
		}

		++m_finishedRequests;
	}

	if (!m_useSimpleMode && reply)
	{
		disconnect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(downloadProgress(qint64,qint64)));
	}
}
Example #10
0
bool
JouleDevice::getSystemInfo(JoulePacket &response, QString &err)
{
    emit updateStatus(tr("Get System info..."));
    if (JOULE_DEBUG) printf("Get System info\n");

    JoulePacket request(READ_SYSTEM_INFO);

    if (!request.write(dev, err)) return false;

    response = JoulePacket(READ_SYSTEM_INFO);
    if (response.read(dev, err)) {

        if (response.payload.length()>3) {
            //array = response.dataArray();
            //int  = qByteArray2Int(response.payload.left(4));
            //QString system = QString("%1").arg(serial);

            return true;
        }
    }
    return false;
}
void AutoGraspGenerationDlg::spaceSearchBox_activated( const QString &s )
{
  if ( s==QString("Complete") ) {
    mHandObjectState->setPositionType(SPACE_COMPLETE);
    mHandObjectState->setRefTran( mObject->getTran() );
  }  else if ( s==QString("Axis-angle") ) {
    mHandObjectState->setPositionType(SPACE_AXIS_ANGLE);
    mHandObjectState->setRefTran( mObject->getTran() );
  } else if ( s==QString("Ellipsoid") ) {
    mHandObjectState->setPositionType(SPACE_ELLIPSOID);
    mHandObjectState->setRefTran( mObject->getTran() );
  } else if ( s==QString("Approach") ) {
    mHandObjectState->setPositionType(SPACE_APPROACH);
    mHandObjectState->setRefTran( mHand->getTran() );
  } else {
    fprintf(stderr,"WRONG SEARCH TYPE IN DROP BOX!\n");
  }
  mHandObjectState->reset();
  updateVariableLayout();
  //force a reset of the planner
  if (mPlanner) mPlanner->invalidateReset();
  updateStatus();
}
void SenseMePetClass::updateMood(){

  updateStatus();
  
  if(status == 0)
  {
    SenseMeLEDMatrix.setFace("happy");
  }
  else if(status == 1)
  {
    SenseMeLEDMatrix.setFace("sad");
  }
  else if(status == 2)
  {
    SenseMeLEDMatrix.setFace("yawn");
  }
  else if(status == 3)
  {
    SenseMeLEDMatrix.setFace("sleep");
  }


}
Example #13
0
void CellModemManager::forwardingStatus(QCallForwarding::Reason reason,
        const QList<QCallForwarding::Status>& status)
{
    if(reason == QCallForwarding::Unconditional) {
        bool callFwdState = false;
        QList<QCallForwarding::Status>::ConstIterator it;
        for(it = status.begin(); it != status.end(); ++it) {
            if(((*it).cls & QTelephony::CallClassVoice) != 0) {
                callFwdState = true;
                break;
            }
        }

        if(callFwdState == d->m_callForwardingEnabled)
            return;

        d->m_callForwardingEnabled = callFwdState;
        if(Ready == state()) {
            emit callForwardingEnabledChanged(callFwdState);
            updateStatus();
        }
    }
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicFileHierarchyDialog::slotFindOrCancelButtonClicked()
{
    if (m_findOrCancelButton->text() == FIND_BUTTON_FIND_TEXT)
    {
        clearFileList();

        if(!m_fileList->isVisible())
        {
            m_fileListLabel->setVisible(true);
            m_fileList->setVisible(true);

            if(height() < DEFAULT_DIALOG_FIND_HEIGHT) resize(width(), DEFAULT_DIALOG_FIND_HEIGHT);
        }

        m_findOrCancelButton->setText(FIND_BUTTON_CANCEL_TEXT);

        m_cancelPressed = false;
        m_files = findMatchingFiles();

        m_findOrCancelButton->setText(FIND_BUTTON_FIND_TEXT);

        if (m_cancelPressed)
        {
            clearFileList();
        }
        else if(m_files.isEmpty())
        {
            updateStatus(NO_FILES_FOUND);
        }

        setOkButtonEnabled(!m_files.isEmpty());
    }
    else
    {
        m_cancelPressed = true;
    }
}
Example #15
0
bool animSleep(int ms) {
	if (sleepInterrupted) {
		return false;
	}
	scriptReleaseGIL();
	int time = glutGet(GLUT_ELAPSED_TIME);
	int returnAt = time + ms;
	int wakeAt, wakeAfter;
	animSleepActive=true;

	while ((ms=returnAt-time)>0) {
		wakeAfter=animFrameDelay;
		if (wakeAfter > animResponseDelay)
			wakeAfter=animResponseDelay;
		if (wakeAfter > ms)
			wakeAfter=ms;
		wakeAt=time+wakeAfter;

		updateStatus(0, true, "script");
		glutMainLoopEvent();
		if (sleepInterrupted)
			break;

		time = glutGet(GLUT_ELAPSED_TIME);
		wakeAfter=wakeAt-time;
		if (wakeAfter>0) {
			utilSleep(wakeAfter);
		}
		time = glutGet(GLUT_ELAPSED_TIME);
	}
	glutMainLoopEvent();
	animSleepActive=false;
	scriptAcquireGIL();
	scriptEventsSchedulePending();
	hidInvokeWaitingEvents();
	return !sleepInterrupted;
}
int
CClientApp::mainLoop()
{
	// create socket multiplexer.  this must happen after daemonization
	// on unix because threads evaporate across a fork().
	CSocketMultiplexer multiplexer;

	// create the event queue
	CEventQueue eventQueue;

	// start client, etc
	appUtil().startNode();

	// load all available plugins.
	ARCH->plugin().init(s_clientScreen->getEventTarget());

	// run event loop.  if startClient() failed we're supposed to retry
	// later.  the timer installed by startClient() will take care of
	// that.
	CEvent event;
	DAEMON_RUNNING(true);
	EVENTQUEUE->getEvent(event);
	while (event.getType() != CEvent::kQuit) {
		EVENTQUEUE->dispatchEvent(event);
		CEvent::deleteData(event);
		EVENTQUEUE->getEvent(event);
	}
	DAEMON_RUNNING(false);

	// close down
	LOG((CLOG_DEBUG1 "stopping client"));
	stopClient();
	updateStatus();
	LOG((CLOG_NOTE "stopped client"));

	return kExitSuccess;
}
Example #17
0
void cutterDialog::on_pushButtonCut_clicked()
{
    if(stopPos-startPos>0)
    {QString dir = rphFile::getDir(this,"Open a Directory for output:","");


        if (!dir.isEmpty())
        {
            ffProcess = new QProcess(this);
            QObject::connect(ffProcess,SIGNAL(readyReadStandardOutput()),this,SLOT(readffmpegoutput()));
            QObject::connect(ffProcess,SIGNAL(finished(int)),this,SLOT(completed(int)));


            mp->stop();
            if (mpp)
                mpp->stop();

            coreTimer = new QTimer(this);

            QObject::connect(coreTimer, SIGNAL(timeout()), this,SLOT(updateStatus()));
            coreTimer->setInterval(1);
            QObject::connect(ffProcess,SIGNAL(started()),coreTimer ,SLOT(start()));

            ui->progressBar->setMaximum(0);
            ui->progressBar->setVisible(true);
            ui->pushButtonclose->setEnabled(true);
            QStringList arguments;
            QFileInfo fi(shortPathName(mp->filepath()));

            cfile=new  QFile(dir+"strip_"+fi.baseName()+"."+fi.suffix());
            filepath=shortPathName(dir+"strip_"+fi.baseName()+"."+fi.suffix());
            arguments<<"-ss"<<QString::number(startPos)<<"-t"<<QString::number(stopPos-startPos)<<"-i"<<shortPathName(mp->filepath())<<"-c"<<"copy"<<"-y"<<dir+"strip_"+fi.baseName()+"."+fi.suffix();
             qDebug()<< arguments;
            ffProcess->start(qApp->applicationDirPath()+"/ffmpeg.exe", arguments);
            ui->pushButtonpre->setEnabled(false);
            //coreTimer->start();
        }
Example #18
0
void RecordDialog::getData()
{
	if (!m_handler->check() || !m_handler->convert())
		return;

	if (!m_bDataReceived)
	{
		m_bDataReceived = true;
		updateStatus();
	}

	// Process digital signals (and handle trigger)
	const QVector<short>& digital = m_handler->digitalRaw();
	int iRecording = -1;
	for (int i = 0; i < digital.size(); i++)
	{
		short n = digital[i];
		ui.digitalSignals->addSample(n);

		bool bTrigger = ((n & 0x01) > 0);
		// Start recording if the settings dialog isn't open, etc.
		if (
			!m_bOptionsDialogOpen && 
			Globals->idacSettings()->bRecordOnTrigger && 
			bTrigger)
		{
			iRecording = i;
		}
	}

	// Display EAD and FID data
	ui.eadSignal->addSamples(m_handler->eadDisplay());
	ui.fidSignal->addSamples(m_handler->fidDisplay());

	if (iRecording >= 0 || QFile::exists(QCoreApplication::applicationDirPath() + "/flag.TestRecording"))
		accept();
}
Example #19
0
FileSinkGui::FileSinkGui(DeviceUISet *deviceUISet, QWidget* parent) :
	QWidget(parent),
	ui(new Ui::FileSinkGui),
	m_deviceUISet(deviceUISet),
	m_doApplySettings(true),
	m_forceSettings(true),
	m_settings(),
	m_fileName("./test.sdriq"),
    m_deviceSampleSink(0),
    m_sampleRate(0),
    m_generation(false),
	m_startingTimeStamp(0),
	m_samplesCount(0),
	m_tickCount(0),
	m_lastEngineState(DSPDeviceSinkEngine::StNotStarted)
{
	ui->setupUi(this);

	ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
	ui->centerFrequency->setValueRange(7, 0, pow(10,7));

    ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow));
    ui->sampleRate->setValueRange(7, 32000U, 9000000U);

	ui->fileNameText->setText(m_fileName);

	connect(&(m_deviceUISet->m_deviceSinkAPI->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick()));
	connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
	connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
	m_statusTimer.start(500);

	displaySettings();

    m_deviceSampleSink = (FileSinkOutput*) m_deviceUISet->m_deviceSinkAPI->getSampleSink();
    connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
}
Example #20
0
Mpris::Mpris(QObject *p)
    : QObject(p)
    , pos(-1)
{
    QDBusConnection::sessionBus().registerService("org.mpris.MediaPlayer2.cantata");

    new PlayerAdaptor(this);
    new MediaPlayer2Adaptor(this);

    QDBusConnection::sessionBus().registerObject("/org/mpris/MediaPlayer2", this, QDBusConnection::ExportAdaptors);
    connect(this, SIGNAL(setRandom(bool)), MPDConnection::self(), SLOT(setRandom(bool)));
    connect(this, SIGNAL(setRepeat(bool)), MPDConnection::self(), SLOT(setRepeat(bool)));
    connect(this, SIGNAL(setSeekId(qint32, quint32)), MPDConnection::self(), SLOT(setSeekId(qint32, quint32)));
    connect(this, SIGNAL(setVolume(int)), MPDConnection::self(), SLOT(setVolume(int)));

//    connect(MPDConnection::self(), SIGNAL(currentSongUpdated(const Song &)), this, SLOT(updateCurrentSong(const Song &)));
    connect(MPDStatus::self(), SIGNAL(updated()), this, SLOT(updateStatus()));
    if (mprisPath.isEmpty()) {
        mprisPath=QLatin1String(CANTATA_REV_URL);
        mprisPath.replace(".", "/");
        mprisPath="/"+mprisPath+"/Track/%1";
    }
    connect(CurrentCover::self(), SIGNAL(coverFile(const QString &)), this, SLOT(updateCurrentCover(const QString &)));
}
Example #21
0
/* EntryPanel::openEntry
 * 'Opens' the given entry (sets the frame label then loads it)
 *******************************************************************/
bool EntryPanel::openEntry(ArchiveEntry* entry) {
	// Check entry was given
	if (!entry) {
		entry_data.clear();
		this->entry = NULL;
		return false;
	}

	// Copy current entry content
	entry_data.clear();
	entry_data.importMem(entry->getData(true), entry->getSize());

	// Load the entry
	if (loadEntry(entry)) {
		this->entry = entry;
		updateStatus();
		return true;
	}
	else {
		theMainWindow->SetStatusText("", 1);
		theMainWindow->SetStatusText("", 2);
		return false;
	}
}
void QGstreamerCameraControl::setCaptureMode(QCamera::CaptureModes mode)
{
    if (m_captureMode == mode || !isCaptureModeSupported(mode))
        return;

    m_captureMode = mode;

    switch (mode) {
    case QCamera::CaptureViewfinder:
    case QCamera::CaptureStillImage:
        m_session->setCaptureMode(QGstreamerCaptureSession::Image);
        break;
    case QCamera::CaptureVideo:
        m_session->setCaptureMode(QGstreamerCaptureSession::AudioAndVideo);
        break;
    case QCamera::CaptureVideo | QCamera::CaptureStillImage:
        m_session->setCaptureMode(QGstreamerCaptureSession::AudioAndVideoAndImage);
        break;
    }

    emit captureModeChanged(mode);
    updateStatus();
    reloadLater();
}
Example #23
0
CategoryWidget::CategoryWidget(QWidget* parent)
    : GenericChatItemWidget(parent)
{
    container = new QWidget(this);
    container->setObjectName("circleWidgetContainer");
    container->setLayoutDirection(Qt::LeftToRight);

    statusLabel = new QLabel(this);
    statusLabel->setObjectName("status");
    statusLabel->setTextFormat(Qt::PlainText);

    statusPic.setPixmap(QPixmap(":/ui/chatArea/scrollBarRightArrow.svg"));

    fullLayout = new QVBoxLayout(this);
    fullLayout->setSpacing(0);
    fullLayout->setMargin(0);
    fullLayout->addWidget(container);

    lineFrame = new QFrame(container);
    lineFrame->setObjectName("line");
    lineFrame->setFrameShape(QFrame::HLine);
    lineFrame->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
    lineFrame->resize(0, 0);

    listLayout = new FriendListLayout();
    listWidget = new QWidget(this);
    listWidget->setLayout(listLayout);
    fullLayout->addWidget(listWidget);

    setAcceptDrops(true);

    onCompactChanged(isCompact());

    setExpanded(true, false);
    updateStatus();
}
Example #24
0
bool
JouleDevice::getUnitFreeSpace(QString &memory, QString &err)
{
    emit updateStatus(tr("Get Unit Free Space..."));
    if (JOULE_DEBUG) printf("Get Unit Free Space\n");

    JoulePacket request1(GET_FREE_SPACE);

    if (!request1.write(dev, err)) return false;

    JoulePacket response1 = JoulePacket(GET_FREE_SPACE);
    if (response1.read(dev, err)) {

        if (response1.payload.length()>3) {
            int empty = qByteArray2Int(response1.payload.left(2));
            int total = qByteArray2Int(response1.payload.right(2));
            int percentage = 100 * empty / total;
            memory = QString("%1/%2 (%3%)").arg(empty).arg(total).arg(percentage);

            return true;
        }
    }
    return false;
}
Example #25
0
void MainWindow::tabChanged(int i)
{
    bool ret;

    if (i < 0)
        return;

    RenderTarget *target = static_cast<RenderTarget*>(ui->tabWidget->widget(i));

    if (target && target->scene())
    {
        if (m_connectedSender) {
            ret = disconnect(m_connectedSender, SIGNAL(statusChanged()), this, SLOT(statusChanged()));
            assert(ret == true);
        }

        ret = connect(target->scene(), SIGNAL(statusChanged()), this, SLOT(statusChanged()), Qt::UniqueConnection);
        assert(ret == true);

        m_connectedSender = static_cast<SceneController*>(target->scene());

        updateStatus();
    }
}
Example #26
0
void addValue(int keyI, char *value, int both){
   
   free(cfg_stru[keyI]);
   cfg_stru[keyI] = 0;
   if (both) {free(cfg_strd[keyI]);cfg_strd[keyI] = 0;}
   
   if (value == NULL || strlen(value) == 0) {
      cfg_val[keyI] = 0;
   } else {
      int val=strtol(value, NULL, 10);
      asprintf(&cfg_stru[keyI],"%s", value);
      if (both) {
         asprintf(&cfg_strd[keyI],"%s", value);
      }
      if (strcmp(value, "true") == 0)
         val = 1;
      else if (strcmp(value, "false") == 0)
         val = 0;
      switch(keyI) {
         case c_autostart:
            if(strcmp(value, "idle") == 0) {
               val = 0;
               idle = 1;
            }else if(strcmp(value, "standard") == 0) { 
               val = 1;
               idle = 0;
            };
            updateStatus();
            break;
         case c_MP4Box:
            if(strcmp(value, "background") == 0)
               val = 2;
      }
      cfg_val[keyI] = val;
   }
}
Example #27
0
void
FileTransferServer::move(const TransferExec& transferExec,
                         const std::string& trCmd) {
  // perform the copy
  copy(transferExec,trCmd);
  int lastExecStatus=transferExec.getLastExecStatus();

  if (lastExecStatus == 0) {

    // remove the source file
    FileFactory ff;
    ff.setSSHServer(transferExec.getSrcMachineName());
    boost::scoped_ptr<File> file (ff.getFileServer( transferExec.getSessionServer(),transferExec.getSrcPath(),
                                                    transferExec.getSrcUser(),transferExec.getSrcUserKey() ) ) ;
    try {
      FMS_Data::RmFileOptions options;
      options.setIsRecursive("true");
      file->rm(options);
    } catch(VishnuException& err) {
      updateStatus(vishnu::TRANSFER_FAILED,transferExec.getTransferId(),err.what());
      transferExec.setLastExecStatus(1);
    }
  }
}
Example #28
0
int FBConnect::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: start(); break;
        case 1: stop(); break;
        case 2: sessionDidLogin((*reinterpret_cast< FBUID(*)>(_a[1]))); break;
        case 3: getFriendList(); break;
        case 4: getNewsFeed(); break;
        case 5: getAlbums((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 6: getOwnAlbums(); break;
        case 7: getComments((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 8: getPhotos((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 9: updateStatus((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 10: sendComment((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 11: test((*reinterpret_cast< const FBError(*)>(_a[1]))); break;
        case 12: update(); break;
        case 13: logout(); break;
        case 14: friendRequestDidLoad((*reinterpret_cast< const QVariant(*)>(_a[1]))); break;
        case 15: newsFeedRequestDidLoad((*reinterpret_cast< const QVariant(*)>(_a[1]))); break;
        case 16: albumRequestDidLoad((*reinterpret_cast< const QVariant(*)>(_a[1]))); break;
        case 17: photosRequestDidLoad((*reinterpret_cast< const QVariant(*)>(_a[1]))); break;
        case 18: commentRequestDidLoad((*reinterpret_cast< const QVariant(*)>(_a[1]))); break;
        case 19: sessionDidLogout(); break;
        case 20: gotPermissions(); break;
        case 21: { bool _r = getName();
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        default: ;
        }
        _id -= 22;
    }
    return _id;
}
Example #29
0
bool
SrmDevice::cleanup( QString &err )
{
    srmio_error_t serr;

    if( ! is_open ){
        if( ! open( err ) )
            goto cleanup;
    }

    emit updateStatus( tr("cleaning device ..."));

    if( ! srmio_pc_cmd_clear( pc, &serr ) ){
        err = tr("failed to clear Powercontrol memory: %1")
            .arg(serr.message);
        goto cleanup;
    }

    return true;

cleanup:
    close();
    return false;
}
void AppleACPIBatteryDevice::initState()
{
    for(int i=0; i<1200; i++)
    {
        if(isStartUp())
            break;
        IOSleep(50);
    }
    
    IOSleep(100);

    IOLog("%s: started\n", this->getName());
    
    setFullyCharged(true);
    setIsCharging(false);
    setExternalConnected(true);
    setExternalChargeCapable(true);
    updateStatus();
    
    IOSleep(500);
    
    // Kick off the 30 second timer and do an initial poll
    pollBatteryState( kNewBatteryPath );
}