void ResourceItem::setGuiState()
{
  mBlockStateChange = true;
  if ( mIsSubresource ) {
    setOn( mResource->subresourceActive( mResourceIdentifier ) );
  } else {
    setOn( mResource->isActive() );
  }
  mBlockStateChange = false;
}
void CCControlSwitch::ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent)
{
    CCPoint location   = this->locationFromTouch(pTouch);

    m_pSwitchSprite->getThumbSprite()->setColor(ccWHITE);

    if (hasMoved())
    {
        setOn(!(location.x < m_pSwitchSprite->getContentSize().width / 2), true);
    } else
    {
        setOn(!m_bOn, true);
    }
}
示例#3
0
void ControlSwitch::onTouchCancelled(Touch *pTouch, Event *pEvent)
{
    Point location   = this->locationFromTouch(pTouch);
    
    _switchSprite->getThumbSprite()->setColor(Color3B::WHITE);
    
    if (hasMoved())
    {
        setOn(!(location.x < _switchSprite->getContentSize().width / 2), true);
    } else
    {
        setOn(!_on, true);
    }
}
示例#4
0
void Relay::switchState() {
	if(isOFF) {
        setOn();
	} else {
		setOff();
	}
}
示例#5
0
文件: vcbutton.cpp 项目: speakman/qlc
VCButton::VCButton(QWidget* parent) : VCWidget(parent, "Button")
{
	/* Just a pointer to the function selection dialog. This is used
	   only when the menu item for selecting a function is clicked */
	m_functionManager = NULL;

	/* No function is initially attached to the button */
	m_function = KNoID;
	QToolTip::add(this, "No function");

	/* Set the frame line width a bit thicker to make this look more
	   like a button than a frame (which it actually is) */
	setLineWidth(2);

	setCaption("");
	setOn(false);
	setExclusive(false);
	m_stopFunctions = false;

	/* Initial size */
	setMinimumSize(20, 20);
	resize(QPoint(30, 30));

	/* Keybinding */
	m_keyBind = new KeyBind();
	connect(m_keyBind, SIGNAL(pressed()), this, SLOT(pressFunction()));
	connect(m_keyBind, SIGNAL(released()), this, SLOT(releaseFunction()));
}
示例#6
0
void glowButton::setState( bool state )
{
	if( state )
		setOn();
	else
		setOff();
}
示例#7
0
//wait for a comparation until the function goes in timeout
uint8_t analogComp::waitComp(unsigned long _timeOut) {
	//exit if the interrupt is on
	if (_interruptEnabled) {
		return 0; //error
	}

	//no timeOut?
	if (_timeOut == 0) {
		_timeOut = 5000; //5 secs
	}

	//set up the analog comparator if it isn't
	if (!_initialized) {
		setOn(AIN0, AIN1);
		_initialized = 0;
	}

	//wait for the comparation
	unsigned long _tempMillis = millis() + _timeOut;
	do {
		if ((ACSR && (1<<ACO)) == 1) { //event raised
			return 1;
		}
	} while ((long)(millis() - _tempMillis) < 0);

	//switch off the analog comparator if it was off
	if (!_initialized) {
		setOff();
	}
	return 0;
}
示例#8
0
//enable the interrupt on comparations
void analogComp::enableInterrupt(void (*tempUserFunction)(void), uint8_t tempMode) {
    if (_interruptEnabled) { //disable interrupts
		SREG &= ~(1<<SREG_I);
        ACSR &= ~(1<<ACIE);
    }

    if (!_initialized) {
        setOn(AIN0, AIN1);
    }

    //set the interrupt mode
    userFunction = tempUserFunction;
    if (tempMode == CHANGE) {
        ACSR &= ~((1<<ACIS1) | (1<<ACIS0)); //interrupt on toggle event
    } else if (tempMode == FALLING) {
        ACSR &= ~(1<<ACIS0);
        ACSR |= (1<<ACIS1);
    } else { //default is RISING
        ACSR |= ((1<<ACIS1) | (1<<ACIS0));

    }
    //enable interrupts
    ACSR |= (1<<ACIE);
    SREG |= (1<<SREG_I);
    _interruptEnabled = 1;
}
示例#9
0
// Resets location of asteroid and turns asteroid off
void Asteroid::resetState() {
    int c = helper.getRandomCol();
    int r = helper.getRandomRowOnTopFraction(.78);
    rect.moveCenter(QPoint(c, r));

    setOn(false);
}
示例#10
0
LayerButton::LayerButton(const QString &text, QWidget *parent)
    : QPushButton(text, parent) {
  setToggleButton(true);
  setOn(true);
  setMaximumWidth(LayerButton::btnSize());
  setMaximumHeight(LayerButton::btnSize());
}
toTreeWidgetCheck::toTreeWidgetCheck(toTreeWidgetItem *parent,
                                     const QString &text,
                                     Type)
        : toTreeWidgetItem(parent, text)
{
    setOn(false);
}
void ModeButton::wasClicked()
{
    emit clicked(id,!on);
    // Keep button in old state, since we don't know if mode change will
    // eventually work. If we aren't channel operator, it won't.
    setOn(on);
}
示例#13
0
 DesktopBehaviorPreviewItem(DesktopBehavior *rootOpts, QListView *parent,
             bool on)
     : QCheckListItem(parent, i18n("Sound Files"), CheckBox),
       m_rootOpts(rootOpts)
 {
     m_pluginName = "audio/";
     setOn(on);
 }
