diff --git a/interface/resources/qml/desktop/Desktop.qml b/interface/resources/qml/desktop/Desktop.qml index 5f924834d9..a59b9d5ac0 100644 --- a/interface/resources/qml/desktop/Desktop.qml +++ b/interface/resources/qml/desktop/Desktop.qml @@ -149,17 +149,17 @@ FocusScope { } function isModalWindow(window) { - return window.modality !== Qt.NonModal; + return true;//window.modality !== (typeof Qt !== 'undefined' ? Qt.NonModal : 0); } function getTopLevelWindows(predicate) { - return findMatchingChildren(desktop, function(child) { - return (isTopLevelWindow(child) && (!predicate || predicate(child))); + return d.findMatchingChildren(desktop, function(child) { + return (d.isTopLevelWindow(child) && (!predicate || predicate(child))); }); } function getDesktopWindow(item) { - return findParentMatching(item, isTopLevelWindow) + return d.findParentMatching(item, d.isTopLevelWindow) } function fixupZOrder(windows, basis, topWindow) { @@ -205,23 +205,23 @@ FocusScope { function raiseWindow(targetWindow) { var predicate; var zBasis; - if (isModalWindow(targetWindow)) { - predicate = isModalWindow; + if (d.isModalWindow(targetWindow)) { + predicate = d.isModalWindow; zBasis = zLevels.modal - } else if (isAlwaysOnTopWindow(targetWindow)) { + } else if (d.isAlwaysOnTopWindow(targetWindow)) { predicate = function(window) { - return (isAlwaysOnTopWindow(window) && !isModalWindow(window)); + return (d.isAlwaysOnTopWindow(window) && !d.isModalWindow(window)); } zBasis = zLevels.top } else { predicate = function(window) { - return (!isAlwaysOnTopWindow(window) && !isModalWindow(window)); + return (!d.isAlwaysOnTopWindow(window) && !d.isModalWindow(window)); } zBasis = zLevels.normal } - var windows = getTopLevelWindows(predicate); - fixupZOrder(windows, zBasis, targetWindow); + var windows = d.getTopLevelWindows(predicate); + d.fixupZOrder(windows, zBasis, targetWindow); } Component.onCompleted: { @@ -264,7 +264,7 @@ FocusScope { } function getRepositionChildren(predicate) { - return findMatchingChildren(desktop, function(child) { + return d.findMatchingChildren(desktop, function(child) { return (child.shouldReposition === true && (!predicate || predicate(child))); }); } diff --git a/interface/resources/qml/hifi/dialogs/GeneralPreferencesDialog.qml b/interface/resources/qml/hifi/dialogs/GeneralPreferencesDialog.qml index cb4913f999..b6441573d8 100644 --- a/interface/resources/qml/hifi/dialogs/GeneralPreferencesDialog.qml +++ b/interface/resources/qml/hifi/dialogs/GeneralPreferencesDialog.qml @@ -17,7 +17,7 @@ PreferencesDialog { id: root objectName: "GeneralPreferencesDialog" title: "General Settings" - showCategories: ["User Interface", "HMD", "Snapshots", "Privacy"] + showCategories: ["User Interface", "HMD", "Snapshots", "Privacy", "Mouse Sensivity"] property var settings: Settings { category: root.objectName property alias x: root.x diff --git a/interface/resources/qml/hifi/tablet/TabletGeneralPreferences.qml b/interface/resources/qml/hifi/tablet/TabletGeneralPreferences.qml index 810f5bb43f..f754bd4ea5 100644 --- a/interface/resources/qml/hifi/tablet/TabletGeneralPreferences.qml +++ b/interface/resources/qml/hifi/tablet/TabletGeneralPreferences.qml @@ -32,6 +32,6 @@ StackView { TabletPreferencesDialog { id: root objectName: "TabletGeneralPreferences" - showCategories: ["UI", "Snapshots", "Scripts", "Privacy", "Octree", "HMD", "Game Controller", "Sixense Controllers", "Perception Neuron", "Kinect", "Leap Motion"] + showCategories: ["UI", "Snapshots", "Scripts", "Privacy", "Octree", "HMD", "Game Controller", "Sixense Controllers", "Perception Neuron", "Kinect", "Leap Motion", "Mouse Sensivity"] } } diff --git a/interface/resources/qml/windows/Frame.qml b/interface/resources/qml/windows/Frame.qml index 98bfb52c38..271d4f2e07 100644 --- a/interface/resources/qml/windows/Frame.qml +++ b/interface/resources/qml/windows/Frame.qml @@ -43,7 +43,7 @@ Item { Text { id: debugZ - visible: DebugQML + visible: (typeof DebugQML !== 'undefined') ? DebugQML : false color: "red" text: (window ? "Z: " + window.z : "") + " " + qmlFile y: window ? window.height + 4 : 0 diff --git a/interface/src/ui/PreferencesDialog.cpp b/interface/src/ui/PreferencesDialog.cpp index e9e13721e7..0ef2aa38a9 100644 --- a/interface/src/ui/PreferencesDialog.cpp +++ b/interface/src/ui/PreferencesDialog.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include "Application.h" @@ -55,7 +56,20 @@ void setupPreferences() { auto preference = new AvatarPreference(AVATAR_BASICS, "Appearance", getter, setter); preferences->addPreference(preference); } - // UI + + static const QString MOUSE_SENSIVITY { "Mouse Sensivity" }; + { + auto getterY = []()->float { return 1.0; }; + auto setterY = [](float value) { }; + preferences->addPreference(new SliderPreference(MOUSE_SENSIVITY, "Y Input", getterY, setterY)); + auto getterX = []()->float { return 1.0; }; + auto setterX = [](float value) { }; + preferences->addPreference(new SliderPreference(MOUSE_SENSIVITY, "X Input", getterX, setterX)); + auto getterSW = []()->float { return 1.0; }; + auto setterSW = [](float value) { }; + preferences->addPreference(new SliderPreference(MOUSE_SENSIVITY, "Scroll Wheel", getterSW, setterSW)); + } + // Graphics quality static const QString GRAPHICS_QUALITY { "Graphics Quality" }; { auto getter = []()->float { return DependencyManager::get()->getLODLevel(); }; @@ -219,69 +233,22 @@ void setupPreferences() { //TODO: Update with advanced movement logic, test that it works { - using namespace controller; - auto controllerScriptingInterface = DependencyManager::get().data(); - static QString advMovementsMappingName = QString("Hifi-AdvancedMovement-Dev-%1").arg(QRandomGenerator().generateDouble()); - static bool advMovementsIsDisabled = false; - static bool inFlipTurn = false; - - //code need to be revise so it should make correct iteration thru controller interface - /* - if (!advMovementsIsDisabled) { - MappingBuilderProxy* basicMapping = static_cast - (controllerScriptingInterface->newMapping(advMovementsMappingName)); - const auto standard = controllerScriptingInterface->getStandard(); - const auto hardware = controllerScriptingInterface->getHardware(); - qDebug() << "hardware" << hardware; - RouteBuilderProxy* fromMapping = static_cast - (basicMapping->fromQml(QJSValue(standard.value("LY").toFloat()))); - for(QMap::const_iterator i = standard.find("LY"); i != standard.end(); ++i) { - auto stick = controllerScriptingInterface->getValue(standard.value("LS").toInt()); - const float value = i.value().toFloat(); - if(value == 1.0f && hardware.contains("OculusTouch")) { - //rotate180 - myAvatar->setWorldOrientation(Quat().multiply(myAvatar->getWorldOrientation(), - Quat().angleAxis(180.0, glm::vec3(0,1,0)))); - - } else if (hardware.contains("Vive")) { - if (value > 0.75f && inFlipTurn == false) { - inFlipTurn = true; - //rotate180(); - QTimer::singleShot(1000, []() { inFlipTurn = false; } ); - } - } - } - for(QMap::const_iterator i = standard.find("RY"); i != standard.end(); ++i) { - auto stick = controllerScriptingInterface->getValue(standard.value("RS").toInt()); - const float value = i.value().toFloat(); - if(value == 1.0f && hardware.contains("OculusTouch")) { - //rotate180 - myAvatar->setWorldOrientation(Quat().multiply(myAvatar->getWorldOrientation(), - Quat().angleAxis(180.0, glm::vec3(0,1,0)))); - } else if (hardware.contains("Vive")) { - if (value > 0.75f && inFlipTurn == false) { - inFlipTurn = true; - //rotate180 - myAvatar->setWorldOrientation(Quat().multiply(myAvatar->getWorldOrientation(), - Quat().angleAxis(180.0, glm::vec3(0,1,0)))); - - QTimer::singleShot(1000, []() { inFlipTurn = false; } ); - } - } - } - }*/ + static const QString movementsControlChannel = QStringLiteral("Hifi-Advanced-Movement-Disabler"); auto getter = [=]()->bool { return myAvatar->useAdvancedMovementControls(); }; auto setter = [=](bool value) { - auto controllerScriptingInterface = DependencyManager::get().data(); + auto messagesClient = DependencyManager::get().data(); myAvatar->setUseAdvancedMovementControls(value); + qDebug() << "vladest movement" << value; if (value) { - controllerScriptingInterface->enableMapping(advMovementsMappingName); + messagesClient->sendMessage(movementsControlChannel, QStringLiteral("enable_mappings"), true); } else { - controllerScriptingInterface->disableMapping(advMovementsMappingName); + messagesClient->sendMessage(movementsControlChannel, QStringLiteral("disable_mappings"), true); } }; - preferences->addPreference(new CheckPreference(MOVEMENT, "Advanced movement for hand controllers", getter, setter)); + preferences->addPreference(new CheckPreference(MOVEMENT, + QStringLiteral("Advanced movement for hand controllers"), + getter, setter)); } { diff --git a/interface/src/ui/overlays/Web3DOverlay.cpp b/interface/src/ui/overlays/Web3DOverlay.cpp index fcdac8c00c..a48e5eaf54 100644 --- a/interface/src/ui/overlays/Web3DOverlay.cpp +++ b/interface/src/ui/overlays/Web3DOverlay.cpp @@ -56,6 +56,7 @@ #include "ui/Snapshot.h" #include "SoundCache.h" #include "raypick/PointerScriptingInterface.h" +#include static int MAX_WINDOW_SIZE = 4096; static const float METERS_TO_INCHES = 39.3701f; @@ -256,6 +257,8 @@ void Web3DOverlay::setupQmlSurface() { _webSurface->getSurfaceContext()->setContextProperty("Pointers", DependencyManager::get().data()); _webSurface->getSurfaceContext()->setContextProperty("Web3DOverlay", this); _webSurface->getSurfaceContext()->setContextProperty("Window", DependencyManager::get().data()); + _webSurface->getSurfaceContext()->setContextProperty("Reticle", qApp->getApplicationCompositor().getReticleInterface()); + _webSurface->getSurfaceContext()->setContextProperty("desktop", DependencyManager::get()->getDesktop()); // Override min fps for tablet UI, for silky smooth scrolling setMaxFPS(90); diff --git a/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js b/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js index e6c9b0aee0..40721e7f72 100644 --- a/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js +++ b/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js @@ -16,7 +16,6 @@ var mappingName, basicMapping, isChecked; var TURN_RATE = 1000; -var MENU_ITEM_NAME = "Advanced Movement For Hand Controllers"; var isDisabled = false; var previousSetting = MyAvatar.useAdvancedMovementControls; if (previousSetting === false) { @@ -29,15 +28,6 @@ if (previousSetting === true) { isChecked = true; } -function addAdvancedMovementItemToSettingsMenu() { - Menu.addMenuItem({ - menuName: "Settings", - menuItemName: MENU_ITEM_NAME, - isCheckable: true, - isChecked: previousSetting - }); -} - function rotate180() { var newOrientation = Quat.multiply(MyAvatar.orientation, Quat.angleAxis(180, { x: 0, @@ -100,30 +90,11 @@ function disableMappings() { } function scriptEnding() { - Menu.removeMenuItem("Settings", MENU_ITEM_NAME); disableMappings(); } - -function menuItemEvent(menuItem) { - if (menuItem == MENU_ITEM_NAME) { - isChecked = Menu.isOptionChecked(MENU_ITEM_NAME); - if (isChecked === true) { - MyAvatar.useAdvancedMovementControls = true; - disableMappings(); - } else if (isChecked === false) { - MyAvatar.useAdvancedMovementControls = false; - enableMappings(); - } - } -} - -addAdvancedMovementItemToSettingsMenu(); - Script.scriptEnding.connect(scriptEnding); -Menu.menuItemEvent.connect(menuItemEvent); - registerBasicMapping(); Script.setTimeout(function() { @@ -151,11 +122,16 @@ HMD.displayModeChanged.connect(function(isHMDMode) { var HIFI_ADVANCED_MOVEMENT_DISABLER_CHANNEL = 'Hifi-Advanced-Movement-Disabler'; function handleMessage(channel, message, sender) { - if (channel == HIFI_ADVANCED_MOVEMENT_DISABLER_CHANNEL) { - if (message == 'disable') { + if (channel === HIFI_ADVANCED_MOVEMENT_DISABLER_CHANNEL) { + if (message === 'disable') { isDisabled = true; - } else if (message == 'enable') { + } else if (message === 'enable') { isDisabled = false; + } else if (message === 'enable_mappings') { + print("enable mappings") + enableMappings(); + } else if (message === 'disable_mappings') { + disableMappings(); } } }