mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 06:23:35 +02:00
enabling certain menus/key events in login
This commit is contained in:
parent
c43e67e4a8
commit
c28ed9fc4b
3 changed files with 43 additions and 3 deletions
|
@ -3894,7 +3894,34 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasFocus() && !_loginDialogPoppedUp) {
|
if (hasFocus() && _loginDialogPoppedUp) {
|
||||||
|
if (_keyboardMouseDevice->isActive()) {
|
||||||
|
_keyboardMouseDevice->keyReleaseEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isMeta = event->modifiers().testFlag(Qt::ControlModifier);
|
||||||
|
bool isOption = event->modifiers().testFlag(Qt::AltModifier);
|
||||||
|
switch (event->key()) {
|
||||||
|
case Qt::Key_4:
|
||||||
|
case Qt::Key_5:
|
||||||
|
case Qt::Key_6:
|
||||||
|
case Qt::Key_7:
|
||||||
|
if (isMeta || isOption) {
|
||||||
|
unsigned int index = static_cast<unsigned int>(event->key() - Qt::Key_1);
|
||||||
|
auto displayPlugins = PluginManager::getInstance()->getDisplayPlugins();
|
||||||
|
if (index < displayPlugins.size()) {
|
||||||
|
auto targetPlugin = displayPlugins.at(index);
|
||||||
|
QString targetName = targetPlugin->getName();
|
||||||
|
auto menu = Menu::getInstance();
|
||||||
|
QAction* action = menu->getActionForOption(targetName);
|
||||||
|
if (action && !action->isChecked()) {
|
||||||
|
action->trigger();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (hasFocus()) {
|
||||||
if (_keyboardMouseDevice->isActive()) {
|
if (_keyboardMouseDevice->isActive()) {
|
||||||
_keyboardMouseDevice->keyPressEvent(event);
|
_keyboardMouseDevice->keyPressEvent(event);
|
||||||
}
|
}
|
||||||
|
@ -5200,7 +5227,11 @@ void Application::pauseUntilLoginDetermined() {
|
||||||
nodeList->getDomainHandler().setInterstitialModeEnabled(false);
|
nodeList->getDomainHandler().setInterstitialModeEnabled(false);
|
||||||
// disconnect domain handler.
|
// disconnect domain handler.
|
||||||
nodeList->getDomainHandler().disconnect();
|
nodeList->getDomainHandler().disconnect();
|
||||||
Menu::getInstance()->setVisible(false);
|
auto menu = Menu::getInstance();
|
||||||
|
menu->getMenu("Edit")->setVisible(false);
|
||||||
|
menu->getMenu("View")->setVisible(false);
|
||||||
|
menu->getMenu("Navigate")->setVisible(false);
|
||||||
|
menu->getMenu("Settings")->setVisible(false);
|
||||||
|
|
||||||
{
|
{
|
||||||
auto scriptEngines = DependencyManager::get<ScriptEngines>().data();
|
auto scriptEngines = DependencyManager::get<ScriptEngines>().data();
|
||||||
|
@ -5248,7 +5279,11 @@ void Application::resumeAfterLoginDialogActionTaken() {
|
||||||
nodeList->getDomainHandler().setInterstitialModeEnabled(_interstitialModeEnabled);
|
nodeList->getDomainHandler().setInterstitialModeEnabled(_interstitialModeEnabled);
|
||||||
nodeList->getDomainHandler().resetting();
|
nodeList->getDomainHandler().resetting();
|
||||||
|
|
||||||
Menu::getInstance()->setVisible(true);
|
auto menu = Menu::getInstance();
|
||||||
|
menu->getMenu("Edit")->setVisible(true);
|
||||||
|
menu->getMenu("View")->setVisible(true);
|
||||||
|
menu->getMenu("Navigate")->setVisible(true);
|
||||||
|
menu->getMenu("Settings")->setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::loadAvatarScripts(const QVector<QString>& urls) {
|
void Application::loadAvatarScripts(const QVector<QString>& urls) {
|
||||||
|
|
|
@ -550,6 +550,10 @@ void MenuWrapper::setEnabled(bool enabled) {
|
||||||
_realMenu->setEnabled(enabled);
|
_realMenu->setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MenuWrapper::setVisible(bool visible) {
|
||||||
|
_realMenu->menuAction()->setVisible(visible);
|
||||||
|
}
|
||||||
|
|
||||||
QAction* MenuWrapper::addSeparator() {
|
QAction* MenuWrapper::addSeparator() {
|
||||||
QAction* action = _realMenu->addSeparator();
|
QAction* action = _realMenu->addSeparator();
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
|
|
|
@ -29,6 +29,7 @@ public:
|
||||||
QList<QAction*> actions();
|
QList<QAction*> actions();
|
||||||
MenuWrapper* addMenu(const QString& menuName);
|
MenuWrapper* addMenu(const QString& menuName);
|
||||||
void setEnabled(bool enabled = true);
|
void setEnabled(bool enabled = true);
|
||||||
|
void setVisible(bool visible = true);
|
||||||
QAction* addSeparator();
|
QAction* addSeparator();
|
||||||
void addAction(QAction* action);
|
void addAction(QAction* action);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue