示例#1
0
bool SpellCheck::setLang(const QString & lang)
{
    bool ok = false;
    // Sometimes $LANG variable is like "es_ES.utf8".
    // Remove codification part:
    QString dict = _getFirstPart(lang, ".");
    if(langs.contains(dict)) {
        ok = true;
    } else {
        // The dictionary is not available.
        // Try to remove the country part: "es_ES" -> "es"
        dict = _getFirstPart(lang, "_");
        if(langs.contains(dict)) {
            ok = true;
        }
    }
    if(ok) {
        bool renable = spellChecker != nullptr && this->lang != dict;
        this->lang = dict;
        if(renable) {
            setEnable(false);
            setEnable(true);
        }
    }
    return ok;
}
示例#2
0
void ButtonCargo::onMenuUp()
{
	GameDocument * pDoc = (GameDocument *)document();
	if (! pDoc )
		return;
	NounShip * pShip = pDoc->ship();
	if (! pShip )
		return;
	Noun * pCargo = m_Cargo;
	if (! pCargo )
		return;

	Noun * pTarget = pDoc->target();
	if ( WidgetCast<CargoEnhancement>( pCargo ) != NULL
		&& VerbApplyEnhancement::canApply( (CargoEnhancement *)pCargo, pShip ) )
	{
		Verb::Ref( new VerbApplyEnhancement( pShip, (CargoEnhancement *)pCargo ) );
		setEnable( false );
	}
	else if ( pTarget != NULL 
		&& pShip->canUnload( pTarget, pCargo ) )
	{
		pShip->verbUnload( pTarget, pCargo );
		setEnable( false );
	}
	else
		pDoc->setTarget( pCargo );

	WindowButton::onMenuUp();
}
示例#3
0
AccSensor::~AccSensor() {
    if (mEnabled) {
        setEnable(ID_A, 0);
    }
    if (mFusionEnabled) {
        setEnable(ID_OR, 0);
    }

	close_device();
}
示例#4
0
void ButtonUnit::setButton( NounUnit * pUnit )
{
	m_Unit = pUnit;
	if ( m_Unit.valid() )
	{
		m_Icon = pUnit->icon();

		setTip( CharString().format("%s\n%s", pUnit->name(), pUnit->status()) );
		setEnable( true );
	}
	else
		setEnable( false );
}
示例#5
0
uint8_t MD_TCS230::readFSM(uint8_t	s)
// Finite State Machine to read a value (internal function)
{
	static const uint8_t	seq[] = { TCS230_RGB_R, TCS230_RGB_G, TCS230_RGB_B };
	static uint8_t	currCol;	// index for seq above

	switch(s)
	{
	case 0:	// enable the hardware for reading
		DUMPS("\n0");
		currCol = 0;	// RGB_R but we don't care
		setEnable(true);
		s++;
		// fall through to the next state

	case 1:	// select a filter and start a reading
		DUMPS("\n1");
		setFilter(seq[currCol]);
		FreqCount.begin(1000/_readDiv);
		s++;
		break;

	case 2:	// see if a value is available
		DUMPS("2");
		if (FreqCount.available())
		{
			DUMP(" VALUE ", FreqCount.read());
			// read the value and save it 
			_Fo.value[seq[currCol++]] = FreqCount.read() * _readDiv;

			if (currCol < RGB_SIZE)
			{
				// loop around again on next call to available()
				s--;
			}
			else
			{
				// end this reading session
				FreqCount.end();
				setEnable(false);
				RGBTransformation();
				s = 0;
			}
		}
		break;
	}

	return(s);
}
MainWindow::MainWindow(QWidget *parent) :

    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    ui->zoomOut->setEnabled(false);
    ui->zoomIn->setEnabled(false);
    ui->cropButton->setEnabled(false);
    ui->rotateButton->setEnabled(false);
    ui->rotateButton_3->setEnabled(false);
    ui->undo->setEnabled(false);
    ui->redo->setEnabled(false);
    ui->reset->setEnabled(false);
    ui->actionSave->setEnabled(false);
    connect(ui->graphicsView,SIGNAL(areaSelected()) , this , SLOT(setEnable()));
    connect(ui->graphicsView,SIGNAL(enableRotateSignal()) , this , SLOT(enableRotateSlot()));

    new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_C), this, SLOT(on_cropButton_clicked()));
    new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Plus), this, SLOT(on_zoomIn_clicked()));
    new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Minus), this, SLOT(on_zoomOut_clicked()));

    new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z), this, SLOT(on_undo_clicked()));
    new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Y), this, SLOT(on_redo_clicked()));
    new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_R), this, SLOT(on_reset_clicked()));


}
示例#7
0
void ExtraAction::disableAction(void)
{
	ASSERT(mCont);
//	mCont->setMaterialName("");
	setEnable(false);
	setActive(false);
}
示例#8
0
DmtSensor::~DmtSensor() {
    if (mEnabled) {
        setEnable(0, 0);
    }

    close_device();
}
 SimpleCircleFacingVisualizer::SimpleCircleFacingVisualizer(
   Ogre::SceneManager* manager,
   Ogre::SceneNode* parent,
   rviz::DisplayContext* context,
   double size,
   std::string text):
   FacingObject(manager, parent, size)
 {
   line_ = new rviz::BillboardLine(
     context->getSceneManager(),
     node_);
   text_under_line_ = new rviz::BillboardLine(
     context->getSceneManager(),
     node_);
   target_text_node_ = node_->createChildSceneNode();
   msg_ = new rviz::MovableText("not initialized", "Arial", 0.05);
   msg_->setVisible(false);
   msg_->setTextAlignment(rviz::MovableText::H_LEFT,
                          rviz::MovableText::V_ABOVE);
   target_text_node_->attachObject(msg_);
   createArrows(context);
   updateLine();
   updateTextUnderLine();
   updateText();
   setEnable(false);
 }
