Showing the changes to interface/src/Menu.cpp (1 of 60 files). Show all
Unified · Split
| @@ -11,7 +11,6 @@ · 10 unmodified lines | |||
| 11 | 11 | ||
| 12 | #include <cstdlib> | 12 | #include <cstdlib> |
| 13 | 13 | ||
| 14 | |||
| 15 | #include <QBoxLayout> | 14 | #include <QBoxLayout> |
| 16 | #include <QColorDialog> | 15 | #include <QColorDialog> |
| 17 | #include <QDialogButtonBox> | 16 | #include <QDialogButtonBox> |
| @@ -44,20 +43,26 @@ · 26 unmodified lines | |||
| 44 | #include "Audio.h" | 43 | #include "Audio.h" |
| 45 | #include "audio/AudioIOStatsRenderer.h" | 44 | #include "audio/AudioIOStatsRenderer.h" |
| 46 | #include "audio/AudioScope.h" | 45 | #include "audio/AudioScope.h" |
| 47 | #include "devices/Faceshift.h" | ||
| 48 | #include "devices/OculusManager.h" | ||
| 49 | #include "devices/Visage.h" | 46 | #include "devices/Visage.h" |
| 50 | #include "Menu.h" | 47 | #include "Menu.h" |
| 51 | #include "scripting/LocationScriptingInterface.h" | 48 | #include "scripting/LocationScriptingInterface.h" |
| 52 | #include "scripting/MenuScriptingInterface.h" | 49 | #include "scripting/MenuScriptingInterface.h" |
| 53 | #include "Util.h" | 50 | #include "Util.h" |
| 51 | #include "ui/AddressBarDialog.h" | ||
| 54 | #include "ui/AnimationsDialog.h" | 52 | #include "ui/AnimationsDialog.h" |
| 55 | #include "ui/AttachmentsDialog.h" | 53 | #include "ui/AttachmentsDialog.h" |
| 54 | #include "ui/BandwidthDialog.h" | ||
| 55 | #include "ui/CachesSizeDialog.h" | ||
| 56 | #include "ui/DataWebDialog.h" | ||
| 57 | #include "ui/HMDToolsDialog.h" | ||
| 58 | #include "ui/LodToolsDialog.h" | ||
| 59 | #include "ui/LoginDialog.h" | ||
| 60 | #include "ui/OctreeStatsDialog.h" | ||
| 61 | #include "ui/PreferencesDialog.h" | ||
| 56 | #include "ui/InfoView.h" | 62 | #include "ui/InfoView.h" |
| 57 | #include "ui/MetavoxelEditor.h" | 63 | #include "ui/MetavoxelEditor.h" |
| 58 | #include "ui/MetavoxelNetworkSimulator.h" | 64 | #include "ui/MetavoxelNetworkSimulator.h" |
| 59 | #include "ui/ModelsBrowser.h" | 65 | #include "ui/ModelsBrowser.h" |
| 60 | #include "ui/LoginDialog.h" | ||
| 61 | #include "ui/NodeBounds.h" | 66 | #include "ui/NodeBounds.h" |
| 62 | 67 | ||
| 63 | Menu* Menu::_instance = NULL; | 68 | Menu* Menu::_instance = NULL; |
| @@ -79,56 +84,9 @@ Menu* Menu::getInstance() { · 15 unmodified lines | |||
| 79 | return _instance; | 84 | return _instance; |
| 80 | } | 85 | } |
| 81 | 86 | ||
| 82 | const float DEFAULT_FACESHIFT_EYE_DEFLECTION = 0.25f; | ||
| 83 | const QString DEFAULT_FACESHIFT_HOSTNAME = "localhost"; | ||
| 84 | const float DEFAULT_AVATAR_LOD_DISTANCE_MULTIPLIER = 1.0f; | ||
| 85 | const int ONE_SECOND_OF_FRAMES = 60; | ||
| 86 | const int FIVE_SECONDS_OF_FRAMES = 5 * ONE_SECOND_OF_FRAMES; | ||
| 87 | |||
| 88 | const QString CONSOLE_TITLE = "Scripting Console"; | ||
| 89 | const float CONSOLE_WINDOW_OPACITY = 0.95f; | ||
| 90 | const int CONSOLE_WIDTH = 800; | ||
| 91 | const int CONSOLE_HEIGHT = 200; | ||
| 92 | |||
| 93 | Menu::Menu() : | 87 | Menu::Menu() : |
| 94 | _actionHash(), | ||
| 95 | _receivedAudioStreamSettings(), | ||
| 96 | _bandwidthDialog(NULL), | ||
| 97 | _fieldOfView(DEFAULT_FIELD_OF_VIEW_DEGREES), | ||
| 98 | _realWorldFieldOfView(DEFAULT_REAL_WORLD_FIELD_OF_VIEW_DEGREES), | ||
| 99 | _faceshiftEyeDeflection(DEFAULT_FACESHIFT_EYE_DEFLECTION), | ||
| 100 | _faceshiftHostname(DEFAULT_FACESHIFT_HOSTNAME), | ||
| 101 | _jsConsole(NULL), | ||
| 102 | _octreeStatsDialog(NULL), | ||
| 103 | _lodToolsDialog(NULL), | ||
| 104 | _hmdToolsDialog(NULL), | ||
| 105 | _newLocationDialog(NULL), | ||
| 106 | _userLocationsDialog(NULL), | ||
| 107 | #if defined(Q_OS_MAC) || defined(Q_OS_WIN) | ||
| 108 | _speechRecognizer(), | ||
| 109 | #endif | ||
| 110 | _octreeSizeScale(DEFAULT_OCTREE_SIZE_SCALE), | ||
| 111 | _oculusUIAngularSize(DEFAULT_OCULUS_UI_ANGULAR_SIZE), | ||
| 112 | _sixenseReticleMoveSpeed(DEFAULT_SIXENSE_RETICLE_MOVE_SPEED), | ||
| 113 | _invertSixenseButtons(DEFAULT_INVERT_SIXENSE_MOUSE_BUTTONS), | ||
| 114 | _automaticAvatarLOD(true), | ||
| 115 | _avatarLODDecreaseFPS(DEFAULT_ADJUST_AVATAR_LOD_DOWN_FPS), | ||
| 116 | _avatarLODIncreaseFPS(ADJUST_LOD_UP_FPS), | ||
| 117 | _avatarLODDistanceMultiplier(DEFAULT_AVATAR_LOD_DISTANCE_MULTIPLIER), | ||
| 118 | _boundaryLevelAdjust(0), | ||
| 119 | _maxOctreePacketsPerSecond(DEFAULT_MAX_OCTREE_PPS), | ||
| 120 | _lastAdjust(usecTimestampNow()), | 88 | _lastAdjust(usecTimestampNow()), |
| 121 | _lastAvatarDetailDrop(usecTimestampNow()), | 89 | _lastAvatarDetailDrop(usecTimestampNow()) |
| 122 | _fpsAverage(FIVE_SECONDS_OF_FRAMES), | ||
| 123 | _fastFPSAverage(ONE_SECOND_OF_FRAMES), | ||
| 124 | _loginAction(NULL), | ||
| 125 | _preferencesDialog(NULL), | ||
| 126 | _loginDialog(NULL), | ||
| 127 | _hasLoginDialogDisplayed(false), | ||
| 128 | _snapshotsLocation(), | ||
| 129 | _scriptsLocation(), | ||
| 130 | _walletPrivateKey(), | ||
| 131 | _shouldRenderTableNeedsRebuilding(true) | ||
| 132 | { | 90 | { |
| 133 | Application *appInstance = Application::getInstance(); | 91 | Application *appInstance = Application::getInstance(); |
| 134 | 92 | ||
| @@ -354,11 +312,8 @@ Menu::Menu() : · 219 unmodified lines | |||
| 354 | 312 | ||
| 355 | QMenu* nodeBordersMenu = viewMenu->addMenu("Server Borders"); | 313 | QMenu* nodeBordersMenu = viewMenu->addMenu("Server Borders"); |
| 356 | NodeBounds& nodeBounds = appInstance->getNodeBoundsDisplay(); | 314 | NodeBounds& nodeBounds = appInstance->getNodeBoundsDisplay(); |
| 357 | addCheckableActionToQMenuAndActionHash(nodeBordersMenu, MenuOption::ShowBordersVoxelNodes, | ||
| 358 | Qt::CTRL | Qt::SHIFT | Qt::Key_1, false, | ||
| 359 | &nodeBounds, SLOT(setShowVoxelNodes(bool))); | ||
| 360 | addCheckableActionToQMenuAndActionHash(nodeBordersMenu, MenuOption::ShowBordersEntityNodes, | 315 | addCheckableActionToQMenuAndActionHash(nodeBordersMenu, MenuOption::ShowBordersEntityNodes, |
| 361 | Qt::CTRL | Qt::SHIFT | Qt::Key_2, false, | 316 | Qt::CTRL | Qt::SHIFT | Qt::Key_1, false, |
| 362 | &nodeBounds, SLOT(setShowEntityNodes(bool))); | 317 | &nodeBounds, SLOT(setShowEntityNodes(bool))); |
| 363 | 318 | ||
| 364 | addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::OffAxisProjection, 0, false); | 319 | addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::OffAxisProjection, 0, false); |
| @@ -492,6 +447,7 @@ Menu::Menu() : · 127 unmodified lines | |||
| 492 | false, | 447 | false, |
| 493 | &UserActivityLogger::getInstance(), | 448 | &UserActivityLogger::getInstance(), |
| 494 | SLOT(disable(bool))); | 449 | SLOT(disable(bool))); |
| 450 | addActionToQMenuAndActionHash(networkMenu, MenuOption::CachesSize, 0, this, SLOT(cachesSizeDialog())); | ||
| 495 | 451 | ||
| 496 | addActionToQMenuAndActionHash(developerMenu, MenuOption::WalletPrivateKey, 0, this, SLOT(changePrivateKey())); | 452 | addActionToQMenuAndActionHash(developerMenu, MenuOption::WalletPrivateKey, 0, this, SLOT(changePrivateKey())); |
| 497 | 453 | ||
| @@ -619,15 +575,6 @@ Menu::Menu() : · 121 unmodified lines | |||
| 619 | #endif | 575 | #endif |
| 620 | } | 576 | } |
| 621 | 577 | ||
| 622 | Menu::~Menu() { | ||
| 623 | bandwidthDetailsClosed(); | ||
| 624 | octreeStatsDetailsClosed(); | ||
| 625 | if (_hmdToolsDialog) { | ||
| 626 | delete _hmdToolsDialog; | ||
| 627 | _hmdToolsDialog = NULL; | ||
| 628 | } | ||
| 629 | } | ||
| 630 | |||
| 631 | void Menu::loadSettings(QSettings* settings) { | 578 | void Menu::loadSettings(QSettings* settings) { |
| 632 | bool lockedSettings = false; | 579 | bool lockedSettings = false; |
| 633 | if (!settings) { | 580 | if (!settings) { |
| @@ -1153,7 +1100,7 @@ void Menu::bandwidthDetails() { · 519 unmodified lines | |||
| 1153 | if (! _bandwidthDialog) { | 1100 | if (! _bandwidthDialog) { |
| 1154 | _bandwidthDialog = new BandwidthDialog(DependencyManager::get<GLCanvas>().data(), | 1101 | _bandwidthDialog = new BandwidthDialog(DependencyManager::get<GLCanvas>().data(), |
| 1155 | Application::getInstance()->getBandwidthMeter()); | 1102 | Application::getInstance()->getBandwidthMeter()); |
| 1156 | connect(_bandwidthDialog, SIGNAL(closed()), SLOT(bandwidthDetailsClosed())); | 1103 | connect(_bandwidthDialog, SIGNAL(closed()), _bandwidthDialog, SLOT(deleteLater())); |
| 1157 | 1104 | ||
| 1158 | _bandwidthDialog->show(); | 1105 | _bandwidthDialog->show(); |
| 1159 | 1106 | ||
| @@ -1253,18 +1200,11 @@ void Menu::audioMuteToggled() { · 93 unmodified lines | |||
| 1253 | } | 1200 | } |
| 1254 | } | 1201 | } |
| 1255 | 1202 | ||
| 1256 | void Menu::bandwidthDetailsClosed() { | ||
| 1257 | if (_bandwidthDialog) { | ||
| 1258 | delete _bandwidthDialog; | ||
| 1259 | _bandwidthDialog = NULL; | ||
| 1260 | } | ||
| 1261 | } | ||
| 1262 | |||
| 1263 | void Menu::octreeStatsDetails() { | 1203 | void Menu::octreeStatsDetails() { |
| 1264 | if (!_octreeStatsDialog) { | 1204 | if (!_octreeStatsDialog) { |
| 1265 | _octreeStatsDialog = new OctreeStatsDialog(DependencyManager::get<GLCanvas>().data(), | 1205 | _octreeStatsDialog = new OctreeStatsDialog(DependencyManager::get<GLCanvas>().data(), |
| 1266 | Application::getInstance()->getOcteeSceneStats()); | 1206 | Application::getInstance()->getOcteeSceneStats()); |
| 1267 | connect(_octreeStatsDialog, SIGNAL(closed()), SLOT(octreeStatsDetailsClosed())); | 1207 | connect(_octreeStatsDialog, SIGNAL(closed()), _octreeStatsDialog, SLOT(deleteLater())); |
| 1268 | _octreeStatsDialog->show(); | 1208 | _octreeStatsDialog->show(); |
| 1269 | if (_hmdToolsDialog) { | 1209 | if (_hmdToolsDialog) { |
| 1270 | _hmdToolsDialog->watchWindow(_octreeStatsDialog->windowHandle()); | 1210 | _hmdToolsDialog->watchWindow(_octreeStatsDialog->windowHandle()); |
| @@ -1273,13 +1213,6 @@ void Menu::octreeStatsDetails() { · 2 unmodified lines | |||
| 1273 | _octreeStatsDialog->raise(); | 1213 | _octreeStatsDialog->raise(); |
| 1274 | } | 1214 | } |
| 1275 | 1215 | ||
| 1276 | void Menu::octreeStatsDetailsClosed() { | ||
| 1277 | if (_octreeStatsDialog) { | ||
| 1278 | delete _octreeStatsDialog; | ||
| 1279 | _octreeStatsDialog = NULL; | ||
| 1280 | } | ||
| 1281 | } | ||
| 1282 | |||
| 1283 | QString Menu::getLODFeedbackText() { | 1216 | QString Menu::getLODFeedbackText() { |
| 1284 | // determine granularity feedback | 1217 | // determine granularity feedback |
| 1285 | int boundaryLevelAdjust = getBoundaryLevelAdjust(); | 1218 | int boundaryLevelAdjust = getBoundaryLevelAdjust(); |
| @@ -1443,11 +1376,23 @@ bool Menu::shouldRenderMesh(float largestDimension, float distanceToCamera) { · 157 unmodified lines | |||
| 1443 | return (distanceToCamera <= visibleDistanceAtClosestScale); | 1376 | return (distanceToCamera <= visibleDistanceAtClosestScale); |
| 1444 | } | 1377 | } |
| 1445 | 1378 | ||
| 1379 | void Menu::cachesSizeDialog() { | ||
| 1380 | qDebug() << "Caches size:" << _cachesSizeDialog.isNull(); | ||
| 1381 | if (!_cachesSizeDialog) { | ||
| 1382 | _cachesSizeDialog = new CachesSizeDialog(DependencyManager::get<GLCanvas>().data()); | ||
| 1383 | connect(_cachesSizeDialog, SIGNAL(closed()), _cachesSizeDialog, SLOT(deleteLater())); | ||
| 1384 | _cachesSizeDialog->show(); | ||
| 1385 | if (_hmdToolsDialog) { | ||
| 1386 | _hmdToolsDialog->watchWindow(_cachesSizeDialog->windowHandle()); | ||
| 1387 | } | ||
| 1388 | } | ||
| 1389 | _cachesSizeDialog->raise(); | ||
| 1390 | } | ||
| 1446 | 1391 | ||
| 1447 | void Menu::lodTools() { | 1392 | void Menu::lodTools() { |
| 1448 | if (!_lodToolsDialog) { | 1393 | if (!_lodToolsDialog) { |
| 1449 | _lodToolsDialog = new LodToolsDialog(DependencyManager::get<GLCanvas>().data()); | 1394 | _lodToolsDialog = new LodToolsDialog(DependencyManager::get<GLCanvas>().data()); |
| 1450 | connect(_lodToolsDialog, SIGNAL(closed()), SLOT(lodToolsClosed())); | 1395 | connect(_lodToolsDialog, SIGNAL(closed()), _lodToolsDialog, SLOT(deleteLater())); |
| 1451 | _lodToolsDialog->show(); | 1396 | _lodToolsDialog->show(); |
| 1452 | if (_hmdToolsDialog) { | 1397 | if (_hmdToolsDialog) { |
| 1453 | _hmdToolsDialog->watchWindow(_lodToolsDialog->windowHandle()); | 1398 | _hmdToolsDialog->watchWindow(_lodToolsDialog->windowHandle()); |
| @@ -1456,13 +1401,6 @@ void Menu::lodTools() { · 2 unmodified lines | |||
| 1456 | _lodToolsDialog->raise(); | 1401 | _lodToolsDialog->raise(); |
| 1457 | } | 1402 | } |
| 1458 | 1403 | ||
| 1459 | void Menu::lodToolsClosed() { | ||
| 1460 | if (_lodToolsDialog) { | ||
| 1461 | delete _lodToolsDialog; | ||
| 1462 | _lodToolsDialog = NULL; | ||
| 1463 | } | ||
| 1464 | } | ||
| 1465 | |||
| 1466 | void Menu::hmdTools(bool showTools) { | 1404 | void Menu::hmdTools(bool showTools) { |
| 1467 | if (showTools) { | 1405 | if (showTools) { |
| 1468 | if (!_hmdToolsDialog) { | 1406 | if (!_hmdToolsDialog) { |