diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 30390c007b..60ae1843d6 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -79,8 +79,6 @@ #include #include #include -#include -#include #include #include #include @@ -2858,10 +2856,6 @@ bool Application::event(QEvent* event) { break; } - if (HFActionEvent::types().contains(event->type())) { - _controllerScriptingInterface->handleMetaEvent(static_cast(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); - } } } diff --git a/interface/src/scripting/ControllerScriptingInterface.cpp b/interface/src/scripting/ControllerScriptingInterface.cpp index 5c55e2094b..4848531de7 100644 --- a/interface/src/scripting/ControllerScriptingInterface.cpp +++ b/interface/src/scripting/ControllerScriptingInterface.cpp @@ -13,23 +13,10 @@ #include #include -#include #include #include "Application.h" -void ControllerScriptingInterface::handleMetaEvent(HFMetaEvent* event) { - if (event->type() == HFActionEvent::startType()) { - emit actionStartEvent(static_cast(*event)); - } else if (event->type() == HFActionEvent::endType()) { - emit actionEndEvent(static_cast(*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)); } diff --git a/interface/src/scripting/ControllerScriptingInterface.h b/interface/src/scripting/ControllerScriptingInterface.h index 8c825a17de..7a2c964622 100644 --- a/interface/src/scripting/ControllerScriptingInterface.h +++ b/interface/src/scripting/ControllerScriptingInterface.h @@ -17,7 +17,6 @@ #include #include -#include #include #include #include @@ -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); diff --git a/libraries/script-engine/src/EventTypes.cpp b/libraries/script-engine/src/EventTypes.cpp index 1bdf0f5034..abdd934e5a 100644 --- a/libraries/script-engine/src/EventTypes.cpp +++ b/libraries/script-engine/src/EventTypes.cpp @@ -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); diff --git a/libraries/script-engine/src/HFActionEvent.cpp b/libraries/script-engine/src/HFActionEvent.cpp deleted file mode 100644 index 3ed3bcb73c..0000000000 --- a/libraries/script-engine/src/HFActionEvent.cpp +++ /dev/null @@ -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 -} - diff --git a/libraries/script-engine/src/HFActionEvent.h b/libraries/script-engine/src/HFActionEvent.h deleted file mode 100644 index c16b165ae3..0000000000 --- a/libraries/script-engine/src/HFActionEvent.h +++ /dev/null @@ -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 - -#include - -#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 \ No newline at end of file diff --git a/libraries/script-engine/src/HFBackEvent.cpp b/libraries/script-engine/src/HFBackEvent.cpp deleted file mode 100644 index c67b2e3431..0000000000 --- a/libraries/script-engine/src/HFBackEvent.cpp +++ /dev/null @@ -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; -} diff --git a/libraries/script-engine/src/HFBackEvent.h b/libraries/script-engine/src/HFBackEvent.h deleted file mode 100644 index bb7b348ea7..0000000000 --- a/libraries/script-engine/src/HFBackEvent.h +++ /dev/null @@ -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 -#include - -#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 \ No newline at end of file diff --git a/libraries/script-engine/src/HFMetaEvent.cpp b/libraries/script-engine/src/HFMetaEvent.cpp deleted file mode 100644 index f06c349996..0000000000 --- a/libraries/script-engine/src/HFMetaEvent.cpp +++ /dev/null @@ -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 HFMetaEvent::_types = QSet(); - -QEvent::Type HFMetaEvent::newEventType() { - QEvent::Type newType = static_cast(QEvent::registerEventType()); - _types.insert(newType); - return newType; -} \ No newline at end of file diff --git a/libraries/script-engine/src/HFMetaEvent.h b/libraries/script-engine/src/HFMetaEvent.h deleted file mode 100644 index 2fd71b8a3b..0000000000 --- a/libraries/script-engine/src/HFMetaEvent.h +++ /dev/null @@ -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 - -class HFMetaEvent : public QEvent { -public: - HFMetaEvent() : QEvent(HFMetaEvent::newEventType()) {}; - HFMetaEvent(QEvent::Type type) : QEvent(type) {}; - static const QSet& types() { return HFMetaEvent::_types; } -protected: - static QEvent::Type newEventType(); - - static QSet _types; -}; - -#endif // hifi_HFMetaEvent_h \ No newline at end of file