示例#10
0
void ButtonCargo::setCargo( Noun * pCargo )
{
	m_Cargo = pCargo;

	// set the tool tip
	if ( WidgetCast<NounUnit>( pCargo ) )
	{
		setTip( CharString().format("%s %s", pCargo->name(), ((NounUnit *)pCargo)->status() ) );
		setIcon( ((NounUnit *)pCargo)->icon() );
	}
	else if(WidgetCast<CargoEnhancement>( pCargo ) )
	{
		CargoEnhancement * pCargoEnhancement = (CargoEnhancement *)pCargo;
		
		setTip( pCargoEnhancement->status() );
		if ( pCargoEnhancement->enhancement() != NULL )
		{
			setIcon( pCargoEnhancement->enhancement()->icon() );
			setColor( pCargoEnhancement->enhancement()->color() );
		}	
	}
	else 
	{
		setTip( pCargo->name() );
		setIcon( pCargo->icon() );
	}

	setEnable( true );
}
示例#11
0
bool Player::init()
{
	if (!Sprite::initWithFile("graphics/luk_sprite.png"))
	{
		return false;
	}



	//Point PBox[8]{Point(-2, -12), Point(-4, -10), Point(-4, -2), Point(-2, 0), Point(2, 0), Point(4, -2), Point(4, -10), Point(2, -12)};
	Point PBox[4]{Point(-4, -12), Point(-4, 0), Point(4, 0), Point(4, -12)};

	//auto body = PhysicsBody::createEdgePolygon(PBox, 4,PHYSICSBODY_MATERIAL_DEFAULT,0.5f);
	auto body = PhysicsBody::createPolygon(PBox, 4);
	body->setEnable(true);
	body->setDynamic(true);
	body->setGravityEnable(true);
	body->setRotationEnable(false);
	body->setVelocityLimit(30.0);
	body->setCategoryBitmask(static_cast<int>(Stage::TileType::PLAYER));
	//BLOCKSとの接触判定をON
	//body->setCollisionBitmask(static_cast<int>(Stage::TileType::BLOCKS));
	body->setCollisionBitmask(static_cast<int>(Stage::TileType::NONE));
	body->setContactTestBitmask(static_cast<int>(Stage::TileType::BLOCKS));

	//body->setContactTestBitmask(INT_MAX);

	this->setPhysicsBody(body);

	this->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
	this->scheduleUpdate();
	return true;
}
示例#12
0
    //-----------------------------------------------------------------------
    void DynamicBlockObject::onVisibleChanged( Bool visible )
    {
        if ( visible == false )
        {
			setEnable( false );
        }
    }
