Rename KeyMap to Keymap

This commit is contained in:
József Farkas
2016-05-23 19:05:17 +02:00
parent dc280dae4c
commit 0725428309
8 changed files with 38 additions and 38 deletions

View File

@@ -1,15 +0,0 @@
import {ClassArray} from '../ClassArray';
import {UhkBuffer} from '../UhkBuffer';
import {KeyMap} from './KeyMap';
export class KeyMaps extends ClassArray<KeyMap> {
jsObjectToClass(jsObject: any): KeyMap {
return new KeyMap().fromJsObject(jsObject);
}
binaryToClass(buffer: UhkBuffer): KeyMap {
return new KeyMap().fromBinary(buffer);
}
}

View File

@@ -3,7 +3,7 @@ import {UhkBuffer} from '../UhkBuffer';
import {Layers} from './Layers';
import {assertUInt8} from '../assert';
export class KeyMap extends Serializable<KeyMap> {
export class Keymap extends Serializable<Keymap> {
@assertUInt8
id: number;
@@ -16,7 +16,7 @@ export class KeyMap extends Serializable<KeyMap> {
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<KeyMap> {
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<KeyMap> {
}
toString(): string {
return `<KeyMap id="${this.id}" name="${this.name}">`;
return `<Keymap id="${this.id}" name="${this.name}">`;
}
}

View File

@@ -0,0 +1,15 @@
import {ClassArray} from '../ClassArray';
import {UhkBuffer} from '../UhkBuffer';
import {Keymap} from './Keymap';
export class Keymaps extends ClassArray<Keymap> {
jsObjectToClass(jsObject: any): Keymap {
return new Keymap().fromJsObject(jsObject);
}
binaryToClass(buffer: UhkBuffer): Keymap {
return new Keymap().fromBinary(buffer);
}
}

View File

@@ -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<UhkConfiguration> {
moduleConfigurations: ModuleConfigurations;
keyMaps: KeyMaps;
keymaps: Keymaps;
macros: Macros;
@@ -38,7 +38,7 @@ export class UhkConfiguration extends Serializable<UhkConfiguration> {
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<UhkConfiguration> {
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<UhkConfiguration> {
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<UhkConfiguration> {
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<UhkConfiguration> {
return `<UhkConfiguration signature="${this.signature}">`;
}
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];
}
}
}

View File

@@ -8,8 +8,8 @@
"description": "Prologue",
"type": "integer"
},
"keyMaps": {
"description": "Array of keyMaps",
"keymaps": {
"description": "Array of keymaps",
"type": "array",
"items": {
"type": "object",

View File

@@ -12,7 +12,7 @@
"maxPointerSpeed": 200
}
],
"keyMaps": [
"keymaps": [
{
"id": 0,
"isDefault": true,

View File

@@ -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() { }

View File

@@ -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() {