History

Merge remote-tracking branch 'upstream/master' into 19612

Ryan Huffman committed 12 years ago

Commit 65fd2a72 parents 45beeaa 19b76e347 files · +1877 −604Browse files

Showing the changes to interface/src/Menu.cpp (1 of 47 files). Show all

Unified · Split

interface/src/Menu.cpp+17−46
@@ -40,6 +40,7 @@ · 39 unmodified lines
4040 #include "ui/InfoView.h"
4141 #include "ui/MetavoxelEditor.h"
4242 #include "ui/ModelsBrowser.h"
43+#include "ui/LoginDialog.h"
4344
4445
4546 Menu* Menu::_instance = NULL;
@@ -169,12 +170,12 @@ Menu::Menu() : · 123 unmodified lines
169170
170171
171172 QMenu* editMenu = addMenu("Edit");
172−
173+
173174 QUndoStack* undoStack = Application::getInstance()->getUndoStack();
174175 QAction* undoAction = undoStack->createUndoAction(editMenu);
175176 undoAction->setShortcut(Qt::CTRL | Qt::Key_Z);
176177 addActionToQMenuAndActionHash(editMenu, undoAction);
177−
178+
178179 QAction* redoAction = undoStack->createRedoAction(editMenu);
179180 redoAction->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_Z);
180181 addActionToQMenuAndActionHash(editMenu, redoAction);
@@ -188,8 +189,8 @@ Menu::Menu() : · 7 unmodified lines
188189
189190 addDisabledActionAndSeparator(editMenu, "Physics");
190191 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()));
193194
194195
195196 addAvatarCollisionSubMenu(editMenu);
@@ -320,7 +321,7 @@ Menu::Menu() : · 124 unmodified lines
320321 addCheckableActionToQMenuAndActionHash(avatarOptionsMenu, MenuOption::Visage, 0, true,
321322 appInstance->getVisage(), SLOT(updateEnabled()));
322323 #endif
323−
324+
324325 addCheckableActionToQMenuAndActionHash(avatarOptionsMenu, MenuOption::GlowWhenSpeaking, 0, true);
325326 addCheckableActionToQMenuAndActionHash(avatarOptionsMenu, MenuOption::ChatCircling, 0, false);
326327
@@ -723,31 +724,31 @@ QAction* Menu::addActionToQMenuAndActionHash(QMenu* destinationMenu, · 396 unmodified lines
723724 QAction::MenuRole role,
724725 int menuItemLocation) {
725726 QAction* actionBefore = NULL;
726−
727+
727728 if (menuItemLocation >= 0 && destinationMenu->actions().size() > menuItemLocation) {
728729 actionBefore = destinationMenu->actions()[menuItemLocation];
729730 }
730−
731+
731732 if (!actionName.isEmpty()) {
732733 action->setText(actionName);
733734 }
734−
735+
735736 if (shortcut != 0) {
736737 action->setShortcut(shortcut);
737738 }
738−
739+
739740 if (role != QAction::NoRole) {
740741 action->setMenuRole(role);
741742 }
742−
743+
743744 if (!actionBefore) {
744745 destinationMenu->addAction(action);
745746 } else {
746747 destinationMenu->insertAction(actionBefore, action);
747748 }
748−
749+
749750 _actionHash.insert(action->text(), action);
750−
751+
751752 return action;
752753 }
753754
@@ -813,42 +814,12 @@ void sendFakeEnterEvent() { · 59 unmodified lines
813814 QCoreApplication::sendEvent(glWidget, &enterEvent);
814815 }
815816
816−const int QLINE_MINIMUM_WIDTH = 400;
817817 const float DIALOG_RATIO_OF_WINDOW = 0.30f;
818818
819819 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);
852823 }
853824
854825 void Menu::editPreferences() {
@@ -1278,7 +1249,7 @@ void Menu::autoAdjustLOD(float currentFPS) { · 423 unmodified lines
12781249 _avatarLODDistanceMultiplier - DISTANCE_DECREASE_RATE);
12791250 }
12801251 }
1281−
1252+
12821253 bool changed = false;
12831254 quint64 elapsed = now - _lastAdjust;
12841255