Moved build pressed keys function to KeyboardUtil class.

This commit is contained in:
Ghazi Triki 2017-02-13 10:28:51 +01:00
parent 5a86a04adf
commit cb6b798fea
7 changed files with 57 additions and 26 deletions

View File

@ -33,19 +33,22 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<mx:Script> <mx:Script>
<![CDATA[ <![CDATA[
import com.asfusion.mate.events.Dispatcher; import com.asfusion.mate.events.Dispatcher;
import flash.events.Event;
import flash.events.Event;
import mx.managers.HistoryManager; import mx.managers.HistoryManager;
import mx.managers.IDragManager; import mx.managers.IDragManager;
import mx.managers.ToolTipManager; import mx.managers.ToolTipManager;
import mx.utils.URLUtil; import mx.utils.URLUtil;
import org.as3commons.logging.api.ILogger; import org.as3commons.logging.api.ILogger;
import org.as3commons.logging.api.getClassLogger; import org.as3commons.logging.api.getClassLogger;
import org.bigbluebutton.core.BBB; import org.bigbluebutton.core.BBB;
import org.bigbluebutton.core.KeyboardUtil;
import org.bigbluebutton.main.api.ExternalApiCallbacks; import org.bigbluebutton.main.api.ExternalApiCallbacks;
import org.bigbluebutton.main.events.ShortcutEvent; import org.bigbluebutton.main.events.ShortcutEvent;
import org.bigbluebutton.main.model.ShortcutOptions; import org.bigbluebutton.main.model.ShortcutOptions;
import org.bigbluebutton.util.QueryStringParameters;
import org.bigbluebutton.util.i18n.ResourceUtil; import org.bigbluebutton.util.i18n.ResourceUtil;
private static const LOGGER:ILogger = getClassLogger(BigBlueButtonMainContainer); private static const LOGGER:ILogger = getClassLogger(BigBlueButtonMainContainer);
@ -199,7 +202,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function handleKeyDown(e:KeyboardEvent) :void { private function handleKeyDown(e:KeyboardEvent) :void {
if (keyCombos == null) loadKeyCombos(globalModifier); 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){ if (e.keyCode < 64 || e.keyCode > 90){
LOGGER.debug("Keypress debugging: KeyCode {0} is nonalphabetic (probably)", [e.keyCode]); LOGGER.debug("Keypress debugging: KeyCode {0} is nonalphabetic (probably)", [e.keyCode]);

View File

@ -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 <http://www.gnu.org/licenses/>.
*
*/
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;
}
}
}

View File

@ -79,6 +79,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.as3commons.lang.StringUtils; import org.as3commons.lang.StringUtils;
import org.as3commons.logging.api.ILogger; import org.as3commons.logging.api.ILogger;
import org.as3commons.logging.api.getClassLogger; import org.as3commons.logging.api.getClassLogger;
import org.bigbluebutton.core.KeyboardUtil;
import org.bigbluebutton.core.TimerUtil; import org.bigbluebutton.core.TimerUtil;
import org.bigbluebutton.core.UsersUtil; import org.bigbluebutton.core.UsersUtil;
import org.bigbluebutton.core.events.LockControlEvent; import org.bigbluebutton.core.events.LockControlEvent;
@ -106,25 +107,25 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private static const LOGGER:ILogger = getClassLogger(ChatBox); private static const LOGGER:ILogger = getClassLogger(ChatBox);
public var publicChat:Boolean = false; public var publicChat:Boolean = false;
public var chatWithUserID:String; public var chatWithUserID:String;
public var chatWithUsername:String public var chatWithUsername:String
public var read:Boolean = true; public var read:Boolean = true;
public var userHasLeft:Boolean = false; public var userHasLeft:Boolean = false;
private var globalDispatcher:Dispatcher = new Dispatcher(); private var globalDispatcher:Dispatcher = new Dispatcher();
[Bindable] public var colorPickerColours:Array = ['0x000000', '0x7A7A7A' ,'0xFF0000', '0xFF8800', [Bindable] public var colorPickerColours:Array = ['0x000000', '0x7A7A7A' ,'0xFF0000', '0xFF8800',
'0x88FF00', '0x00FF00', '0x00FF88', '0x00FFFF', '0x0088FF', '0x0000FF', '0x8800FF', '0xFF00FF']; '0x88FF00', '0x00FF00', '0x00FF88', '0x00FFFF', '0x0088FF', '0x0000FF', '0x8800FF', '0xFF00FF'];
[Bindable] [Bindable]
private var backgroundColor:uint = 0x000000; private var backgroundColor:uint = 0x000000;
private var lastSenderId:String = ""; private var lastSenderId:String = "";
private var lastTime:String = ""; private var lastTime:String = "";
[Bindable] [Bindable]
private var chatMessages:ChatConversation = new ChatConversation(); private var chatMessages:ChatConversation = new ChatConversation();
private var lastCount:Number = 0; private var lastCount:Number = 0;
private var scrollTimer:Timer; private var scrollTimer:Timer;
private var currentMessage:int; private var currentMessage:int;
@ -145,8 +146,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private var indicatorNeeded:Boolean = false private var indicatorNeeded:Boolean = false
private var repeat:Boolean = false; private var repeat:Boolean = false;
[Bindable] [Bindable]
private var chatListHeight:Number = 100; private var chatListHeight:Number = 100;
[Bindable] public var chatOptions:ChatOptions = new ChatOptions(); [Bindable] public var chatOptions:ChatOptions = new ChatOptions();
@ -446,7 +447,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
var modifier:String = ExternalInterface.call("determineModifier"); var modifier:String = ExternalInterface.call("determineModifier");
loadKeyCombos(modifier); 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]) { if (keyCombos[keyPress]) {
LOGGER.debug("WATERFALL: Caught shortcut in chat box, {0}", [keyCombos[keyPress]]); LOGGER.debug("WATERFALL: Caught shortcut in chat box, {0}", [keyCombos[keyPress]]);

View File

@ -43,6 +43,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.common.IBbbModuleWindow; import org.bigbluebutton.common.IBbbModuleWindow;
import org.bigbluebutton.common.events.LocaleChangeEvent; import org.bigbluebutton.common.events.LocaleChangeEvent;
import org.bigbluebutton.core.KeyboardUtil;
import org.bigbluebutton.main.events.ShortcutEvent; import org.bigbluebutton.main.events.ShortcutEvent;
import org.bigbluebutton.modules.chat.model.ChatOptions; import org.bigbluebutton.modules.chat.model.ChatOptions;
import org.bigbluebutton.util.i18n.ResourceUtil; import org.bigbluebutton.util.i18n.ResourceUtil;
@ -97,8 +98,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function handleKeyDown(e:KeyboardEvent) :void { private function handleKeyDown(e:KeyboardEvent) :void {
var modifier:String = ExternalInterface.call("determineModifier"); var modifier:String = ExternalInterface.call("determineModifier");
loadKeyCombos(modifier); loadKeyCombos(modifier);
var keyPress:String = (e.ctrlKey ? "control+" : "") + (e.shiftKey ? "shift+" : "") + var keyPress:String = KeyboardUtil.buildPressedKeys(e);
(e.altKey ? "alt+" : "") + e.keyCode;
if (keyCombos[keyPress]) { if (keyCombos[keyPress]) {
disp.dispatchEvent(new ShortcutEvent(keyCombos[keyPress])); disp.dispatchEvent(new ShortcutEvent(keyCombos[keyPress]));
} }

View File

@ -71,7 +71,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import mx.controls.Menu; import mx.controls.Menu;
import mx.events.MenuEvent; import mx.events.MenuEvent;
import mx.events.ResizeEvent;
import mx.managers.PopUpManager; import mx.managers.PopUpManager;
import flexlib.mdi.events.MDIWindowEvent; import flexlib.mdi.events.MDIWindowEvent;
@ -81,6 +80,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.common.IBbbModuleWindow; import org.bigbluebutton.common.IBbbModuleWindow;
import org.bigbluebutton.common.events.LocaleChangeEvent; import org.bigbluebutton.common.events.LocaleChangeEvent;
import org.bigbluebutton.core.BBB; import org.bigbluebutton.core.BBB;
import org.bigbluebutton.core.KeyboardUtil;
import org.bigbluebutton.core.UsersUtil; import org.bigbluebutton.core.UsersUtil;
import org.bigbluebutton.main.events.MadePresenterEvent; import org.bigbluebutton.main.events.MadePresenterEvent;
import org.bigbluebutton.main.events.ShortcutEvent; import org.bigbluebutton.main.events.ShortcutEvent;
@ -107,11 +107,11 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private static const LOGGER:ILogger = getClassLogger(PresentationWindow); 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..."; private static const GOTO_PAGE_BUTTON:String = "Go to Page...";
[Bindable] [Bindable]
private var thumbY:Number; private var thumbY:Number;
public var uploadWindow:FileUploadWindow = null; public var uploadWindow:FileUploadWindow = null;
private var pageDialog:GotoPageDialog; private var pageDialog:GotoPageDialog;
@ -225,7 +225,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
var modifier:String = ExternalInterface.call("determineModifier"); var modifier:String = ExternalInterface.call("determineModifier");
loadKeyCombos(modifier); 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]) { if (keyCombos[keyPress]) {
//globalDispatcher.dispatchEvent(new ShortcutEvent(keyCombos[keyPress])); //globalDispatcher.dispatchEvent(new ShortcutEvent(keyCombos[keyPress]));

View File

@ -63,6 +63,7 @@
import org.bigbluebutton.common.IBbbModuleWindow; import org.bigbluebutton.common.IBbbModuleWindow;
import org.bigbluebutton.common.Images; import org.bigbluebutton.common.Images;
import org.bigbluebutton.common.events.LocaleChangeEvent; import org.bigbluebutton.common.events.LocaleChangeEvent;
import org.bigbluebutton.core.KeyboardUtil;
import org.bigbluebutton.core.TimerUtil; import org.bigbluebutton.core.TimerUtil;
import org.bigbluebutton.core.UsersUtil; import org.bigbluebutton.core.UsersUtil;
import org.bigbluebutton.core.events.LockControlEvent; import org.bigbluebutton.core.events.LockControlEvent;
@ -492,8 +493,7 @@
// Handle general-access hotkeys, regardless of what window the user is focused in // Handle general-access hotkeys, regardless of what window the user is focused in
private function handleKeyDown(e:KeyboardEvent):void { private function handleKeyDown(e:KeyboardEvent):void {
if (keyCombos == null) loadKeyCombos(modifier); if (keyCombos == null) loadKeyCombos(modifier);
var keyPress:String = (e.ctrlKey ? "control+" : "") + (e.shiftKey ? "shift+" : "") + var keyPress:String = KeyboardUtil.buildPressedKeys(e);
(e.altKey ? "alt+" : "") + e.keyCode;
if (keyCombos[keyPress]) { if (keyCombos[keyPress]) {
switch (keyCombos[keyPress]) { switch (keyCombos[keyPress]) {
case FOCUS_USERS_LIST: case FOCUS_USERS_LIST:

View File

@ -40,6 +40,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import mx.core.UIComponent; import mx.core.UIComponent;
import org.bigbluebutton.core.KeyboardUtil;
import org.bigbluebutton.main.events.ShortcutEvent; import org.bigbluebutton.main.events.ShortcutEvent;
import org.bigbluebutton.main.views.MainCanvas; import org.bigbluebutton.main.views.MainCanvas;
import org.bigbluebutton.modules.videoconf.model.VideoConfOptions; import org.bigbluebutton.modules.videoconf.model.VideoConfOptions;
@ -73,8 +74,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function handleKeyDown(e:KeyboardEvent) :void { private function handleKeyDown(e:KeyboardEvent) :void {
var modifier:String = ExternalInterface.call("determineModifier"); var modifier:String = ExternalInterface.call("determineModifier");
loadKeyCombos(modifier); loadKeyCombos(modifier);
var keyPress:String = (e.ctrlKey ? "control+" : "") + (e.shiftKey ? "shift+" : "") + var keyPress:String = KeyboardUtil.buildPressedKeys(e);
(e.altKey ? "alt+" : "") + e.keyCode;
if (keyCombos[keyPress]) { if (keyCombos[keyPress]) {
disp.dispatchEvent(new ShortcutEvent(keyCombos[keyPress])); disp.dispatchEvent(new ShortcutEvent(keyCombos[keyPress]));
} }