Showing the changes to interface/src/Menu.cpp (1 of 47 files). Show all
Unified · Split
| @@ -40,6 +40,7 @@ · 39 unmodified lines | ||
| 40 | 40 | #include "ui/InfoView.h" |
| 41 | 41 | #include "ui/MetavoxelEditor.h" |
| 42 | 42 | #include "ui/ModelsBrowser.h" |
| 43 | +#include "ui/LoginDialog.h" | |
| 43 | 44 | |
| 44 | 45 | |
| 45 | 46 | Menu* Menu::_instance = NULL; |
| @@ -169,12 +170,12 @@ Menu::Menu() : · 123 unmodified lines | ||
| 169 | 170 | |
| 170 | 171 | |
| 171 | 172 | QMenu* editMenu = addMenu("Edit"); |
| 172 | − | |
| 173 | + | |
| 173 | 174 | QUndoStack* undoStack = Application::getInstance()->getUndoStack(); |
| 174 | 175 | QAction* undoAction = undoStack->createUndoAction(editMenu); |
| 175 | 176 | undoAction->setShortcut(Qt::CTRL | Qt::Key_Z); |
| 176 | 177 | addActionToQMenuAndActionHash(editMenu, undoAction); |
| 177 | − | |
| 178 | + | |
| 178 | 179 | QAction* redoAction = undoStack->createRedoAction(editMenu); |
| 179 | 180 | redoAction->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_Z); |
| 180 | 181 | addActionToQMenuAndActionHash(editMenu, redoAction); |
| @@ -188,8 +189,8 @@ Menu::Menu() : · 7 unmodified lines | ||
| 188 | 189 | |
| 189 | 190 | addDisabledActionAndSeparator(editMenu, "Physics"); |
| 190 | 191 | QObject* avatar = appInstance->getAvatar(); |
| 191 | − addCheckableActionToQMenuAndActionHash(editMenu, MenuOption::ObeyGravity, Qt::SHIFT | Qt::Key_G, true, | |
| 192 | − avatar, SLOT(updateMotionBehaviorFlags())); | |
| 192 | + addCheckableActionToQMenuAndActionHash(editMenu, MenuOption::ObeyEnvironmentalGravity, Qt::SHIFT | Qt::Key_G, true, | |
| 193 | + avatar, SLOT(updateMotionBehaviors())); | |
| 193 | 194 | |
| 194 | 195 | |
| 195 | 196 | addAvatarCollisionSubMenu(editMenu); |
| @@ -320,7 +321,7 @@ Menu::Menu() : · 124 unmodified lines | ||
| 320 | 321 | addCheckableActionToQMenuAndActionHash(avatarOptionsMenu, MenuOption::Visage, 0, true, |
| 321 | 322 | appInstance->getVisage(), SLOT(updateEnabled())); |
| 322 | 323 | #endif |
| 323 | − | |
| 324 | + | |
| 324 | 325 | addCheckableActionToQMenuAndActionHash(avatarOptionsMenu, MenuOption::GlowWhenSpeaking, 0, true); |
| 325 | 326 | addCheckableActionToQMenuAndActionHash(avatarOptionsMenu, MenuOption::ChatCircling, 0, false); |
| 326 | 327 | |
| @@ -723,31 +724,31 @@ QAction* Menu::addActionToQMenuAndActionHash(QMenu* destinationMenu, · 396 unmodified lines | ||
| 723 | 724 | QAction::MenuRole role, |
| 724 | 725 | int menuItemLocation) { |
| 725 | 726 | QAction* actionBefore = NULL; |
| 726 | − | |
| 727 | + | |
| 727 | 728 | if (menuItemLocation >= 0 && destinationMenu->actions().size() > menuItemLocation) { |
| 728 | 729 | actionBefore = destinationMenu->actions()[menuItemLocation]; |
| 729 | 730 | } |
| 730 | − | |
| 731 | + | |
| 731 | 732 | if (!actionName.isEmpty()) { |
| 732 | 733 | action->setText(actionName); |
| 733 | 734 | } |
| 734 | − | |
| 735 | + | |
| 735 | 736 | if (shortcut != 0) { |
| 736 | 737 | action->setShortcut(shortcut); |
| 737 | 738 | } |
| 738 | − | |
| 739 | + | |
| 739 | 740 | if (role != QAction::NoRole) { |
| 740 | 741 | action->setMenuRole(role); |
| 741 | 742 | } |
| 742 | − | |
| 743 | + | |
| 743 | 744 | if (!actionBefore) { |
| 744 | 745 | destinationMenu->addAction(action); |
| 745 | 746 | } else { |
| 746 | 747 | destinationMenu->insertAction(actionBefore, action); |
| 747 | 748 | } |
| 748 | − | |
| 749 | + | |
| 749 | 750 | _actionHash.insert(action->text(), action); |
| 750 | − | |
| 751 | + | |
| 751 | 752 | return action; |
| 752 | 753 | } |
| 753 | 754 | |
| @@ -813,42 +814,12 @@ void sendFakeEnterEvent() { · 59 unmodified lines | ||
| 813 | 814 | QCoreApplication::sendEvent(glWidget, &enterEvent); |
| 814 | 815 | } |
| 815 | 816 | |
| 816 | −const int QLINE_MINIMUM_WIDTH = 400; | |
| 817 | 817 | const float DIALOG_RATIO_OF_WINDOW = 0.30f; |
| 818 | 818 | |
| 819 | 819 | void Menu::loginForCurrentDomain() { |
| 820 | − QDialog loginDialog(Application::getInstance()->getWindow()); | |
| 821 | − loginDialog.setWindowTitle("Login"); | |
| 822 | − | |
| 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(); | |
| 820 | + LoginDialog* loginDialog = new LoginDialog(Application::getInstance()->getWindow()); | |
| 821 | + loginDialog->show(); | |
| 822 | + loginDialog->resizeAndPosition(false); | |
| 852 | 823 | } |
| 853 | 824 | |
| 854 | 825 | void Menu::editPreferences() { |
| @@ -1278,7 +1249,7 @@ void Menu::autoAdjustLOD(float currentFPS) { · 423 unmodified lines | ||
| 1278 | 1249 | _avatarLODDistanceMultiplier - DISTANCE_DECREASE_RATE); |
| 1279 | 1250 | } |
| 1280 | 1251 | } |
| 1281 | − | |
| 1252 | + | |
| 1282 | 1253 | bool changed = false; |
| 1283 | 1254 | quint64 elapsed = now - _lastAdjust; |
| 1284 | 1255 | |