Showing the changes to interface/src/Menu.cpp (1 of 152 files). Show all
Unified · Split
| @@ -86,7 +86,8 @@ Menu::Menu() : · 85 unmodified lines | ||
| 86 | 86 | _lastAvatarDetailDrop(usecTimestampNow()), |
| 87 | 87 | _fpsAverage(FIVE_SECONDS_OF_FRAMES), |
| 88 | 88 | _fastFPSAverage(ONE_SECOND_OF_FRAMES), |
| 89 | − _loginAction(NULL) | |
| 89 | + _loginAction(NULL), | |
| 90 | + _preferencesDialog(NULL) | |
| 90 | 91 | { |
| 91 | 92 | Application *appInstance = Application::getInstance(); |
| 92 | 93 | |
| @@ -252,7 +253,6 @@ Menu::Menu() : · 159 unmodified lines | ||
| 252 | 253 | addDisabledActionAndSeparator(viewMenu, "Stats"); |
| 253 | 254 | addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Stats, Qt::Key_Slash); |
| 254 | 255 | addActionToQMenuAndActionHash(viewMenu, MenuOption::Log, Qt::CTRL | Qt::Key_L, appInstance, SLOT(toggleLogDialog())); |
| 255 | − addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Oscilloscope, 0, false); | |
| 256 | 256 | addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Bandwidth, 0, true); |
| 257 | 257 | addActionToQMenuAndActionHash(viewMenu, MenuOption::BandwidthDetails, 0, this, SLOT(bandwidthDetails())); |
| 258 | 258 | addActionToQMenuAndActionHash(viewMenu, MenuOption::OctreeStats, 0, this, SLOT(octreeStatsDetails())); |
| @@ -304,6 +304,11 @@ Menu::Menu() : · 45 unmodified lines | ||
| 304 | 304 | true, |
| 305 | 305 | appInstance->getFaceshift(), |
| 306 | 306 | SLOT(setTCPEnabled(bool))); |
| 307 | +#ifdef HAVE_FACEPLUS | |
| 308 | + addCheckableActionToQMenuAndActionHash(avatarOptionsMenu, MenuOption::Faceplus, 0, true, | |
| 309 | + appInstance->getFaceplus(), SLOT(updateEnabled())); | |
| 310 | +#endif | |
| 311 | + | |
| 307 | 312 | #ifdef HAVE_VISAGE |
| 308 | 313 | addCheckableActionToQMenuAndActionHash(avatarOptionsMenu, MenuOption::Visage, 0, true, |
| 309 | 314 | appInstance->getVisage(), SLOT(updateEnabled())); |
| @@ -679,6 +684,7 @@ QAction* Menu::addCheckableActionToQMenuAndActionHash(QMenu* destinationMenu, · 369 unmodified lines | ||
| 679 | 684 | QAction::NoRole, menuItemLocation); |
| 680 | 685 | action->setCheckable(true); |
| 681 | 686 | action->setChecked(checked); |
| 687 | + connect(action, SIGNAL(changed()), Application::getInstance(), SLOT(bumpSettings())); | |
| 682 | 688 | |
| 683 | 689 | return action; |
| 684 | 690 | } |
| @@ -703,7 +709,12 @@ bool Menu::isOptionChecked(const QString& menuOption) { · 18 unmodified lines | ||
| 703 | 709 | } |
| 704 | 710 | |
| 705 | 711 | void Menu::triggerOption(const QString& menuOption) { |
| 706 | − _actionHash.value(menuOption)->trigger(); | |
| 712 | + QAction* action = _actionHash.value(menuOption); | |
| 713 | + if (action) { | |
| 714 | + action->trigger(); | |
| 715 | + } else { | |
| 716 | + qDebug() << "NULL Action for menuOption '" << menuOption << "'"; | |
| 717 | + } | |
| 707 | 718 | } |
| 708 | 719 | |
| 709 | 720 | QAction* Menu::getActionForOption(const QString& menuOption) { |
| @@ -762,184 +773,31 @@ void Menu::loginForCurrentDomain() { · 52 unmodified lines | ||
| 762 | 773 | } |
| 763 | 774 | |
| 764 | 775 | void Menu::editPreferences() { |
| 765 | − Application* applicationInstance = Application::getInstance(); | |
| 766 | − ModelsBrowser headBrowser(Head); | |
| 767 | − ModelsBrowser skeletonBrowser(Skeleton); | |
| 768 | − | |
| 769 | − const QString BROWSE_BUTTON_TEXT = "Browse"; | |
| 770 | − | |
| 771 | − QDialog dialog(applicationInstance->getWindow()); | |
| 772 | − dialog.setWindowTitle("Interface Preferences"); | |
| 773 | − | |
| 774 | − QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom); | |
| 775 | − dialog.setLayout(layout); | |
| 776 | − | |
| 777 | − QFormLayout* form = new QFormLayout(); | |
| 778 | − layout->addLayout(form, 1); | |
| 779 | − | |
| 780 | − | |
| 781 | − QHBoxLayout headModelLayout; | |
| 782 | − QString faceURLString = applicationInstance->getAvatar()->getHead()->getFaceModel().getURL().toString(); | |
| 783 | − QLineEdit headURLEdit(faceURLString); | |
| 784 | − QPushButton headBrowseButton(BROWSE_BUTTON_TEXT); | |
| 785 | − connect(&headBrowseButton, SIGNAL(clicked()), &headBrowser, SLOT(browse())); | |
| 786 | − connect(&headBrowser, SIGNAL(selected(QString)), &headURLEdit, SLOT(setText(QString))); | |
| 787 | − headURLEdit.setMinimumWidth(QLINE_MINIMUM_WIDTH); | |
| 788 | − headURLEdit.setPlaceholderText(DEFAULT_HEAD_MODEL_URL.toString()); | |
| 789 | − headModelLayout.addWidget(&headURLEdit); | |
| 790 | − headModelLayout.addWidget(&headBrowseButton); | |
| 791 | − form->addRow("Head URL:", &headModelLayout); | |
| 792 | − | |
| 793 | − QHBoxLayout skeletonModelLayout; | |
| 794 | − QString skeletonURLString = applicationInstance->getAvatar()->getSkeletonModel().getURL().toString(); | |
| 795 | − QLineEdit skeletonURLEdit(skeletonURLString); | |
| 796 | − QPushButton SkeletonBrowseButton(BROWSE_BUTTON_TEXT); | |
| 797 | − connect(&SkeletonBrowseButton, SIGNAL(clicked()), &skeletonBrowser, SLOT(browse())); | |
| 798 | − connect(&skeletonBrowser, SIGNAL(selected(QString)), &skeletonURLEdit, SLOT(setText(QString))); | |
| 799 | − skeletonURLEdit.setMinimumWidth(QLINE_MINIMUM_WIDTH); | |
| 800 | − skeletonURLEdit.setPlaceholderText(DEFAULT_BODY_MODEL_URL.toString()); | |
| 801 | − skeletonModelLayout.addWidget(&skeletonURLEdit); | |
| 802 | − skeletonModelLayout.addWidget(&SkeletonBrowseButton); | |
| 803 | − form->addRow("Skeleton URL:", &skeletonModelLayout); | |
| 804 | − | |
| 805 | − | |
| 806 | − QString displayNameString = applicationInstance->getAvatar()->getDisplayName(); | |
| 807 | − QLineEdit* displayNameEdit = new QLineEdit(displayNameString); | |
| 808 | − displayNameEdit->setMinimumWidth(QLINE_MINIMUM_WIDTH); | |
| 809 | − form->addRow("Display name:", displayNameEdit); | |
| 810 | − | |
| 811 | − QSlider* pupilDilation = new QSlider(Qt::Horizontal); | |
| 812 | − pupilDilation->setValue(applicationInstance->getAvatar()->getHead()->getPupilDilation() * pupilDilation->maximum()); | |
| 813 | − form->addRow("Pupil Dilation:", pupilDilation); | |
| 814 | − | |
| 815 | − QSlider* faceshiftEyeDeflection = new QSlider(Qt::Horizontal); | |
| 816 | − faceshiftEyeDeflection->setValue(_faceshiftEyeDeflection * faceshiftEyeDeflection->maximum()); | |
| 817 | − form->addRow("Faceshift Eye Deflection:", faceshiftEyeDeflection); | |
| 818 | − | |
| 819 | − QSpinBox* fieldOfView = new QSpinBox(); | |
| 820 | − fieldOfView->setMaximum(180.f); | |
| 821 | − fieldOfView->setMinimum(1.f); | |
| 822 | − fieldOfView->setValue(_fieldOfView); | |
| 823 | − form->addRow("Vertical Field of View (Degrees):", fieldOfView); | |
| 824 | − | |
| 825 | − QDoubleSpinBox* leanScale = new QDoubleSpinBox(); | |
| 826 | − leanScale->setValue(applicationInstance->getAvatar()->getLeanScale()); | |
| 827 | − form->addRow("Lean Scale:", leanScale); | |
| 828 | − | |
| 829 | − QDoubleSpinBox* avatarScale = new QDoubleSpinBox(); | |
| 830 | − avatarScale->setValue(applicationInstance->getAvatar()->getScale()); | |
| 831 | − form->addRow("Avatar Scale:", avatarScale); | |
| 832 | − | |
| 833 | − QSpinBox* audioJitterBufferSamples = new QSpinBox(); | |
| 834 | − audioJitterBufferSamples->setMaximum(10000); | |
| 835 | − audioJitterBufferSamples->setMinimum(-10000); | |
| 836 | − audioJitterBufferSamples->setValue(_audioJitterBufferSamples); | |
| 837 | − form->addRow("Audio Jitter Buffer Samples (0 for automatic):", audioJitterBufferSamples); | |
| 838 | − | |
| 839 | − QSpinBox* maxVoxels = new QSpinBox(); | |
| 840 | − const int MAX_MAX_VOXELS = 5000000; | |
| 841 | − const int MIN_MAX_VOXELS = 0; | |
| 842 | − const int STEP_MAX_VOXELS = 50000; | |
| 843 | − maxVoxels->setMaximum(MAX_MAX_VOXELS); | |
| 844 | − maxVoxels->setMinimum(MIN_MAX_VOXELS); | |
| 845 | − maxVoxels->setSingleStep(STEP_MAX_VOXELS); | |
| 846 | − maxVoxels->setValue(_maxVoxels); | |
| 847 | − form->addRow("Maximum Voxels:", maxVoxels); | |
| 848 | − | |
| 849 | − QSpinBox* maxVoxelsPPS = new QSpinBox(); | |
| 850 | − const int MAX_MAX_VOXELS_PPS = 6000; | |
| 851 | − const int MIN_MAX_VOXELS_PPS = 60; | |
| 852 | − const int STEP_MAX_VOXELS_PPS = 10; | |
| 853 | − maxVoxelsPPS->setMaximum(MAX_MAX_VOXELS_PPS); | |
| 854 | − maxVoxelsPPS->setMinimum(MIN_MAX_VOXELS_PPS); | |
| 855 | − maxVoxelsPPS->setSingleStep(STEP_MAX_VOXELS_PPS); | |
| 856 | − maxVoxelsPPS->setValue(_maxVoxelPacketsPerSecond); | |
| 857 | − form->addRow("Maximum Voxels Packets Per Second:", maxVoxelsPPS); | |
| 858 | − | |
| 859 | − QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); | |
| 860 | − dialog.connect(buttons, SIGNAL(accepted()), SLOT(accept())); | |
| 861 | − dialog.connect(buttons, SIGNAL(rejected()), SLOT(reject())); | |
| 862 | − layout->addWidget(buttons); | |
| 863 | − | |
| 864 | − int ret = dialog.exec(); | |
| 865 | − if (ret == QDialog::Accepted) { | |
| 866 | − bool shouldDispatchIdentityPacket = false; | |
| 867 | − | |
| 868 | − if (headURLEdit.text() != faceURLString) { | |
| 869 | − // change the faceModelURL in the profile, it will also update this user's BlendFace | |
| 870 | − if (headURLEdit.text().isEmpty()) { | |
| 871 | − applicationInstance->getAvatar()->setFaceModelURL(QUrl(headURLEdit.placeholderText())); | |
| 872 | − } else { | |
| 873 | − applicationInstance->getAvatar()->setFaceModelURL(QUrl(headURLEdit.text())); | |
| 874 | − } | |
| 875 | − shouldDispatchIdentityPacket = true; | |
| 876 | − } | |
| 877 | − | |
| 878 | − if (skeletonURLEdit.text() != skeletonURLString) { | |
| 879 | − // change the skeletonModelURL in the profile, it will also update this user's Body | |
| 880 | − if (skeletonURLEdit.text().isEmpty()) { | |
| 881 | − applicationInstance->getAvatar()->setSkeletonModelURL(QUrl(skeletonURLEdit.placeholderText())); | |
| 882 | − } else { | |
| 883 | − applicationInstance->getAvatar()->setSkeletonModelURL(QUrl(skeletonURLEdit.text())); | |
| 884 | − } | |
| 885 | − shouldDispatchIdentityPacket = true; | |
| 886 | − } | |
| 887 | − | |
| 888 | − QString displayNameStr(displayNameEdit->text()); | |
| 889 | − | |
| 890 | − if (displayNameStr != displayNameString) { | |
| 891 | − applicationInstance->getAvatar()->setDisplayName(displayNameStr); | |
| 892 | − shouldDispatchIdentityPacket = true; | |
| 893 | − } | |
| 894 | − | |
| 895 | − if (shouldDispatchIdentityPacket) { | |
| 896 | − applicationInstance->getAvatar()->sendIdentityPacket(); | |
| 897 | − } | |
| 898 | − | |
| 899 | − applicationInstance->getAvatar()->getHead()->setPupilDilation(pupilDilation->value() / (float)pupilDilation->maximum()); | |
| 900 | − | |
| 901 | − _maxVoxels = maxVoxels->value(); | |
| 902 | − applicationInstance->getVoxels()->setMaxVoxels(_maxVoxels); | |
| 903 | − | |
| 904 | − _maxVoxelPacketsPerSecond = maxVoxelsPPS->value(); | |
| 905 | − | |
| 906 | − applicationInstance->getAvatar()->setLeanScale(leanScale->value()); | |
| 907 | − applicationInstance->getAvatar()->setClampedTargetScale(avatarScale->value()); | |
| 908 | − | |
| 909 | − _audioJitterBufferSamples = audioJitterBufferSamples->value(); | |
| 910 | − | |
| 911 | − if (_audioJitterBufferSamples != 0) { | |
| 912 | − applicationInstance->getAudio()->setJitterBufferSamples(_audioJitterBufferSamples); | |
| 913 | − } | |
| 914 | − | |
| 915 | − _fieldOfView = fieldOfView->value(); | |
| 916 | − applicationInstance->resizeGL(applicationInstance->getGLWidget()->width(), applicationInstance->getGLWidget()->height()); | |
| 917 | − | |
| 918 | − _faceshiftEyeDeflection = faceshiftEyeDeflection->value() / (float)faceshiftEyeDeflection->maximum(); | |
| 776 | + if (!_preferencesDialog) { | |
| 777 | + _preferencesDialog = new PreferencesDialog(Application::getInstance()->getWindow()); | |
| 778 | + _preferencesDialog->show(); | |
| 779 | + } else { | |
| 780 | + _preferencesDialog->close(); | |
| 919 | 781 | } |
| 920 | − QMetaObject::invokeMethod(applicationInstance->getAudio(), "reset", Qt::QueuedConnection); | |
| 921 | − | |
| 922 | − sendFakeEnterEvent(); | |
| 923 | 782 | } |
| 924 | 783 | |
| 925 | 784 | void Menu::goToDomain(const QString newDomain) { |
| 926 | − if (NodeList::getInstance()->getDomainInfo().getHostname() != newDomain) { | |
| 927 | − | |
| 785 | + if (NodeList::getInstance()->getDomainHandler().getHostname() != newDomain) { | |
| 928 | 786 | // send a node kill request, indicating to other clients that they should play the "disappeared" effect |
| 929 | 787 | Application::getInstance()->getAvatar()->sendKillAvatar(); |
| 930 | 788 | |
| 931 | 789 | // give our nodeList the new domain-server hostname |
| 932 | − NodeList::getInstance()->getDomainInfo().setHostname(newDomain); | |
| 790 | + NodeList::getInstance()->getDomainHandler().setHostname(newDomain); | |
| 933 | 791 | } |
| 934 | 792 | } |
| 935 | 793 | |
| 936 | 794 | void Menu::goToDomainDialog() { |
| 937 | 795 | |
| 938 | − QString currentDomainHostname = NodeList::getInstance()->getDomainInfo().getHostname(); | |
| 796 | + QString currentDomainHostname = NodeList::getInstance()->getDomainHandler().getHostname(); | |
| 939 | 797 | |
| 940 | − if (NodeList::getInstance()->getDomainInfo().getPort() != DEFAULT_DOMAIN_SERVER_PORT) { | |
| 798 | + if (NodeList::getInstance()->getDomainHandler().getPort() != DEFAULT_DOMAIN_SERVER_PORT) { | |
| 941 | 799 | // add the port to the currentDomainHostname string if it is custom |
| 942 | − currentDomainHostname.append(QString(":%1").arg(NodeList::getInstance()->getDomainInfo().getPort())); | |
| 800 | + currentDomainHostname.append(QString(":%1").arg(NodeList::getInstance()->getDomainHandler().getPort())); | |
| 943 | 801 | } |
| 944 | 802 | |
| 945 | 803 | QInputDialog domainDialog(Application::getInstance()->getWindow()); |
| @@ -1059,7 +917,6 @@ void Menu::goToLocation() { · 113 unmodified lines | ||
| 1059 | 917 | QString currentLocation = QString("%1, %2, %3").arg(QString::number(avatarPos.x), |
| 1060 | 918 | QString::number(avatarPos.y), QString::number(avatarPos.z)); |
| 1061 | 919 | |
| 1062 | − | |
| 1063 | 920 | QInputDialog coordinateDialog(Application::getInstance()->getWindow()); |
| 1064 | 921 | coordinateDialog.setWindowTitle("Go to Location"); |
| 1065 | 922 | coordinateDialog.setLabelText("Coordinate as x,y,z:"); |
| @@ -1133,7 +990,7 @@ void Menu::nameLocation() { · 67 unmodified lines | ||
| 1133 | 990 | connect(manager, &LocationManager::creationCompleted, this, &Menu::namedLocationCreated); |
| 1134 | 991 | NamedLocation* location = new NamedLocation(locationName, |
| 1135 | 992 | myAvatar->getPosition(), myAvatar->getOrientation(), |
| 1136 | − NodeList::getInstance()->getDomainInfo().getHostname()); | |
| 993 | + NodeList::getInstance()->getDomainHandler().getHostname()); | |
| 1137 | 994 | manager->createNamedLocation(location); |
| 1138 | 995 | } |
| 1139 | 996 | } |
| @@ -1203,7 +1060,7 @@ void Menu::showMetavoxelEditor() { · 63 unmodified lines | ||
| 1203 | 1060 | void Menu::showChat() { |
| 1204 | 1061 | QMainWindow* mainWindow = Application::getInstance()->getWindow(); |
| 1205 | 1062 | if (!_chatWindow) { |
| 1206 | − mainWindow->addDockWidget(Qt::NoDockWidgetArea, _chatWindow = new ChatWindow()); | |
| 1063 | + mainWindow->addDockWidget(Qt::RightDockWidgetArea, _chatWindow = new ChatWindow()); | |
| 1207 | 1064 | } |
| 1208 | 1065 | if (!_chatWindow->toggleViewAction()->isChecked()) { |
| 1209 | 1066 | const QRect& windowGeometry = mainWindow->geometry(); |