Beispiel #1
0
void B9Projector::keyReleaseEvent(QKeyEvent * pEvent)
{
    QWidget::keyReleaseEvent(pEvent);
    if(pEvent->modifiers()!=Qt::ShiftModifier)
        emit keyReleased(pEvent->key()+32);
    else
        emit keyReleased(pEvent->key());
}
Beispiel #2
0
	void Controller::onKeyReleased(unsigned char key)
	{
		if(_2Players){
			if (_secondPlayer == NULL){
				_secondPlayer = _pm->secondPlayer();
				keyReleased(key);
			}
			else keyReleased(key);
		}
	}
Beispiel #3
0
/* This function does nothing - since it's already been drawn */
void runCreditsScreen( void )
{
	// Check for key presses now.
	if( keyReleased(KEY_ESC)
	   || keyReleased(KEY_SPACE)
	   || mouseReleased(MOUSE_LMB)
	   || gameTime - lastChange > 4000 )
	{
		lastChange = gameTime;
		changeTitleMode(QUIT);
	}
	return;
}
Beispiel #4
0
void Keyboard::processEvent( const InputEvent& event )
{
    if( event.deviceType != InputDeviceType::Keyboard )
        return;

    const KeyEvent& keyEvent = static_cast<const KeyEvent&>(event);
    
    switch(keyEvent.eventType)
    {
    case KeyboardEventType::KeyPressed:
    {
        keyPressed(keyEvent);
        break;
    }
    case KeyboardEventType::KeyReleased:
    {
        keyReleased(keyEvent);
        break;
    }
    case KeyboardEventType::KeyText:
    {
        onKeyText(keyEvent);
        break;
    } }
}
Beispiel #5
0
void MainGLWidget::keyReleaseEvent(QKeyEvent *event)
{
    if(event->isAutoRepeat())
        event->ignore();
    else
        emit keyReleased(event->key());
}
Beispiel #6
0
void Piano::viewMousePressEvent(QMouseEvent* event)
      {
      button = event->button();
      shift  = event->modifiers() & Qt::ShiftModifier;
      if (keyDown != -1) {
            emit keyReleased(keyDown, shift);
            keyDown = -1;
            }
      keyDown = y2pitch(event->y());
      if (keyDown < 0 || keyDown > 127) {
            keyDown = -1;
            }
      else {
            int velocity = event->x()*127/40;
            // REMOVE Tim. Noteoff. Changed. Zero note on vel is not allowed now.
//             emit keyPressed(keyDown, velocity>127 ? 127 : velocity, shift); //emit keyPressed(keyDown, shift);
            if(velocity > 127)
              velocity = 127;
            else if(velocity <= 0)
              velocity = 1;  // Zero note on vel is not allowed.
            emit keyPressed(keyDown, velocity, shift); //emit keyPressed(keyDown, shift);
            }
            
      if (keyDown != -1 && keyDown != _curSelectedPitch) {
            _curSelectedPitch = keyDown;
            emit curSelectedPitchChanged(_curSelectedPitch);
            redraw(); 
            MusEGlobal::song->update(SC_DRUMMAP);
            }
      }
void MapWidget::handleKeyReleaseEvent(QKeyEvent* event)
{
	if (keyReleased)
	{
		keyReleased(event);
	}
}
    std::queue<Event> SDLInputBackend::fetchEvents()
    {
        SDL_Event event;
        std::queue<Event> result;

        while(SDL_PollEvent(&event))
        {
            if(event.type == SDL_QUIT)
                result.push(closed());
            else if(event.type == SDL_VIDEORESIZE)
                result.push(resized(event));
            else if(event.type == SDL_ACTIVEEVENT)
                result.push(active(event));
            else if(event.type == SDL_KEYDOWN)
                result.push(keyPressed(event));
            else if(event.type == SDL_KEYUP)
                result.push(keyReleased(event));
            else if(event.type == SDL_MOUSEBUTTONDOWN)
                result.push(mouseButtonPressed(event));
            else if(event.type == SDL_MOUSEBUTTONUP)
                result.push(mouseButtonReleased(event));
            else if(event.type == SDL_MOUSEMOTION)
                result.push(mouseMoved(event));
            else if(event.type == SDL_JOYBUTTONDOWN)
                result.push(gamepadButtonPressed(event));
            else if(event.type == SDL_JOYBUTTONUP)
                result.push(gamepadButtonReleased(event));
            else if(event.type == SDL_JOYAXISMOTION)
                result.push(gamepadMoved(event));
        }

        return result;
    }
bool Viewer::deviceEventOccurred(const DeviceEvent &event) {
	switch (event.getType()) {
		case Device::EKeyDownEvent:
			if (event.getKeyboardKey() == 'q' 
				|| event.getKeyboardSpecial() == Device::EKeyEscape) {
				m_quit = true;
				m_leaveEventLoop = true;
			} else {
				keyPressed(event);
			}
			break;
		case Device::EKeyUpEvent: keyReleased(event); break;
		case Device::EMouseMotionEvent: mouseMoved(event); break;
		case Device::EMouseDragEvent: mouseDragged(event); break;
		case Device::EMouseButtonDownEvent: mouseButtonPressed(event); break;
		case Device::EMouseButtonUpEvent: mouseButtonReleased(event); break;
		case Device::EMouseBeginDragEvent: mouseBeginDrag(event); break;
		case Device::EMouseEndDragEvent: mouseEndDrag(event); break;
		case Device::EQuitEvent:
			m_quit = true;
			m_leaveEventLoop = true;
			break;
		case Device::EResizeEvent:
			m_renderer->reconfigure(m_device);
			windowResized(event);
			// no break
		case Device::EGainFocusEvent:
			m_leaveEventLoop = true;
			break;
	}

	return true;
}
Beispiel #10
0
void QgsMapCanvas::keyReleaseEvent( QKeyEvent * e )
{
  QgsDebugMsg( "keyRelease event" );

  switch ( e->key() )
  {
    case Qt::Key_Space:
      if ( !e->isAutoRepeat() && mCanvasProperties->panSelectorDown )
      {
        QgsDebugMsg( "Releasing pan selector" );

        mCanvasProperties->panSelectorDown = false;
        panActionEnd( mCanvasProperties->mouseLastXY );
      }
      break;

    default:
      // Pass it on
      if ( mMapTool )
      {
        mMapTool->keyReleaseEvent( e );
      }
      else e->ignore();

      QgsDebugMsg( "Ignoring key release: " + QString::number( e->key() ) );
  }

  emit keyReleased( e );

} //keyReleaseEvent()
Beispiel #11
0
	void GenericSkin::mouseMultiReleased(int x, int y) {
		if(mTouchedInside) {
			mTouchedInside = false;
			mIsSimulatingMultiTouch = false;

			// blits the current screen again since the
			// two multi touch markers will othervise be
			// visible.
			drawScreen();

			if( x>=screenRect.x && x<screenRect.x+screenRect.w &&
				y>=screenRect.y && y<screenRect.y+screenRect.h) {
					mListener->onMoSyncPointerRelease(x-screenRect.x,
														y-screenRect.y, 0);
					mListener->onMoSyncPointerRelease(x-screenRect.x,
														y-screenRect.y, 1);
					return;
			}
			return;
		}

		if(!mPressedKey) return;
		mListener->onMoSyncKeyRelease(mPressedKey);
		keyReleased(mPressedKey);
		mPressedKey = 0;
	}
