Showing the changes to interface/src/Menu.cpp (1 of 148 files). Show all
Unified · Split
| @@ -26,6 +26,7 @@ · 25 unmodified lines | ||
| 26 | 26 | #include <QWindow> |
| 27 | 27 | |
| 28 | 28 | #include <AccountManager.h> |
| 29 | +#include <XmppClient.h> | |
| 29 | 30 | #include <UUID.h> |
| 30 | 31 | |
| 31 | 32 | #include "Application.h" |
| @@ -66,7 +67,7 @@ Menu::Menu() : · 34 unmodified lines | ||
| 66 | 67 | _faceshiftEyeDeflection(DEFAULT_FACESHIFT_EYE_DEFLECTION), |
| 67 | 68 | _frustumDrawMode(FRUSTUM_DRAW_MODE_ALL), |
| 68 | 69 | _viewFrustumOffset(DEFAULT_FRUSTUM_OFFSET), |
| 69 | − _voxelStatsDialog(NULL), | |
| 70 | + _octreeStatsDialog(NULL), | |
| 70 | 71 | _lodToolsDialog(NULL), |
| 71 | 72 | _maxVoxels(DEFAULT_MAX_VOXELS_PER_SYSTEM), |
| 72 | 73 | _voxelSizeScale(DEFAULT_OCTREE_SIZE_SCALE), |
| @@ -164,6 +165,19 @@ Menu::Menu() : · 91 unmodified lines | ||
| 164 | 165 | addActionToQMenuAndActionHash(toolsMenu, MenuOption::MetavoxelEditor, 0, this, SLOT(showMetavoxelEditor())); |
| 165 | 166 | addActionToQMenuAndActionHash(toolsMenu, MenuOption::FstUploader, 0, Application::getInstance(), SLOT(uploadFST())); |
| 166 | 167 | |
| 168 | + _chatAction = addActionToQMenuAndActionHash(toolsMenu, | |
| 169 | + MenuOption::Chat, | |
| 170 | + Qt::Key_Return, | |
| 171 | + this, | |
| 172 | + SLOT(showChat())); | |
| 173 | +#ifdef HAVE_QXMPP | |
| 174 | + const QXmppClient& xmppClient = XmppClient::getInstance().getXMPPClient(); | |
| 175 | + toggleChat(); | |
| 176 | + connect(&xmppClient, SIGNAL(connected()), this, SLOT(toggleChat())); | |
| 177 | + connect(&xmppClient, SIGNAL(disconnected()), this, SLOT(toggleChat())); | |
| 178 | +#else | |
| 179 | + _chatAction->setEnabled(false); | |
| 180 | +#endif | |
| 167 | 181 | |
| 168 | 182 | QMenu* viewMenu = addMenu("View"); |
| 169 | 183 | |
| @@ -215,7 +229,7 @@ Menu::Menu() : · 45 unmodified lines | ||
| 215 | 229 | addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Oscilloscope, 0, true); |
| 216 | 230 | addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Bandwidth, 0, true); |
| 217 | 231 | addActionToQMenuAndActionHash(viewMenu, MenuOption::BandwidthDetails, 0, this, SLOT(bandwidthDetails())); |
| 218 | − addActionToQMenuAndActionHash(viewMenu, MenuOption::VoxelStats, 0, this, SLOT(voxelStatsDetails())); | |
| 232 | + addActionToQMenuAndActionHash(viewMenu, MenuOption::OctreeStats, 0, this, SLOT(octreeStatsDetails())); | |
| 219 | 233 | |
| 220 | 234 | QMenu* developerMenu = addMenu("Developer"); |
| 221 | 235 | |
| @@ -343,7 +357,7 @@ Menu::Menu() : · 121 unmodified lines | ||
| 343 | 357 | |
| 344 | 358 | Menu::~Menu() { |
| 345 | 359 | bandwidthDetailsClosed(); |
| 346 | − voxelStatsDetailsClosed(); | |
| 360 | + octreeStatsDetailsClosed(); | |
| 347 | 361 | } |
| 348 | 362 | |
| 349 | 363 | void Menu::loadSettings(QSettings* settings) { |
| @@ -701,8 +715,8 @@ void Menu::editPreferences() { · 351 unmodified lines | ||
| 701 | 715 | form->addRow("Faceshift Eye Deflection:", faceshiftEyeDeflection); |
| 702 | 716 | |
| 703 | 717 | QSpinBox* fieldOfView = new QSpinBox(); |
| 704 | − fieldOfView->setMaximum(180); | |
| 705 | − fieldOfView->setMinimum(1); | |
| 718 | + fieldOfView->setMaximum(180.f); | |
| 719 | + fieldOfView->setMinimum(1.f); | |
| 706 | 720 | fieldOfView->setValue(_fieldOfView); |
| 707 | 721 | form->addRow("Vertical Field of View (Degrees):", fieldOfView); |
| 708 | 722 | |
| @@ -1023,6 +1037,30 @@ void Menu::showMetavoxelEditor() { · 314 unmodified lines | ||
| 1023 | 1037 | _MetavoxelEditor->raise(); |
| 1024 | 1038 | } |
| 1025 | 1039 | |
| 1040 | +void Menu::showChat() { | |
| 1041 | + if (!_chatWindow) { | |
| 1042 | + _chatWindow = new ChatWindow(); | |
| 1043 | + QMainWindow* mainWindow = Application::getInstance()->getWindow(); | |
| 1044 | + _chatWindow->setGeometry(mainWindow->width() - _chatWindow->width(), | |
| 1045 | + mainWindow->geometry().y(), | |
| 1046 | + _chatWindow->width(), | |
| 1047 | + mainWindow->height()); | |
| 1048 | + } | |
| 1049 | + if (!_chatWindow->isVisible()) { | |
| 1050 | + _chatWindow->show(); | |
| 1051 | + } | |
| 1052 | + _chatWindow->raise(); | |
| 1053 | +} | |
| 1054 | + | |
| 1055 | +void Menu::toggleChat() { | |
| 1056 | +#ifdef HAVE_QXMPP | |
| 1057 | + _chatAction->setEnabled(XmppClient::getInstance().getXMPPClient().isConnected()); | |
| 1058 | + if (!_chatAction->isEnabled() && _chatWindow) { | |
| 1059 | + _chatWindow->close(); | |
| 1060 | + } | |
| 1061 | +#endif | |
| 1062 | +} | |
| 1063 | + | |
| 1026 | 1064 | void Menu::audioMuteToggled() { |
| 1027 | 1065 | QAction *muteAction = _actionHash.value(MenuOption::MuteAudio); |
| 1028 | 1066 | muteAction->setChecked(Application::getInstance()->getAudio()->getMuted()); |
| @@ -1035,21 +1073,55 @@ void Menu::bandwidthDetailsClosed() { · 6 unmodified lines | ||
| 1035 | 1073 | } |
| 1036 | 1074 | } |
| 1037 | 1075 | |
| 1038 | −void Menu::voxelStatsDetails() { | |
| 1039 | − if (!_voxelStatsDialog) { | |
| 1040 | − _voxelStatsDialog = new VoxelStatsDialog(Application::getInstance()->getGLWidget(), | |
| 1076 | +void Menu::octreeStatsDetails() { | |
| 1077 | + if (!_octreeStatsDialog) { | |
| 1078 | + _octreeStatsDialog = new OctreeStatsDialog(Application::getInstance()->getGLWidget(), | |
| 1041 | 1079 | Application::getInstance()->getOcteeSceneStats()); |
| 1042 | − connect(_voxelStatsDialog, SIGNAL(closed()), SLOT(voxelStatsDetailsClosed())); | |
| 1043 | − _voxelStatsDialog->show(); | |
| 1080 | + connect(_octreeStatsDialog, SIGNAL(closed()), SLOT(octreeStatsDetailsClosed())); | |
| 1081 | + _octreeStatsDialog->show(); | |
| 1082 | + } | |
| 1083 | + _octreeStatsDialog->raise(); | |
| 1084 | +} | |
| 1085 | + | |
| 1086 | +void Menu::octreeStatsDetailsClosed() { | |
| 1087 | + if (_octreeStatsDialog) { | |
| 1088 | + delete _octreeStatsDialog; | |
| 1089 | + _octreeStatsDialog = NULL; | |
| 1044 | 1090 | } |
| 1045 | − _voxelStatsDialog->raise(); | |
| 1046 | 1091 | } |
| 1047 | 1092 | |
| 1048 | −void Menu::voxelStatsDetailsClosed() { | |
| 1049 | − if (_voxelStatsDialog) { | |
| 1050 | − delete _voxelStatsDialog; | |
| 1051 | − _voxelStatsDialog = NULL; | |
| 1093 | +QString Menu::getLODFeedbackText() { | |
| 1094 | + // determine granularity feedback | |
| 1095 | + int boundaryLevelAdjust = getBoundaryLevelAdjust(); | |
| 1096 | + QString granularityFeedback; | |
| 1097 | + | |
| 1098 | + switch (boundaryLevelAdjust) { | |
| 1099 | + case 0: { | |
| 1100 | + granularityFeedback = QString("at standard granularity."); | |
| 1101 | + } break; | |
| 1102 | + case 1: { | |
| 1103 | + granularityFeedback = QString("at half of standard granularity."); | |
| 1104 | + } break; | |
| 1105 | + case 2: { | |
| 1106 | + granularityFeedback = QString("at a third of standard granularity."); | |
| 1107 | + } break; | |
| 1108 | + default: { | |
| 1109 | + granularityFeedback = QString("at 1/%1th of standard granularity.").arg(boundaryLevelAdjust + 1); | |
| 1110 | + } break; | |
| 1111 | + } | |
| 1112 | + | |
| 1113 | + // distance feedback | |
| 1114 | + float voxelSizeScale = getVoxelSizeScale(); | |
| 1115 | + float relativeToDefault = voxelSizeScale / DEFAULT_OCTREE_SIZE_SCALE; | |
| 1116 | + QString result; | |
| 1117 | + if (relativeToDefault > 1.01) { | |
| 1118 | + result = QString("%1 further %2").arg(relativeToDefault,8,'f',2).arg(granularityFeedback); | |
| 1119 | + } else if (relativeToDefault > 0.99) { | |
| 1120 | + result = QString("the default distance %1").arg(granularityFeedback); | |
| 1121 | + } else { | |
| 1122 | + result = QString("%1 of default %2").arg(relativeToDefault,8,'f',3).arg(granularityFeedback); | |
| 1052 | 1123 | } |
| 1124 | + return result; | |
| 1053 | 1125 | } |
| 1054 | 1126 | |
| 1055 | 1127 | void Menu::autoAdjustLOD(float currentFPS) { |