Showing the changes to interface/src/Menu.cpp (1 of 14 files). Show all
Unified · Split
| @@ -87,7 +87,7 @@ Menu::Menu() : · 86 unmodified lines | |||
| 87 | _loginAction(NULL) | 87 | _loginAction(NULL) |
| 88 | { | 88 | { |
| 89 | Application *appInstance = Application::getInstance(); | 89 | Application *appInstance = Application::getInstance(); |
| 90 | 90 | ||
| 91 | QMenu* fileMenu = addMenu("File"); | 91 | QMenu* fileMenu = addMenu("File"); |
| 92 | 92 | ||
| 93 | #ifdef Q_OS_MAC | 93 | #ifdef Q_OS_MAC |
| @@ -100,23 +100,24 @@ Menu::Menu() : · 6 unmodified lines | |||
| 100 | #endif | 100 | #endif |
| 101 | 101 | ||
| 102 | AccountManager& accountManager = AccountManager::getInstance(); | 102 | AccountManager& accountManager = AccountManager::getInstance(); |
| 103 | 103 | ||
| 104 | _loginAction = addActionToQMenuAndActionHash(fileMenu, MenuOption::Logout); | 104 | _loginAction = addActionToQMenuAndActionHash(fileMenu, MenuOption::Logout); |
| 105 | 105 | ||
| 106 | // call our toggle login function now so the menu option is setup properly | 106 | // call our toggle login function now so the menu option is setup properly |
| 107 | toggleLoginMenuItem(); | 107 | toggleLoginMenuItem(); |
| 108 | 108 | ||
| 109 | // connect to the appropriate slots of the AccountManager so that we can change the Login/Logout menu item | 109 | // connect to the appropriate slots of the AccountManager so that we can change the Login/Logout menu item |
| 110 | connect(&accountManager, &AccountManager::accessTokenChanged, this, &Menu::toggleLoginMenuItem); | 110 | connect(&accountManager, &AccountManager::accessTokenChanged, this, &Menu::toggleLoginMenuItem); |
| 111 | connect(&accountManager, &AccountManager::logoutComplete, this, &Menu::toggleLoginMenuItem); | 111 | connect(&accountManager, &AccountManager::logoutComplete, this, &Menu::toggleLoginMenuItem); |
| 112 | 112 | ||
| 113 | addDisabledActionAndSeparator(fileMenu, "Scripts"); | 113 | addDisabledActionAndSeparator(fileMenu, "Scripts"); |
| 114 | addActionToQMenuAndActionHash(fileMenu, MenuOption::LoadScript, Qt::CTRL | Qt::Key_O, appInstance, SLOT(loadDialog())); | 114 | addActionToQMenuAndActionHash(fileMenu, MenuOption::LoadScript, Qt::CTRL | Qt::Key_O, appInstance, SLOT(loadDialog())); |
| 115 | addActionToQMenuAndActionHash(fileMenu, MenuOption::LoadScriptURL, | 115 | addActionToQMenuAndActionHash(fileMenu, MenuOption::LoadScriptURL, |
| 116 | Qt::CTRL | Qt::SHIFT | Qt::Key_O, appInstance, SLOT(loadScriptURLDialog())); | 116 | Qt::CTRL | Qt::SHIFT | Qt::Key_O, appInstance, SLOT(loadScriptURLDialog())); |
| 117 | addActionToQMenuAndActionHash(fileMenu, MenuOption::StopAllScripts, 0, appInstance, SLOT(stopAllScripts())); | 117 | addActionToQMenuAndActionHash(fileMenu, MenuOption::StopAllScripts, 0, appInstance, SLOT(stopAllScripts())); |
| 118 | addActionToQMenuAndActionHash(fileMenu, MenuOption::ReloadAllScripts, 0, appInstance, SLOT(reloadAllScripts())); | 118 | addActionToQMenuAndActionHash(fileMenu, MenuOption::ReloadAllScripts, 0, appInstance, SLOT(reloadAllScripts())); |
| 119 | _activeScriptsMenu = fileMenu->addMenu("Running Scripts"); | 119 | addActionToQMenuAndActionHash(fileMenu, MenuOption::RunningScripts, Qt::CTRL | Qt::Key_J, |
| 120 | appInstance, SLOT(toggleRunningScriptsWidget())); | ||
| 120 | 121 | ||
| 121 | addDisabledActionAndSeparator(fileMenu, "Go"); | 122 | addDisabledActionAndSeparator(fileMenu, "Go"); |
| 122 | addActionToQMenuAndActionHash(fileMenu, | 123 | addActionToQMenuAndActionHash(fileMenu, |
| @@ -147,7 +148,7 @@ Menu::Menu() : · 24 unmodified lines | |||
| 147 | 148 | ||
| 148 | addDisabledActionAndSeparator(fileMenu, "Upload Avatar Model"); | 149 | addDisabledActionAndSeparator(fileMenu, "Upload Avatar Model"); |
| 149 | addActionToQMenuAndActionHash(fileMenu, MenuOption::UploadFST, 0, Application::getInstance(), SLOT(uploadFST())); | 150 | addActionToQMenuAndActionHash(fileMenu, MenuOption::UploadFST, 0, Application::getInstance(), SLOT(uploadFST())); |
| 150 | 151 | ||
| 151 | addDisabledActionAndSeparator(fileMenu, "Settings"); | 152 | addDisabledActionAndSeparator(fileMenu, "Settings"); |
| 152 | addActionToQMenuAndActionHash(fileMenu, MenuOption::SettingsImport, 0, this, SLOT(importSettings())); | 153 | addActionToQMenuAndActionHash(fileMenu, MenuOption::SettingsImport, 0, this, SLOT(importSettings())); |
| 153 | addActionToQMenuAndActionHash(fileMenu, MenuOption::SettingsExport, 0, this, SLOT(exportSettings())); | 154 | addActionToQMenuAndActionHash(fileMenu, MenuOption::SettingsExport, 0, this, SLOT(exportSettings())); |
| @@ -172,8 +173,8 @@ Menu::Menu() : · 18 unmodified lines | |||
| 172 | addDisabledActionAndSeparator(editMenu, "Physics"); | 173 | addDisabledActionAndSeparator(editMenu, "Physics"); |
| 173 | addCheckableActionToQMenuAndActionHash(editMenu, MenuOption::Gravity, Qt::SHIFT | Qt::Key_G, false); | 174 | addCheckableActionToQMenuAndActionHash(editMenu, MenuOption::Gravity, Qt::SHIFT | Qt::Key_G, false); |
| 174 | 175 | ||
| 175 | 176 | ||
| 176 | 177 | ||
| 177 | 178 | ||
| 178 | addAvatarCollisionSubMenu(editMenu); | 179 | addAvatarCollisionSubMenu(editMenu); |
| 179 | 180 | ||
| @@ -207,7 +208,7 @@ Menu::Menu() : · 27 unmodified lines | |||
| 207 | addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Mirror, Qt::SHIFT | Qt::Key_H, true); | 208 | addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Mirror, Qt::SHIFT | Qt::Key_H, true); |
| 208 | addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::FullscreenMirror, Qt::Key_H, false, | 209 | addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::FullscreenMirror, Qt::Key_H, false, |
| 209 | appInstance, SLOT(cameraMenuChanged())); | 210 | appInstance, SLOT(cameraMenuChanged())); |
| 210 | 211 | ||
| 211 | addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Enable3DTVMode, 0, | 212 | addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Enable3DTVMode, 0, |
| 212 | false, | 213 | false, |
| 213 | appInstance, | 214 | appInstance, |
| @@ -333,16 +334,16 @@ Menu::Menu() : · 119 unmodified lines | |||
| 333 | addCheckableActionToQMenuAndActionHash(renderDebugMenu, MenuOption::PipelineWarnings, Qt::CTRL | Qt::SHIFT | Qt::Key_P); | 334 | addCheckableActionToQMenuAndActionHash(renderDebugMenu, MenuOption::PipelineWarnings, Qt::CTRL | Qt::SHIFT | Qt::Key_P); |
| 334 | addCheckableActionToQMenuAndActionHash(renderDebugMenu, MenuOption::SuppressShortTimings, Qt::CTRL | Qt::SHIFT | Qt::Key_S); | 335 | addCheckableActionToQMenuAndActionHash(renderDebugMenu, MenuOption::SuppressShortTimings, Qt::CTRL | Qt::SHIFT | Qt::Key_S); |
| 335 | 336 | ||
| 336 | addCheckableActionToQMenuAndActionHash(renderDebugMenu, | 337 | addCheckableActionToQMenuAndActionHash(renderDebugMenu, |
| 337 | MenuOption::CullSharedFaces, | 338 | MenuOption::CullSharedFaces, |
| 338 | Qt::CTRL | Qt::SHIFT | Qt::Key_C, | 339 | Qt::CTRL | Qt::SHIFT | Qt::Key_C, |
| 339 | false, | 340 | false, |
| 340 | appInstance->getVoxels(), | 341 | appInstance->getVoxels(), |
| 341 | SLOT(cullSharedFaces())); | 342 | SLOT(cullSharedFaces())); |
| 342 | 343 | ||
| 343 | addCheckableActionToQMenuAndActionHash(renderDebugMenu, | 344 | addCheckableActionToQMenuAndActionHash(renderDebugMenu, |
| 344 | MenuOption::ShowCulledSharedFaces, | 345 | MenuOption::ShowCulledSharedFaces, |
| 345 | Qt::CTRL | Qt::SHIFT | Qt::Key_X, | 346 | Qt::CTRL | Qt::SHIFT | Qt::Key_X, |
| 346 | false, | 347 | false, |
| 347 | appInstance->getVoxels(), | 348 | appInstance->getVoxels(), |
| 348 | SLOT(showCulledSharedFaces())); | 349 | SLOT(showCulledSharedFaces())); |
| @@ -360,14 +361,14 @@ Menu::Menu() : · 11 unmodified lines | |||
| 360 | false, | 361 | false, |
| 361 | appInstance->getAudio(), | 362 | appInstance->getAudio(), |
| 362 | SLOT(toggleMute())); | 363 | SLOT(toggleMute())); |
| 363 | 364 | ||
| 364 | addActionToQMenuAndActionHash(developerMenu, MenuOption::PasteToVoxel, | 365 | addActionToQMenuAndActionHash(developerMenu, MenuOption::PasteToVoxel, |
| 365 | Qt::CTRL | Qt::SHIFT | Qt::Key_V, | 366 | Qt::CTRL | Qt::SHIFT | Qt::Key_V, |
| 366 | this, | 367 | this, |
| 367 | SLOT(pasteToVoxel())); | 368 | SLOT(pasteToVoxel())); |
| 368 | 369 | ||
| 369 | connect(appInstance->getAudio(), SIGNAL(muteToggled()), this, SLOT(audioMuteToggled())); | 370 | connect(appInstance->getAudio(), SIGNAL(muteToggled()), this, SLOT(audioMuteToggled())); |
| 370 | 371 | ||
| 371 | #ifndef Q_OS_MAC | 372 | #ifndef Q_OS_MAC |
| 372 | QMenu* helpMenu = addMenu("Help"); | 373 | QMenu* helpMenu = addMenu("Help"); |
| 373 | QAction* helpAction = helpMenu->addAction(MenuOption::AboutApp); | 374 | QAction* helpAction = helpMenu->addAction(MenuOption::AboutApp); |
| @@ -571,7 +572,7 @@ void Menu::addDisabledActionAndSeparator(QMenu* destinationMenu, const QString& · 197 unmodified lines | |||
| 571 | QAction* separatorText = new QAction(actionName,destinationMenu); | 572 | QAction* separatorText = new QAction(actionName,destinationMenu); |
| 572 | separatorText->setEnabled(false); | 573 | separatorText->setEnabled(false); |
| 573 | destinationMenu->insertAction(actionBefore, separatorText); | 574 | destinationMenu->insertAction(actionBefore, separatorText); |
| 574 | 575 | ||
| 575 | } else { | 576 | } else { |
| 576 | destinationMenu->addSeparator(); | 577 | destinationMenu->addSeparator(); |
| 577 | (destinationMenu->addAction(actionName))->setEnabled(false); | 578 | (destinationMenu->addAction(actionName))->setEnabled(false); |
| @@ -623,7 +624,7 @@ QAction* Menu::addCheckableActionToQMenuAndActionHash(QMenu* destinationMenu, · 45 unmodified lines | |||
| 623 | const char* member, | 624 | const char* member, |
| 624 | int menuItemLocation) { | 625 | int menuItemLocation) { |
| 625 | 626 | ||
| 626 | QAction* action = addActionToQMenuAndActionHash(destinationMenu, actionName, shortcut, receiver, member, | 627 | QAction* action = addActionToQMenuAndActionHash(destinationMenu, actionName, shortcut, receiver, member, |
| 627 | QAction::NoRole, menuItemLocation); | 628 | QAction::NoRole, menuItemLocation); |
| 628 | action->setCheckable(true); | 629 | action->setCheckable(true); |
| 629 | action->setChecked(checked); | 630 | action->setChecked(checked); |
| @@ -677,35 +678,35 @@ const float DIALOG_RATIO_OF_WINDOW = 0.30f; · 47 unmodified lines | |||
| 677 | void Menu::loginForCurrentDomain() { | 678 | void Menu::loginForCurrentDomain() { |
| 678 | QDialog loginDialog(Application::getInstance()->getWindow()); | 679 | QDialog loginDialog(Application::getInstance()->getWindow()); |
| 679 | loginDialog.setWindowTitle("Login"); | 680 | loginDialog.setWindowTitle("Login"); |
| 680 | 681 | ||
| 681 | QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom); | 682 | QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom); |
| 682 | loginDialog.setLayout(layout); | 683 | loginDialog.setLayout(layout); |
| 683 | loginDialog.setWindowFlags(Qt::Sheet); | 684 | loginDialog.setWindowFlags(Qt::Sheet); |
| 684 | 685 | ||
| 685 | QFormLayout* form = new QFormLayout(); | 686 | QFormLayout* form = new QFormLayout(); |
| 686 | layout->addLayout(form, 1); | 687 | layout->addLayout(form, 1); |
| 687 | 688 | ||
| 688 | QLineEdit* loginLineEdit = new QLineEdit(); | 689 | QLineEdit* loginLineEdit = new QLineEdit(); |
| 689 | loginLineEdit->setMinimumWidth(QLINE_MINIMUM_WIDTH); | 690 | loginLineEdit->setMinimumWidth(QLINE_MINIMUM_WIDTH); |
| 690 | form->addRow("Login:", loginLineEdit); | 691 | form->addRow("Login:", loginLineEdit); |
| 691 | 692 | ||
| 692 | QLineEdit* passwordLineEdit = new QLineEdit(); | 693 | QLineEdit* passwordLineEdit = new QLineEdit(); |
| 693 | passwordLineEdit->setMinimumWidth(QLINE_MINIMUM_WIDTH); | 694 | passwordLineEdit->setMinimumWidth(QLINE_MINIMUM_WIDTH); |
| 694 | passwordLineEdit->setEchoMode(QLineEdit::Password); | 695 | passwordLineEdit->setEchoMode(QLineEdit::Password); |
| 695 | form->addRow("Password:", passwordLineEdit); | 696 | form->addRow("Password:", passwordLineEdit); |
| 696 | 697 | ||
| 697 | QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); | 698 | QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); |
| 698 | loginDialog.connect(buttons, SIGNAL(accepted()), SLOT(accept())); | 699 | loginDialog.connect(buttons, SIGNAL(accepted()), SLOT(accept())); |
| 699 | loginDialog.connect(buttons, SIGNAL(rejected()), SLOT(reject())); | 700 | loginDialog.connect(buttons, SIGNAL(rejected()), SLOT(reject())); |
| 700 | layout->addWidget(buttons); | 701 | layout->addWidget(buttons); |
| 701 | 702 | ||
| 702 | int dialogReturn = loginDialog.exec(); | 703 | int dialogReturn = loginDialog.exec(); |
| 703 | 704 | ||
| 704 | if (dialogReturn == QDialog::Accepted && !loginLineEdit->text().isEmpty() && !passwordLineEdit->text().isEmpty()) { | 705 | if (dialogReturn == QDialog::Accepted && !loginLineEdit->text().isEmpty() && !passwordLineEdit->text().isEmpty()) { |
| 705 | // attempt to get an access token given this username and password | 706 | // attempt to get an access token given this username and password |
| 706 | AccountManager::getInstance().requestAccessToken(loginLineEdit->text(), passwordLineEdit->text()); | 707 | AccountManager::getInstance().requestAccessToken(loginLineEdit->text(), passwordLineEdit->text()); |
| 707 | } | 708 | } |
| 708 | 709 | ||
| 709 | sendFakeEnterEvent(); | 710 | sendFakeEnterEvent(); |
| 710 | } | 711 | } |
| 711 | 712 | ||
| @@ -713,19 +714,19 @@ void Menu::editPreferences() { · 1 unmodified line | |||
| 713 | Application* applicationInstance = Application::getInstance(); | 714 | Application* applicationInstance = Application::getInstance(); |
| 714 | ModelBrowser headBrowser(Head); | 715 | ModelBrowser headBrowser(Head); |
| 715 | ModelBrowser skeletonBrowser(Skeleton); | 716 | ModelBrowser skeletonBrowser(Skeleton); |
| 716 | 717 | ||
| 717 | const QString BROWSE_BUTTON_TEXT = "Browse"; | 718 | const QString BROWSE_BUTTON_TEXT = "Browse"; |
| 718 | 719 | ||
| 719 | QDialog dialog(applicationInstance->getWindow()); | 720 | QDialog dialog(applicationInstance->getWindow()); |
| 720 | dialog.setWindowTitle("Interface Preferences"); | 721 | dialog.setWindowTitle("Interface Preferences"); |
| 721 | 722 | ||
| 722 | QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom); | 723 | QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom); |
| 723 | dialog.setLayout(layout); | 724 | dialog.setLayout(layout); |
| 724 | 725 | ||
| 725 | QFormLayout* form = new QFormLayout(); | 726 | QFormLayout* form = new QFormLayout(); |
| 726 | layout->addLayout(form, 1); | 727 | layout->addLayout(form, 1); |
| 727 | 728 | ||
| 728 | 729 | ||
| 729 | QHBoxLayout headModelLayout; | 730 | QHBoxLayout headModelLayout; |
| 730 | QString faceURLString = applicationInstance->getAvatar()->getHead()->getFaceModel().getURL().toString(); | 731 | QString faceURLString = applicationInstance->getAvatar()->getHead()->getFaceModel().getURL().toString(); |
| 731 | QLineEdit headURLEdit(faceURLString); | 732 | QLineEdit headURLEdit(faceURLString); |
| @@ -737,7 +738,7 @@ void Menu::editPreferences() { · 5 unmodified lines | |||
| 737 | headModelLayout.addWidget(&headURLEdit); | 738 | headModelLayout.addWidget(&headURLEdit); |
| 738 | headModelLayout.addWidget(&headBrowseButton); | 739 | headModelLayout.addWidget(&headBrowseButton); |
| 739 | form->addRow("Head URL:", &headModelLayout); | 740 | form->addRow("Head URL:", &headModelLayout); |
| 740 | 741 | ||
| 741 | QHBoxLayout skeletonModelLayout; | 742 | QHBoxLayout skeletonModelLayout; |
| 742 | QString skeletonURLString = applicationInstance->getAvatar()->getSkeletonModel().getURL().toString(); | 743 | QString skeletonURLString = applicationInstance->getAvatar()->getSkeletonModel().getURL().toString(); |
| 743 | QLineEdit skeletonURLEdit(skeletonURLString); | 744 | QLineEdit skeletonURLEdit(skeletonURLString); |
| @@ -749,7 +750,7 @@ void Menu::editPreferences() { · 5 unmodified lines | |||
| 749 | skeletonModelLayout.addWidget(&skeletonURLEdit); | 750 | skeletonModelLayout.addWidget(&skeletonURLEdit); |
| 750 | skeletonModelLayout.addWidget(&SkeletonBrowseButton); | 751 | skeletonModelLayout.addWidget(&SkeletonBrowseButton); |
| 751 | form->addRow("Skeleton URL:", &skeletonModelLayout); | 752 | form->addRow("Skeleton URL:", &skeletonModelLayout); |
| 752 | 753 | ||
| 753 | 754 | ||
| 754 | QString displayNameString = applicationInstance->getAvatar()->getDisplayName(); | 755 | QString displayNameString = applicationInstance->getAvatar()->getDisplayName(); |
| 755 | QLineEdit* displayNameEdit = new QLineEdit(displayNameString); | 756 | QLineEdit* displayNameEdit = new QLineEdit(displayNameString); |
| @@ -826,12 +827,12 @@ void Menu::editPreferences() { · 70 unmodified lines | |||
| 826 | } | 827 | } |
| 827 | 828 | ||
| 828 | QString displayNameStr(displayNameEdit->text()); | 829 | QString displayNameStr(displayNameEdit->text()); |
| 829 | 830 | ||
| 830 | if (displayNameStr != displayNameString) { | 831 | if (displayNameStr != displayNameString) { |
| 831 | applicationInstance->getAvatar()->setDisplayName(displayNameStr); | 832 | applicationInstance->getAvatar()->setDisplayName(displayNameStr); |
| 832 | shouldDispatchIdentityPacket = true; | 833 | shouldDispatchIdentityPacket = true; |
| 833 | } | 834 | } |
| 834 | 835 | ||
| 835 | if (shouldDispatchIdentityPacket) { | 836 | if (shouldDispatchIdentityPacket) { |
| 836 | applicationInstance->getAvatar()->sendIdentityPacket(); | 837 | applicationInstance->getAvatar()->sendIdentityPacket(); |
| 837 | } | 838 | } |
| @@ -864,10 +865,10 @@ void Menu::editPreferences() { · 26 unmodified lines | |||
| 864 | 865 | ||
| 865 | void Menu::goToDomain(const QString newDomain) { | 866 | void Menu::goToDomain(const QString newDomain) { |
| 866 | if (NodeList::getInstance()->getDomainInfo().getHostname() != newDomain) { | 867 | if (NodeList::getInstance()->getDomainInfo().getHostname() != newDomain) { |
| 867 | 868 | ||
| 868 | // send a node kill request, indicating to other clients that they should play the "disappeared" effect | 869 | // send a node kill request, indicating to other clients that they should play the "disappeared" effect |
| 869 | Application::getInstance()->getAvatar()->sendKillAvatar(); | 870 | Application::getInstance()->getAvatar()->sendKillAvatar(); |
| 870 | 871 | ||
| 871 | // give our nodeList the new domain-server hostname | 872 | // give our nodeList the new domain-server hostname |
| 872 | NodeList::getInstance()->getDomainInfo().setHostname(newDomain); | 873 | NodeList::getInstance()->getDomainInfo().setHostname(newDomain); |
| 873 | } | 874 | } |
| @@ -897,7 +898,7 @@ void Menu::goToDomainDialog() { · 23 unmodified lines | |||
| 897 | // the user input a new hostname, use that | 898 | // the user input a new hostname, use that |
| 898 | newHostname = domainDialog.textValue(); | 899 | newHostname = domainDialog.textValue(); |
| 899 | } | 900 | } |
| 900 | 901 | ||
| 901 | goToDomain(newHostname); | 902 | goToDomain(newHostname); |
| 902 | } | 903 | } |
| 903 | 904 | ||
| @@ -913,7 +914,7 @@ bool Menu::goToDestination(QString destination) { · 9 unmodified lines | |||
| 913 | } | 914 | } |
| 914 | 915 | ||
| 915 | void Menu::goTo() { | 916 | void Menu::goTo() { |
| 916 | 917 | ||
| 917 | QInputDialog gotoDialog(Application::getInstance()->getWindow()); | 918 | QInputDialog gotoDialog(Application::getInstance()->getWindow()); |
| 918 | gotoDialog.setWindowTitle("Go to"); | 919 | gotoDialog.setWindowTitle("Go to"); |
| 919 | gotoDialog.setLabelText("Destination:"); | 920 | gotoDialog.setLabelText("Destination:"); |
| @@ -921,7 +922,7 @@ void Menu::goTo() { · 1 unmodified line | |||
| 921 | gotoDialog.setTextValue(destination); | 922 | gotoDialog.setTextValue(destination); |
| 922 | gotoDialog.setWindowFlags(Qt::Sheet); | 923 | gotoDialog.setWindowFlags(Qt::Sheet); |
| 923 | gotoDialog.resize(gotoDialog.parentWidget()->size().width() * DIALOG_RATIO_OF_WINDOW, gotoDialog.size().height()); | 924 | gotoDialog.resize(gotoDialog.parentWidget()->size().width() * DIALOG_RATIO_OF_WINDOW, gotoDialog.size().height()); |
| 924 | 925 | ||
| 925 | int dialogReturn = gotoDialog.exec(); | 926 | int dialogReturn = gotoDialog.exec(); |
| 926 | if (dialogReturn == QDialog::Accepted && !gotoDialog.textValue().isEmpty()) { | 927 | if (dialogReturn == QDialog::Accepted && !gotoDialog.textValue().isEmpty()) { |
| 927 | goToUser(gotoDialog.textValue()); | 928 | goToUser(gotoDialog.textValue()); |
| @@ -1070,7 +1071,7 @@ void Menu::toggleLoginMenuItem() { · 142 unmodified lines | |||
| 1070 | AccountManager& accountManager = AccountManager::getInstance(); | 1071 | AccountManager& accountManager = AccountManager::getInstance(); |
| 1071 | 1072 | ||
| 1072 | disconnect(_loginAction, 0, 0, 0); | 1073 | disconnect(_loginAction, 0, 0, 0); |
| 1073 | 1074 | ||
| 1074 | if (accountManager.isLoggedIn()) { | 1075 | if (accountManager.isLoggedIn()) { |
| 1075 | // change the menu item to logout | 1076 | // change the menu item to logout |
| 1076 | _loginAction->setText("Logout " + accountManager.getUsername()); | 1077 | _loginAction->setText("Logout " + accountManager.getUsername()); |
| @@ -1078,7 +1079,7 @@ void Menu::toggleLoginMenuItem() { · 1 unmodified line | |||
| 1078 | } else { | 1079 | } else { |
| 1079 | // change the menu item to login | 1080 | // change the menu item to login |
| 1080 | _loginAction->setText("Login"); | 1081 | _loginAction->setText("Login"); |
| 1081 | 1082 | ||
| 1082 | connect(_loginAction, &QAction::triggered, this, &Menu::loginForCurrentDomain); | 1083 | connect(_loginAction, &QAction::triggered, this, &Menu::loginForCurrentDomain); |
| 1083 | } | 1084 | } |
| 1084 | } | 1085 | } |
| @@ -1185,7 +1186,7 @@ QString Menu::getLODFeedbackText() { · 100 unmodified lines | |||
| 1185 | } break; | 1186 | } break; |
| 1186 | } | 1187 | } |
| 1187 | 1188 | ||
| 1188 | // distance feedback | 1189 | // distance feedback |
| 1189 | float voxelSizeScale = getVoxelSizeScale(); | 1190 | float voxelSizeScale = getVoxelSizeScale(); |
| 1190 | float relativeToDefault = voxelSizeScale / DEFAULT_OCTREE_SIZE_SCALE; | 1191 | float relativeToDefault = voxelSizeScale / DEFAULT_OCTREE_SIZE_SCALE; |
| 1191 | QString result; | 1192 | QString result; |
| @@ -1200,7 +1201,7 @@ QString Menu::getLODFeedbackText() { · 8 unmodified lines | |||
| 1200 | } | 1201 | } |
| 1201 | 1202 | ||
| 1202 | void Menu::autoAdjustLOD(float currentFPS) { | 1203 | void Menu::autoAdjustLOD(float currentFPS) { |
| 1203 | // NOTE: our first ~100 samples at app startup are completely all over the place, and we don't | 1204 | // NOTE: our first ~100 samples at app startup are completely all over the place, and we don't |
| 1204 | // really want to count them in our average, so we will ignore the real frame rates and stuff | 1205 | // really want to count them in our average, so we will ignore the real frame rates and stuff |
| 1205 | // our moving average with simulated good data | 1206 | // our moving average with simulated good data |
| 1206 | const int IGNORE_THESE_SAMPLES = 100; | 1207 | const int IGNORE_THESE_SAMPLES = 100; |
| @@ -1212,7 +1213,7 @@ void Menu::autoAdjustLOD(float currentFPS) { · 5 unmodified lines | |||
| 1212 | _fastFPSAverage.updateAverage(currentFPS); | 1213 | _fastFPSAverage.updateAverage(currentFPS); |
| 1213 | 1214 | ||
| 1214 | quint64 now = usecTimestampNow(); | 1215 | quint64 now = usecTimestampNow(); |
| 1215 | 1216 | ||
| 1216 | const quint64 ADJUST_AVATAR_LOD_DOWN_DELAY = 1000 * 1000; | 1217 | const quint64 ADJUST_AVATAR_LOD_DOWN_DELAY = 1000 * 1000; |
| 1217 | if (_fastFPSAverage.getAverage() < ADJUST_LOD_DOWN_FPS) { | 1218 | if (_fastFPSAverage.getAverage() < ADJUST_LOD_DOWN_FPS) { |
| 1218 | if (now - _lastAvatarDetailDrop > ADJUST_AVATAR_LOD_DOWN_DELAY) { | 1219 | if (now - _lastAvatarDetailDrop > ADJUST_AVATAR_LOD_DOWN_DELAY) { |
| @@ -1231,11 +1232,11 @@ void Menu::autoAdjustLOD(float currentFPS) { · 12 unmodified lines | |||
| 1231 | _avatarLODDistanceMultiplier = qMax(MINIMUM_DISTANCE_MULTIPLIER, | 1232 | _avatarLODDistanceMultiplier = qMax(MINIMUM_DISTANCE_MULTIPLIER, |
| 1232 | _avatarLODDistanceMultiplier - DISTANCE_DECREASE_RATE); | 1233 | _avatarLODDistanceMultiplier - DISTANCE_DECREASE_RATE); |
| 1233 | } | 1234 | } |
| 1234 | 1235 | ||
| 1235 | bool changed = false; | 1236 | bool changed = false; |
| 1236 | quint64 elapsed = now - _lastAdjust; | 1237 | quint64 elapsed = now - _lastAdjust; |
| 1237 | 1238 | ||
| 1238 | if (elapsed > ADJUST_LOD_DOWN_DELAY && _fpsAverage.getAverage() < ADJUST_LOD_DOWN_FPS | 1239 | if (elapsed > ADJUST_LOD_DOWN_DELAY && _fpsAverage.getAverage() < ADJUST_LOD_DOWN_FPS |
| 1239 | && _voxelSizeScale > ADJUST_LOD_MIN_SIZE_SCALE) { | 1240 | && _voxelSizeScale > ADJUST_LOD_MIN_SIZE_SCALE) { |
| 1240 | 1241 | ||
| 1241 | _voxelSizeScale *= ADJUST_LOD_DOWN_BY; | 1242 | _voxelSizeScale *= ADJUST_LOD_DOWN_BY; |
| @@ -1248,7 +1249,7 @@ void Menu::autoAdjustLOD(float currentFPS) { · 6 unmodified lines | |||
| 1248 | << "_voxelSizeScale=" << _voxelSizeScale; | 1249 | << "_voxelSizeScale=" << _voxelSizeScale; |
| 1249 | } | 1250 | } |
| 1250 | 1251 | ||
| 1251 | if (elapsed > ADJUST_LOD_UP_DELAY && _fpsAverage.getAverage() > ADJUST_LOD_UP_FPS | 1252 | if (elapsed > ADJUST_LOD_UP_DELAY && _fpsAverage.getAverage() > ADJUST_LOD_UP_FPS |
| 1252 | && _voxelSizeScale < ADJUST_LOD_MAX_SIZE_SCALE) { | 1253 | && _voxelSizeScale < ADJUST_LOD_MAX_SIZE_SCALE) { |
| 1253 | _voxelSizeScale *= ADJUST_LOD_UP_BY; | 1254 | _voxelSizeScale *= ADJUST_LOD_UP_BY; |
| 1254 | if (_voxelSizeScale > ADJUST_LOD_MAX_SIZE_SCALE) { | 1255 | if (_voxelSizeScale > ADJUST_LOD_MAX_SIZE_SCALE) { |
| @@ -1259,7 +1260,7 @@ void Menu::autoAdjustLOD(float currentFPS) { · 4 unmodified lines | |||
| 1259 | qDebug() << "adjusting LOD up... average fps for last approximately 5 seconds=" << _fpsAverage.getAverage() | 1260 | qDebug() << "adjusting LOD up... average fps for last approximately 5 seconds=" << _fpsAverage.getAverage() |
| 1260 | << "_voxelSizeScale=" << _voxelSizeScale; | 1261 | << "_voxelSizeScale=" << _voxelSizeScale; |
| 1261 | } | 1262 | } |
| 1262 | 1263 | ||
| 1263 | if (changed) { | 1264 | if (changed) { |
| 1264 | if (_lodToolsDialog) { | 1265 | if (_lodToolsDialog) { |
| 1265 | _lodToolsDialog->reloadSliders(); | 1266 | _lodToolsDialog->reloadSliders(); |
| @@ -1337,13 +1338,13 @@ void Menu::addAvatarCollisionSubMenu(QMenu* overMenu) { · 71 unmodified lines | |||
| 1337 | 1338 | ||
| 1338 | Application* appInstance = Application::getInstance(); | 1339 | Application* appInstance = Application::getInstance(); |
| 1339 | QObject* avatar = appInstance->getAvatar(); | 1340 | QObject* avatar = appInstance->getAvatar(); |
| 1340 | addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithEnvironment, | 1341 | addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithEnvironment, |
| 1341 | 0, false, avatar, SLOT(updateCollisionFlags())); | 1342 | 0, false, avatar, SLOT(updateCollisionFlags())); |
| 1342 | addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithAvatars, | 1343 | addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithAvatars, |
| 1343 | 0, true, avatar, SLOT(updateCollisionFlags())); | 1344 | 0, true, avatar, SLOT(updateCollisionFlags())); |
| 1344 | addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithVoxels, | 1345 | addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithVoxels, |
| 1345 | 0, false, avatar, SLOT(updateCollisionFlags())); | 1346 | 0, false, avatar, SLOT(updateCollisionFlags())); |
| 1346 | addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithParticles, | 1347 | addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithParticles, |
| 1347 | 0, true, avatar, SLOT(updateCollisionFlags())); | 1348 | 0, true, avatar, SLOT(updateCollisionFlags())); |
| 1348 | } | 1349 | } |
| 1349 | 1350 | ||
| @@ -1352,9 +1353,9 @@ QAction* Menu::getActionFromName(const QString& menuName, QMenu* menu) { · 2 unmodified lines | |||
| 1352 | if (menu) { | 1353 | if (menu) { |
| 1353 | menuActions = menu->actions(); | 1354 | menuActions = menu->actions(); |
| 1354 | } else { | 1355 | } else { |
| 1355 | menuActions = actions(); | 1356 | menuActions = actions(); |
| 1356 | } | 1357 | } |
| 1357 | 1358 | ||
| 1358 | foreach (QAction* menuAction, menuActions) { | 1359 | foreach (QAction* menuAction, menuActions) { |
| 1359 | if (menuName == menuAction->text()) { | 1360 | if (menuName == menuAction->text()) { |
| 1360 | return menuAction; | 1361 | return menuAction; |
| @@ -1461,7 +1462,7 @@ QMenu* Menu::addMenu(const QString& menuName) { · 100 unmodified lines | |||
| 1461 | 1462 | ||
| 1462 | void Menu::removeMenu(const QString& menuName) { | 1463 | void Menu::removeMenu(const QString& menuName) { |
| 1463 | QAction* action = getMenuAction(menuName); | 1464 | QAction* action = getMenuAction(menuName); |
| 1464 | 1465 | ||
| 1465 | // only proceed if the menu actually exists | 1466 | // only proceed if the menu actually exists |
| 1466 | if (action) { | 1467 | if (action) { |
| 1467 | QString finalMenuPart; | 1468 | QString finalMenuPart; |
| @@ -1513,7 +1514,7 @@ void Menu::addMenuItem(const MenuItemProperties& properties) { · 45 unmodified lines | |||
| 1513 | if (!properties.shortcutKeySequence.isEmpty()) { | 1514 | if (!properties.shortcutKeySequence.isEmpty()) { |
| 1514 | shortcut = new QShortcut(properties.shortcutKeySequence, this); | 1515 | shortcut = new QShortcut(properties.shortcutKeySequence, this); |
| 1515 | } | 1516 | } |
| 1516 | 1517 | ||
| 1517 | // check for positioning requests | 1518 | // check for positioning requests |
| 1518 | int requestedPosition = properties.position; | 1519 | int requestedPosition = properties.position; |
| 1519 | if (requestedPosition == UNSPECIFIED_POSITION && !properties.beforeItem.isEmpty()) { | 1520 | if (requestedPosition == UNSPECIFIED_POSITION && !properties.beforeItem.isEmpty()) { |
| @@ -1527,13 +1528,13 @@ void Menu::addMenuItem(const MenuItemProperties& properties) { · 7 unmodified lines | |||
| 1527 | requestedPosition = afterPosition + 1; | 1528 | requestedPosition = afterPosition + 1; |
| 1528 | } | 1529 | } |
| 1529 | } | 1530 | } |
| 1530 | 1531 | ||
| 1531 | QAction* menuItemAction = NULL; | 1532 | QAction* menuItemAction = NULL; |
| 1532 | if (properties.isSeparator) { | 1533 | if (properties.isSeparator) { |
| 1533 | addDisabledActionAndSeparator(menuObj, properties.menuItemName, requestedPosition); | 1534 | addDisabledActionAndSeparator(menuObj, properties.menuItemName, requestedPosition); |
| 1534 | } else if (properties.isCheckable) { | 1535 | } else if (properties.isCheckable) { |
| 1535 | menuItemAction = addCheckableActionToQMenuAndActionHash(menuObj, properties.menuItemName, | 1536 | menuItemAction = addCheckableActionToQMenuAndActionHash(menuObj, properties.menuItemName, |
| 1536 | properties.shortcutKeySequence, properties.isChecked, | 1537 | properties.shortcutKeySequence, properties.isChecked, |
| 1537 | MenuScriptingInterface::getInstance(), SLOT(menuItemTriggered()), requestedPosition); | 1538 | MenuScriptingInterface::getInstance(), SLOT(menuItemTriggered()), requestedPosition); |
| 1538 | } else { | 1539 | } else { |
| 1539 | menuItemAction = addActionToQMenuAndActionHash(menuObj, properties.menuItemName, properties.shortcutKeySequence, | 1540 | menuItemAction = addActionToQMenuAndActionHash(menuObj, properties.menuItemName, properties.shortcutKeySequence, |