remove HMD Tools as menu item, automatically hide/show it when display plugin is an hmd

This commit is contained in:
ZappoMan 2015-08-14 16:27:50 -07:00
parent ea685f4587
commit 6a802560f2
5 changed files with 10 additions and 18 deletions

View file

@ -4680,6 +4680,11 @@ void Application::updateDisplayMode() {
if (oldDisplayPlugin) {
oldDisplayPlugin->deactivate();
_offscreenContext->makeCurrent();
// if the old plugin was HMD and the new plugin is not HMD, then hide our hmdtools
if (oldDisplayPlugin->isHmd() && !newDisplayPlugin->isHmd()) {
DependencyManager::get<DialogsManager>()->hmdTools(false);
}
}
emit activeDisplayPluginChanged();
resetSensors();

View file

@ -289,16 +289,6 @@ Menu::Menu() {
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::CenterPlayerInView,
0, false, qApp, SLOT(rotationModeChanged()));
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::HMDTools,
#ifdef Q_OS_MAC
Qt::META | Qt::Key_H,
#else
Qt::CTRL | Qt::Key_H,
#endif
false,
dialogsManager.data(),
SLOT(hmdTools(bool)));
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::TurnWithHead, 0, false);
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::StandingHMDSensorMode, 0, false,

View file

@ -199,7 +199,6 @@ namespace MenuOption {
const QString FullscreenMirror = "Fullscreen Mirror";
const QString GlowWhenSpeaking = "Glow When Speaking";
const QString HandMouseInput = "Enable Hand Mouse Input";
const QString HMDTools = "HMD Tools";
const QString IncreaseAvatarSize = "Increase Avatar Size";
const QString IndependentMode = "Independent Mode";
const QString InputMenu = "Avatar>Input Devices";

View file

@ -173,7 +173,6 @@ void DialogsManager::hmdTools(bool showTools) {
}
void DialogsManager::hmdToolsClosed() {
Menu::getInstance()->getActionForOption(MenuOption::HMDTools)->setChecked(false);
_hmdToolsDialog->hide();
}

View file

@ -30,8 +30,9 @@
static const int WIDTH = 350;
static const int HEIGHT = 100;
HMDToolsDialog::HMDToolsDialog(QWidget* parent) :
QDialog(parent, Qt::Window | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint)
QDialog(parent, Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowStaysOnTopHint)
{
// FIXME do we want to support more than one connected HMD? It seems like a pretty corner case
foreach(auto displayPlugin, PluginManager::getInstance()->getDisplayPlugins()) {
@ -171,14 +172,12 @@ void HMDToolsDialog::leaveHMDMode() {
}
void HMDToolsDialog::reject() {
// Just regularly close upon ESC
close();
// We don't want this window to be closable from a close icon, just from our "Leave HMD Mode" button
}
void HMDToolsDialog::closeEvent(QCloseEvent* event) {
// TODO: consider if we want to prevent closing of this window with event->ignore();
QDialog::closeEvent(event);
emit closed();
// We don't want this window to be closable from a close icon, just from our "Leave HMD Mode" button
event->ignore();
}
void HMDToolsDialog::centerCursorOnWidget(QWidget* widget) {