remove unused HFMetaEvents

This commit is contained in:
SamGondelman 2017-10-11 14:37:23 -07:00
parent 99109fe8e5
commit 403b18977b
10 changed files with 0 additions and 268 deletions

View file

@ -79,8 +79,6 @@
#include <gpu/Batch.h>
#include <gpu/Context.h>
#include <gpu/gl/GLBackend.h>
#include <HFActionEvent.h>
#include <HFBackEvent.h>
#include <InfoView.h>
#include <input-plugins/InputPlugin.h>
#include <controllers/UserInputMapper.h>
@ -2858,10 +2856,6 @@ bool Application::event(QEvent* event) {
break;
}
if (HFActionEvent::types().contains(event->type())) {
_controllerScriptingInterface->handleMetaEvent(static_cast<HFMetaEvent*>(event));
}
return QApplication::event(event);
}
@ -3166,25 +3160,8 @@ void Application::keyPressEvent(QKeyEvent* event) {
case Qt::Key_Equal:
getMyAvatar()->resetSize();
break;
case Qt::Key_Space: {
if (!event->isAutoRepeat()) {
// FIXME -- I don't think we've tested the HFActionEvent in a while... this looks possibly dubious
// this starts an HFActionEvent
HFActionEvent startActionEvent(HFActionEvent::startType(),
computePickRay(getMouse().x, getMouse().y));
sendEvent(this, &startActionEvent);
}
break;
}
case Qt::Key_Escape: {
getActiveDisplayPlugin()->abandonCalibration();
if (!event->isAutoRepeat()) {
// this starts the HFCancelEvent
HFBackEvent startBackEvent(HFBackEvent::startType());
sendEvent(this, &startBackEvent);
}
break;
}
@ -3210,30 +3187,6 @@ void Application::keyReleaseEvent(QKeyEvent* event) {
if (_keyboardMouseDevice->isActive()) {
_keyboardMouseDevice->keyReleaseEvent(event);
}
switch (event->key()) {
case Qt::Key_Space: {
if (!event->isAutoRepeat()) {
// FIXME -- I don't think we've tested the HFActionEvent in a while... this looks possibly dubious
// this ends the HFActionEvent
HFActionEvent endActionEvent(HFActionEvent::endType(),
computePickRay(getMouse().x, getMouse().y));
sendEvent(this, &endActionEvent);
}
break;
}
case Qt::Key_Escape: {
if (!event->isAutoRepeat()) {
// this ends the HFCancelEvent
HFBackEvent endBackEvent(HFBackEvent::endType());
sendEvent(this, &endBackEvent);
}
break;
}
default:
event->ignore();
break;
}
}
void Application::focusOutEvent(QFocusEvent* event) {
@ -3370,13 +3323,6 @@ void Application::mousePressEvent(QMouseEvent* event) {
if (_keyboardMouseDevice->isActive()) {
_keyboardMouseDevice->mousePressEvent(event);
}
if (event->button() == Qt::LeftButton) {
// nobody handled this - make it an action event on the _window object
HFActionEvent actionEvent(HFActionEvent::startType(),
computePickRay(mappedEvent.x(), mappedEvent.y()));
sendEvent(this, &actionEvent);
}
}
}
@ -3431,13 +3377,6 @@ void Application::mouseReleaseEvent(QMouseEvent* event) {
if (_keyboardMouseDevice->isActive()) {
_keyboardMouseDevice->mouseReleaseEvent(event);
}
if (event->button() == Qt::LeftButton) {
// fire an action end event
HFActionEvent actionEvent(HFActionEvent::endType(),
computePickRay(mappedEvent.x(), mappedEvent.y()));
sendEvent(this, &actionEvent);
}
}
}

View file

@ -13,23 +13,10 @@
#include <avatar/AvatarManager.h>
#include <avatar/MyAvatar.h>
#include <HFBackEvent.h>
#include <plugins/PluginManager.h>
#include "Application.h"
void ControllerScriptingInterface::handleMetaEvent(HFMetaEvent* event) {
if (event->type() == HFActionEvent::startType()) {
emit actionStartEvent(static_cast<HFActionEvent&>(*event));
} else if (event->type() == HFActionEvent::endType()) {
emit actionEndEvent(static_cast<HFActionEvent&>(*event));
} else if (event->type() == HFBackEvent::startType()) {
emit backStartEvent();
} else if (event->type() == HFBackEvent::endType()) {
emit backEndEvent();
}
}
bool ControllerScriptingInterface::isKeyCaptured(QKeyEvent* event) const {
return isKeyCaptured(KeyEvent(*event));
}

View file

@ -17,7 +17,6 @@
#include <controllers/UserInputMapper.h>
#include <controllers/ScriptingInterface.h>
#include <HFActionEvent.h>
#include <KeyEvent.h>
#include <MouseEvent.h>
#include <SpatialEvent.h>
@ -36,8 +35,6 @@ public:
void emitKeyPressEvent(QKeyEvent* event);
void emitKeyReleaseEvent(QKeyEvent* event);
void handleMetaEvent(HFMetaEvent* event);
void emitMouseMoveEvent(QMouseEvent* event);
void emitMousePressEvent(QMouseEvent* event);
void emitMouseDoublePressEvent(QMouseEvent* event);
@ -72,12 +69,6 @@ signals:
void keyPressEvent(const KeyEvent& event);
void keyReleaseEvent(const KeyEvent& event);
void actionStartEvent(const HFActionEvent& event);
void actionEndEvent(const HFActionEvent& event);
void backStartEvent();
void backEndEvent();
void mouseMoveEvent(const MouseEvent& event);
void mousePressEvent(const MouseEvent& event);
void mouseDoublePressEvent(const MouseEvent& event);

