From 544d4121228059730f9ebe872232572752ae684c Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 15 Jan 2015 09:33:35 -0800 Subject: [PATCH 1/2] Add menu items that copy location address and location path And Rename File > Go to File > Location --- interface/src/Menu.cpp | 21 ++++++++++++++++++++- interface/src/Menu.h | 4 ++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 1219fc3486..01f41dd931 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -122,7 +123,7 @@ Menu::Menu() : addActionToQMenuAndActionHash(fileMenu, MenuOption::RunningScripts, Qt::CTRL | Qt::Key_J, appInstance, SLOT(toggleRunningScriptsWidget())); - addDisabledActionAndSeparator(fileMenu, "Go"); + addDisabledActionAndSeparator(fileMenu, "Location"); addActionToQMenuAndActionHash(fileMenu, MenuOption::NameLocation, Qt::CTRL | Qt::Key_N, @@ -138,6 +139,10 @@ Menu::Menu() : Qt::Key_Enter, this, SLOT(toggleAddressBar())); + addActionToQMenuAndActionHash(fileMenu, MenuOption::CopyAddress, 0, + this, SLOT(copyAddress())); + addActionToQMenuAndActionHash(fileMenu, MenuOption::CopyPath, 0, + this, SLOT(copyPath())); addDisabledActionAndSeparator(fileMenu, "Upload Avatar Model"); addActionToQMenuAndActionHash(fileMenu, MenuOption::UploadHead, 0, @@ -1006,6 +1011,20 @@ void Menu::toggleAddressBar() { } } +void Menu::copyAddress() { + auto addressManager = DependencyManager::get(); + QString address = addressManager->currentAddress().toString(); + QClipboard* clipboard = QApplication::clipboard(); + clipboard->setText(address); +} + +void Menu::copyPath() { + auto addressManager = DependencyManager::get(); + QString path = addressManager->currentPath(); + QClipboard* clipboard = QApplication::clipboard(); + clipboard->setText(path); +} + void Menu::changeVSync() { Application::getInstance()->setVSyncEnabled(isOptionChecked(MenuOption::RenderTargetFramerateVSyncOn)); } diff --git a/interface/src/Menu.h b/interface/src/Menu.h index 6f30ca983b..79dd0799a9 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -177,6 +177,8 @@ public slots: void importSettings(); void exportSettings(); void toggleAddressBar(); + void copyAddress(); + void copyPath(); void toggleLoginMenuItem(); void toggleSixense(bool shouldEnable); @@ -343,6 +345,8 @@ namespace MenuOption { const QString CollideWithEnvironment = "Collide With World Boundaries"; const QString Collisions = "Collisions"; const QString Console = "Console..."; + const QString CopyAddress = "Copy Address"; + const QString CopyPath = "Copy Path"; const QString ControlWithSpeech = "Control With Speech"; const QString DontRenderEntitiesAsScene = "Don't Render Entities as Scene"; const QString DontDoPrecisionPicking = "Don't Do Precision Picking"; From 91e321565a7978fd8b9fab0092fc4d2a4a09f02e Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 15 Jan 2015 10:38:17 -0800 Subject: [PATCH 2/2] Change menu item text --- interface/src/Menu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/src/Menu.h b/interface/src/Menu.h index 79dd0799a9..02892f2fed 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -345,8 +345,8 @@ namespace MenuOption { const QString CollideWithEnvironment = "Collide With World Boundaries"; const QString Collisions = "Collisions"; const QString Console = "Console..."; - const QString CopyAddress = "Copy Address"; - const QString CopyPath = "Copy Path"; + const QString CopyAddress = "Copy Address to Clipboard"; + const QString CopyPath = "Copy Path to Clipboard"; const QString ControlWithSpeech = "Control With Speech"; const QString DontRenderEntitiesAsScene = "Don't Render Entities as Scene"; const QString DontDoPrecisionPicking = "Don't Do Precision Picking";