Exemple #1
0
void exitProcessList( void ) {

	removeMonitor("ps");
	removeMonitor("pscount");

	if (!RunAsDaemon)
	{
		removeCommand("kill");
		removeCommand("setpriority");
	}

	destr_ctnr( ProcessList, free );
}
Exemple #2
0
void CUndoRedoStack::remove(QUndoCommand* cmd)
{
    if(!cmd)
        return;

    int inUndo = d->undoStack.indexOf(cmd);
    int inRedo = inUndo >= 0 ? -1 : d->redoStack.indexOf(cmd);

    CUndoRedoCmdBase* cmd2 = dynamic_cast<CUndoRedoCmdBase*>(cmd);
    if(cmd2)
        removeCommand(cmd2);

    if(inUndo >= 0)
    {
        d->undoStack.remove(inUndo);
        emit canUndoChanged(d->undoStack.count());
    }
    else if(inRedo >= 0)
    {
        d->redoStack.remove(inRedo);
        emit canRedoChanged(d->redoStack.count());
    }

    emit countChanged(count());
}
Exemple #3
0
/* main ()
**
** Scan the command line arguments, then enter into the command loop.
*/
int main (int argc, char ** argv) {
  checkHostCompatibility ();
  checkArithmetic ();
  processCommandLine (argc, argv);

  /* If the "write" option (-w) was given, write a file to the DISK. */
  if (commandOptionW) {
    writeCommand ();
  } else if (commandOptionI) {
    initializeCommand ();
  } else if (commandOptionL) {
    listCommand ();
  } else if (commandOptionC) {
    createCommand ();
  } else if (commandOptionR) {
    removeCommand ();
  } else if (commandOptionA) {
    addCommand ();
  } else if (commandOptionE) {
    extractCommand ();
  } else {
    fatalError ("No commands given; Use -h for help display");
    return -1;
  }

  return 0;
}
Exemple #4
0
S32 LLToolBarView::addCommand(const LLCommandId& commandId, EToolBarLocation toolbar, int rank)
{
	int old_rank;
	removeCommand(commandId, old_rank);

	S32 command_location = mToolbars[toolbar]->addCommand(commandId, rank);

	return command_location;
}
Exemple #5
0
void cMenu::setDisposeable( bool canDispose )
{
	if( !canDispose )
		addCommand("{nodispose}");
	else
		if( !disposeable )
			removeCommand( string("{nodispose}") );
	disposeable=canDispose;
}
Exemple #6
0
void cMenu::setCloseable( bool canClose )
{
	if( !canClose )
		addCommand("{noclose}");
	else
		if( !closeable )
			removeCommand( string("{noclose}") );
	closeable=canClose;
}
Exemple #7
0
void cMenu::setMoveable( bool canMove )
{
	if( !canMove )
		addCommand("{nomove}");
	else 
		if( !moveable )
			removeCommand( string("{nomove}") );
	moveable=canMove;
}
Exemple #8
0
void HiRes5Engine::applyRegionWorkarounds() {
	// WORKAROUND: Remove/fix buggy commands
	switch (_state.region) {
	case 3:
		// "USE PIN" references a missing message, but cannot
		// be triggered due to shadowing of the "USE" verb.
		// We remove it anyway to allow script dumping to proceed.
		// TODO: Investigate if we should fix this command instead
		// of removing it.
		removeCommand(_roomCommands, 12);
		break;
	case 14:
		// "WITH SHOVEL" references a missing message. This bug
		// is game-breaking in the original, but unlikely to occur
		// in practice due to the "DIG" command not asking for what
		// to dig with. Probably a remnant of an earlier version
		// of the script.
		removeCommand(_roomCommands, 0);
	}
}
bool UserConfig::removeCommand(unsigned id, Q3ListViewItem *item)
{
    if (item->text(1).toUInt() == id){
        delete item;
        return true;
    }
    for (item = item->firstChild(); item; item = item->nextSibling()){
        if (removeCommand(id, item))
            return true;
    }
    return false;
}
void *UserConfig::processEvent(Event *e)
{
    switch (e->type()){
    case EventContactDeleted:{
            Contact *contact = (Contact*)(e->param());
            if (contact == m_contact)
                close();
            return NULL;
        }
    case EventGroupDeleted:{
            Group *group = (Group*)(e->param());
            if (group == m_group)
                close();
            return NULL;
        }
    case EventFetchInfoFail:{
            Contact *contact = (Contact*)(e->param());
            if ((contact == m_contact) && m_nUpdates){
                if (--m_nUpdates == 0){
                    btnUpdate->setEnabled(true);
                    setTitle();
                }
            }
            return NULL;
        }
    case EventContactCreated:
    case EventContactChanged:{
            Contact *contact = (Contact*)(e->param());
            if (contact == m_contact){
                if (m_nUpdates)
                    m_nUpdates--;
                btnUpdate->setEnabled(m_nUpdates == 0);
                setTitle();
            }
            return NULL;
        }
    case EventGroupChanged:{
            Group *group = (Group*)(e->param());
            if (group == m_group)
                setTitle();
            return NULL;
        }
    case EventCommandRemove:
        removeCommand((unsigned)(e->param()));
        return NULL;
    case EventLanguageChanged:
    case EventPluginChanged:
    case EventClientsChanged:
        fill();
        return NULL;
    }
    return NULL;
}
Exemple #11
0
void CUndoRedoStack::push(QUndoCommand* cmd)
{
    if(!cmd)
        return;

    // First register the undo command into the undo stack.
    QUndoCommand* topCmd = d->undoStack.count() ? d->undoStack.top() : 0;
    if(!topCmd)
    {
        d->undoStack.push(cmd);
        CUndoRedoCmdBase* cmd2 = dynamic_cast<CUndoRedoCmdBase*>(cmd);
        if(cmd2)
            addCommand(cmd2);
    }
    else
    {
        if(topCmd->id() == cmd->id())
        {
            bool success = topCmd->mergeWith(cmd);
            if(!success)
            {
                d->undoStack.push(cmd);
                CUndoRedoCmdBase* cmd2 = dynamic_cast<CUndoRedoCmdBase*>(cmd);
                if(cmd2)
                    addCommand(cmd2);
            }
            else
                delete cmd;
        }
    }

    // Now clear the redo stack.
    for(int i=0; i<d->redoStack.count(); i++)
    {
        QUndoCommand* cmd = d->redoStack.pop();
        CUndoRedoCmdBase* cmd2 = dynamic_cast<CUndoRedoCmdBase*>(cmd);
        if(cmd2)
            removeCommand(cmd2);
        delete cmd;
    }

    // emit change notifications.
    emit canUndoChanged(d->undoStack.count());
    emit canRedoChanged(d->redoStack.count());
    emit countChanged(count());
}
void UserConfig::removeCommand(unsigned id)
{
    for (Q3ListViewItem *item = lstBox->firstChild(); item; item = item->nextSibling())
        removeCommand(id, item);
}
void ArServerHandlerCamera::addCommandToServer(const char *command, 
                                               const char *description,
				                                       const char *argumentDescription,
				                                       const char *returnDescription,
                                               const char *commandGroup)
{
  if (command == NULL) {
    ArLog::log(ArLog::Normal, 
               "ArServerHandlerCamera::addCommandToServer() cannot add NULL command");
    return;
  }

  std::map<std::string, std::string>::iterator iter = 
    myCommandToPacketNameMap.find(command);

  if (iter == myCommandToPacketNameMap.end()) {
    ArLog::log(ArLog::Normal, 
               "ArServerHandlerCamera::addCommandToServer() cannot find packet name for command %s",
               command);
    return;
  }
  
  const char *packetName = iter->second.c_str();
  ArFunctor2<ArServerClient *, ArNetPacket *> *callback = NULL;

  std::map<std::string, ArFunctor2<ArServerClient *, ArNetPacket *> *>::iterator cbIter =
    myCommandToCBMap.find(command);
  if (cbIter != myCommandToCBMap.end()) {
    callback = cbIter->second;
  }
  if (callback == NULL) {
    ArLog::log(ArLog::Normal, 
               "ArServerHandlerCamera::addCommandToServer() cannot find callback for command %s",
               command);
  }

  bool isSuccess = true;

  /**
   * It'd be kind of nice if we could do something along the following lines
   * so that the PTZ controls do not show up in ME.  (Not entirely sure how
   * though because - at least in the case of VCC4 - there's a four second
   * timeout before the comm is deemed unidirectional.)
  if ((myCamera != NULL) &&
      (!myCamera->isBidirectionalComm()) &&
      (strcmp(commandGroup, CONTROL_COMMAND_GROUP) == 0)) {
    isSuccess = false;
  }
  **/

  if (isSuccess) {
    isSuccess = myServer->addData
                       (packetName, 
		                    description,
		                    callback,
		                    argumentDescription, 
		                    returnDescription,
                        commandGroup, "RETURN_SINGLE");
  }
  if (!isSuccess) {
    ArLog::log(ArLog::Normal, 
               "ArServerHandlerCamera::addCommandToServer() error adding server handler for packet %s",
               packetName);
    removeCommand(command);
  }

} // end method addCommandToServer
void ArServerHandlerCamera::addAllCommandsToServer()
{
  if (myServer == NULL) {
    ArLog::log(ArLog::Normal, 
               "ArServerHandlerCamera::addAllCommandsToServer() cannot add to NULL server");
    return;
  }

  // 
  addCommandToServer
     (ArCameraCommands::GET_CAMERA_DATA, 
	    "Get \"double\" information about camera position. (factor == 100)",
	    NO_ARGS, 
	    "byte2: pan * factor, byte2: tilt * factor, byte2: zoomPercent * factor (optional)",
      INFO_COMMAND_GROUP);

  addCommandToServer
     (ArCameraCommands::GET_CAMERA_INFO, 
		  "Get (\"double\") information about the camera's pan, tilt, and (optional) zoom ranges. (factor == 100)",
		  NO_ARGS, 
		  "byte2: minPan * factor, byte2: maxPan * factor byte2: minTilt * factor, byte2: maxTilt * factor, byte2: minZoom * factor, byte2: maxZoom * factor, byte: isZoomAvailable",
      INFO_COMMAND_GROUP);

 addCommandToServer
     (ArCameraCommands::SET_CAMERA_ABS, 
      "Sends absolute (\"double\") pan, tilt, and zoom (optional) commands to the camera. (factor == 100)",
      NO_ARGS, 
      "byte2: pan * factor, byte2: tilt * factor, byte2: zoom * factor (optional)",
      CONTROL_COMMAND_GROUP);

 if ((myCamera != NULL) && (myCamera->canGetFOV())) {
    addCommandToServer
      (ArCameraCommands::SET_CAMERA_PCT, 
		    "Sends (\"double\") pan, tilt, and zoom (optional) commands to point camera, as percent of visible frame. (factor == 100)",
		    NO_ARGS,
		    "byte2: panOffset * factor, byte2: tiltOffset * factor, byte2: zoom * factor (optional)",
      CONTROL_COMMAND_GROUP);
 }
 else {
   removeCommand(ArCameraCommands::SET_CAMERA_PCT);
 }

 addCommandToServer
     (ArCameraCommands::SET_CAMERA_REL, 
		  "Sends (\"double\") pan, tilt, and zoom (optional) commands to the camera, relative to its current position. (factor == 100)",
		  NO_ARGS, 
		  "byte2: relPan * factor, byte2: relTilt * factor, byte2: relZoom * factor (optional)",
      CONTROL_COMMAND_GROUP);

 addCommandToServer(ArCameraCommands::GET_CAMERA_MODE_LIST,
		    "Gets the list of modes this camera supports",
		    NO_ARGS,
		    "ubyte2: numModes; <repeating numModes times> string: modeName",
        INFO_COMMAND_GROUP);
		    

 addCommandToServer(ArCameraCommands::CAMERA_MODE_UPDATED,
		    "Sent whenever the camera mode is updated",
		    NO_ARGS,
		    "string: modeName; <other data depends on mode>",
        INFO_COMMAND_GROUP);

 addCommandToServer(ArCameraCommands::SET_CAMERA_MODE,
		    "Sets the mode of the camera",
		    "string: modeName; <other data depends on mode>",
		    NO_ARGS,
        CONTROL_COMMAND_GROUP);		    

 addCommandToServer(ArCameraCommands::RESET_CAMERA,
		    "Resets the camera to 0 0 0 and may reinitialize it (depending on camera)",
		    NO_ARGS,
		    NO_ARGS,
        CONTROL_COMMAND_GROUP);		    
		    

  // Continue to support old-style integer commands for backward compatibility....

 addCommandToServer
   (ArCameraCommands::GET_CAMERA_DATA_INT, 
	  "Get (integer) information about camera position",
	  NO_ARGS, 
	  "byte2: pan, byte2: tilt, byte2: zoom (optional)",
    INFO_COMMAND_GROUP);

 addCommandToServer
   (ArCameraCommands::GET_CAMERA_INFO_INT, 
		"Get (integer) information about the camera's pan, tilt, and (optional) zoom ranges",
		NO_ARGS, 
		"byte2: minPan, byte2: maxPan byte2: minTilt, byte2: maxTilt, byte2: minZoom, byte2: maxZoom, byte: isZoomAvailable",
    INFO_COMMAND_GROUP);

 addCommandToServer
   (ArCameraCommands::SET_CAMERA_REL_INT, 
		"Sends (integer) pan, tilt, and zoom (optional) commands to the camera, relative to its current position",
		NO_ARGS, 
		"byte: relPan, byte: relTilt, byte: relZoom (optional)",
    CONTROL_COMMAND_GROUP);

 addCommandToServer
   (ArCameraCommands::SET_CAMERA_ABS_INT, 
    "Sends absolute (integer) pan, tilt, and zoom (optional) commands to the camera",
    NO_ARGS, 
    "byte: pan, byte: tilt, byte: zoom (optional)",
    CONTROL_COMMAND_GROUP);

 addCommandToServer
   (ArCameraCommands::SET_CAMERA_PCT_INT, 
    "Sends (integer) pan, tilt commands to the camera, as percent of visible frame",
    NO_ARGS, 
    "byte: pan, byte: tilt, byte: zoom (optional)",
    CONTROL_COMMAND_GROUP);

} // end method addToServer