hook meta+enter up to address bar display

This commit is contained in:
Stephen Birarda 2014-09-11 10:24:04 -07:00
parent 71f2c0b542
commit dd1b23044f
3 changed files with 21 additions and 72 deletions

View file

@ -422,8 +422,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
MIDIManager& midiManagerInstance = MIDIManager::getInstance(); MIDIManager& midiManagerInstance = MIDIManager::getInstance();
midiManagerInstance.openDefaultPort(); midiManagerInstance.openDefaultPort();
#endif #endif
AddressManager::getInstance().handleLookupString("1.5,2.5,0.0/0.0,-161.98,0.02");
} }
Application::~Application() { Application::~Application() {
@ -913,7 +911,12 @@ void Application::keyPressEvent(QKeyEvent* event) {
case Qt::Key_Return: case Qt::Key_Return:
case Qt::Key_Enter: case Qt::Key_Enter:
Menu::getInstance()->triggerOption(MenuOption::Chat); if (isMeta) {
Menu::getInstance()->triggerOption(MenuOption::AddressBar);
} else {
Menu::getInstance()->triggerOption(MenuOption::Chat);
}
break; break;
case Qt::Key_Up: case Qt::Key_Up:
@ -1317,7 +1320,7 @@ void Application::dropEvent(QDropEvent *event) {
SnapshotMetaData* snapshotData = Snapshot::parseSnapshotData(snapshotPath); SnapshotMetaData* snapshotData = Snapshot::parseSnapshotData(snapshotPath);
if (snapshotData) { if (snapshotData) {
if (!snapshotData->getDomain().isEmpty()) { if (!snapshotData->getDomain().isEmpty()) {
Menu::getInstance()->goToDomain(snapshotData->getDomain()); // Menu::getInstance()->goToDomain(snapshotData->getDomain());
} }
_myAvatar->setPosition(snapshotData->getLocation()); _myAvatar->setPosition(snapshotData->getLocation());
@ -4101,7 +4104,7 @@ void Application::urlGoTo(int argc, const char * constArgv[]) {
if (urlParts.count() == 1) { if (urlParts.count() == 1) {
// location coordinates or place name // location coordinates or place name
QString domain = urlParts[0]; QString domain = urlParts[0];
Menu::goToDomain(domain); // Menu::goToDomain(domain);
} else if (urlParts.count() > 1) { } else if (urlParts.count() > 1) {
// if url has 2 or more parts, the first one is domain name // if url has 2 or more parts, the first one is domain name
QString domain = urlParts[0]; QString domain = urlParts[0];
@ -4113,7 +4116,7 @@ void Application::urlGoTo(int argc, const char * constArgv[]) {
// any third part is an avatar orientation. // any third part is an avatar orientation.
QString orientation = urlParts.count() > 2 ? urlParts[2] : QString(); QString orientation = urlParts.count() > 2 ? urlParts[2] : QString();
Menu::goToDomain(domain); // Menu::goToDomain(domain);
// goto either @user, #place, or x-xx,y-yy,z-zz // goto either @user, #place, or x-xx,y-yy,z-zz
// style co-ordinate. // style co-ordinate.

View file

@ -30,6 +30,7 @@
#include <QDesktopServices> #include <QDesktopServices>
#include <AccountManager.h> #include <AccountManager.h>
#include <AddressManager.h>
#include <XmppClient.h> #include <XmppClient.h>
#include <UUID.h> #include <UUID.h>
#include <UserActivityLogger.h> #include <UserActivityLogger.h>
@ -158,16 +159,6 @@ Menu::Menu() :
Qt::CTRL | Qt::Key_G, Qt::CTRL | Qt::Key_G,
appInstance->getAvatar(), appInstance->getAvatar(),
SLOT(goHome())); SLOT(goHome()));
addActionToQMenuAndActionHash(fileMenu,
MenuOption::GoToDomain,
Qt::CTRL | Qt::Key_D,
this,
SLOT(goToDomainDialog()));
addActionToQMenuAndActionHash(fileMenu,
MenuOption::GoToLocation,
Qt::CTRL | Qt::SHIFT | Qt::Key_L,
this,
SLOT(goToLocation()));
addActionToQMenuAndActionHash(fileMenu, addActionToQMenuAndActionHash(fileMenu,
MenuOption::NameLocation, MenuOption::NameLocation,
Qt::CTRL | Qt::Key_N, Qt::CTRL | Qt::Key_N,
@ -179,10 +170,10 @@ Menu::Menu() :
this, this,
SLOT(toggleLocationList())); SLOT(toggleLocationList()));
addActionToQMenuAndActionHash(fileMenu, addActionToQMenuAndActionHash(fileMenu,
MenuOption::GoTo, MenuOption::AddressBar,
Qt::Key_At, Qt::CTRL | Qt::Key_Enter,
this, this,
SLOT(goTo())); SLOT(toggleAddressBar()));
addDisabledActionAndSeparator(fileMenu, "Upload Avatar Model"); addDisabledActionAndSeparator(fileMenu, "Upload Avatar Model");
addActionToQMenuAndActionHash(fileMenu, MenuOption::UploadHead, 0, Application::getInstance(), SLOT(uploadHead())); addActionToQMenuAndActionHash(fileMenu, MenuOption::UploadHead, 0, Application::getInstance(), SLOT(uploadHead()));
@ -1149,62 +1140,22 @@ void Menu::changePrivateKey() {
sendFakeEnterEvent(); sendFakeEnterEvent();
} }
void Menu::goToDomain(const QString newDomain) { void Menu::toggleAddressBar() {
if (NodeList::getInstance()->getDomainHandler().getHostname() != newDomain) {
// send a node kill request, indicating to other clients that they should play the "disappeared" effect
Application::getInstance()->getAvatar()->sendKillAvatar();
// give our nodeList the new domain-server hostname
NodeList::getInstance()->getDomainHandler().setHostname(newDomain);
}
}
void Menu::goToDomainDialog() {
QString currentDomainHostname = NodeList::getInstance()->getDomainHandler().getHostname();
if (NodeList::getInstance()->getDomainHandler().getPort() != DEFAULT_DOMAIN_SERVER_PORT) {
// add the port to the currentDomainHostname string if it is custom
currentDomainHostname.append(QString(":%1").arg(NodeList::getInstance()->getDomainHandler().getPort()));
}
QInputDialog domainDialog(Application::getInstance()->getWindow());
domainDialog.setWindowTitle("Go to Domain");
domainDialog.setLabelText("Domain server:");
domainDialog.setTextValue(currentDomainHostname);
domainDialog.resize(domainDialog.parentWidget()->size().width() * DIALOG_RATIO_OF_WINDOW, domainDialog.size().height());
int dialogReturn = domainDialog.exec();
if (dialogReturn == QDialog::Accepted) {
QString newHostname(DEFAULT_DOMAIN_HOSTNAME);
if (domainDialog.textValue().size() > 0) {
// the user input a new hostname, use that
newHostname = domainDialog.textValue();
}
goToDomain(newHostname);
}
sendFakeEnterEvent();
}
void Menu::addressBarDialog() {
QInputDialog addressBarDialog(Application::getInstance()->getWindow()); QInputDialog addressBarDialog(Application::getInstance()->getWindow());
addressBarDialog.setWindowTitle("Address Bar"); addressBarDialog.setWindowTitle("Address Bar");
addressBarDialog.setLabelText("place, @user, hifi://domain/path, position/orientation"); addressBarDialog.setWindowFlags(Qt::Sheet);
QString destination = QString(); addressBarDialog.setLabelText("place, domain, @user, example.com, position/orientation");
addressBarDialog.setTextValue(destination);
addressBarDialog.resize(addressBarDialog.parentWidget()->size().width() * DIALOG_RATIO_OF_WINDOW, addressBarDialog.resize(addressBarDialog.parentWidget()->size().width() * DIALOG_RATIO_OF_WINDOW,
addressBarDialog.size().height()); addressBarDialog.size().height());
int dialogReturn = addressBarDialog.exec(); int dialogReturn = addressBarDialog.exec();
if (dialogReturn == QDialog::Accepted && !addressBarDialog.textValue().isEmpty()) { if (dialogReturn == QDialog::Accepted && !addressBarDialog.textValue().isEmpty()) {
// let the location manager parse this out and decide what to do with it // let the AddressManger figure out what to do with this
// LocationManager::getInstance().handleAddressBarEntry(addressBarDialog.textValue()); AddressManager::getInstance().handleLookupString(addressBarDialog.textValue());
} }
sendFakeEnterEvent(); sendFakeEnterEvent();
} }

View file

@ -163,8 +163,6 @@ public:
void removeAction(QMenu* menu, const QString& actionName); void removeAction(QMenu* menu, const QString& actionName);
void static goToDomain(const QString newDomain);
const QByteArray& getWalletPrivateKey() const { return _walletPrivateKey; } const QByteArray& getWalletPrivateKey() const { return _walletPrivateKey; }
signals: signals:
@ -182,7 +180,7 @@ public slots:
void saveSettings(QSettings* settings = NULL); void saveSettings(QSettings* settings = NULL);
void importSettings(); void importSettings();
void exportSettings(); void exportSettings();
void addressBarDialog(); void toggleAddressBar();
void pasteToVoxel(); void pasteToVoxel();
void toggleLoginMenuItem(); void toggleLoginMenuItem();
@ -205,7 +203,6 @@ private slots:
void editAttachments(); void editAttachments();
void editAnimations(); void editAnimations();
void changePrivateKey(); void changePrivateKey();
void goToDomainDialog();
void nameLocation(); void nameLocation();
void toggleLocationList(); void toggleLocationList();
void bandwidthDetailsClosed(); void bandwidthDetailsClosed();
@ -307,6 +304,7 @@ private:
namespace MenuOption { namespace MenuOption {
const QString AboutApp = "About Interface"; const QString AboutApp = "About Interface";
const QString AddressBar = "Show Address Bar";
const QString AlignForearmsWithWrists = "Align Forearms with Wrists"; const QString AlignForearmsWithWrists = "Align Forearms with Wrists";
const QString AlternateIK = "Alternate IK"; const QString AlternateIK = "Alternate IK";
const QString AmbientOcclusion = "Ambient Occlusion"; const QString AmbientOcclusion = "Ambient Occlusion";
@ -393,9 +391,6 @@ namespace MenuOption {
const QString GlowMode = "Cycle Glow Mode"; const QString GlowMode = "Cycle Glow Mode";
const QString GlowWhenSpeaking = "Glow When Speaking"; const QString GlowWhenSpeaking = "Glow When Speaking";
const QString GoHome = "Go Home"; const QString GoHome = "Go Home";
const QString GoToDomain = "Go To Domain...";
const QString GoTo = "Go To...";
const QString GoToLocation = "Go To Location...";
const QString HeadMouse = "Head Mouse"; const QString HeadMouse = "Head Mouse";
const QString IncreaseAvatarSize = "Increase Avatar Size"; const QString IncreaseAvatarSize = "Increase Avatar Size";
const QString IncreaseVoxelSize = "Increase Voxel Size"; const QString IncreaseVoxelSize = "Increase Voxel Size";