Showing the changes to interface/src/Menu.cpp (1 of 45 files). Show all
Unified · Split
| @@ -40,6 +40,7 @@ · 39 unmodified lines | |||
| 40 | #include "ui/InfoView.h" | 40 | #include "ui/InfoView.h" |
| 41 | #include "ui/MetavoxelEditor.h" | 41 | #include "ui/MetavoxelEditor.h" |
| 42 | #include "ui/ModelsBrowser.h" | 42 | #include "ui/ModelsBrowser.h" |
| 43 | #include "ui/LoginDialog.h" | ||
| 43 | 44 | ||
| 44 | 45 | ||
| 45 | Menu* Menu::_instance = NULL; | 46 | Menu* Menu::_instance = NULL; |
| @@ -187,9 +188,9 @@ Menu::Menu() : · 141 unmodified lines | |||
| 187 | QAction::PreferencesRole); | 188 | QAction::PreferencesRole); |
| 188 | 189 | ||
| 189 | addDisabledActionAndSeparator(editMenu, "Physics"); | 190 | addDisabledActionAndSeparator(editMenu, "Physics"); |
| 190 | addCheckableActionToQMenuAndActionHash(editMenu, MenuOption::Gravity, Qt::SHIFT | Qt::Key_G, false); | 191 | QObject* avatar = appInstance->getAvatar(); |
| 191 | 192 | addCheckableActionToQMenuAndActionHash(editMenu, MenuOption::ObeyEnvironmentalGravity, Qt::SHIFT | Qt::Key_G, true, | |
| 192 | 193 | avatar, SLOT(updateMotionBehaviors())); | |
| 193 | 194 | ||
| 194 | 195 | ||
| 195 | addAvatarCollisionSubMenu(editMenu); | 196 | addAvatarCollisionSubMenu(editMenu); |
| @@ -508,7 +509,7 @@ void Menu::loadSettings(QSettings* settings) { · 312 unmodified lines | |||
| 508 | // MyAvatar caches some menu options, so we have to update them whenever we load settings. | 509 | // MyAvatar caches some menu options, so we have to update them whenever we load settings. |
| 509 | // TODO: cache more settings in MyAvatar that are checked with very high frequency. | 510 | // TODO: cache more settings in MyAvatar that are checked with very high frequency. |
| 510 | MyAvatar* myAvatar = Application::getInstance()->getAvatar(); | 511 | MyAvatar* myAvatar = Application::getInstance()->getAvatar(); |
| 511 | myAvatar->updateCollisionFlags(); | 512 | myAvatar->updateCollisionGroups(); |
| 512 | 513 | ||
| 513 | if (lockedSettings) { | 514 | if (lockedSettings) { |
| 514 | Application::getInstance()->unlockSettings(); | 515 | Application::getInstance()->unlockSettings(); |
| @@ -817,38 +818,9 @@ const int QLINE_MINIMUM_WIDTH = 400; · 302 unmodified lines | |||
| 817 | const float DIALOG_RATIO_OF_WINDOW = 0.30f; | 818 | const float DIALOG_RATIO_OF_WINDOW = 0.30f; |
| 818 | 819 | ||
| 819 | void Menu::loginForCurrentDomain() { | 820 | void Menu::loginForCurrentDomain() { |
| 820 | QDialog loginDialog(Application::getInstance()->getWindow()); | 821 | LoginDialog* loginDialog = new LoginDialog(Application::getInstance()->getWindow()); |
| 821 | loginDialog.setWindowTitle("Login"); | 822 | loginDialog->show(); |
| 822 | 823 | loginDialog->resizeAndPosition(false); | |
| 823 | QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom); | ||
| 824 | loginDialog.setLayout(layout); | ||
| 825 | loginDialog.setWindowFlags(Qt::Sheet); | ||
| 826 | |||
| 827 | QFormLayout* form = new QFormLayout(); | ||
| 828 | layout->addLayout(form, 1); | ||
| 829 | |||
| 830 | QLineEdit* loginLineEdit = new QLineEdit(); | ||
| 831 | loginLineEdit->setMinimumWidth(QLINE_MINIMUM_WIDTH); | ||
| 832 | form->addRow("Login:", loginLineEdit); | ||
| 833 | |||
| 834 | QLineEdit* passwordLineEdit = new QLineEdit(); | ||
| 835 | passwordLineEdit->setMinimumWidth(QLINE_MINIMUM_WIDTH); | ||
| 836 | passwordLineEdit->setEchoMode(QLineEdit::Password); | ||
| 837 | form->addRow("Password:", passwordLineEdit); | ||
| 838 | |||
| 839 | QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); | ||
| 840 | loginDialog.connect(buttons, SIGNAL(accepted()), SLOT(accept())); | ||
| 841 | loginDialog.connect(buttons, SIGNAL(rejected()), SLOT(reject())); | ||
| 842 | layout->addWidget(buttons); | ||
| 843 | |||
| 844 | int dialogReturn = loginDialog.exec(); | ||
| 845 | |||
| 846 | if (dialogReturn == QDialog::Accepted && !loginLineEdit->text().isEmpty() && !passwordLineEdit->text().isEmpty()) { | ||
| 847 | // attempt to get an access token given this username and password | ||
| 848 | AccountManager::getInstance().requestAccessToken(loginLineEdit->text(), passwordLineEdit->text()); | ||
| 849 | } | ||
| 850 | |||
| 851 | sendFakeEnterEvent(); | ||
| 852 | } | 824 | } |
| 853 | 825 | ||
| 854 | void Menu::editPreferences() { | 826 | void Menu::editPreferences() { |
| @@ -931,7 +903,12 @@ void Menu::goTo() { · 76 unmodified lines | |||
| 931 | if (desiredDestination.startsWith(CUSTOM_URL_SCHEME + "//")) { | 903 | if (desiredDestination.startsWith(CUSTOM_URL_SCHEME + "//")) { |
| 932 | QStringList urlParts = desiredDestination.remove(0, CUSTOM_URL_SCHEME.length() + 2).split('/', QString::SkipEmptyParts); | 904 | QStringList urlParts = desiredDestination.remove(0, CUSTOM_URL_SCHEME.length() + 2).split('/', QString::SkipEmptyParts); |
| 933 | 905 | ||
| 934 | if (urlParts.count() > 1) { | 906 | if (urlParts.count() == 1) { |
| 907 | // location coordinates or place name | ||
| 908 | QString domain = urlParts[0]; | ||
| 909 | goToDomain(domain); | ||
| 910 | } | ||
| 911 | else if (urlParts.count() > 1) { | ||
| 935 | // if url has 2 or more parts, the first one is domain name | 912 | // if url has 2 or more parts, the first one is domain name |
| 936 | QString domain = urlParts[0]; | 913 | QString domain = urlParts[0]; |
| 937 | 914 | ||
| @@ -952,12 +929,7 @@ void Menu::goTo() { · 14 unmodified lines | |||
| 952 | // location orientation | 929 | // location orientation |
| 953 | goToOrientation(orientation); | 930 | goToOrientation(orientation); |
| 954 | } | 931 | } |
| 955 | } else if (urlParts.count() == 1) { | ||
| 956 | // location coordinates or place name | ||
| 957 | QString destination = urlParts[0]; | ||
| 958 | goTo(destination); | ||
| 959 | } | 932 | } |
| 960 | |||
| 961 | } else { | 933 | } else { |
| 962 | goToUser(gotoDialog.textValue()); | 934 | goToUser(gotoDialog.textValue()); |
| 963 | } | 935 | } |
| @@ -1381,13 +1353,13 @@ void Menu::addAvatarCollisionSubMenu(QMenu* overMenu) { · 417 unmodified lines | |||
| 1381 | Application* appInstance = Application::getInstance(); | 1353 | Application* appInstance = Application::getInstance(); |
| 1382 | QObject* avatar = appInstance->getAvatar(); | 1354 | QObject* avatar = appInstance->getAvatar(); |
| 1383 | addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithEnvironment, | 1355 | addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithEnvironment, |
| 1384 | 0, false, avatar, SLOT(updateCollisionFlags())); | 1356 | 0, false, avatar, SLOT(updateCollisionGroups())); |
| 1385 | addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithAvatars, | 1357 | addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithAvatars, |
| 1386 | 0, true, avatar, SLOT(updateCollisionFlags())); | 1358 | 0, true, avatar, SLOT(updateCollisionGroups())); |
| 1387 | addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithVoxels, | 1359 | addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithVoxels, |
| 1388 | 0, false, avatar, SLOT(updateCollisionFlags())); | 1360 | 0, false, avatar, SLOT(updateCollisionGroups())); |
| 1389 | addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithParticles, | 1361 | addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithParticles, |
| 1390 | 0, true, avatar, SLOT(updateCollisionFlags())); | 1362 | 0, true, avatar, SLOT(updateCollisionGroups())); |
| 1391 | } | 1363 | } |
| 1392 | 1364 | ||
| 1393 | QAction* Menu::getActionFromName(const QString& menuName, QMenu* menu) { | 1365 | QAction* Menu::getActionFromName(const QString& menuName, QMenu* menu) { |