From 0725428309744e22cb2abd61a89b74b5d1297273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zsef=20Farkas?= Date: Mon, 23 May 2016 19:05:17 +0200 Subject: [PATCH] Rename KeyMap to Keymap --- config-serializer/config-items/KeyMaps.ts | 15 ------------ .../config-items/{KeyMap.ts => Keymap.ts} | 8 +++---- config-serializer/config-items/Keymaps.ts | 15 ++++++++++++ .../config-items/UhkConfiguration.ts | 24 +++++++++---------- config-serializer/config-schema.json | 4 ++-- config-serializer/uhk-config.json | 2 +- .../popover/tab/keymap-tab.component.ts | 6 ++--- src/main-app.component.ts | 2 +- 8 files changed, 38 insertions(+), 38 deletions(-) delete mode 100644 config-serializer/config-items/KeyMaps.ts rename config-serializer/config-items/{KeyMap.ts => Keymap.ts} (86%) create mode 100644 config-serializer/config-items/Keymaps.ts diff --git a/config-serializer/config-items/KeyMaps.ts b/config-serializer/config-items/KeyMaps.ts deleted file mode 100644 index d6172a95..00000000 --- a/config-serializer/config-items/KeyMaps.ts +++ /dev/null @@ -1,15 +0,0 @@ -import {ClassArray} from '../ClassArray'; -import {UhkBuffer} from '../UhkBuffer'; -import {KeyMap} from './KeyMap'; - -export class KeyMaps extends ClassArray { - - jsObjectToClass(jsObject: any): KeyMap { - return new KeyMap().fromJsObject(jsObject); - } - - binaryToClass(buffer: UhkBuffer): KeyMap { - return new KeyMap().fromBinary(buffer); - } - -} diff --git a/config-serializer/config-items/KeyMap.ts b/config-serializer/config-items/Keymap.ts similarity index 86% rename from config-serializer/config-items/KeyMap.ts rename to config-serializer/config-items/Keymap.ts index 014a33e7..f4697054 100644 --- a/config-serializer/config-items/KeyMap.ts +++ b/config-serializer/config-items/Keymap.ts @@ -3,7 +3,7 @@ import {UhkBuffer} from '../UhkBuffer'; import {Layers} from './Layers'; import {assertUInt8} from '../assert'; -export class KeyMap extends Serializable { +export class Keymap extends Serializable { @assertUInt8 id: number; @@ -16,7 +16,7 @@ export class KeyMap extends Serializable { layers: Layers; - _fromJsObject(jsObject: any): KeyMap { + _fromJsObject(jsObject: any): Keymap { this.id = jsObject.id; this.isDefault = jsObject.isDefault; this.abbreviation = jsObject.abbreviation; @@ -25,7 +25,7 @@ export class KeyMap extends Serializable { return this; } - _fromBinary(buffer: UhkBuffer): KeyMap { + _fromBinary(buffer: UhkBuffer): Keymap { this.id = buffer.readUInt8(); this.isDefault = buffer.readBoolean(); this.abbreviation = buffer.readString(); @@ -53,6 +53,6 @@ export class KeyMap extends Serializable { } toString(): string { - return ``; + return ``; } } diff --git a/config-serializer/config-items/Keymaps.ts b/config-serializer/config-items/Keymaps.ts new file mode 100644 index 00000000..96a81bdc --- /dev/null +++ b/config-serializer/config-items/Keymaps.ts @@ -0,0 +1,15 @@ +import {ClassArray} from '../ClassArray'; +import {UhkBuffer} from '../UhkBuffer'; +import {Keymap} from './Keymap'; + +export class Keymaps extends ClassArray { + + jsObjectToClass(jsObject: any): Keymap { + return new Keymap().fromJsObject(jsObject); + } + + binaryToClass(buffer: UhkBuffer): Keymap { + return new Keymap().fromBinary(buffer); + } + +} diff --git a/config-serializer/config-items/UhkConfiguration.ts b/config-serializer/config-items/UhkConfiguration.ts index e1f5fbc6..c055ae6c 100644 --- a/config-serializer/config-items/UhkConfiguration.ts +++ b/config-serializer/config-items/UhkConfiguration.ts @@ -1,7 +1,7 @@ import {Serializable} from '../Serializable'; import {ModuleConfigurations} from './ModuleConfigurations'; -import {KeyMaps} from './KeyMaps'; -import {KeyMap} from './KeyMap'; +import {Keymaps} from './Keymaps'; +import {Keymap} from './Keymap'; import {Macros} from './Macros'; import {UhkBuffer} from '../UhkBuffer'; import {assertUInt8, assertUInt32} from '../assert'; @@ -24,7 +24,7 @@ export class UhkConfiguration extends Serializable { moduleConfigurations: ModuleConfigurations; - keyMaps: KeyMaps; + keymaps: Keymaps; macros: Macros; @@ -38,7 +38,7 @@ export class UhkConfiguration extends Serializable { this.hardwareId = jsObject.hardwareId; this.brandId = jsObject.brandId; this.moduleConfigurations = new ModuleConfigurations().fromJsObject(jsObject.moduleConfigurations); - this.keyMaps = new KeyMaps().fromJsObject(jsObject.keyMaps); + this.keymaps = new Keymaps().fromJsObject(jsObject.keymaps); this.macros = new Macros().fromJsObject(jsObject.macros); this.epilogue = jsObject.epilogue; return this; @@ -51,7 +51,7 @@ export class UhkConfiguration extends Serializable { this.hardwareId = buffer.readUInt8(); this.brandId = buffer.readUInt8(); this.moduleConfigurations = new ModuleConfigurations().fromBinary(buffer); - this.keyMaps = new KeyMaps().fromBinary(buffer); + this.keymaps = new Keymaps().fromBinary(buffer); this.macros = new Macros().fromBinary(buffer); this.epilogue = buffer.readUInt32(); return this; @@ -65,7 +65,7 @@ export class UhkConfiguration extends Serializable { hardwareId: this.hardwareId, brandId: this.brandId, moduleConfigurations: this.moduleConfigurations.toJsObject(), - keyMaps: this.keyMaps.toJsObject(), + keymaps: this.keymaps.toJsObject(), macros: this.macros.toJsObject(), epilogue: this.epilogue }; @@ -78,7 +78,7 @@ export class UhkConfiguration extends Serializable { buffer.writeUInt8(this.hardwareId); buffer.writeUInt8(this.brandId); this.moduleConfigurations.toBinary(buffer); - this.keyMaps.toBinary(buffer); + this.keymaps.toBinary(buffer); this.macros.toBinary(buffer); buffer.writeUInt32(this.epilogue); } @@ -87,11 +87,11 @@ export class UhkConfiguration extends Serializable { return ``; } - getKeymap(keymapId: number): KeyMap { - let keyMaps: KeyMap[] = this.keyMaps.elements; - for (let i = 0; i < keyMaps.length; ++i) { - if (keymapId === keyMaps[i].id) { - return keyMaps[i]; + getKeymap(keymapId: number): Keymap { + let keymaps: Keymap[] = this.keymaps.elements; + for (let i = 0; i < keymaps.length; ++i) { + if (keymapId === keymaps[i].id) { + return keymaps[i]; } } } diff --git a/config-serializer/config-schema.json b/config-serializer/config-schema.json index df83e460..31a5675d 100644 --- a/config-serializer/config-schema.json +++ b/config-serializer/config-schema.json @@ -8,8 +8,8 @@ "description": "Prologue", "type": "integer" }, - "keyMaps": { - "description": "Array of keyMaps", + "keymaps": { + "description": "Array of keymaps", "type": "array", "items": { "type": "object", diff --git a/config-serializer/uhk-config.json b/config-serializer/uhk-config.json index a919d1da..e3f7942b 100644 --- a/config-serializer/uhk-config.json +++ b/config-serializer/uhk-config.json @@ -12,7 +12,7 @@ "maxPointerSpeed": 200 } ], - "keyMaps": [ + "keymaps": [ { "id": 0, "isDefault": true, diff --git a/src/components/popover/tab/keymap-tab.component.ts b/src/components/popover/tab/keymap-tab.component.ts index e0b6523d..913d46bf 100644 --- a/src/components/popover/tab/keymap-tab.component.ts +++ b/src/components/popover/tab/keymap-tab.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit } from '@angular/core'; import {UhkConfigurationService} from '../../../services/uhk-configuration.service'; -import {KeyMap} from '../../../../config-serializer/config-items/KeyMap'; +import {Keymap} from '../../../../config-serializer/config-items/Keymap'; import {SvgKeyboardComponent} from '../../svg-keyboard.component'; @Component({ @@ -30,12 +30,12 @@ import {SvgKeyboardComponent} from '../../svg-keyboard.component'; }) export class KeymapTabComponent implements OnInit { - private keymaps: KeyMap[]; + private keymaps: Keymap[]; private selectedKeymapIndex: number; constructor(uhkConfigurationService: UhkConfigurationService) { this.selectedKeymapIndex = -1; - this.keymaps = uhkConfigurationService.getUhkConfiguration().keyMaps.elements; + this.keymaps = uhkConfigurationService.getUhkConfiguration().keymaps.elements; } ngOnInit() { } diff --git a/src/main-app.component.ts b/src/main-app.component.ts index f4643355..3b59f7ef 100644 --- a/src/main-app.component.ts +++ b/src/main-app.component.ts @@ -61,7 +61,7 @@ export class MainAppComponent implements OnInit, AfterViewInit { } ngOnInit() { - this.layers = this.uhkConfigurationService.getUhkConfiguration().keyMaps.elements[0].layers; + this.layers = this.uhkConfigurationService.getUhkConfiguration().keymaps.elements[0].layers; } ngAfterViewInit() {