void EventHandler::onKeyReleased(QString label, QString action)
{
    Key key;
    key.setLabel(label);

    if (action == "return")
        key.setAction(Key::ActionReturn);
    else if (action == "keyTab")
        key.setAction(Key::ActionTab);
    else if (action == "backspace")
        key.setAction(Key::ActionBackspace);
    else if (action == "space")
        key.setAction(Key::ActionSpace);
    else if (action == "shift")
        key.setAction(Key::ActionShift);
    else if (action == "keyRight")
        key.setAction(Key::ActionRight);
    else if (action == "keyLeft")
        key.setAction(Key::ActionLeft);
    else if (action == "keyDown")
        key.setAction(Key::ActionDown);
    else if (action == "keyUp")
        key.setAction(Key::ActionUp);
    else
        key.setAction(Key::ActionInsert);

    Q_EMIT keyReleased(key);
}
//--------------------------------------------------------------
void ofxMSAInteractiveObject::_keyReleased(ofKeyEventArgs &e) {
	int key = e.key;	
	if(verbose) printf("ofxMSAInteractiveObject::_keyReleased(key: %i)\n", key);
	if(!enabled) return;
	if(isMouseOver()) onKeyRelease(key);
    keyReleased(key);
}
Beispiel #14
0
void GameView::keyReleaseEvent(QKeyEvent* p_event)
{
    if(p_event->isAutoRepeat())
    {
        return;
    }
    emit(keyReleased(p_event));
}
void GraphicsKeyboardItem::mouseReleaseEvent ( QGraphicsSceneMouseEvent * )
{
    if (activeKey) {
        activeKey->releaseKey();
        keyReleased(getChannel(), activeKeyIndex, 127);
        activeKey = 0;
    }
}
void PercussionPitchRuler::mouseReleaseEvent(QMouseEvent *e)
{
    if (e->button() == Qt::LeftButton) {
        m_mouseDown = false;
        m_selecting = false;
        emit keyReleased(e->y(), false);
    }
}
Beispiel #17
0
void VirtualConsole::keyReleaseEvent(QKeyEvent* e)
{
    if (_app->mode() == App::Operate)
    {
        emit keyReleased(e);
        e->accept();
    }
}
Beispiel #18
0
bool inputManager::keyReleased(std::vector<int> keys)
{
    for(int i = 0; i <keys.size(); i++)
    {
        if(keyReleased(keys[i]))
            return true;
    }
    return false;
}
Beispiel #19
0
void Piano::leaveEvent(QEvent*)
{
    if (keyDown != -1) {
        emit keyReleased(keyDown, shift);
        keyDown = -1;
    }
    emit pitchChanged(-1);
    setPitch(-1);
}
Beispiel #20
0
void Piano::viewMouseReleaseEvent(QMouseEvent* event)
{
    button = Qt::NoButton;
    shift = event->modifiers() & Qt::ShiftModifier;
    if (keyDown != -1) {
        emit keyReleased(keyDown, shift);
        keyDown = -1;
    }
}
Beispiel #21
0
void ScenarioView::keyReleaseEvent(QKeyEvent* event)
{
  QGraphicsItem::keyReleaseEvent(event);
  if (event->key() == Qt::Key_Shift || event->key() == Qt::Key_Control
      || event->key() == Qt::Key_Alt)
  {
    keyReleased(event->key());
  }

  event->accept();
}
Beispiel #22
0
void Player::doEvent(const sf::Event &event)
{
  switch (event.type)
  {
  case sf::Event::KeyPressed:
    keyPressed(event.key.code);
    break;
  case sf::Event::KeyReleased:
    keyReleased(event.key.code);
    break;
  }
}
Beispiel #23
0
EmulKey::EmulKey(EmulKbd *kbd, const char *label, int _keycode, int _row, int _col) :
	QPushButton(label, kbd),
	row(_row), col(_col),
	keycode(_keycode)
{
	// don't let the widget get focus
	setFocusPolicy(Qt::NoFocus);

	// unused
	connect(this, SIGNAL(pressed()), this, SLOT(keyPressed()));
	connect(this, SIGNAL(released()), this, SLOT(keyReleased()));
}
Beispiel #24
0
// Main method. The openGL equivalent of a pilot checking
// things off a list before taking off.
int main(int argc, char** argv)
{
  SDL_Event event;

  if (SDL_Init(SDL_INIT_EVERYTHING) == -1) {
	return 1;
  }

  //Creates screen
  screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE);
  if(screen == NULL) {
	return 1;
  }



  //Sets the widnow caption
  SDL_WM_SetCaption("VGC", NULL);

  //Unicode translation for Keyboard events. Overhead, and may not be useful
  //int SDL_EnableUNICODE(1);

  // Where the keys are stored.
  for (int i = 0; i < SDLK_LAST; i++) {
	keys[i] = 0;
  }


  int running = 1;
  while (running) {

	while(SDL_PollEvent(&event)) {
	  int code = event.key.keysym.sym;
	  if (event.type == SDL_KEYUP) {

		keyReleased(code,0,0);
	  } else if (event.type == SDL_KEYDOWN) {
		keyPressed(code,0,0);
		if (code == SDLK_q) {
		  running = 0;
		}
	  }
	}
	display();
  }



  return EXIT_SUCCESS;
}
Beispiel #25
0
void Piano::mouseMoveEvent(QMouseEvent* event)
      {
      int pitch = y2pitch(event->pos().y());
      if (pitch != curPitch) {
            curPitch = pitch;
            emit pitchChanged(curPitch);
            if ((curKeyPressed != -1) && (curKeyPressed != pitch)) {
                  emit keyReleased(curKeyPressed);
                  curKeyPressed = pitch;
                  emit keyPressed(curKeyPressed);
                  }
            update();
            }
      }
