mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-08 14:29:24 +02:00
Merge pull request #9491 from hyperlogic/tablet-ui
Tablet Help and Goto Buttons bug fixes.
This commit is contained in:
commit
48898f41b2
8 changed files with 35 additions and 3 deletions
|
@ -151,3 +151,10 @@ void MenuScriptingInterface::closeInfoView(const QString& path) {
|
||||||
QMetaObject::invokeMethod(Menu::getInstance(), "closeInfoView", Q_ARG(const QString&, path));
|
QMetaObject::invokeMethod(Menu::getInstance(), "closeInfoView", Q_ARG(const QString&, path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MenuScriptingInterface::isInfoViewVisible(const QString& path) {
|
||||||
|
bool result;
|
||||||
|
QMetaObject::invokeMethod(Menu::getInstance(), "isInfoViewVisible", Qt::BlockingQueuedConnection,
|
||||||
|
Q_RETURN_ARG(bool, result), Q_ARG(const QString&, path));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -183,6 +183,7 @@ public slots:
|
||||||
void setMenuEnabled(const QString& menuName, bool isEnabled);
|
void setMenuEnabled(const QString& menuName, bool isEnabled);
|
||||||
|
|
||||||
void closeInfoView(const QString& path);
|
void closeInfoView(const QString& path);
|
||||||
|
bool isInfoViewVisible(const QString& path);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
|
|
@ -130,6 +130,15 @@ void OffscreenUi::hide(const QString& name) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OffscreenUi::isVisible(const QString& name) {
|
||||||
|
QQuickItem* item = getRootItem()->findChild<QQuickItem*>(name);
|
||||||
|
if (item) {
|
||||||
|
return QQmlProperty(item, OFFSCREEN_VISIBILITY_PROPERTY).read().toBool();
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class ModalDialogListener : public QObject {
|
class ModalDialogListener : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class OffscreenUi;
|
friend class OffscreenUi;
|
||||||
|
|
|
@ -40,6 +40,7 @@ public:
|
||||||
void createDesktop(const QUrl& url);
|
void createDesktop(const QUrl& url);
|
||||||
void show(const QUrl& url, const QString& name, std::function<void(QQmlContext*, QObject*)> f = [](QQmlContext*, QObject*) {});
|
void show(const QUrl& url, const QString& name, std::function<void(QQmlContext*, QObject*)> f = [](QQmlContext*, QObject*) {});
|
||||||
void hide(const QString& name);
|
void hide(const QString& name);
|
||||||
|
bool isVisible(const QString& name);
|
||||||
void toggle(const QUrl& url, const QString& name, std::function<void(QQmlContext*, QObject*)> f = [](QQmlContext*, QObject*) {});
|
void toggle(const QUrl& url, const QString& name, std::function<void(QQmlContext*, QObject*)> f = [](QQmlContext*, QObject*) {});
|
||||||
bool shouldSwallowShortcut(QEvent* event);
|
bool shouldSwallowShortcut(QEvent* event);
|
||||||
bool navigationFocused();
|
bool navigationFocused();
|
||||||
|
|
|
@ -261,6 +261,11 @@ void Menu::closeInfoView(const QString& path) {
|
||||||
offscreenUi->hide(path);
|
offscreenUi->hide(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Menu::isInfoViewVisible(const QString& path) {
|
||||||
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
|
return offscreenUi->isVisible(path);
|
||||||
|
}
|
||||||
|
|
||||||
void Menu::triggerOption(const QString& menuOption) {
|
void Menu::triggerOption(const QString& menuOption) {
|
||||||
QAction* action = _actionHash.value(menuOption);
|
QAction* action = _actionHash.value(menuOption);
|
||||||
if (action) {
|
if (action) {
|
||||||
|
|
|
@ -115,6 +115,7 @@ public slots:
|
||||||
void toggleDeveloperMenus();
|
void toggleDeveloperMenus();
|
||||||
void toggleAdvancedMenus();
|
void toggleAdvancedMenus();
|
||||||
|
|
||||||
|
bool isInfoViewVisible(const QString& path);
|
||||||
void closeInfoView(const QString& path);
|
void closeInfoView(const QString& path);
|
||||||
|
|
||||||
void triggerOption(const QString& menuOption);
|
void triggerOption(const QString& menuOption);
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
(function() { // BEGIN LOCAL_SCOPE
|
(function() { // BEGIN LOCAL_SCOPE
|
||||||
|
|
||||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
var isActive = false
|
|
||||||
var button = tablet.addButton({
|
var button = tablet.addButton({
|
||||||
icon: "icons/tablet-icons/goto-i.svg",
|
icon: "icons/tablet-icons/goto-i.svg",
|
||||||
text:"GOTO"
|
text:"GOTO"
|
||||||
|
@ -22,14 +21,13 @@ var button = tablet.addButton({
|
||||||
|
|
||||||
|
|
||||||
function onAddressBarShown(visible) {
|
function onAddressBarShown(visible) {
|
||||||
|
button.editProperties({isActive: visible});
|
||||||
}
|
}
|
||||||
|
|
||||||
function setActive(active) {
|
function setActive(active) {
|
||||||
isActive = active;
|
isActive = active;
|
||||||
}
|
}
|
||||||
function onClicked(){
|
function onClicked(){
|
||||||
setActive(!isActive);
|
|
||||||
button.editProperties({isActive: isActive});
|
|
||||||
DialogsManager.toggleAddressBar();
|
DialogsManager.toggleAddressBar();
|
||||||
}
|
}
|
||||||
button.clicked.connect(onClicked);
|
button.clicked.connect(onClicked);
|
||||||
|
|
|
@ -53,7 +53,17 @@
|
||||||
|
|
||||||
button.clicked.connect(onClicked);
|
button.clicked.connect(onClicked);
|
||||||
|
|
||||||
|
var POLL_RATE = 500;
|
||||||
|
var interval = Script.setInterval(function () {
|
||||||
|
var visible = Menu.isInfoViewVisible('InfoView_html/help.html');
|
||||||
|
if (visible !== enabled) {
|
||||||
|
enabled = visible;
|
||||||
|
button.editProperties({isActive: enabled});
|
||||||
|
}
|
||||||
|
}, POLL_RATE);
|
||||||
|
|
||||||
Script.scriptEnding.connect(function () {
|
Script.scriptEnding.connect(function () {
|
||||||
|
Script.clearInterval(interval);
|
||||||
tablet.removeButton(button);
|
tablet.removeButton(button);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue