mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-04 21:30:48 +02:00
More work on menus and some code cleanup
This commit is contained in:
parent
c0d562ed55
commit
1ff8c67576
21 changed files with 438 additions and 513 deletions
|
@ -13,6 +13,7 @@ Hifi.HifiMenu {
|
||||||
opacity: 0.0
|
opacity: 0.0
|
||||||
property int animationDuration: 200
|
property int animationDuration: 200
|
||||||
HifiPalette { id: hifiPalette }
|
HifiPalette { id: hifiPalette }
|
||||||
|
z: 10000
|
||||||
|
|
||||||
onEnabledChanged: {
|
onEnabledChanged: {
|
||||||
if (enabled && columns.length == 0) {
|
if (enabled && columns.length == 0) {
|
||||||
|
@ -109,7 +110,9 @@ Hifi.HifiMenu {
|
||||||
property var menuBuilder: Component {
|
property var menuBuilder: Component {
|
||||||
Border {
|
Border {
|
||||||
SystemPalette { id: sysPalette; colorGroup: SystemPalette.Active }
|
SystemPalette { id: sysPalette; colorGroup: SystemPalette.Active }
|
||||||
x: root.models.length * 60;
|
x: root.models.length == 1 ?
|
||||||
|
(root.width / 2 - width / 2) :
|
||||||
|
root.columns[root.models.length - 2].x + 60;
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
border.color: hifiPalette.hifiBlue
|
border.color: hifiPalette.hifiBlue
|
||||||
color: sysPalette.window
|
color: sysPalette.window
|
||||||
|
@ -143,6 +146,7 @@ Hifi.HifiMenu {
|
||||||
width: listView.minWidth; height: 32
|
width: listView.minWidth; height: 32
|
||||||
color: sysPalette.highlight
|
color: sysPalette.highlight
|
||||||
y: (listView.currentItem) ? listView.currentItem.y : 0;
|
y: (listView.currentItem) ? listView.currentItem.y : 0;
|
||||||
|
x: 32
|
||||||
Behavior on y {
|
Behavior on y {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: 100
|
duration: 100
|
||||||
|
@ -245,129 +249,6 @@ Hifi.HifiMenu {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
HifiMenu {
|
|
||||||
id: rootMenu
|
|
||||||
Menu {
|
|
||||||
id: menu
|
|
||||||
Menu {
|
|
||||||
title: "File"
|
|
||||||
MenuItem {
|
|
||||||
action: HifiAction {
|
|
||||||
name: rootMenu.login
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
action: HifiAction {
|
|
||||||
name: "Test"
|
|
||||||
checkable: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
action: HifiAction {
|
|
||||||
name: rootMenu.quit
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Menu {
|
|
||||||
title: "Edit"
|
|
||||||
MenuItem {
|
|
||||||
action: HifiAction {
|
|
||||||
text: "Copy"
|
|
||||||
shortcut: StandardKey.Copy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
action: HifiAction {
|
|
||||||
text: "Cut"
|
|
||||||
shortcut: StandardKey.Cut
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
action: HifiAction {
|
|
||||||
text: "Paste"
|
|
||||||
shortcut: StandardKey.Paste
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
action: HifiAction {
|
|
||||||
text: "Undo"
|
|
||||||
shortcut: StandardKey.Undo
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
action: HifiAction {
|
|
||||||
text: "Redo"
|
|
||||||
shortcut: StandardKey.Redo
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
action: HifiAction {
|
|
||||||
name: rootMenu.attachments
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
action: HifiAction {
|
|
||||||
name: rootMenu.animations
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Menu {
|
|
||||||
title: "Scripts"
|
|
||||||
MenuItem {
|
|
||||||
action: HifiAction {
|
|
||||||
name: rootMenu.scriptEditor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
action: HifiAction {
|
|
||||||
name: rootMenu.loadScript
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
action: HifiAction {
|
|
||||||
name: rootMenu.loadScriptURL
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
action: HifiAction {
|
|
||||||
name: rootMenu.stopAllScripts
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
action: HifiAction {
|
|
||||||
name: rootMenu.reloadAllScripts
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
action: HifiAction {
|
|
||||||
name: rootMenu.runningScripts
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Menu {
|
|
||||||
title: "Location"
|
|
||||||
MenuItem {
|
|
||||||
action: HifiAction {
|
|
||||||
name: rootMenu.addressBar
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
action: HifiAction {
|
|
||||||
name: rootMenu.copyAddress
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
action: HifiAction {
|
|
||||||
name: rootMenu.copyPath
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
Keys.onPressed: {
|
Keys.onPressed: {
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case Qt.Key_Escape:
|
case Qt.Key_Escape:
|
||||||
|
|
|
@ -16,6 +16,8 @@ Item {
|
||||||
|
|
||||||
HifiPalette { id: hifiPalette }
|
HifiPalette { id: hifiPalette }
|
||||||
SystemPalette { id: sysPalette; colorGroup: SystemPalette.Active }
|
SystemPalette { id: sysPalette; colorGroup: SystemPalette.Active }
|
||||||
|
x: parent ? parent.width / 2 - width / 2 : 0
|
||||||
|
y: parent ? parent.height / 2 - height / 2 : 0
|
||||||
|
|
||||||
property int animationDuration: 400
|
property int animationDuration: 400
|
||||||
property bool destroyOnInvisible: false
|
property bool destroyOnInvisible: false
|
||||||
|
|
|
@ -1079,12 +1079,12 @@ bool Application::eventFilter(QObject* object, QEvent* event) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool _altPressed;
|
static bool altPressed;
|
||||||
static bool _ctrlPressed;
|
static bool ctrlPressed;
|
||||||
|
|
||||||
void Application::keyPressEvent(QKeyEvent* event) {
|
void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
_altPressed = event->key() == Qt::Key_Alt;
|
altPressed = event->key() == Qt::Key_Alt;
|
||||||
_ctrlPressed = event->key() == Qt::Key_Control;
|
ctrlPressed = event->key() == Qt::Key_Control;
|
||||||
_keysPressed.insert(event->key());
|
_keysPressed.insert(event->key());
|
||||||
|
|
||||||
_controllerScriptingInterface.emitKeyPressEvent(event); // send events to any registered scripts
|
_controllerScriptingInterface.emitKeyPressEvent(event); // send events to any registered scripts
|
||||||
|
@ -1336,15 +1336,13 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::keyReleaseEvent(QKeyEvent* event) {
|
void Application::keyReleaseEvent(QKeyEvent* event) {
|
||||||
if (event->key() == Qt::Key_Alt && _altPressed) {
|
if (event->key() == Qt::Key_Alt && altPressed && _window->isActiveWindow()) {
|
||||||
Menu::toggle();
|
Menu::toggle();
|
||||||
}
|
}
|
||||||
if (event->key() == Qt::Key_Control && _ctrlPressed) {
|
if (event->key() == Qt::Key_Control && ctrlPressed && _window->isActiveWindow()) {
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
Menu::toggle();
|
||||||
auto rootMenu = offscreenUi->getRootItem()->findChild<QObject*>("rootMenu");
|
|
||||||
QMetaObject::invokeMethod(rootMenu, "popup");
|
|
||||||
}
|
}
|
||||||
_ctrlPressed = event->key() == Qt::Key_Control;
|
ctrlPressed = altPressed = false;
|
||||||
|
|
||||||
_keysPressed.remove(event->key());
|
_keysPressed.remove(event->key());
|
||||||
|
|
||||||
|
|
|
@ -94,9 +94,9 @@ void MainWindow::changeEvent(QEvent* event) {
|
||||||
emit windowShown(true);
|
emit windowShown(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isFullScreen() != Menu::getInstance()->isOptionChecked(MenuOption::Fullscreen)) {
|
//if (isFullScreen() != Menu::getInstance()->isOptionChecked(MenuOption::Fullscreen)) {
|
||||||
Menu::getInstance()->setIsOptionChecked(MenuOption::Fullscreen, isFullScreen());
|
// Menu::getInstance()->setIsOptionChecked(MenuOption::Fullscreen, isFullScreen());
|
||||||
}
|
//}
|
||||||
} else if (event->type() == QEvent::ActivationChange) {
|
} else if (event->type() == QEvent::ActivationChange) {
|
||||||
if (isActiveWindow()) {
|
if (isActiveWindow()) {
|
||||||
emit windowShown(true);
|
emit windowShown(true);
|
||||||
|
|
|
@ -45,13 +45,12 @@
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
|
|
||||||
// Proxy object to simplify porting over
|
// Proxy object to simplify porting over
|
||||||
HifiAction::HifiAction(const QString & menuOption) : _menuOption(menuOption) {
|
HifiAction::HifiAction(const QString& menuOption) : _menuOption(menuOption) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//void HifiAction::setCheckable(bool) {
|
void HifiAction::setCheckable(bool checkable) {
|
||||||
// Menu::getInstance()->set
|
Menu::getInstance()->setCheckable(_menuOption, checkable);
|
||||||
// qFatal("Not implemented");
|
}
|
||||||
//}
|
|
||||||
|
|
||||||
void HifiAction::setChecked(bool checked) {
|
void HifiAction::setChecked(bool checked) {
|
||||||
Menu::getInstance()->setChecked(_menuOption, checked);
|
Menu::getInstance()->setChecked(_menuOption, checked);
|
||||||
|
@ -65,7 +64,7 @@ QString HifiAction::shortcut() const {
|
||||||
return Menu::getInstance()->getItemShortcut(_menuOption);
|
return Menu::getInstance()->getItemShortcut(_menuOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HifiAction::setText(const QString & text) {
|
void HifiAction::setText(const QString& text) {
|
||||||
Menu::getInstance()->setItemText(_menuOption, text);
|
Menu::getInstance()->setItemText(_menuOption, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +100,7 @@ Menu* Menu::getInstance() {
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu::Menu(QQuickItem * parent) : HifiMenu(parent) {
|
Menu::Menu(QQuickItem* parent) : HifiMenu(parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menu::init() {
|
void Menu::init() {
|
||||||
|
@ -125,12 +124,15 @@ void Menu::init() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
static const QString SCRIPTS_MENU{ "Scripts" };
|
static const QString SCRIPTS_MENU{ "Scripts" };
|
||||||
addMenu(FILE_MENU, SCRIPTS_MENU);
|
addMenu(FILE_MENU, LOCATION_MENU);
|
||||||
|
#else
|
||||||
|
static const QString SCRIPTS_MENU{ FILE_MENU };
|
||||||
|
addSeparator(FILE_MENU, "Scripts");
|
||||||
|
#endif
|
||||||
//Qt::CTRL | Qt::Key_O
|
//Qt::CTRL | Qt::Key_O
|
||||||
addItem(SCRIPTS_MENU, MenuOption::LoadScript, [=] {
|
addItem(SCRIPTS_MENU, MenuOption::LoadScript, qApp, SLOT(loadDialog()));
|
||||||
qApp->loadDialog();
|
|
||||||
});
|
|
||||||
//Qt::CTRL | Qt::SHIFT | Qt::Key_O
|
//Qt::CTRL | Qt::SHIFT | Qt::Key_O
|
||||||
addItem(SCRIPTS_MENU, MenuOption::LoadScriptURL, [=] {
|
addItem(SCRIPTS_MENU, MenuOption::LoadScriptURL, [=] {
|
||||||
qApp->loadScriptURLDialog();
|
qApp->loadScriptURLDialog();
|
||||||
|
@ -149,9 +151,15 @@ void Menu::init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
static const QString LOCATION_MENU{ "Location" };
|
static const QString LOCATION_MENU{ "Location" };
|
||||||
addMenu(FILE_MENU, LOCATION_MENU);
|
addMenu(FILE_MENU, LOCATION_MENU);
|
||||||
|
#else
|
||||||
|
addSeparator(FILE_MENU, "Location");
|
||||||
|
static const QString LOCATION_MENU{ FILE_MENU };
|
||||||
|
#endif
|
||||||
qApp->getBookmarks()->setupMenus(LOCATION_MENU);
|
qApp->getBookmarks()->setupMenus(LOCATION_MENU);
|
||||||
|
|
||||||
//Qt::CTRL | Qt::Key_L
|
//Qt::CTRL | Qt::Key_L
|
||||||
addItem(LOCATION_MENU, MenuOption::AddressBar, [=] {
|
addItem(LOCATION_MENU, MenuOption::AddressBar, [=] {
|
||||||
auto dialogsManager = DependencyManager::get<DialogsManager>();
|
auto dialogsManager = DependencyManager::get<DialogsManager>();
|
||||||
|
@ -178,16 +186,15 @@ void Menu::init() {
|
||||||
{
|
{
|
||||||
static const QString EDIT_MENU{ "Edit" };
|
static const QString EDIT_MENU{ "Edit" };
|
||||||
addMenu(ROOT_MENU, EDIT_MENU);
|
addMenu(ROOT_MENU, EDIT_MENU);
|
||||||
#if 0
|
|
||||||
QUndoStack* undoStack = qApp->getUndoStack();
|
|
||||||
QAction* undoAction = undoStack->createUndoAction(editMenu);
|
|
||||||
undoAction->setShortcut(Qt::CTRL | Qt::Key_Z);
|
|
||||||
addActionToQMenuAndActionHash(editMenu, undoAction);
|
|
||||||
|
|
||||||
QAction* redoAction = undoStack->createRedoAction(editMenu);
|
QUndoStack* undoStack = qApp->getUndoStack();
|
||||||
redoAction->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_Z);
|
QAction* undoAction = undoStack->createUndoAction(this);
|
||||||
addActionToQMenuAndActionHash(editMenu, redoAction);
|
//undoAction->setShortcut(Qt::CTRL | Qt::Key_Z);
|
||||||
#endif
|
addItem(EDIT_MENU, undoAction->text(), undoAction, SLOT(trigger()));
|
||||||
|
|
||||||
|
QAction* redoAction = undoStack->createRedoAction(this);
|
||||||
|
//redoAction->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_Z);
|
||||||
|
addItem(EDIT_MENU, redoAction->text(), redoAction, SLOT(trigger()));
|
||||||
|
|
||||||
// Qt::CTRL | Qt::Key_Comma
|
// Qt::CTRL | Qt::Key_Comma
|
||||||
// QAction::PreferencesRole
|
// QAction::PreferencesRole
|
||||||
|
@ -231,23 +238,20 @@ void Menu::init() {
|
||||||
// FIXME group
|
// FIXME group
|
||||||
addCheckableItem(VIZ_MENU, MenuOption::VisibleToEveryone,
|
addCheckableItem(VIZ_MENU, MenuOption::VisibleToEveryone,
|
||||||
discoverabilityManager->getDiscoverabilityMode() == Discoverability::All,
|
discoverabilityManager->getDiscoverabilityMode() == Discoverability::All,
|
||||||
[=](bool) { discoverabilityManager->setVisibility(); });
|
discoverabilityManager.data(), SLOT(setVisibility()));
|
||||||
addCheckableItem(VIZ_MENU, MenuOption::VisibleToFriends,
|
addCheckableItem(VIZ_MENU, MenuOption::VisibleToFriends,
|
||||||
discoverabilityManager->getDiscoverabilityMode() == Discoverability::Friends,
|
discoverabilityManager->getDiscoverabilityMode() == Discoverability::Friends,
|
||||||
[=](bool) { discoverabilityManager->setVisibility(); });
|
discoverabilityManager.data(), SLOT(setVisibility()));
|
||||||
addCheckableItem(VIZ_MENU, MenuOption::VisibleToNoOne,
|
addCheckableItem(VIZ_MENU, MenuOption::VisibleToNoOne,
|
||||||
discoverabilityManager->getDiscoverabilityMode() == Discoverability::None,
|
discoverabilityManager->getDiscoverabilityMode() == Discoverability::None,
|
||||||
[=](bool) { discoverabilityManager->setVisibility(); });
|
discoverabilityManager.data(), SLOT(setVisibility()));
|
||||||
|
|
||||||
connect(discoverabilityManager.data(), &DiscoverabilityManager::discoverabilityModeChanged,
|
connect(discoverabilityManager.data(), &DiscoverabilityManager::discoverabilityModeChanged,
|
||||||
discoverabilityManager.data(), &DiscoverabilityManager::visibilityChanged);
|
discoverabilityManager.data(), &DiscoverabilityManager::visibilityChanged);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Qt::CTRL | Qt::ALT | Qt::Key_T,
|
//Qt::CTRL | Qt::ALT | Qt::Key_T,
|
||||||
addItem(TOOLS_MENU, MenuOption::ToolWindow, [=] {
|
addItem(TOOLS_MENU, MenuOption::ToolWindow,
|
||||||
// dialogsManager->toggleToolWindow();
|
dialogsManager.data(), SLOT(toggleToolWindow()));
|
||||||
});
|
|
||||||
|
|
||||||
//Qt::CTRL | Qt::ALT | Qt::Key_J,
|
//Qt::CTRL | Qt::ALT | Qt::Key_J,
|
||||||
addItem(TOOLS_MENU, MenuOption::Console, [=] {
|
addItem(TOOLS_MENU, MenuOption::Console, [=] {
|
||||||
|
@ -297,12 +301,10 @@ void Menu::init() {
|
||||||
addCheckableItem(AVATAR_MENU, MenuOption::NamesAboveHeads, true);
|
addCheckableItem(AVATAR_MENU, MenuOption::NamesAboveHeads, true);
|
||||||
addCheckableItem(AVATAR_MENU, MenuOption::GlowWhenSpeaking, true);
|
addCheckableItem(AVATAR_MENU, MenuOption::GlowWhenSpeaking, true);
|
||||||
addCheckableItem(AVATAR_MENU, MenuOption::BlueSpeechSphere, true);
|
addCheckableItem(AVATAR_MENU, MenuOption::BlueSpeechSphere, true);
|
||||||
addCheckableItem(AVATAR_MENU, MenuOption::EnableCharacterController, true, [=](bool) {
|
addCheckableItem(AVATAR_MENU, MenuOption::EnableCharacterController, true,
|
||||||
avatar->updateMotionBehavior();
|
avatar, SLOT(updateMotionBehavior()));
|
||||||
});
|
addCheckableItem(AVATAR_MENU, MenuOption::ShiftHipsForIdleAnimations, false,
|
||||||
addCheckableItem(AVATAR_MENU, MenuOption::ShiftHipsForIdleAnimations, false, [=](bool) {
|
avatar, SLOT(updateMotionBehavior()));
|
||||||
avatar->updateMotionBehavior();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -311,32 +313,28 @@ void Menu::init() {
|
||||||
|
|
||||||
// Mac Qt::CTRL | Qt::META | Qt::Key_F,
|
// Mac Qt::CTRL | Qt::META | Qt::Key_F,
|
||||||
// Win32/Linux Qt::CTRL | Qt::Key_F,
|
// Win32/Linux Qt::CTRL | Qt::Key_F,
|
||||||
addCheckableItem(VIEW_MENU, MenuOption::Fullscreen, false, [=](bool checked) {
|
addCheckableItem(VIEW_MENU, MenuOption::Fullscreen, false);
|
||||||
// qApp->setFullscreen(checked);
|
connectCheckable(MenuOption::Fullscreen, qApp, SLOT(setFullscreen(bool)));
|
||||||
});
|
|
||||||
// QML Qt::Key_P,
|
// QML Qt::Key_P,
|
||||||
addCheckableItem(VIEW_MENU, MenuOption::FirstPerson, true, [=](bool checked) {
|
addCheckableItem(VIEW_MENU, MenuOption::FirstPerson, true,
|
||||||
// qApp->cameraMenuChanged();
|
qApp, SLOT(cameraMenuChanged()));
|
||||||
});
|
|
||||||
//QML Qt::SHIFT | Qt::Key_H,
|
//QML Qt::SHIFT | Qt::Key_H,
|
||||||
addCheckableItem(VIEW_MENU, MenuOption::Mirror, true);
|
addCheckableItem(VIEW_MENU, MenuOption::Mirror, true,
|
||||||
|
qApp, SLOT(cameraMenuChanged()));
|
||||||
// QML Qt::Key_H,
|
// QML Qt::Key_H,
|
||||||
addCheckableItem(VIEW_MENU, MenuOption::FullscreenMirror, true, [=](bool checked) {
|
addCheckableItem(VIEW_MENU, MenuOption::FullscreenMirror, false,
|
||||||
// qApp->cameraMenuChanged();
|
qApp, SLOT(cameraMenuChanged()));
|
||||||
});
|
|
||||||
|
|
||||||
// Mac Qt::META | Qt::Key_H,
|
// Mac Qt::META | Qt::Key_H,
|
||||||
// Win32/Linux Qt::CTRL | Qt::Key_H,
|
// Win32/Linux Qt::CTRL | Qt::Key_H,
|
||||||
addCheckableItem(VIEW_MENU, MenuOption::HMDTools, false, [=](bool checked) {
|
addCheckableItem(VIEW_MENU, MenuOption::HMDTools, false, [=](bool checked) {
|
||||||
dialogsManager->hmdTools(checked);
|
dialogsManager->hmdTools(checked);
|
||||||
});
|
});
|
||||||
addCheckableItem(VIEW_MENU, MenuOption::EnableVRMode, false, [=](bool checked) {
|
addCheckableItem(VIEW_MENU, MenuOption::EnableVRMode, false);
|
||||||
// qApp->setEnableVRMode(checked);
|
connectCheckable(MenuOption::EnableVRMode, qApp, SLOT(setEnableVRMode(bool)));
|
||||||
});
|
addCheckableItem(VIEW_MENU, MenuOption::Enable3DTVMode, false);
|
||||||
addCheckableItem(VIEW_MENU, MenuOption::Enable3DTVMode, false, [=](bool checked) {
|
connectCheckable(MenuOption::Enable3DTVMode, qApp, SLOT(setEnable3DTVMode(bool)));
|
||||||
// qApp->setEnable3DTVMode(checked);
|
|
||||||
});
|
|
||||||
|
|
||||||
{
|
{
|
||||||
static const QString BORDER_MENU{ "Server Borders" };
|
static const QString BORDER_MENU{ "Server Borders" };
|
||||||
|
@ -363,7 +361,6 @@ void Menu::init() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
static const QString DEV_MENU{ "Developer" };
|
static const QString DEV_MENU{ "Developer" };
|
||||||
addMenu(ROOT_MENU, DEV_MENU);
|
addMenu(ROOT_MENU, DEV_MENU);
|
||||||
|
@ -561,25 +558,19 @@ void Menu::init() {
|
||||||
static const QString AUDIO_MENU{ "Audio" };
|
static const QString AUDIO_MENU{ "Audio" };
|
||||||
addMenu(DEV_MENU, AUDIO_MENU);
|
addMenu(DEV_MENU, AUDIO_MENU);
|
||||||
auto audioIO = DependencyManager::get<AudioClient>();
|
auto audioIO = DependencyManager::get<AudioClient>();
|
||||||
addCheckableItem(AUDIO_MENU, MenuOption::AudioNoiseReduction, true, [=](bool checked) {
|
addCheckableItem(AUDIO_MENU, MenuOption::AudioNoiseReduction, true,
|
||||||
audioIO->toggleAudioNoiseReduction();
|
audioIO.data(), SLOT(toggleAudioNoiseReduction()));
|
||||||
});
|
addCheckableItem(AUDIO_MENU, MenuOption::EchoServerAudio, false,
|
||||||
addCheckableItem(AUDIO_MENU, MenuOption::EchoServerAudio, false, [=](bool checked) {
|
audioIO.data(), SLOT(toggleServerEcho()));
|
||||||
audioIO->toggleServerEcho();
|
addCheckableItem(AUDIO_MENU, MenuOption::EchoLocalAudio, false,
|
||||||
});
|
audioIO.data(), SLOT(toggleLocalEcho()));
|
||||||
addCheckableItem(AUDIO_MENU, MenuOption::EchoLocalAudio, false, [=](bool checked) {
|
addCheckableItem(AUDIO_MENU, MenuOption::StereoAudio, false,
|
||||||
audioIO->toggleLocalEcho();
|
audioIO.data(), SLOT(toggleStereoInput()));
|
||||||
});
|
|
||||||
addCheckableItem(AUDIO_MENU, MenuOption::StereoAudio, false, [=](bool checked) {
|
|
||||||
audioIO->toggleStereoInput();
|
|
||||||
});
|
|
||||||
// Qt::CTRL | Qt::Key_M,
|
// Qt::CTRL | Qt::Key_M,
|
||||||
addCheckableItem(AUDIO_MENU, MenuOption::MuteAudio, false, [=](bool checked) {
|
addCheckableItem(AUDIO_MENU, MenuOption::MuteAudio, false,
|
||||||
audioIO->toggleMute();
|
audioIO.data(), SLOT(toggleMute()));
|
||||||
});
|
addCheckableItem(AUDIO_MENU, MenuOption::MuteEnvironment, false,
|
||||||
addCheckableItem(AUDIO_MENU, MenuOption::MuteEnvironment, false, [=](bool checked) {
|
audioIO.data(), SLOT(sendMuteEnvironmentPacket()));
|
||||||
audioIO->sendMuteEnvironmentPacket();
|
|
||||||
});
|
|
||||||
{
|
{
|
||||||
static const QString SCOPE_MENU{ "Audio Scope" };
|
static const QString SCOPE_MENU{ "Audio Scope" };
|
||||||
addMenu(AUDIO_MENU, SCOPE_MENU);
|
addMenu(AUDIO_MENU, SCOPE_MENU);
|
||||||
|
@ -637,6 +628,37 @@ void Menu::loadSettings() {
|
||||||
void Menu::saveSettings() {
|
void Menu::saveSettings() {
|
||||||
// scanMenuBar(&Menu::saveAction);
|
// scanMenuBar(&Menu::saveAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Menu::addMenuItem(const MenuItemProperties& properties) {
|
||||||
|
if (QThread::currentThread() != Application::getInstance()->getMainThread()) {
|
||||||
|
Application::getInstance()->postLambdaEvent([=]{
|
||||||
|
addMenuItem(properties);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Shortcut key items: in order of priority
|
||||||
|
//QString shortcutKey;
|
||||||
|
//KeyEvent shortcutKeyEvent;
|
||||||
|
//QKeySequence shortcutKeySequence; // this is what we actually use, it's set from one of the above
|
||||||
|
|
||||||
|
//// location related items: in order of priority
|
||||||
|
//int position;
|
||||||
|
//QString beforeItem;
|
||||||
|
//QString afterItem;
|
||||||
|
|
||||||
|
if (properties.isSeparator) {
|
||||||
|
addSeparator(properties.menuName, properties.menuItemName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
addItem(properties.menuName, properties.menuItemName);
|
||||||
|
if (properties.isCheckable) {
|
||||||
|
setCheckable(properties.menuItemName);
|
||||||
|
if (properties.isChecked) {
|
||||||
|
setChecked(properties.menuItemName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
void Menu::loadAction(Settings& settings, QAction& action) {
|
void Menu::loadAction(Settings& settings, QAction& action) {
|
||||||
|
@ -688,4 +710,5 @@ void Menu::addDisabledActionAndSeparator(QMenu* destinationMenu, const QString&
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -28,72 +28,50 @@ void MenuScriptingInterface::menuItemTriggered() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuScriptingInterface::addMenu(const QString& menu) {
|
void MenuScriptingInterface::addMenu(const QString& menu) {
|
||||||
QMetaObject::invokeMethod(Menu::getInstance(), "addMenu", Q_ARG(const QString&, menu));
|
Menu::getInstance()->addMenu("", menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuScriptingInterface::removeMenu(const QString& menu) {
|
void MenuScriptingInterface::removeMenu(const QString& menu) {
|
||||||
QMetaObject::invokeMethod(Menu::getInstance(), "removeMenu", Q_ARG(const QString&, menu));
|
Menu::getInstance()->removeMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MenuScriptingInterface::menuExists(const QString& menu) {
|
bool MenuScriptingInterface::menuExists(const QString& menu) {
|
||||||
bool result;
|
return Menu::getInstance()->menuExists(menu);
|
||||||
QMetaObject::invokeMethod(Menu::getInstance(), "menuExists", Qt::BlockingQueuedConnection,
|
|
||||||
Q_RETURN_ARG(bool, result),
|
|
||||||
Q_ARG(const QString&, menu));
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuScriptingInterface::addSeparator(const QString& menuName, const QString& separatorName) {
|
void MenuScriptingInterface::addSeparator(const QString& menuName, const QString& separatorName) {
|
||||||
QMetaObject::invokeMethod(Menu::getInstance(), "addSeparator",
|
Menu::getInstance()->addSeparator(menuName, separatorName);
|
||||||
Q_ARG(const QString&, menuName),
|
|
||||||
Q_ARG(const QString&, separatorName));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuScriptingInterface::removeSeparator(const QString& menuName, const QString& separatorName) {
|
void MenuScriptingInterface::removeSeparator(const QString& menuName, const QString& separatorName) {
|
||||||
QMetaObject::invokeMethod(Menu::getInstance(), "removeSeparator",
|
Menu::getInstance()->removeSeparator(menuName, separatorName);
|
||||||
Q_ARG(const QString&, menuName),
|
|
||||||
Q_ARG(const QString&, separatorName));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuScriptingInterface::addMenuItem(const MenuItemProperties& properties) {
|
void MenuScriptingInterface::addMenuItem(const MenuItemProperties& properties) {
|
||||||
QMetaObject::invokeMethod(Menu::getInstance(), "addMenuItem", Q_ARG(const MenuItemProperties&, properties));
|
Menu::getInstance()->addMenuItem(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuScriptingInterface::addMenuItem(const QString& menu, const QString& menuitem, const QString& shortcutKey) {
|
void MenuScriptingInterface::addMenuItem(const QString& menu, const QString& menuitem, const QString& shortcutKey) {
|
||||||
MenuItemProperties properties(menu, menuitem, shortcutKey);
|
Menu::getInstance()->addItem(menu, menuitem);
|
||||||
QMetaObject::invokeMethod(Menu::getInstance(), "addMenuItem", Q_ARG(const MenuItemProperties&, properties));
|
Menu::getInstance()->setItemShortcut(menuitem, shortcutKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuScriptingInterface::addMenuItem(const QString& menu, const QString& menuitem) {
|
void MenuScriptingInterface::addMenuItem(const QString& menu, const QString& menuitem) {
|
||||||
MenuItemProperties properties(menu, menuitem);
|
Menu::getInstance()->addItem(menu, menuitem);
|
||||||
QMetaObject::invokeMethod(Menu::getInstance(), "addMenuItem", Q_ARG(const MenuItemProperties&, properties));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuScriptingInterface::removeMenuItem(const QString& menu, const QString& menuitem) {
|
void MenuScriptingInterface::removeMenuItem(const QString& menu, const QString& menuitem) {
|
||||||
QMetaObject::invokeMethod(Menu::getInstance(), "removeMenuItem",
|
Menu::getInstance()->removeItem(menuitem);
|
||||||
Q_ARG(const QString&, menu),
|
|
||||||
Q_ARG(const QString&, menuitem));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bool MenuScriptingInterface::menuItemExists(const QString& menu, const QString& menuitem) {
|
bool MenuScriptingInterface::menuItemExists(const QString& menu, const QString& menuitem) {
|
||||||
bool result;
|
return Menu::getInstance()->itemExists(menu, menuitem);
|
||||||
QMetaObject::invokeMethod(Menu::getInstance(), "menuItemExists", Qt::BlockingQueuedConnection,
|
|
||||||
Q_RETURN_ARG(bool, result),
|
|
||||||
Q_ARG(const QString&, menu),
|
|
||||||
Q_ARG(const QString&, menuitem));
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MenuScriptingInterface::isOptionChecked(const QString& menuOption) {
|
bool MenuScriptingInterface::isOptionChecked(const QString& menuOption) {
|
||||||
bool result;
|
return Menu::getInstance()->isChecked(menuOption);
|
||||||
QMetaObject::invokeMethod(Menu::getInstance(), "isOptionChecked", Qt::BlockingQueuedConnection,
|
|
||||||
Q_RETURN_ARG(bool, result),
|
|
||||||
Q_ARG(const QString&, menuOption));
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuScriptingInterface::setIsOptionChecked(const QString& menuOption, bool isChecked) {
|
void MenuScriptingInterface::setIsOptionChecked(const QString& menuOption, bool isChecked) {
|
||||||
QMetaObject::invokeMethod(Menu::getInstance(), "setIsOptionChecked", Qt::BlockingQueuedConnection,
|
Menu::getInstance()->setChecked(menuOption, isChecked);
|
||||||
Q_ARG(const QString&, menuOption),
|
|
||||||
Q_ARG(bool, isChecked));
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,13 +45,18 @@ QScriptValue WindowScriptingInterface::hasFocus() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowScriptingInterface::setFocus() {
|
void WindowScriptingInterface::setFocus() {
|
||||||
|
Application::getInstance()->postLambdaEvent([] {
|
||||||
auto window = Application::getInstance()->getWindow();
|
auto window = Application::getInstance()->getWindow();
|
||||||
window->activateWindow();
|
window->activateWindow();
|
||||||
window->setFocus();
|
window->setFocus();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowScriptingInterface::raiseMainWindow() {
|
void WindowScriptingInterface::raiseMainWindow() {
|
||||||
// Application::getInstance()->getWindow()->raise();
|
// It's forbidden to call raise() from another thread.
|
||||||
|
Application::getInstance()->postLambdaEvent([] {
|
||||||
|
Application::getInstance()->getWindow()->raise();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowScriptingInterface::setCursorVisible(bool visible) {
|
void WindowScriptingInterface::setCursorVisible(bool visible) {
|
||||||
|
|
|
@ -323,7 +323,7 @@ void ApplicationOverlay::displayOverlayTextureOculus(Camera& whichCamera) {
|
||||||
//Render magnifier, but dont show border for mouse magnifier
|
//Render magnifier, but dont show border for mouse magnifier
|
||||||
glm::vec2 projection = screenToOverlay(glm::vec2(_reticlePosition[MOUSE].x(),
|
glm::vec2 projection = screenToOverlay(glm::vec2(_reticlePosition[MOUSE].x(),
|
||||||
_reticlePosition[MOUSE].y()));
|
_reticlePosition[MOUSE].y()));
|
||||||
with_each_texture(_overlays.getTexture(), _newUiTexture, [&] {
|
with_each_texture(_overlays.getTexture(), 0, [&] {
|
||||||
renderMagnifier(projection, _magSizeMult[i], i != MOUSE);
|
renderMagnifier(projection, _magSizeMult[i], i != MOUSE);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,16 +14,26 @@
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include <QDir>
|
||||||
#include "PathUtils.h"
|
#include "PathUtils.h"
|
||||||
|
|
||||||
|
|
||||||
QString& PathUtils::resourcesPath() {
|
QString& PathUtils::resourcesPath() {
|
||||||
|
#ifdef DEBUG
|
||||||
|
static QString staticResourcePath;
|
||||||
|
if (staticResourcePath.isEmpty()) {
|
||||||
|
QDir path(__FILE__);
|
||||||
|
path.cdUp();
|
||||||
|
staticResourcePath = path.cleanPath(path.absoluteFilePath("../../../interface/resources/")) + "/";
|
||||||
|
}
|
||||||
|
#else
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
static QString staticResourcePath = QCoreApplication::applicationDirPath() + "/../Resources/";
|
static QString staticResourcePath = QCoreApplication::applicationDirPath() + "/../Resources/";
|
||||||
#else
|
#else
|
||||||
static QString staticResourcePath = QCoreApplication::applicationDirPath() + "/resources/";
|
static QString staticResourcePath = QCoreApplication::applicationDirPath() + "/resources/";
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
return staticResourcePath;
|
return staticResourcePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ void HifiMenu::setTriggerAction(const QString & name, std::function<void()> f) {
|
||||||
QObject* addMenu(QObject* parent, const QString & text) {
|
QObject* addMenu(QObject* parent, const QString & text) {
|
||||||
// FIXME add more checking here to ensure no name conflicts
|
// FIXME add more checking here to ensure no name conflicts
|
||||||
QVariant returnedValue;
|
QVariant returnedValue;
|
||||||
QMetaObject::invokeMethod(parent, "addMenu",
|
QMetaObject::invokeMethod(parent, "addMenu", Qt::DirectConnection,
|
||||||
Q_RETURN_ARG(QVariant, returnedValue),
|
Q_RETURN_ARG(QVariant, returnedValue),
|
||||||
Q_ARG(QVariant, text));
|
Q_ARG(QVariant, text));
|
||||||
QObject* result = returnedValue.value<QObject*>();
|
QObject* result = returnedValue.value<QObject*>();
|
||||||
|
@ -59,7 +59,7 @@ class QQuickMenuItem;
|
||||||
QObject* addItem(QObject* parent, const QString& text) {
|
QObject* addItem(QObject* parent, const QString& text) {
|
||||||
// FIXME add more checking here to ensure no name conflicts
|
// FIXME add more checking here to ensure no name conflicts
|
||||||
QQuickMenuItem* returnedValue{ nullptr };
|
QQuickMenuItem* returnedValue{ nullptr };
|
||||||
bool invokeResult = QMetaObject::invokeMethod(parent, "addItem",
|
bool invokeResult = QMetaObject::invokeMethod(parent, "addItem", Qt::DirectConnection,
|
||||||
Q_RETURN_ARG(QQuickMenuItem*, returnedValue),
|
Q_RETURN_ARG(QQuickMenuItem*, returnedValue),
|
||||||
Q_ARG(QString, text));
|
Q_ARG(QString, text));
|
||||||
Q_ASSERT(invokeResult);
|
Q_ASSERT(invokeResult);
|
||||||
|
@ -104,9 +104,11 @@ bool HifiMenu::menuExists(const QString& menuName) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HifiMenu::addSeparator(const QString& parentMenu, const QString& separatorName) {
|
void HifiMenu::addSeparator(const QString& parentMenu, const QString& separatorName) {
|
||||||
// FIXME 'add sep'
|
QObject * parent = findMenuObject(parentMenu);
|
||||||
// addMenu(parentMenu, separatorName);
|
bool invokeResult = QMetaObject::invokeMethod(parent, "addSeparator", Qt::DirectConnection);
|
||||||
// setEnabled()
|
Q_ASSERT(invokeResult);
|
||||||
|
addItem(parentMenu, separatorName);
|
||||||
|
enableItem(separatorName, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HifiMenu::removeSeparator(const QString& parentMenu, const QString& separatorName) {
|
void HifiMenu::removeSeparator(const QString& parentMenu, const QString& separatorName) {
|
||||||
|
@ -132,6 +134,11 @@ void HifiMenu::addItem(const QString & parentMenu, const QString & menuOption, s
|
||||||
addItem(parentMenu, menuOption);
|
addItem(parentMenu, menuOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HifiMenu::addItem(const QString & parentMenu, const QString & menuOption, QObject* receiver, const char* slot) {
|
||||||
|
addItem(parentMenu, menuOption);
|
||||||
|
connectItem(menuOption, receiver, slot);
|
||||||
|
}
|
||||||
|
|
||||||
void HifiMenu::removeItem(const QString& menuOption) {
|
void HifiMenu::removeItem(const QString& menuOption) {
|
||||||
removeMenu(menuOption);
|
removeMenu(menuOption);
|
||||||
}
|
}
|
||||||
|
@ -170,8 +177,10 @@ void HifiMenu::setChecked(const QString& menuOption, bool isChecked) {
|
||||||
warn(menuOption);
|
warn(menuOption);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (menuItem->property("checked").toBool() != isChecked) {
|
||||||
menuItem->setProperty("checked", QVariant::fromValue(isChecked));
|
menuItem->setProperty("checked", QVariant::fromValue(isChecked));
|
||||||
Q_ASSERT(menuItem->property("checked").toBool() == isChecked);
|
Q_ASSERT(menuItem->property("checked").toBool() == isChecked);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HifiMenu::setCheckable(const QString& menuOption, bool checkable) {
|
void HifiMenu::setCheckable(const QString& menuOption, bool checkable) {
|
||||||
|
@ -185,7 +194,7 @@ void HifiMenu::setCheckable(const QString& menuOption, bool checkable) {
|
||||||
Q_ASSERT(menuItem->property("checkable").toBool() == checkable);
|
Q_ASSERT(menuItem->property("checkable").toBool() == checkable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HifiMenu::setItemText(const QString& menuOption, const QString & text) {
|
void HifiMenu::setItemText(const QString& menuOption, const QString& text) {
|
||||||
QObject* menuItem = findMenuObject(menuOption);
|
QObject* menuItem = findMenuObject(menuOption);
|
||||||
if (!menuItem) {
|
if (!menuItem) {
|
||||||
warn(menuOption);
|
warn(menuOption);
|
||||||
|
@ -253,3 +262,18 @@ QString HifiMenu::getItemShortcut(const QString& menuOption) {
|
||||||
}
|
}
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HifiMenu::addCheckableItem(const QString& parentMenu, const QString& menuOption, bool checked, QObject* receiver, const char* slot) {
|
||||||
|
addCheckableItem(parentMenu, menuOption, checked);
|
||||||
|
connectItem(menuOption, receiver, slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HifiMenu::connectCheckable(const QString& menuOption, QObject* receiver, const char* slot) {
|
||||||
|
QObject* result = findMenuObject(menuOption);
|
||||||
|
connect(result, SIGNAL(toggled(bool)), receiver, slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HifiMenu::connectItem(const QString& menuOption, QObject* receiver, const char* slot) {
|
||||||
|
QObject* result = findMenuObject(menuOption);
|
||||||
|
connect(result, SIGNAL(triggered()), receiver, slot);
|
||||||
|
}
|
||||||
|
|
|
@ -37,9 +37,13 @@ public:
|
||||||
|
|
||||||
void addItem(const QString& parentMenu, const QString& menuOption);
|
void addItem(const QString& parentMenu, const QString& menuOption);
|
||||||
void addItem(const QString& parentMenu, const QString& menuOption, std::function<void()> f);
|
void addItem(const QString& parentMenu, const QString& menuOption, std::function<void()> f);
|
||||||
|
void addItem(const QString& parentMenu, const QString& menuOption, QObject* receiver, const char* slot);
|
||||||
|
|
||||||
void addCheckableItem(const QString& parentMenu, const QString& menuOption, bool checked = false);
|
void addCheckableItem(const QString& parentMenu, const QString& menuOption, bool checked = false);
|
||||||
void addCheckableItem(const QString& parentMenu, const QString& menuOption, bool checked, std::function<void(bool)> f);
|
void addCheckableItem(const QString& parentMenu, const QString& menuOption, bool checked, std::function<void(bool)> f);
|
||||||
|
void addCheckableItem(const QString& parentMenu, const QString& menuOption, bool checked, QObject* receiver, const char* slot);
|
||||||
|
void connectCheckable(const QString& menuOption, QObject* receiver, const char* slot);
|
||||||
|
void connectItem(const QString& menuOption, QObject* receiver, const char* slot);
|
||||||
|
|
||||||
void removeItem(const QString& menuitem);
|
void removeItem(const QString& menuitem);
|
||||||
bool itemExists(const QString& menuName, const QString& menuitem) const;
|
bool itemExists(const QString& menuName, const QString& menuitem) const;
|
||||||
|
@ -48,15 +52,15 @@ public:
|
||||||
bool isChecked(const QString& menuOption) const;
|
bool isChecked(const QString& menuOption) const;
|
||||||
void setChecked(const QString& menuOption, bool checked = true);
|
void setChecked(const QString& menuOption, bool checked = true);
|
||||||
void setCheckable(const QString& menuOption, bool checkable = true);
|
void setCheckable(const QString& menuOption, bool checkable = true);
|
||||||
void setExclusiveGroup(const QString& menuOption, const QString & groupName);
|
void setExclusiveGroup(const QString& menuOption, const QString& groupName);
|
||||||
void setItemText(const QString& menuOption, const QString& text);
|
void setItemText(const QString& menuOption, const QString& text);
|
||||||
void setItemVisible(const QString& menuOption, bool visible = true);
|
void setItemVisible(const QString& menuOption, bool visible = true);
|
||||||
bool isItemVisible(const QString& menuOption);
|
bool isItemVisible(const QString& menuOption);
|
||||||
|
|
||||||
void setItemShortcut(const QString& menuOption, const QString & shortcut);
|
void setItemShortcut(const QString& menuOption, const QString& shortcut);
|
||||||
QString getItemShortcut(const QString& menuOption);
|
QString getItemShortcut(const QString& menuOption);
|
||||||
|
|
||||||
void setRootMenu(QObject * rootMenu);
|
void setRootMenu(QObject* rootMenu);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onTriggeredByName(const QString& name);
|
void onTriggeredByName(const QString& name);
|
||||||
|
|
Loading…
Reference in a new issue