updating branch with master

This commit is contained in:
Dante Ruiz 2017-02-15 15:24:08 +00:00
parent b86886667b
commit 22baab1359
3 changed files with 42 additions and 19 deletions

View file

@ -2,8 +2,14 @@ import QtQuick 2.5
import QtGraphicalEffects 1.0
import QtQuick.Controls 1.4
import QtQml 2.2
import QtWebChannel 1.0
import QtWebEngine 1.1
import HFWebEngineProfile 1.0
import "."
import "../../styles-uit"
import "../../controls"
FocusScope {
id: tabletMenu
@ -14,8 +20,9 @@ FocusScope {
property var rootMenu: Menu { objectName:"rootMenu" }
property var point: Qt.point(50, 50)
TabletMouseHandler { id: menuPopperUpper }
property var eventBridge;
signal sendToScript(var message);
TabletMenuStack { id: menuPopperUpper }
Rectangle {
id: bgNavBar
@ -101,6 +108,6 @@ FocusScope {
buildMenu()
}
function buildMenu() {
menuPopperUpper.popup(tabletMenu, rootMenu.items)
menuPopperUpper.popup(rootMenu.items);
}
}

View file

@ -1,7 +1,7 @@
//
// MessageDialog.qml
//
// Created by Bradley Austin Davis on 18 Jan 2016
// Created by Dante Ruiz on 13 Feb 2017
// Copyright 2016 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
@ -28,8 +28,11 @@ Item {
}
}
QtObject {
StackView {
anchors.fill: parent
id: d
objectName: "stack"
initialItem: topMenu
property var menuStack: []
property var topMenu: null;
property var modelMaker: Component { ListModel { } }
@ -53,6 +56,12 @@ Item {
}
}
function pushSource(path) {
}
function popSource() {
}
function toModel(items) {
var result = modelMaker.createObject(tabletMenu);
for (var i = 0; i < items.length; ++i) {
@ -76,15 +85,15 @@ Item {
}
function popMenu() {
if (menuStack.length) {
menuStack.pop().destroy();
if (d.depth) {
d.pop();
}
if (menuStack.length) {
topMenu = menuStack[menuStack.length - 1];
if (d.depth) {
topMenu = d.currentItem;
topMenu.focus = true;
topMenu.forceActiveFocus();
// show current menu level on nav bar
if (topMenu.objectName === "" || menuStack.length === 1) {
if (topMenu.objectName === "" || d.depth === 1) {
breadcrumbText.text = "Menu";
} else {
breadcrumbText.text = topMenu.objectName;
@ -96,16 +105,14 @@ Item {
}
function pushMenu(newMenu) {
menuStack.push(newMenu);
d.push({ item:newMenu, destroyOnPop: true});
topMenu = newMenu;
topMenu.focus = true;
topMenu.forceActiveFocus();
}
function clearMenus() {
while (menuStack.length) {
popMenu()
}
d.clear()
}
function clampMenuPosition(menu) {
@ -123,7 +130,7 @@ Item {
}
}
function buildMenu(items, targetPosition) {
function buildMenu(items) {
var model = toModel(items);
// Menus must be childed to desktop for Z-ordering
var newMenu = menuViewMaker.createObject(tabletMenu, { model: model, isSubMenu: topMenu !== null });
@ -154,13 +161,13 @@ Item {
}
function popup(parent, items) {
function popup(items) {
d.clearMenus();
d.buildMenu(items, point);
d.buildMenu(items);
}
function closeLastMenu() {
if (d.menuStack.length > 1) {
if (d.depth > 1) {
d.popMenu();
return true;
}

View file

@ -5743,8 +5743,17 @@ bool Application::displayAvatarAttachmentConfirmationDialog(const QString& name)
}
void Application::toggleRunningScriptsWidget() const {
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
auto tabletWindow = tabletScriptingInterface->getTabletWindow();
static const QUrl url("hifi/dialogs/RunningScripts.qml");
DependencyManager::get<OffscreenUi>()->show(url, "RunningScripts");
if (tabletWindow) {
auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system"));
if (tablet) {
tablet->pushOntoStack("../..//hifi/dialogs/RunningScripts.qml");
}
} else {
DependencyManager::get<OffscreenUi>()->show(url, "RunningScripts");
}
//if (_runningScriptsWidget->isVisible()) {
// if (_runningScriptsWidget->hasFocus()) {
// _runningScriptsWidget->hide();