From 3994ec4176b015c921dc1138b9fbd43ae6388a35 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 5 Jul 2018 17:54:27 -0700 Subject: [PATCH] adding potential fix - moving methods to Application --- interface/src/Application.cpp | 23 ++++++++++++++++++++++- interface/src/Application.h | 3 +++ interface/src/Menu.cpp | 5 ++--- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 4b530dc1d0..3eff06742d 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -1668,7 +1669,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo return qApp->getMyAvatar()->getSnapTurn() ? 1 : 0; }); _applicationStateDevice->setInputVariant(STATE_ADVANCED_MOVEMENT_CONTROLS, []() -> float { - return qApp->getMyAvatar()->useAdvancedMovementControls() ? 1 : 0; + auto isAdvanced = qApp->getMyAvatar()->useAdvancedMovementControls(); + return isAdvanced ? 1 : 0; }); _applicationStateDevice->setInputVariant(STATE_GROUNDED, []() -> float { @@ -8304,6 +8306,25 @@ void Application::saveNextPhysicsStats(QString filename) { _physicsEngine->saveNextPhysicsStats(filename); } +void Application::copyAddress() { + if (QThread::currentThread() != thread()) { + QMetaObject::invokeMethod(this, "copyAddress"); + return; + } + + // assume that the address is being copied because the user wants a shareable address + QApplication::clipboard()->setText(QString("copyAddress worked!")); +} + +void Application::copyPath() { + if (QThread::currentThread() != thread()) { + QMetaObject::invokeMethod(this, "copyPath"); + return; + } + + QApplication::clipboard()->setText(QString("copyPath worked!")); +} + #if defined(Q_OS_ANDROID) void Application::enterBackground() { QMetaObject::invokeMethod(DependencyManager::get().data(), diff --git a/interface/src/Application.h b/interface/src/Application.h index 346ea258da..13e4d83fd4 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -368,6 +368,9 @@ public slots: void resetSensors(bool andReload = false); void setActiveFaceTracker() const; + void copyAddress(); + void copyPath(); + #if (PR_BUILD || DEV_BUILD) void sendWrongProtocolVersionsSignature(bool checked) { ::sendWrongProtocolVersionsSignature(checked); } #endif diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 646067169f..4554d1efd8 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -268,13 +268,12 @@ Menu::Menu() { locationBookmarks->setupMenus(this, navigateMenu); // Navigate > Copy Address - auto addressManager = DependencyManager::get(); addActionToQMenuAndActionHash(navigateMenu, MenuOption::CopyAddress, 0, - addressManager.data(), SLOT(copyAddress())); + qApp, SLOT(copyAddress())); // Navigate > Copy Path addActionToQMenuAndActionHash(navigateMenu, MenuOption::CopyPath, 0, - addressManager.data(), SLOT(copyPath())); + qApp, SLOT(copyPath())); // Settings menu ----------------------------------