Пример #1
0
bool
AuthorizerManager::allowWriteInstance(
	const ServiceEnvironmentIFCRef& env,
	const String& ns,
	const CIMObjectPath& op,
	Authorizer2IFC::EDynamicFlag dynamic,
	Authorizer2IFC::EWriteFlag flag,
	OperationContext& context)
{
	// If the CIMServer is calling into the AuthorizerManager from the
	// loaded authorizer, don't do anything and authorize.
	// If there is no loaded authorizer, authorize everything.
	if (AuthorizerMarker::active(context)
	   || !m_authorizer
	   || !m_initialized
	   || !isOn(context))
	{
		return true;
	}

	AuthorizerMarker am(context);
	return m_authorizer->doAllowWriteInstance(
		createAuthEnvRef(context, env), ns, op, dynamic, flag,
		context);
}
Пример #2
0
void
Item::newItems( const KFileItemList &list ) //SLOT
{
    for( KFileItemListIterator it( list ); *it; ++it )
    {
        //Fully disable (always appears off and greyed-out) if it is "/proc", "/sys" or
        //"/dev" or one of their children. This is because we will never scan them, so we
        //might as well show that.
        //These match up with the skipped dirs in CollectionScanner::readDir.
        bool fully_disable=false;

        if ( this->m_url.fileName().isEmpty() && ( ( *it )->url().fileName()=="proc"
             || ( *it )->url().fileName()=="dev" || ( *it )->url().fileName()=="sys" ) )
        {
            fully_disable=true;
        }

        Item *item = new Item( this, (*it)->url() , fully_disable || this->isFullyDisabled() );

        if ( !item->isFullyDisabled() )
        {
            if( CollectionSetup::instance()->recursive() && isOn() ||
                CollectionSetup::instance()->m_dirs.contains( item->fullPath() ) )
            {
                item->setOn( true );
            }
        }

        item->setPixmap( 0, (*it)->pixmap( KIcon::SizeSmall ) );
    }
}
LEDControl::~LEDControl() {
    // turn the torch off when closing the app
    if( isOn() )
        toggleState();

    releaseGstreamerTorch();
}
Пример #4
0
void ToggleButton::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
                QWidget *widget)
{
    Q_UNUSED(option);
    Q_UNUSED(widget);
    painter->drawPixmap(x, y, isOn() ? *img_on : *img_off);
}
Пример #5
0
void HideButton::drawButtonLabel(QPainter *p)
{
    if(pixmap())
    {
        QPixmap pix = m_highlight ? m_activeIcon : m_normalIcon;

        if(isOn() || isDown())
        {
            p->translate(2, 2);
        }

        QPoint origin(2, 2);

        if(pix.height() < (height() - 4))
        {
            origin.setY(origin.y() + ((height() - pix.height()) / 2));
        }

        if(pix.width() < (width() - 4))
        {
            origin.setX(origin.x() + ((width() - pix.width()) / 2));
        }

        p->drawPixmap(origin, pix);
    }
}
Пример #6
0
void KCommonDecorationButton::setOn(bool on)
{
    if (on != isOn() ) {
        QButton::setOn(on);
        reset(StateChange);
    }
}
Пример #7
0
void SecondaryDriveRight::set(bool mainDrive, bool secondaryDriveLeft, int leftRightCenter) { 
  if(isOn() && tooMuchCurrentDraw()) {
    _stalled = true;
  }
  if(disabled()){
    return;
  }
  int maxPowerIncrease = 30;
  int minPower = 0;
  int out = 0;

  if(!mainDrive) {
    minPower = _minPower;
    out = minPower;
  }
  int scaledTurn = leftRightCenter/maxPowerIncrease;
  if(scaledTurn > 1) {
    if(!secondaryDriveLeft) {
      out = 0 - (minPower + abs(scaledTurn));
    } else {
      out = minPower;  
    }
  } else if(scaledTurn < -1) {
    out = minPower + abs(scaledTurn);
  }

  out = map(out, -180, 180, 0, 179);
  on();
  _motor->write(out);
}
Пример #8
0
void EngineController::go() {
    /*qDebug() << "EngineController:" << "go";
    if(isOn()) qDebug() << "EngineController:" << "is on";
    if(goButtonPressed) qDebug() << "EngineController:" << "Go-Button is pressed";
    if(ui->radio_play->isChecked()) qDebug() << "EngineController:" << "Radio Play is checked";
    if(ui->checkBox_black->isChecked()) qDebug() << "EngineController:" << "Black-Checkbox is checked";
    if(ui->checkBox_black->isChecked() && !ui->checkBox_white->isChecked() && game->getActiveColor() == 'w') qCritical() << "EngineController:" << "go error";
    if(engine->isThinking()) qDebug() << "EngineController:" << "is thinking";*/

    if(isOn()) {
        if(!goButtonPressed) {
            if(ui->radio_play->isChecked()) {
                if(ui->checkBox_black->isChecked() && !ui->checkBox_white->isChecked() && game->getActiveColor() == 'w') return;
                if(ui->checkBox_white->isChecked() && !ui->checkBox_black->isChecked() && game->getActiveColor() == 'b') return;
            }
        }
        if(!engine->isThinking()) {
            engine->setPosition(game->board->getFenstring());
            activeColor = game->board->getActiveColor();
            engine->go();
            ui->goButton->setText("stop");
            ui->playButton->setEnabled(false);
            ui->progressBar->setValue(0);
        }
        goButtonPressed = false;
    }
}
void NeXTMatrix::_break(uint8_t code)
{
    if (isOn(NEXT_KBD_ROW(code), NEXT_KBD_COL(code))) {
        _matrix[NEXT_KBD_ROW(code)] &= ~(1<<NEXT_KBD_COL(code));
        _is_modified = true;
    }
}
Пример #10
0
bool Drawable::collide(Drawable &item)
{
   Rect rect1 = item.boundingRect();
   Rect rect2 = boundingRect();

   Point points1[4];
   points1[0] = rect1.top_right();
   points1[1] = rect1.top_left();
   points1[2] = rect1.bottom_left();
   points1[3] = rect1.bottom_right();

   Point points2[4];
   points2[0] = rect2.top_right();
   points2[1] = rect2.top_left();
   points2[2] = rect2.bottom_left();
   points2[3] = rect2.bottom_right();

   for (int i = 0; i < 4; ++i)
   {
      /*
	If only on corner of this is on item, or if only one of the
	item corner is on this, we return true because it collides.
	Otherwisely, we return false since it doesn't.
      */

      if (isOn(points1[i]))
	 return true;
      if (item.isOn(points2[i]))
	 return true;
   }
   return false;
}
Пример #11
0
void VCButton::releaseFunction()
{
  assert(m_keyBind);

  if (/*m_keyBind->pressAction() == KeyBind::PressNothing || */
      m_functionID == KNoID)
    {
      return;
    }

  else if (m_keyBind->releaseAction() == KeyBind::ReleaseNothing)
    {
      return;
    }

  else if (m_keyBind->releaseAction() == KeyBind::ReleaseStop)
    {
      Function* f = _app->doc()->function(m_functionID);
      if (f)
	{
	  if (isOn())
	    {
	      f->stop();
//	      setOn(false);
	    }
        }
    }
}
Пример #12
0
  bool
  FlagStatus::isOn(const Vector_ModifierFlag& modifierFlags) const
  {
    bool strict = false;

    for (size_t i = 0; i < modifierFlags.size(); ++i) {
      if (modifierFlags[i] == ModifierFlag::ZERO) continue;

      if (modifierFlags[i] == ModifierFlag::NONE) {
        strict = true;
      } else {
        if (! isOn(modifierFlags[i])) return false;
      }
    }

    // If modifierFlags contains ModifierFlag::NONE,
    // return false when unspecified modifierflag is pressed.
    if (strict) {
      for (size_t i = 0; i < item_.size(); ++i) {
        if (item_[i].sum(true) > 0 &&
            ! modifierFlags.is_include(item_[i].flag_)) {
          return false;
        }
      }
    }

    return true;
  }