KionixSensor::~KionixSensor() {
    if (mEnabled) {
        setEnable(0, 0);
    }

	close_device();
}
示例#14
0
bool Player::init()
{
	if (!Sprite::initWithFile("graphics/luk_sprite.png"))
	{
		return false;
	}
	this->setAnchorPoint(Vec2::ANCHOR_MIDDLE);

	cocos2d::Point PBox[8]{cocos2d::Point(-2, -12), cocos2d::Point(-4, -10), cocos2d::Point(-4, -2), cocos2d::Point(-2, 0), cocos2d::Point(2, 0), cocos2d::Point(4, -2), cocos2d::Point(4, -10), cocos2d::Point(2, -12)};
	playerRect = Rect();
	auto body = PhysicsBody::createPolygon(PBox, 8);
	body->setEnable(true);
	body->setDynamic(true);
	body->setGravityEnable(true);
	body->setRotationEnable(false);
	body->setVelocityLimit(30.0);
	body->setCategoryBitmask(static_cast<int>(Stage::TileType::PLAYER));
	//BLOCKSとの接触判定をON
	body->setCollisionBitmask(static_cast<int>(Stage::TileType::EMPTY));
	body->setContactTestBitmask(static_cast<int>(Stage::TileType::BLOCKS));

	//body->setContactTestBitmask(INT_MAX);

	this->setPhysicsBody(body);

	this->scheduleUpdate();
	return true;
}
示例#15
0
void RigidControlet::setVisible( bool b ){
	mNode->setVisible( b );
	/*效率考虑,因为RigidControlet使用一个Controlet接口
		在不需要的时候禁止打可以略微减少调用
	*/
	setEnable( b );
}
ButtonBuildStructure::ButtonBuildStructure()
{
	m_Flags |= NOCLIP;
	m_Style = HAS_BACK | EFFECT_HIGHLIGHT | EFFECT_FADEIN | SMOOTH_LL | LOCK_ICON_SIZE;
	m_Alpha = 0.75f;

	setWindow( RectInt( PointInt(0,0), SizeInt( 32, 24 ) ) );
	setEnable( false );
}
PwmSysfsDriverNode::PwmSysfsDriverNode(ros::NodeHandle const& nh,
                                       ros::NodeHandle const& nh_rel):
  nh_(nh), nh_rel_(nh_rel)
{
  // get reqired path to sysfs pwm directory parameter
  std::string pwm_sysfs_dir;
  if (!nh_rel_.getParam("pwm_sysfs_dir", pwm_sysfs_dir)) {
    ROS_FATAL("Path to sysfs pwm directory required.");
    ros::shutdown();
    return;
  }

  // attemp to create driver
  try {
    driver_.reset(new PwmSysfsDriver(pwm_sysfs_dir));
  }
  catch (PwmSysfsDriverException e) {
    driver_.reset();
    ROS_FATAL("Failed to initialize driver: %s", e.what());
    ros::shutdown();
    return;
  }

  // set initial pwm values
  bool enable;
  if (nh_rel_.getParam("initial_enable", enable))
    setEnable(enable);

  bool invert_polarity;
  if (nh_rel_.getParam("initial_invert_polarity", invert_polarity))
    setInvertPolarity(invert_polarity);

  double period;
  if (nh_rel_.getParam("initial_period", period))
    setPeriod(period);

  double duty;
  if (nh_rel_.getParam("initial_duty", duty))
    setDuty(duty);

  // boolean pwm enable
  enable_sub_ = nh_.subscribe("enable", 10,
                              &PwmSysfsDriverNode::enableCallback, this);

  // boolean pwm invert polarity
  invert_polarity_sub_ =
    nh_.subscribe("invert_polarity", 10,
                  &PwmSysfsDriverNode::invertPolarityCallback, this);

  // pwm cycle period, in nanoseconds
  period_sub_ = nh_.subscribe("period", 10,
                              &PwmSysfsDriverNode::periodCallback, this);

  // pwm duty cycle fraction, 0 to 1
  duty_sub_ = nh_.subscribe("duty", 10,
                            &PwmSysfsDriverNode::dutyCallback, this);
}
示例#18
0
void Prop::init(){
	
	setASpeed(1.0f);
	isCollision = false;
	setEnable(false);
	setPositionX(1100);
	setMoveDown(false);
	setFuncPropTime(300);
}
示例#19
0
void ViewEngineering::ButtonGadget::setGadget( NounGadget * pGadget )
{
	m_rGadget = pGadget;

	setName( pGadget->name() );
	setIcon( pGadget->icon() );
	setTip( String().format("%s\n%d%%", pGadget->nounContext()->name(), int( pGadget->damageRatioInv() * 100) ) );
	setEnable( true );
}
示例#20
0
ViewEngineering::ButtonGadget::ButtonGadget() 
{
	m_Flags |= NOCLIP;
	m_Style = HAS_BACK | EFFECT_HIGHLIGHT | EFFECT_FADEIN | SMOOTH_LL | LOCK_ICON_SIZE;
	m_Alpha = 0.75f;

	setWindow( RectInt( PointInt(0,0), SizeInt( 32, 24 ) ) );
	setEnable( false );
}
示例#21
0
ButtonUnit::ButtonUnit()
{
	m_Flags |= NOCLIP;
	m_Style = HAS_BACK | EFFECT_HIGHLIGHT | EFFECT_FADEIN | SMOOTH_LL;
	m_Alpha = 0.75f;

	setWindow( RectInt( PointInt(0,0), SizeInt( 32, 24 ) ) );
	setEnable( false );
}
示例#22
0
ButtonCargo::ButtonCargo()
{
	m_Flags |= NOCLIP;
	m_Style = HAS_BACK | EFFECT_HIGHLIGHT | EFFECT_FADEIN | SMOOTH_LL | SHOW_HOTKEY | LOCK_ICON_SIZE;
	m_Alpha = 0.75f;
	m_HotKey = 'U';

	setWindow( RectInt( PointInt(0,0), CARGO_BUTTON_SIZE ) );
	setEnable( false );
}
 void PictogramObject::setAction(uint8_t type)
 {
   action_ = type;
   if (action_ == jsk_rviz_plugins::Pictogram::DELETE) {
     setEnable(false);
   }
   else if (action_ == jsk_rviz_plugins::Pictogram::JUMP_ONCE) {
     start();
   }
 }