示例#14
0
void G25SequencerButton::mouseUp (const MouseEvent& e)
{
    //[UserCode_mouseUp] -- Add your code here...
    stopTimer();
    if (!isSelected)
        setOn(!isOn);
    //[/UserCode_mouseUp]
}
示例#15
0
 DesktopBehaviorPreviewItem(DesktopBehavior *rootOpts, QListView *parent,
             const KService::Ptr &plugin, bool on)
     : QCheckListItem(parent, plugin->name(), CheckBox),
       m_rootOpts(rootOpts)
 {
     m_pluginName = plugin->desktopEntryName();
     setOn(on);
 }
示例#16
0
HiddenListViewItem::HiddenListViewItem( QListView *parent, KFileItem *fi, bool hidden=false, bool veto=false, bool vetoOplock=false )
  : QMultiCheckListItem( parent )
{
  setPixmap( COL_NAME, fi->pixmap(KIcon::SizeSmall));

  setText( COL_NAME, fi->text() );
  setText( COL_SIZE, KGlobal::locale()->formatNumber( fi->size(), 0));
  setText( COL_DATE,  fi->timeString() );
  setText( COL_PERM,  fi->permissionsString() );
  setText( COL_OWNER, fi->user() );
  setText( COL_GROUP, fi->group() );

  setOn(COL_HIDDEN,hidden);
  setOn(COL_VETO,veto);
  setOn(COL_VETO_OPLOCK,vetoOplock);

  _fileItem = fi;
}
示例#17
0
void Plugin::unloadPlugin()
{
    setOn(false);
    lua_pushnil(L);               // clear module in lua
    lua_setglobal(L, module.c_str());
    lua_gc(L, LUA_GCCOLLECT, 0);
    if (hModule)
        { FreeLibrary(hModule);  hModule = NULL; }
    load_state = false;
}
示例#18
0
LayerButton::LayerButton(const QString& text, QWidget* parent)
: QPushButton(text, parent)
{
	int btn_size = 20;

	setToggleButton(true);
	setOn(true);
	setMaximumWidth(btn_size);
	setMaximumHeight(btn_size);
}
示例#19
0
文件: vcbutton.cpp 项目: speakman/qlc
void VCButton::functionStopEvent(FunctionStopEvent* e)
{
	if (e && e->functionID() == m_function)
	{
		setOn(false);
		slotFlashReady();

		/* Flash the button for 100ms */
		QTimer::singleShot(100, this, SLOT(slotFlashReady()));
	}
}
示例#20
0
ILTelemetry::ILTelemetry() : ILObject() {
	_i = new ILTelemetryImpl;
	_i->delegate = NULL;
	_i->on = false;
	
	setDelegate(new ILTelemetryStdoutLogger());
	
	char* isOn = getenv("ILTelemetryIsOn");
	if (isOn && strcmp(isOn, "YES") == 0)
		setOn(true);
}
示例#21
0
DesktopButton::DesktopButton(QWidget *parent) : PanelButton(parent, "DesktopButton")
{
    setToggleButton(true);

    QToolTip::add(this, i18n("Show desktop"));
    setTitle(i18n("Desktop Access"));
    setIcon("desktop");

    connect(this, SIGNAL(toggled(bool)), this, SLOT(showDesktop(bool)));
    connect(ShowDesktop::the(), SIGNAL(desktopShown(bool)), this, SLOT(toggle(bool)));

    setOn(ShowDesktop::the()->desktopShowing());
}
示例#22
0
void glowButton::toggle( )
{
	if( state )
	{
		state = FALSE;
		setOff();
	}
	else
	{
		state = TRUE;
		setOn();
	}
}
示例#23
0
文件: vcbutton.cpp 项目: speakman/qlc
void VCButton::customEvent(QCustomEvent* e)
{
  if (e->type() == KFunctionStopEvent && 
      ((FunctionStopEvent*)e)->functionID() == m_functionID)
    {
      setOn(false);
      slotFlashReady();
      QTimer::singleShot(KFlashReadyTime, this, SLOT(slotFlashReady()));
    }
  else if (e->type() == KVCMenuEvent)
    {
      parseWidgetMenu(((VCMenuEvent*) e)->menuItem());
    }
}
示例#24
0
void RandomFillCubeSequence::next(){

  cycle++;
  
  // Seems to need a way to abort because in some cases no available
  // random position can be found, even when the cube isn't full.
  for(int i=0; i<150 ;i++) {
    int x = rand() % 8;
    int y = rand() % 8;
    int z = rand() % 8;
        
    if (!getState(x,y,z)) {
      setOn(x,y,z);
      return;
    }
  }
  
  Serial.print("No random position found on cycle ");
  Serial.println(cycle);
}
示例#25
0
bool QAction::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: activate(); break;
    case 1: toggle(); break;
    case 2: setOn((bool)static_QUType_bool.get(_o+1)); break;
    case 3: setEnabled((bool)static_QUType_bool.get(_o+1)); break;
    case 4: setDisabled((bool)static_QUType_bool.get(_o+1)); break;
    case 5: setVisible((bool)static_QUType_bool.get(_o+1)); break;
    case 6: internalActivation(); break;
    case 7: toolButtonToggled((bool)static_QUType_bool.get(_o+1)); break;
    case 8: objectDestroyed(); break;
    case 9: menuStatusText((int)static_QUType_int.get(_o+1)); break;
    case 10: showStatusText((const QString&)static_QUType_QString.get(_o+1)); break;
    case 11: clearStatusText(); break;
    default:
	return QObject::qt_invoke( _id, _o );
    }
    return TRUE;
}
示例#26
0
bool Plugin::reloadPlugin()
{
    if (file.empty())
        return false;
    const wchar_t* fname = file.c_str();
    bool result = false;
    const wchar_t *e = wcsrchr(fname, L'.');
    if (!e) return false;
    Plugin *old = _cp;
    _cp = this;
    tstring ext(e+1);
    if (ext == L"lua")
        result = loadLuaPlugin(fname);
    else if (ext == L"dll")
        result = loadDllPlugin(fname);
    _cp = old;
    setOn(result);
    load_state = result;
    return result;
}
示例#27
0
status_t BnLedService::onTransact(
    uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
    switch(code) {
        case CONNECT: {
            CHECK_INTERFACE(ILedService, data, reply);
            return NO_ERROR;
        } break;
	case LED_ON:
            CHECK_INTERFACE(ILedService, data, reply);
            int n = data.readInt32();//
            status_t result = setOn(n);//
            reply->writeInt32(result);//
	    return NO_ERROR;//
	case LED_OFF://
            CHECK_INTERFACE(ILedService, data, reply);//
            int n = data.readInt32();//
            status_t result = setOff(n);//
            reply->writeInt32(result);//
	    return NO_ERROR;//
        default:
            return BBinder::onTransact(code, data, reply, flags);
    }
}
void KMultiTabBarTab::setState(bool b)
{
	setOn(b);
	updateState();
}
示例#29
0
void LED::toggle()
{
    isOn() ? setOff() : setOn();
}
int QAbstractButton::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: pressed(); break;
        case 1: released(); break;
        case 2: clicked((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 3: clicked(); break;
        case 4: toggled((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 5: setIconSize((*reinterpret_cast< const QSize(*)>(_a[1]))); break;
        case 6: animateClick((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 7: animateClick(); break;
        case 8: click(); break;
        case 9: toggle(); break;
        case 10: setChecked((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 11: setOn((*reinterpret_cast< bool(*)>(_a[1]))); break;
        }
        _id -= 12;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = text(); break;
        case 1: *reinterpret_cast< QIcon*>(_v) = icon(); break;
        case 2: *reinterpret_cast< QSize*>(_v) = iconSize(); break;
        case 3: *reinterpret_cast< QKeySequence*>(_v) = shortcut(); break;
        case 4: *reinterpret_cast< bool*>(_v) = isCheckable(); break;
        case 5: *reinterpret_cast< bool*>(_v) = isChecked(); break;
        case 6: *reinterpret_cast< bool*>(_v) = autoRepeat(); break;
        case 7: *reinterpret_cast< bool*>(_v) = autoExclusive(); break;
        case 8: *reinterpret_cast< int*>(_v) = autoRepeatDelay(); break;
        case 9: *reinterpret_cast< int*>(_v) = autoRepeatInterval(); break;
        case 10: *reinterpret_cast< bool*>(_v) = isDown(); break;
        }
        _id -= 11;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setText(*reinterpret_cast< QString*>(_v)); break;
        case 1: setIcon(*reinterpret_cast< QIcon*>(_v)); break;
        case 2: setIconSize(*reinterpret_cast< QSize*>(_v)); break;
        case 3: setShortcut(*reinterpret_cast< QKeySequence*>(_v)); break;
        case 4: setCheckable(*reinterpret_cast< bool*>(_v)); break;
        case 5: setChecked(*reinterpret_cast< bool*>(_v)); break;
        case 6: setAutoRepeat(*reinterpret_cast< bool*>(_v)); break;
        case 7: setAutoExclusive(*reinterpret_cast< bool*>(_v)); break;
        case 8: setAutoRepeatDelay(*reinterpret_cast< int*>(_v)); break;
        case 9: setAutoRepeatInterval(*reinterpret_cast< int*>(_v)); break;
        case 10: setDown(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 11;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        bool *_b = reinterpret_cast<bool*>(_a[0]);
        switch (_id) {
        case 5: *_b = isCheckable(); break;
        }
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 11;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}