Пример #13
0
void GM862::init() {
  delay(1000);
  getStatus();                    // identify if modem is turned on or not
  Serial.println("GM862 MC Control");
  // test to see if modem is on
  if(!isOn()){
    Serial.println("Turning on Modem ...");
    switchOn();                   // switch the modem on
    delay(4000);                        // wait for the modem to boot
  }
  Serial.println("initializing modem ...");
  char buf[BUF_LENGTH];
  requestModem("AT", 1000, true, buf);
  requestModem("AT+IPR=19200", 1000, true, buf);
  requestModem("AT+CMEE=2", 1000, true, buf);
  requestModem("AT+CNMI=2,1,2,1,0", 1000, true, buf);
  requestModem("AT+CMGF=1", 1000, true, buf);             // send text sms
  state |= STATE_INITIALIZED;
  checkNetwork();             // check the network availability
//  modem.version();                    // request modem version info
/*  while (!modem.isRegistered()) {
    delay(1000);
    modem.checkNetwork();             // check the network availability
  }*/
  Serial.println("Modem is ready");
}
Пример #14
0
    /*******************************************************************
     *Função membro getCopy
     *Parâmetros: void
     *Retorna Cópia do efeito, no estado actual em que se encontra
     *******************************************************************/
    AelEffect* AelButterWorth::getCopy(){
        AelButterWorth *cp = new AelButterWorth(gain, cutoff, BandWidth ,getNChannels(), getSampleRate());
        
        cp->ON = ON;

        switch (ON) {
            case lowpass:
                cp->set_LPF();
                break;
            case highpass:
                cp->set_HPF();
                break;
            case rejectband:
                cp->set_NOTCH();
                break;
            case bandpass:
                cp->set_BPF();
                break;
            default:
                break;
        }
        
        cp->setWetLevel(getWetLevel());
        
        if(!isOn()){
            cp->m_turnOff();
        }
        
        
        return cp;
        
    }
