From cb6b798feac5b0e7218da1243f0e06be4a77de42 Mon Sep 17 00:00:00 2001 From: Ghazi Triki Date: Mon, 13 Feb 2017 10:28:51 +0100 Subject: [PATCH] Moved build pressed keys function to KeyboardUtil class. --- .../src/BigBlueButtonMainContainer.mxml | 13 +++++---- .../org/bigbluebutton/core/KeyboardUtil.as | 27 +++++++++++++++++++ .../modules/chat/views/ChatBox.mxml | 23 ++++++++-------- .../modules/chat/views/ChatWindow.mxml | 4 +-- .../present/ui/views/PresentationWindow.mxml | 8 +++--- .../modules/users/views/UsersWindow.mxml | 4 +-- .../modules/videoconf/views/VideoDock.mxml | 4 +-- 7 files changed, 57 insertions(+), 26 deletions(-) create mode 100644 bigbluebutton-client/src/org/bigbluebutton/core/KeyboardUtil.as diff --git a/bigbluebutton-client/src/BigBlueButtonMainContainer.mxml b/bigbluebutton-client/src/BigBlueButtonMainContainer.mxml index 99881b885f..7181492186 100755 --- a/bigbluebutton-client/src/BigBlueButtonMainContainer.mxml +++ b/bigbluebutton-client/src/BigBlueButtonMainContainer.mxml @@ -33,19 +33,22 @@ with BigBlueButton; if not, see . . private function handleKeyDown(e:KeyboardEvent) :void { if (keyCombos == null) loadKeyCombos(globalModifier); - var keyPress:String = (e.ctrlKey ? "control+" : "") + (e.shiftKey ? "shift+" : "") + (e.altKey ? "alt+" : "") + e.keyCode; + var keyPress:String = KeyboardUtil.buildPressedKeys(e); if (e.keyCode < 64 || e.keyCode > 90){ LOGGER.debug("Keypress debugging: KeyCode {0} is nonalphabetic (probably)", [e.keyCode]); diff --git a/bigbluebutton-client/src/org/bigbluebutton/core/KeyboardUtil.as b/bigbluebutton-client/src/org/bigbluebutton/core/KeyboardUtil.as new file mode 100644 index 0000000000..70cb504134 --- /dev/null +++ b/bigbluebutton-client/src/org/bigbluebutton/core/KeyboardUtil.as @@ -0,0 +1,27 @@ +/** + * BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ + * + * Copyright (c) 2017 BigBlueButton Inc. and by respective authors (see below). + * + * This program is free software; you can redistribute it and/or modify it under the + * terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3.0 of the License, or (at your option) any later + * version. + * + * BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along + * with BigBlueButton; if not, see . + * + */ +package org.bigbluebutton.core { + import flash.events.KeyboardEvent; + + public final class KeyboardUtil { + public static function buildPressedKeys(e:KeyboardEvent):String { + return (e.ctrlKey ? "control+" : "") + (e.shiftKey ? "shift+" : "") + (e.altKey ? "alt+" : "") + e.keyCode; + } + } +} diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml index 705544162c..995646989b 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml @@ -79,6 +79,7 @@ with BigBlueButton; if not, see . import org.as3commons.lang.StringUtils; import org.as3commons.logging.api.ILogger; import org.as3commons.logging.api.getClassLogger; + import org.bigbluebutton.core.KeyboardUtil; import org.bigbluebutton.core.TimerUtil; import org.bigbluebutton.core.UsersUtil; import org.bigbluebutton.core.events.LockControlEvent; @@ -106,25 +107,25 @@ with BigBlueButton; if not, see . private static const LOGGER:ILogger = getClassLogger(ChatBox); - public var publicChat:Boolean = false; - public var chatWithUserID:String; - public var chatWithUsername:String + public var publicChat:Boolean = false; + public var chatWithUserID:String; + public var chatWithUsername:String public var read:Boolean = true; public var userHasLeft:Boolean = false; private var globalDispatcher:Dispatcher = new Dispatcher(); - [Bindable] public var colorPickerColours:Array = ['0x000000', '0x7A7A7A' ,'0xFF0000', '0xFF8800', - '0x88FF00', '0x00FF00', '0x00FF88', '0x00FFFF', '0x0088FF', '0x0000FF', '0x8800FF', '0xFF00FF']; + [Bindable] public var colorPickerColours:Array = ['0x000000', '0x7A7A7A' ,'0xFF0000', '0xFF8800', + '0x88FF00', '0x00FF00', '0x00FF88', '0x00FFFF', '0x0088FF', '0x0000FF', '0x8800FF', '0xFF00FF']; [Bindable] private var backgroundColor:uint = 0x000000; private var lastSenderId:String = ""; private var lastTime:String = ""; - [Bindable] - private var chatMessages:ChatConversation = new ChatConversation(); - + [Bindable] + private var chatMessages:ChatConversation = new ChatConversation(); + private var lastCount:Number = 0; private var scrollTimer:Timer; private var currentMessage:int; @@ -145,8 +146,8 @@ with BigBlueButton; if not, see . private var indicatorNeeded:Boolean = false private var repeat:Boolean = false; - [Bindable] - private var chatListHeight:Number = 100; + [Bindable] + private var chatListHeight:Number = 100; [Bindable] public var chatOptions:ChatOptions = new ChatOptions(); @@ -446,7 +447,7 @@ with BigBlueButton; if not, see . var modifier:String = ExternalInterface.call("determineModifier"); loadKeyCombos(modifier); - var keyPress:String = (e.ctrlKey ? "control+" : "") + (e.shiftKey ? "shift+" : "") + (e.altKey ? "alt+" : "") + e.keyCode; + var keyPress:String = KeyboardUtil.buildPressedKeys(e); if (keyCombos[keyPress]) { LOGGER.debug("WATERFALL: Caught shortcut in chat box, {0}", [keyCombos[keyPress]]); diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatWindow.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatWindow.mxml index 4be28c107c..c069e69268 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatWindow.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatWindow.mxml @@ -43,6 +43,7 @@ with BigBlueButton; if not, see . import org.bigbluebutton.common.IBbbModuleWindow; import org.bigbluebutton.common.events.LocaleChangeEvent; + import org.bigbluebutton.core.KeyboardUtil; import org.bigbluebutton.main.events.ShortcutEvent; import org.bigbluebutton.modules.chat.model.ChatOptions; import org.bigbluebutton.util.i18n.ResourceUtil; @@ -97,8 +98,7 @@ with BigBlueButton; if not, see . private function handleKeyDown(e:KeyboardEvent) :void { var modifier:String = ExternalInterface.call("determineModifier"); loadKeyCombos(modifier); - var keyPress:String = (e.ctrlKey ? "control+" : "") + (e.shiftKey ? "shift+" : "") + - (e.altKey ? "alt+" : "") + e.keyCode; + var keyPress:String = KeyboardUtil.buildPressedKeys(e); if (keyCombos[keyPress]) { disp.dispatchEvent(new ShortcutEvent(keyCombos[keyPress])); } diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/PresentationWindow.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/PresentationWindow.mxml index 5e404e5390..3cd45ba848 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/PresentationWindow.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/PresentationWindow.mxml @@ -71,7 +71,6 @@ with BigBlueButton; if not, see . import mx.controls.Menu; import mx.events.MenuEvent; - import mx.events.ResizeEvent; import mx.managers.PopUpManager; import flexlib.mdi.events.MDIWindowEvent; @@ -81,6 +80,7 @@ with BigBlueButton; if not, see . import org.bigbluebutton.common.IBbbModuleWindow; import org.bigbluebutton.common.events.LocaleChangeEvent; import org.bigbluebutton.core.BBB; + import org.bigbluebutton.core.KeyboardUtil; import org.bigbluebutton.core.UsersUtil; import org.bigbluebutton.main.events.MadePresenterEvent; import org.bigbluebutton.main.events.ShortcutEvent; @@ -107,11 +107,11 @@ with BigBlueButton; if not, see . private static const LOGGER:ILogger = getClassLogger(PresentationWindow); - public static const TITLE:String = "Presentation"; + public static const TITLE:String = "Presentation"; private static const GOTO_PAGE_BUTTON:String = "Go to Page..."; [Bindable] - private var thumbY:Number; + private var thumbY:Number; public var uploadWindow:FileUploadWindow = null; private var pageDialog:GotoPageDialog; @@ -225,7 +225,7 @@ with BigBlueButton; if not, see . var modifier:String = ExternalInterface.call("determineModifier"); loadKeyCombos(modifier); - var keyPress:String = (e.ctrlKey ? "control+" : "") + (e.shiftKey ? "shift+" : "") + (e.altKey ? "alt+" : "") + e.keyCode; + var keyPress:String = KeyboardUtil.buildPressedKeys(e); if (keyCombos[keyPress]) { //globalDispatcher.dispatchEvent(new ShortcutEvent(keyCombos[keyPress])); diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/users/views/UsersWindow.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/users/views/UsersWindow.mxml index 109fb8e08a..904399336c 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/users/views/UsersWindow.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/users/views/UsersWindow.mxml @@ -63,6 +63,7 @@ import org.bigbluebutton.common.IBbbModuleWindow; import org.bigbluebutton.common.Images; import org.bigbluebutton.common.events.LocaleChangeEvent; + import org.bigbluebutton.core.KeyboardUtil; import org.bigbluebutton.core.TimerUtil; import org.bigbluebutton.core.UsersUtil; import org.bigbluebutton.core.events.LockControlEvent; @@ -492,8 +493,7 @@ // Handle general-access hotkeys, regardless of what window the user is focused in private function handleKeyDown(e:KeyboardEvent):void { if (keyCombos == null) loadKeyCombos(modifier); - var keyPress:String = (e.ctrlKey ? "control+" : "") + (e.shiftKey ? "shift+" : "") + - (e.altKey ? "alt+" : "") + e.keyCode; + var keyPress:String = KeyboardUtil.buildPressedKeys(e); if (keyCombos[keyPress]) { switch (keyCombos[keyPress]) { case FOCUS_USERS_LIST: diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/views/VideoDock.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/views/VideoDock.mxml index 1cceb3502c..67fa27195c 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/views/VideoDock.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/views/VideoDock.mxml @@ -40,6 +40,7 @@ with BigBlueButton; if not, see . import mx.core.UIComponent; + import org.bigbluebutton.core.KeyboardUtil; import org.bigbluebutton.main.events.ShortcutEvent; import org.bigbluebutton.main.views.MainCanvas; import org.bigbluebutton.modules.videoconf.model.VideoConfOptions; @@ -73,8 +74,7 @@ with BigBlueButton; if not, see . private function handleKeyDown(e:KeyboardEvent) :void { var modifier:String = ExternalInterface.call("determineModifier"); loadKeyCombos(modifier); - var keyPress:String = (e.ctrlKey ? "control+" : "") + (e.shiftKey ? "shift+" : "") + - (e.altKey ? "alt+" : "") + e.keyCode; + var keyPress:String = KeyboardUtil.buildPressedKeys(e); if (keyCombos[keyPress]) { disp.dispatchEvent(new ShortcutEvent(keyCombos[keyPress])); }