示例#24
0
ButtonGadget::ButtonGadget() : 
	m_bCursorOver( false )
{
	m_Flags |= NOCLIP;
	m_Style = HAS_BACK | EFFECT_HIGHLIGHT | EFFECT_FADEIN | SMOOTH_LL;
	m_Alpha = 0.75f;
	m_IconColor = GREEN;

	setWindow( RectInt( PointInt(0,0), SizeInt( 32, 24 ) ) );
	setEnable( false );
}
示例#25
0
void ButtonGadget::setGadget( NounGadget * pGadget )
{
	ASSERT( windowStyle() );

	if ( m_Gadget != pGadget )
	{
		m_Gadget = pGadget;

		if ( m_Gadget.valid() )
		{
			setName( pGadget->name() );
			setEnable( true );				// enable this button
		}
		else
		{
			setName( "" );
			setEnable( false );
		}
	}
}
void Lobby::newWindow(int playerNum, bool silence)
{
    RoomView* window = (RoomView*)gui->newWindow(playerNum);
    connect(window, SIGNAL(closed()), this, SLOT(onWindowClose()));
    setEnable(false);
    if(silence)
    {
        gui->logAppend(QStringLiteral("这是个禁言房"));
        gui->getChatLine()->setEnabled(false);
    }
}
void EvaluateHandleModifierUI::toggleSignals(bool toggleconnections){
    if (toggleconnections){
        connect(name, SIGNAL(textEdited(QString)), this, SLOT(setName(QString)), Qt::UniqueConnection);
        connect(enable, SIGNAL(released()), this, SLOT(setEnable()), Qt::UniqueConnection);
        connect(handlePositionOut, SIGNAL(editingFinished()), this, SLOT(setHandlePositionOut()), Qt::UniqueConnection);
        connect(handleRotationOut, SIGNAL(editingFinished()), this, SLOT(setHandleRotationOut()), Qt::UniqueConnection);
        connect(isValidOut, SIGNAL(released()), this, SLOT(setIsValidOut()), Qt::UniqueConnection);
        connect(extrapolationTimeStep, SIGNAL(editingFinished()), this, SLOT(setExtrapolationTimeStep()), Qt::UniqueConnection);
        connect(handleChangeSpeed, SIGNAL(editingFinished()), this, SLOT(setHandleChangeSpeed()), Qt::UniqueConnection);
        connect(handleChangeMode, SIGNAL(currentIndexChanged(int)), this, SLOT(setHandleChangeMode(int)), Qt::UniqueConnection);
        connect(table, SIGNAL(cellDoubleClicked(int,int)), this, SLOT(viewSelected(int,int)), Qt::UniqueConnection);
    }else{
void CoordinationUnit::addFollower(CoordinationUnit *ca)
{
	CoordinationFollowListType::iterator t_it;

	t_it = m_follower_list.find(ca);

	if (t_it== m_follower_list.end())
	{
		m_follower_list[ca] = 0;
		ca->addTrigger(this);
	}
	setEnable();
}
示例#29
0
文件: menu.cpp 项目: easy63/RPG
void CMenu::setVisible(bool _bVisible)
{
	bVisible = _bVisible;

	if(bVisible)
	{
		if(iActiveItem < 0 && vMenuItems.size() > 0)
		{
			iActiveItem = 0;
		}

		CEngine::instance()->bindObject(pWindow, RENDER_LAYER_INTERFACE);
		for(int i = 0;i < vMenuItems.size();i++)
		{
			if(i >= iStartItem && i < (iStartItem + iQtyItemsWindow))
			{
				CEngine::instance()->bindObject(vMenuItems[i], RENDER_LAYER_INTERFACE_TEXT);
			}
			else
			{
				CEngine::instance()->unbindObject(vMenuItems[i]);
			}
		}
		setEnable(isEnable());
		update();
	}
	else
	{
		iActiveItem = -1;
		iStartItem = 0;
		CEngine::instance()->unbindObject(pWindow);
		for(auto &iter : vMenuItems)
		{
			iter->setActive(false);
			CEngine::instance()->unbindObject(iter);
		}
		setEnable(false);
	}
}
示例#30
0
QPopupMenu * 
ViewFogGL3::createToolsMenu(QWidget * parent)
{
  QPixmap wheel(ViewerIcon3::icon_wheel);
  QPopupMenu * menu = new QPopupMenu(parent,"Fog Menu");
  int id = menu->insertItem(wheel,tr("Control"),__control, SLOT(show()));
  ViewPopupButton3 * bt = new ViewPopupButton3(menu,id,"Control Fog");
  QObject::connect(__control,SIGNAL(visibilityChanged(bool)),bt,SLOT(check(bool)));
  menu->insertSeparator();
  id = menu->insertItem(tr("Enable"),this, SLOT(setEnable()));
  bt = new ViewPopupButton3(menu,id,"Enable Fog");
  QObject::connect(this,SIGNAL(enabled(bool)),bt,SLOT(check(bool)));
  return menu;
}