Пример #15
0
void KDockButton_Private::drawButton( QPainter* p )
{
  p->fillRect( 0,0, width(), height(), QBrush(colorGroup().brush(QColorGroup::Background)) );
  p->drawPixmap( (width() - pixmap()->width()) / 2, (height() - pixmap()->height()) / 2, *pixmap() );
  if ( moveMouse && !isDown() ){
    p->setPen( white );
    p->moveTo( 0, height() - 1 );
    p->lineTo( 0, 0 );
    p->lineTo( width() - 1, 0 );

    p->setPen( colorGroup().dark() );
    p->lineTo( width() - 1, height() - 1 );
    p->lineTo( 0, height() - 1 );
  }
  if ( isOn() || isDown() ){
    p->setPen( colorGroup().dark() );
    p->moveTo( 0, height() - 1 );
    p->lineTo( 0, 0 );
    p->lineTo( width() - 1, 0 );

    p->setPen( white );
    p->lineTo( width() - 1, height() - 1 );
    p->lineTo( 0, height() - 1 );
  }
}
Пример #16
0
void SimpleButton::drawButtonLabel( QPainter *p )
{
    if (!pixmap())
    {
        return;
    }

    QPixmap pix = m_highlight? m_activeIcon : m_normalIcon;

    if (isOn() || isDown())
    {
        pix = pix.convertToImage().smoothScale(pix.width() - 2,
                                               pix.height() - 2);
    }

    int h = height();
    int w = width();
    int ph = pix.height();
    int pw = pix.width();
    int margin = KDialog::spacingHint();
    QPoint origin(margin / 2, margin / 2);

    if (ph < (h - margin))
    {
        origin.setY((h - ph) / 2);
    }

    if (pw < (w - margin))
    {
        origin.setX((w - pw) / 2);
    }

    p->drawPixmap(origin, pix);
}
Пример #17
0
void KColorButton::drawButtonLabel(QPainter *painter)
{
    int x, y, w, h;
    QRect r = style().subRect(QStyle::SR_PushButtonContents, this);
    r.rect(&x, &y, &w, &h);

    int margin = style().pixelMetric(QStyle::PM_ButtonMargin, this);
    x += margin;
    y += margin;
    w -= 2 * margin;
    h -= 2 * margin;

    if(isOn() || isDown())
    {
        x += style().pixelMetric(QStyle::PM_ButtonShiftHorizontal, this);
        y += style().pixelMetric(QStyle::PM_ButtonShiftVertical, this);
    }

    QColor fillCol = isEnabled() ? col : backgroundColor();
    qDrawShadePanel(painter, x, y, w, h, colorGroup(), true, 1, NULL);
    if(fillCol.isValid())
        painter->fillRect(x + 1, y + 1, w - 2, h - 2, fillCol);

    if(hasFocus())
    {
        QRect focusRect = style().subRect(QStyle::SR_PushButtonFocusRect, this);
        style().drawPrimitive(QStyle::PE_FocusRect, painter, focusRect, colorGroup());
    }
}
Пример #18
0
bool
AuthorizerManager::allowReadInstance(
	const ServiceEnvironmentIFCRef& env,
	const String& ns,
	const String& className,
	const StringArray* clientPropertyList,
	StringArray& authorizedPropertyList,
	OperationContext& context)
{
	// If the CIMServer is calling into the AuthorizerManager from the
	// loaded authorizer, don't do anything and authorize.
	// If there is no loaded authorizer, authorize everything.
	if (AuthorizerMarker::active(context)
	   || !m_authorizer
	   || !m_initialized
	   || !isOn(context))
	{
		return true;
	}

	AuthorizerMarker am(context);
	return m_authorizer->doAllowReadInstance(
		createAuthEnvRef(context, env), ns, className,
		clientPropertyList, authorizedPropertyList, context);
}
Пример #19
0
std::vector<std::vector<bool>> Map::getBoolMap() const
{
    std::vector<std::vector<bool>> boolMap;

    boolMap.resize(_mapSize.x);

    for (int i = 0; i < _mapSize.x; i++)
    {
        boolMap[i].resize(_mapSize.y);

        for (int j = 0; j < _mapSize.y; j++)
        {
            //Valeur par défaut, qui représente un mur.
            boolMap[i][j] = true;

            //Position à laquelle on est rendu
            sf::Vector2f pos(i * _width, j*_width);

            for (auto it = _map.begin(); it != _map.end() && boolMap[i][j]; it++)
            {
                //Si la position est sur une ligne, elle ne représente pas un mur et on quitte la boucle
                if (it->isOn(pos))
                    boolMap[i][j] = false;
            }
        }
    }

    return boolMap;
}
Пример #20
0
void VCButton::releaseFunction()
{
	Q_ASSERT(m_keyBind != NULL);

	if (m_function == KNoID)
	{
		return;
	}
	else if (m_keyBind->releaseAction() == KeyBind::ReleaseNothing)
	{
		return;
	}
	else if (m_keyBind->releaseAction() == KeyBind::ReleaseStop)
	{
		Function* function = NULL;
		function = _app->doc()->function(m_function);
		if (function != NULL)
		{
			if (isOn() == true)
			{
				function->stop();
			}
		}
	}
}
Пример #21
0
void PHN_Sim::togglePower() {
  if (isOn()) {
    end();
  } else {
    powerOnStart();
    powerOnEnd();
  }
}
Пример #22
0
/**
 * @brief Handles the case where there's a redstone torch below us
 * @param component	The component below us
 */
