History

Merge remote-tracking branch 'upstream/master' into ovr6

Brad Davis committed 11 years ago

Commit 4f8ea3f2 parents e5a9fa8 ab73905114 files · +2745 −1385Browse files

Showing the changes to interface/src/Application.cpp (1 of 114 files). Show all

Unified · Split

interface/src/Application.cpp+54−28
@@ -57,6 +57,7 @@ · 56 unmodified lines
5757
5858 #include <AccountManager.h>
5959 #include <AddressManager.h>
60+#include <CursorManager.h>
6061 #include <AmbientOcclusionEffect.h>
6162 #include <AudioInjector.h>
6263 #include <DeferredLightingEffect.h>
@@ -100,6 +101,7 @@ · 37 unmodified lines
100101 #include "ModelPackager.h"
101102 #include "Util.h"
102103 #include "InterfaceLogging.h"
104+#include "InterfaceActionFactory.h"
103105
104106 #include "avatar/AvatarManager.h"
105107
@@ -257,6 +259,7 @@ bool setupEssentials(int& argc, char** argv) { · 151 unmodified lines
257259
258260 DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
259261 DependencyManager::registerInheritance<AvatarHashMap, AvatarManager>();
262+ DependencyManager::registerInheritance<EntityActionFactoryInterface, InterfaceActionFactory>();
260263
261264 Setting::init();
262265
@@ -293,7 +296,8 @@ bool setupEssentials(int& argc, char** argv) { · 30 unmodified lines
293296 auto discoverabilityManager = DependencyManager::set<DiscoverabilityManager>();
294297 auto sceneScriptingInterface = DependencyManager::set<SceneScriptingInterface>();
295298 auto offscreenUi = DependencyManager::set<OffscreenUi>();
296− auto pathUtils = DependencyManager::set<PathUtils>();
299+ auto pathUtils = DependencyManager::set<PathUtils>();
300+ auto actionFactory = DependencyManager::set<InterfaceActionFactory>();
297301
298302 return true;
299303 }
@@ -336,7 +340,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 36 unmodified lines
336340 _enableProcessOctreeThread(true),
337341 _octreeProcessor(),
338342 _nodeBoundsDisplay(this),
339− _applicationOverlay(),
340343 _runningScriptsWidget(NULL),
341344 _runningScriptsWidgetWasVisible(false),
342345 _trayIcon(new QSystemTrayIcon(_window)),
@@ -347,7 +350,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 4 unmodified lines
347350 _notifiedPacketVersionMismatchThisDomain(false),
348351 _domainConnectionRefusals(QList<QString>()),
349352 _maxOctreePPS(maxOctreePacketsPerSecond.get()),
350− _lastFaceTrackerUpdate(0)
353+ _lastFaceTrackerUpdate(0),
354+ _applicationOverlay()
351355 {
352356 setInstance(this);
353357 #ifdef Q_OS_WIN
@@ -421,6 +425,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 67 unmodified lines
421425 connect(audioIO.data(), &AudioClient::muteToggled, this, &Application::audioMuteToggled);
422426 connect(audioIO.data(), &AudioClient::receivedFirstPacket,
423427 &AudioScriptingInterface::getInstance(), &AudioScriptingInterface::receivedFirstPacket);
428+ connect(audioIO.data(), &AudioClient::disconnected,
429+ &AudioScriptingInterface::getInstance(), &AudioScriptingInterface::disconnected);
424430
425431 audioThread->start();
426432
@@ -524,7 +530,16 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 97 unmodified lines
524530 _window->setVisible(true);
525531 _glWidget->setFocusPolicy(Qt::StrongFocus);
526532 _glWidget->setFocus();
527−
533+#ifdef Q_OS_MAC
534+ // OSX doesn't seem to provide for hiding the cursor only on the GL widget
535+ _window->setCursor(Qt::BlankCursor);
536+#else
537+ // On windows and linux, hiding the top level cursor also means it's invisible
538+ // when hovering over the window menu, which is a pain, so only hide it for
539+ // the GL surface
540+ _glWidget->setCursor(Qt::BlankCursor);
541+#endif
542+
528543 // enable mouse tracking; otherwise, we only get drag events
529544 _glWidget->setMouseTracking(true);
530545
@@ -942,12 +957,15 @@ void Application::paintGL() { · 411 unmodified lines
942957 displaySide(&renderArgs, _myCamera);
943958 glPopMatrix();
944959
960+ renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE;
945961 if (Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror)) {
946962 _rearMirrorTools->render(&renderArgs, true, _glWidget->mapFromGlobal(QCursor::pos()));
947963 } else if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) {
948964 renderRearViewMirror(&renderArgs, _mirrorViewRect);
949965 }
950966
967+ renderArgs._renderMode = RenderArgs::NORMAL_RENDER_MODE;
968+
951969 auto finalFbo = DependencyManager::get<GlowEffect>()->render(&renderArgs);
952970
953971 glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
@@ -1228,9 +1246,20 @@ void Application::keyPressEvent(QKeyEvent* event) { · 274 unmodified lines
12281246 }
12291247 break;
12301248
1231− case Qt::Key_Apostrophe:
1232− resetSensors();
1249+ case Qt::Key_Apostrophe: {
1250+ if (isMeta) {
1251+ auto cursor = Cursor::Manager::instance().getCursor();
1252+ auto curIcon = cursor->getIcon();
1253+ if (curIcon == Cursor::Icon::DEFAULT) {
1254+ cursor->setIcon(Cursor::Icon::LINK);
1255+ } else {
1256+ cursor->setIcon(Cursor::Icon::DEFAULT);
1257+ }
1258+ } else {
1259+ resetSensors();
1260+ }
12331261 break;
1262+ }
12341263
12351264 case Qt::Key_A:
12361265 if (isShifted) {
@@ -1354,12 +1383,27 @@ void Application::keyPressEvent(QKeyEvent* event) { · 117 unmodified lines
13541383 case Qt::Key_Slash:
13551384 Menu::getInstance()->triggerOption(MenuOption::Stats);
13561385 break;
1357− case Qt::Key_Plus:
1358− _myAvatar->increaseSize();
1386+
1387+ case Qt::Key_Plus: {
1388+ if (isMeta && event->modifiers().testFlag(Qt::KeypadModifier)) {
1389+ auto& cursorManager = Cursor::Manager::instance();
1390+ cursorManager.setScale(cursorManager.getScale() * 1.1f);
1391+ } else {
1392+ _myAvatar->increaseSize();
1393+ }
13591394 break;
1360− case Qt::Key_Minus:
1361− _myAvatar->decreaseSize();
1395+ }
1396+
1397+ case Qt::Key_Minus: {
1398+ if (isMeta && event->modifiers().testFlag(Qt::KeypadModifier)) {
1399+ auto& cursorManager = Cursor::Manager::instance();
1400+ cursorManager.setScale(cursorManager.getScale() / 1.1f);
1401+ } else {
1402+ _myAvatar->decreaseSize();
1403+ }
13621404 break;
1405+ }
1406+
13631407 case Qt::Key_Equal:
13641408 _myAvatar->resetSize();
13651409 break;
@@ -1895,8 +1939,6 @@ void Application::setEnableVRMode(bool enableVRMode) { · 529 unmodified lines
18951939 }
18961940
18971941 resizeGL();
1898−
1899− updateCursorVisibility();
19001942 }
19011943
19021944 void Application::setLowVelocityFilter(bool lowVelocityFilter) {
@@ -2398,19 +2440,8 @@ void Application::updateCursor(float deltaTime) { · 495 unmodified lines
23982440 lastMousePos = QCursor::pos();
23992441 }
24002442
2401−void Application::updateCursorVisibility() {
2402− if (!_cursorVisible ||
2403− Menu::getInstance()->isOptionChecked(MenuOption::EnableVRMode) ||
2404− Menu::getInstance()->isOptionChecked(MenuOption::Enable3DTVMode)) {
2405− _window->setCursor(Qt::BlankCursor);
2406− } else {
2407− _window->unsetCursor();
2408− }
2409−}
2410−
24112443 void Application::setCursorVisible(bool visible) {
24122444 _cursorVisible = visible;
2413− updateCursorVisibility();
24142445 }
24152446
24162447 void Application::update(float deltaTime) {
@@ -3409,7 +3440,6 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 992 unmodified lines
34093440 "Application::displaySide() ... entities...");
34103441
34113442 RenderArgs::DebugFlags renderDebugFlags = RenderArgs::RENDER_DEBUG_NONE;
3412− RenderArgs::RenderMode renderMode = RenderArgs::DEFAULT_RENDER_MODE;
34133443
34143444 if (Menu::getInstance()->isOptionChecked(MenuOption::PhysicsShowHulls)) {
34153445 renderDebugFlags = (RenderArgs::DebugFlags) (renderDebugFlags | (int) RenderArgs::RENDER_DEBUG_HULLS);
@@ -3418,10 +3448,6 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 2 unmodified lines
34183448 renderDebugFlags =
34193449 (RenderArgs::DebugFlags) (renderDebugFlags | (int) RenderArgs::RENDER_DEBUG_SIMULATION_OWNERSHIP);
34203450 }
3421− if (theCamera.getMode() == CAMERA_MODE_MIRROR) {
3422− renderMode = RenderArgs::MIRROR_RENDER_MODE;
3423− }
3424− renderArgs->_renderMode = renderMode;
34253451 renderArgs->_debugFlags = renderDebugFlags;
34263452 _entities.render(renderArgs);
34273453 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t