View file

@ -9,7 +9,6 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "HFActionEvent.h"
#include "KeyEvent.h"
#include "MouseEvent.h"
#include "SpatialEvent.h"
@ -20,7 +19,6 @@
#include "EventTypes.h"
void registerEventTypes(QScriptEngine* engine) {
qScriptRegisterMetaType(engine, HFActionEvent::toScriptValue, HFActionEvent::fromScriptValue);
qScriptRegisterMetaType(engine, KeyEvent::toScriptValue, KeyEvent::fromScriptValue);
qScriptRegisterMetaType(engine, MouseEvent::toScriptValue, MouseEvent::fromScriptValue);
qScriptRegisterMetaType(engine, PointerEvent::toScriptValue, PointerEvent::fromScriptValue);

View file

@ -1,40 +0,0 @@
//
// HFActionEvent.cpp
// script-engine/src
//
// Created by Stephen Birarda on 2014-10-27.
// Copyright 2014 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "HFActionEvent.h"
HFActionEvent::HFActionEvent(QEvent::Type type, const PickRay& actionRay) :
HFMetaEvent(type),
actionRay(actionRay)
{
}
QEvent::Type HFActionEvent::startType() {
static QEvent::Type startType = HFMetaEvent::newEventType();
return startType;
}
QEvent::Type HFActionEvent::endType() {
static QEvent::Type endType = HFMetaEvent::newEventType();
return endType;
}
QScriptValue HFActionEvent::toScriptValue(QScriptEngine* engine, const HFActionEvent& event) {
QScriptValue obj = engine->newObject();
obj.setProperty("actionRay", pickRayToScriptValue(engine, event.actionRay));
return obj;
}
void HFActionEvent::fromScriptValue(const QScriptValue& object, HFActionEvent& event) {
// not yet implemented
}

View file

@ -1,38 +0,0 @@
//
// HFActionEvent.h
// script-engine/src
//
// Created by Stephen Birarda on 2014-10-27.
// Copyright 2014 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_HFActionEvent_h
#define hifi_HFActionEvent_h
#include <qscriptengine.h>
#include <RegisteredMetaTypes.h>
#include "HFMetaEvent.h"
class HFActionEvent : public HFMetaEvent {
public:
HFActionEvent() {};
HFActionEvent(QEvent::Type type, const PickRay& actionRay);
static QEvent::Type startType();
static QEvent::Type endType();
static QScriptValue toScriptValue(QScriptEngine* engine, const HFActionEvent& event);
static void fromScriptValue(const QScriptValue& object, HFActionEvent& event);
PickRay actionRay;
};
Q_DECLARE_METATYPE(HFActionEvent)
#endif // hifi_HFActionEvent_h

View file

@ -1,28 +0,0 @@
//
// HFBackEvent.cpp
// script-engine/src
//
// Created by Stephen Birarda on 2014-10-27.
// Copyright 2014 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "HFBackEvent.h"
HFBackEvent::HFBackEvent(QEvent::Type type) :
HFMetaEvent(type)
{
}
QEvent::Type HFBackEvent::startType() {
static QEvent::Type startType = HFMetaEvent::newEventType();
return startType;
}
QEvent::Type HFBackEvent::endType() {
static QEvent::Type endType = HFMetaEvent::newEventType();
return endType;
}

View file

@ -1,29 +0,0 @@
//
// HFBackEvent.h
// script-engine/src
//
// Created by Stephen Birarda on 2014-10-27.
// Copyright 2014 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_HFBackEvent_h
#define hifi_HFBackEvent_h
#include <qevent.h>
#include <qscriptengine.h>
#include "HFMetaEvent.h"
class HFBackEvent : public HFMetaEvent {
public:
HFBackEvent() {};
HFBackEvent(QEvent::Type type);
static QEvent::Type startType();
static QEvent::Type endType();
};
#endif // hifi_HFBackEvent_h

View file

@ -1,20 +0,0 @@
//
// HFMetaEvent.cpp
// script-engine/src
//
// Created by Stephen Birarda on 2014-10-27.
// Copyright 2014 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "HFMetaEvent.h"
QSet<QEvent::Type> HFMetaEvent::_types = QSet<QEvent::Type>();
QEvent::Type HFMetaEvent::newEventType() {
QEvent::Type newType = static_cast<QEvent::Type>(QEvent::registerEventType());
_types.insert(newType);
return newType;
}

View file

@ -1,28 +0,0 @@
//
// HFMetaEvent.h
// script-engine/src
//
// Created by Stephen Birarda on 2014-10-27.
// Copyright 2014 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_HFMetaEvent_h
#define hifi_HFMetaEvent_h
#include <qevent.h>
class HFMetaEvent : public QEvent {
public:
HFMetaEvent() : QEvent(HFMetaEvent::newEventType()) {};
HFMetaEvent(QEvent::Type type) : QEvent(type) {};
static const QSet<QEvent::Type>& types() { return HFMetaEvent::_types; }
protected:
static QEvent::Type newEventType();
static QSet<QEvent::Type> _types;
};
#endif // hifi_HFMetaEvent_h