History

better implementation

danteruiz committed 7 years ago

Commit 2ab8eb91 parent 5f3e31b5 files · +52 −37Browse files

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

Unified · Split

interface/src/Application.cpp+36−0
@@ -2342,6 +2342,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 2341 unmodified lines
2342 return viewFrustum.getPosition();2342 return viewFrustum.getPosition();
2343 });2343 });
2344 2344
2345 DependencyManager::get<UsersScriptingInterface>()->setKickConfirmationOperator([this] (const QUuid& nodeID) { userKickConfirmation(nodeID); });
2346
2345 render::entities::WebEntityRenderer::setAcquireWebSurfaceOperator([this](const QString& url, bool htmlContent, QSharedPointer<OffscreenQmlSurface>& webSurface, bool& cachedWebSurface) {2347 render::entities::WebEntityRenderer::setAcquireWebSurfaceOperator([this](const QString& url, bool htmlContent, QSharedPointer<OffscreenQmlSurface>& webSurface, bool& cachedWebSurface) {
2346 bool isTablet = url == TabletScriptingInterface::QML;2348 bool isTablet = url == TabletScriptingInterface::QML;
2347 if (htmlContent) {2349 if (htmlContent) {
@@ -3287,6 +3289,40 @@ void Application::onDesktopRootItemCreated(QQuickItem* rootItem) { · 939 unmodified lines
3287#endif3289#endif
3288}3290}
3289 3291
3292void Application::userKickConfirmation(const QUuid& nodeID) {
3293 auto avatarHashMap = DependencyManager::get<AvatarHashMap>();
3294 auto avatar = avatarHashMap->getAvatarBySessionID(nodeID);
3295
3296 QString userName;
3297
3298 if (avatar) {
3299 userName = avatar->getSessionDisplayName();
3300 } else {
3301 userName = nodeID.toString();
3302 }
3303
3304 QString kickMessage = "Do you wish to kick " + userName + " from your domain";
3305 ModalDialogListener* dlg = OffscreenUi::asyncQuestion("Kick User", kickMessage,
3306 QMessageBox::Yes | QMessageBox::No);
3307
3308 if (dlg->getDialogItem()) {
3309
3310 QObject::connect(dlg, &ModalDialogListener::response, this, [=] (QVariant answer) {
3311 QObject::disconnect(dlg, &ModalDialogListener::response, this, nullptr);
3312
3313 bool yes = (static_cast<QMessageBox::StandardButton>(answer.toInt()) == QMessageBox::Yes);
3314 // ask the NodeList to kick the user with the given session ID
3315
3316 if (yes) {
3317 DependencyManager::get<NodeList>()->kickNodeBySessionID(nodeID);
3318 }
3319
3320 DependencyManager::get<UsersScriptingInterface>()->setWaitForKickResponse(false);
3321 });
3322 DependencyManager::get<UsersScriptingInterface>()->setWaitForKickResponse(true);
3323 }
3324}
3325
3290void Application::setupQmlSurface(QQmlContext* surfaceContext, bool setAdditionalContextProperties) {3326void Application::setupQmlSurface(QQmlContext* surfaceContext, bool setAdditionalContextProperties) {
3291 surfaceContext->setContextProperty("Users", DependencyManager::get<UsersScriptingInterface>().data());3327 surfaceContext->setContextProperty("Users", DependencyManager::get<UsersScriptingInterface>().data());
3292 surfaceContext->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data());3328 surfaceContext->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data());

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t