add toggleOverlays menu item and action

This commit is contained in:
Brad Hefta-Gaub 2016-02-25 08:31:11 -08:00
parent cfdaf643a1
commit 5828c32041
6 changed files with 16 additions and 3 deletions

View file

@ -817,6 +817,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
} else if (action == controller::toInt(controller::Action::RETICLE_Y)) {
auto oldPos = _compositor.getReticlePosition();
_compositor.setReticlePosition({ oldPos.x, oldPos.y + state });
} else if (action == controller::toInt(controller::Action::TOGGLE_OVERLAY)) {
_overlayConductor.setEnabled(!_overlayConductor.getEnabled());
}
}
});
@ -2030,9 +2032,7 @@ void Application::keyPressEvent(QKeyEvent* event) {
Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, !Menu::getInstance()->isOptionChecked(MenuOption::FirstPerson));
cameraMenuChanged();
break;
case Qt::Key_O:
_overlayConductor.setEnabled(!_overlayConductor.getEnabled());
break;
case Qt::Key_Slash:
Menu::getInstance()->triggerOption(MenuOption::Stats);
break;
@ -2993,6 +2993,11 @@ void Application::updateThreads(float deltaTime) {
}
}
void Application::toggleOverlays() {
auto overlaysVisible = Menu::getInstance()->isOptionChecked(MenuOption::Overlays);
_overlayConductor.setEnabled(overlaysVisible);
}
void Application::cycleCamera() {
auto menu = Menu::getInstance();
if (menu->isOptionChecked(MenuOption::FullscreenMirror)) {

View file

@ -149,6 +149,7 @@ public:
const ApplicationOverlay& getApplicationOverlay() const { return _applicationOverlay; }
ApplicationCompositor& getApplicationCompositor() { return _compositor; }
const ApplicationCompositor& getApplicationCompositor() const { return _compositor; }
Overlays& getOverlays() { return _overlays; }
bool isForeground() const { return _isForeground; }
@ -270,6 +271,7 @@ public slots:
void cycleCamera();
void cameraMenuChanged();
void toggleOverlays();
void reloadResourceCaches();

View file

@ -255,6 +255,9 @@ Menu::Menu() {
0, true, qApp, SLOT(rotationModeChanged()),
UNSPECIFIED_POSITION, "Advanced");
// View > Overlays
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Overlays, 0, true,
qApp, SLOT(toggleOverlays()));
// Navigate menu ----------------------------------
MenuWrapper* navigateMenu = addMenu("Navigate");

View file

@ -247,6 +247,7 @@ namespace MenuOption {
const QString OnePointCalibration = "1 Point Calibration";
const QString OnlyDisplayTopTen = "Only Display Top Ten";
const QString OutputMenu = "Display";
const QString Overlays = "Overlays";
const QString PackageModel = "Package Model...";
const QString Pair = "Pair";
const QString PhysicsShowHulls = "Draw Collision Hulls";

View file

@ -61,6 +61,7 @@ namespace controller {
makeButtonPair(Action::CONTEXT_MENU, "ContextMenu"),
makeButtonPair(Action::TOGGLE_MUTE, "ToggleMute"),
makeButtonPair(Action::CYCLE_CAMERA, "CycleCamera"),
makeButtonPair(Action::TOGGLE_OVERLAY, "ToggleOverlay"),
makeAxisPair(Action::RETICLE_CLICK, "ReticleClick"),
makeAxisPair(Action::RETICLE_X, "ReticleX"),

View file

@ -52,6 +52,7 @@ enum class Action {
CONTEXT_MENU,
TOGGLE_MUTE,
CYCLE_CAMERA,
TOGGLE_OVERLAY,
SHIFT,