Beispiel #26
0
void VirtualConsole::keyReleaseEvent(QKeyEvent* event)
{
    if (event->isAutoRepeat() == true)
    {
        event->ignore();
        return;
    }

    if ((event->modifiers() & Qt::ControlModifier) == 0)
        m_tapModifierDown = false;

    QKeySequence seq(event->key() | event->modifiers());
    emit keyReleased(seq);

    event->accept();
}
Beispiel #27
0
	void GenericSkin::mouseReleased(int x, int y) {
		if(mTouchedInside) {
			mTouchedInside = false;
			if( x>=screenRect.x && x<screenRect.x+screenRect.w &&
				y>=screenRect.y && y<screenRect.y+screenRect.h) {
					mListener->onMoSyncPointerRelease(x-screenRect.x, y-screenRect.y, 0);
					return;
			}
			return;
		}

		if(!mPressedKey) return;
		mListener->onMoSyncKeyRelease(mPressedKey);
		keyReleased(mPressedKey);
		mPressedKey = 0;
	}
    std::queue<Event> SFMLInputBackend::fetchEvents()
    {
        sf::Event event;
        std::queue<Event> result;

        while (mWindow.pollEvent(event))
        {
            if(event.type == sf::Event::Closed)
                result.push(closed());
            else if(event.type == sf::Event::Resized)
                result.push(resized(event));
            else if(event.type == sf::Event::LostFocus)
                result.push(lostFocus());
            else if(event.type == sf::Event::GainedFocus)
                result.push(gainedFocus());
            else if(event.type == sf::Event::TextEntered)
                result.push(textEntered(event));
            else if(event.type == sf::Event::KeyPressed)
                result.push(keyPressed(event));
            else if(event.type == sf::Event::KeyReleased)
                result.push(keyReleased(event));
            else if(event.type == sf::Event::MouseWheelMoved)
                result.push(mouseWheelMoved(event));
            else if(event.type == sf::Event::MouseButtonPressed)
                result.push(mouseButtonPressed(event));
            else if(event.type == sf::Event::MouseButtonReleased)
                result.push(mouseButtonReleased(event));
            else if(event.type == sf::Event::MouseMoved)
                result.push(mouseMoved(event));
            else if(event.type == sf::Event::MouseEntered)
                result.push(mouseEntered());
            else if(event.type == sf::Event::MouseLeft)
                result.push(mouseLeft());
            else if(event.type == sf::Event::JoystickButtonPressed)
                result.push(gamepadButtonPressed(event));
            else if(event.type == sf::Event::JoystickButtonReleased)
                result.push(gamepadButtonReleased(event));
            else if(event.type == sf::Event::JoystickMoved)
                result.push(gamepadMoved(event));
            else if(event.type == sf::Event::JoystickConnected)
                result.push(gamepadConnected(event));
            else if(event.type == sf::Event::JoystickDisconnected)
                result.push(gamepadDisconnected(event));
        }

        return result;
    }
void TemporalScenarioView::keyReleaseEvent(QKeyEvent *event)
{
    QGraphicsObject::keyReleaseEvent(event);
    if(event->key() == Qt::Key_Shift || event->key() == Qt::Key_Control)
    {
        emit keyReleased(event->key());
    }/*
    else if( !event->isAutoRepeat())
    {
        if(event->key() == Qt::Key_C)
        {
            emit keyReleased(event->key());
        }
    }
    */

    event->accept();
}
void EventHandler::onReleased(int index)
{
    Q_D(EventHandler);

    const QVector<Key> &keys(d->layout->keyArea().keys());

    if (index >= keys.count()) {
        qWarning() << __PRETTY_FUNCTION__
                   << "Invalid index:" << index
                   << "Keys available:" << keys.count();
        return;
    }

    const Key &key(keys.at(index));

    const Key normal_key(d->updater->modifyKey(key, KeyDescription::NormalState));
    d->layout->replaceKey(index, normal_key);
    d->updater->onKeyReleased(normal_key);

    Q_EMIT keyReleased(normal_key);
}