void Redstone::SolidBlock::_onRedstoneTorchBelow(
	const Redstone::Component * component)
{
	auto torch = dynamic_cast<const RedstoneTorch *>(component);

	if (torch->isOn())
		this->_stronglyPowered = true;
}
Пример #23
0
 virtual void paintCell( QPainter * p, const QColorGroup &cg, int c, int w, int a )
 {
     QFont f = p->font();
     if( isOn() )
         f.setBold( !f.bold() );
     p->setFont( f );
     super::paintCell( p, cg, c, w, a );
 }
Пример #24
0
 void Light::_blink() {
   if(isOn() && _shouldBlinkOff()) {
     _blinkOff();
   }
   else if(isOff() && _shouldBlinkOn()) {
     _blinkOn();
   }
 }
Пример #25
0
void GM862::switchOff() {
  Serial.println("switching off");
  if (isOn()) {
    switchModem();
    state &= ~STATE_ON;
  }
  Serial.println("done");
}
Пример #26
0
void SCarLight::TurnOff()
{
	VERIFY(!ph_world->Processing());
	if(!isOn()) return;
 	glow_render ->set_active(false);
	light_render->set_active(false);
	smart_cast<IKinematics*>(m_holder->PCar()->Visual())->LL_SetBoneVisible(bone_id,FALSE,TRUE);
}
Пример #27
0
 static void issue(const T1& a1, const T2& a2)
 {
    if (isOn()) {
       _currentCount++;
       _totalCount++;
       handler().handle(Warning(a1, a2));
    }
 }
Пример #28
0
void GM862::switchOn() {
  Serial.println("switching on");
  if (!isOn()) {
    switchModem();
    state |= STATE_ON;
  }
  Serial.println("done");
}
Пример #29
0
 /**
  * \name Static template members for issueing
  * If isOn() returns `true`, then these increase the warning counters,
  * construct a \a Warning instance from the provided arguments and pass it
  * to the handler().
  * @{
  */
 static void issue()
 {
    if (isOn()) {
       _currentCount++;
       _totalCount++;
       handler().handle(Warning());
    }
 }
Пример #30
0
 static void issue(const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5)
 {
    if (isOn()) {
       _currentCount++;
       _totalCount++;
       handler().handle(Warning(a1, a2, a3, a4, a5));
    }
 }