Rename KeyMap to Keymap
This commit is contained in:
@@ -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,7 @@ import {UhkBuffer} from '../UhkBuffer';
|
|||||||
import {Layers} from './Layers';
|
import {Layers} from './Layers';
|
||||||
import {assertUInt8} from '../assert';
|
import {assertUInt8} from '../assert';
|
||||||
|
|
||||||
export class KeyMap extends Serializable<KeyMap> {
|
export class Keymap extends Serializable<Keymap> {
|
||||||
|
|
||||||
@assertUInt8
|
@assertUInt8
|
||||||
id: number;
|
id: number;
|
||||||
@@ -16,7 +16,7 @@ export class KeyMap extends Serializable<KeyMap> {
|
|||||||
|
|
||||||
layers: Layers;
|
layers: Layers;
|
||||||
|
|
||||||
_fromJsObject(jsObject: any): KeyMap {
|
_fromJsObject(jsObject: any): Keymap {
|
||||||
this.id = jsObject.id;
|
this.id = jsObject.id;
|
||||||
this.isDefault = jsObject.isDefault;
|
this.isDefault = jsObject.isDefault;
|
||||||
this.abbreviation = jsObject.abbreviation;
|
this.abbreviation = jsObject.abbreviation;
|
||||||
@@ -25,7 +25,7 @@ export class KeyMap extends Serializable<KeyMap> {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
_fromBinary(buffer: UhkBuffer): KeyMap {
|
_fromBinary(buffer: UhkBuffer): Keymap {
|
||||||
this.id = buffer.readUInt8();
|
this.id = buffer.readUInt8();
|
||||||
this.isDefault = buffer.readBoolean();
|
this.isDefault = buffer.readBoolean();
|
||||||
this.abbreviation = buffer.readString();
|
this.abbreviation = buffer.readString();
|
||||||
@@ -53,6 +53,6 @@ export class KeyMap extends Serializable<KeyMap> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toString(): string {
|
toString(): string {
|
||||||
return `<KeyMap id="${this.id}" name="${this.name}">`;
|
return `<Keymap id="${this.id}" name="${this.name}">`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import {Serializable} from '../Serializable';
|
import {Serializable} from '../Serializable';
|
||||||
import {ModuleConfigurations} from './ModuleConfigurations';
|
import {ModuleConfigurations} from './ModuleConfigurations';
|
||||||
import {KeyMaps} from './KeyMaps';
|
import {Keymaps} from './Keymaps';
|
||||||
import {KeyMap} from './KeyMap';
|
import {Keymap} from './Keymap';
|
||||||
import {Macros} from './Macros';
|
import {Macros} from './Macros';
|
||||||
import {UhkBuffer} from '../UhkBuffer';
|
import {UhkBuffer} from '../UhkBuffer';
|
||||||
import {assertUInt8, assertUInt32} from '../assert';
|
import {assertUInt8, assertUInt32} from '../assert';
|
||||||
@@ -24,7 +24,7 @@ export class UhkConfiguration extends Serializable<UhkConfiguration> {
|
|||||||
|
|
||||||
moduleConfigurations: ModuleConfigurations;
|
moduleConfigurations: ModuleConfigurations;
|
||||||
|
|
||||||
keyMaps: KeyMaps;
|
keymaps: Keymaps;
|
||||||
|
|
||||||
macros: Macros;
|
macros: Macros;
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ export class UhkConfiguration extends Serializable<UhkConfiguration> {
|
|||||||
this.hardwareId = jsObject.hardwareId;
|
this.hardwareId = jsObject.hardwareId;
|
||||||
this.brandId = jsObject.brandId;
|
this.brandId = jsObject.brandId;
|
||||||
this.moduleConfigurations = new ModuleConfigurations().fromJsObject(jsObject.moduleConfigurations);
|
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.macros = new Macros().fromJsObject(jsObject.macros);
|
||||||
this.epilogue = jsObject.epilogue;
|
this.epilogue = jsObject.epilogue;
|
||||||
return this;
|
return this;
|
||||||
@@ -51,7 +51,7 @@ export class UhkConfiguration extends Serializable<UhkConfiguration> {
|
|||||||
this.hardwareId = buffer.readUInt8();
|
this.hardwareId = buffer.readUInt8();
|
||||||
this.brandId = buffer.readUInt8();
|
this.brandId = buffer.readUInt8();
|
||||||
this.moduleConfigurations = new ModuleConfigurations().fromBinary(buffer);
|
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.macros = new Macros().fromBinary(buffer);
|
||||||
this.epilogue = buffer.readUInt32();
|
this.epilogue = buffer.readUInt32();
|
||||||
return this;
|
return this;
|
||||||
@@ -65,7 +65,7 @@ export class UhkConfiguration extends Serializable<UhkConfiguration> {
|
|||||||
hardwareId: this.hardwareId,
|
hardwareId: this.hardwareId,
|
||||||
brandId: this.brandId,
|
brandId: this.brandId,
|
||||||
moduleConfigurations: this.moduleConfigurations.toJsObject(),
|
moduleConfigurations: this.moduleConfigurations.toJsObject(),
|
||||||
keyMaps: this.keyMaps.toJsObject(),
|
keymaps: this.keymaps.toJsObject(),
|
||||||
macros: this.macros.toJsObject(),
|
macros: this.macros.toJsObject(),
|
||||||
epilogue: this.epilogue
|
epilogue: this.epilogue
|
||||||
};
|
};
|
||||||
@@ -78,7 +78,7 @@ export class UhkConfiguration extends Serializable<UhkConfiguration> {
|
|||||||
buffer.writeUInt8(this.hardwareId);
|
buffer.writeUInt8(this.hardwareId);
|
||||||
buffer.writeUInt8(this.brandId);
|
buffer.writeUInt8(this.brandId);
|
||||||
this.moduleConfigurations.toBinary(buffer);
|
this.moduleConfigurations.toBinary(buffer);
|
||||||
this.keyMaps.toBinary(buffer);
|
this.keymaps.toBinary(buffer);
|
||||||
this.macros.toBinary(buffer);
|
this.macros.toBinary(buffer);
|
||||||
buffer.writeUInt32(this.epilogue);
|
buffer.writeUInt32(this.epilogue);
|
||||||
}
|
}
|
||||||
@@ -87,11 +87,11 @@ export class UhkConfiguration extends Serializable<UhkConfiguration> {
|
|||||||
return `<UhkConfiguration signature="${this.signature}">`;
|
return `<UhkConfiguration signature="${this.signature}">`;
|
||||||
}
|
}
|
||||||
|
|
||||||
getKeymap(keymapId: number): KeyMap {
|
getKeymap(keymapId: number): Keymap {
|
||||||
let keyMaps: KeyMap[] = this.keyMaps.elements;
|
let keymaps: Keymap[] = this.keymaps.elements;
|
||||||
for (let i = 0; i < keyMaps.length; ++i) {
|
for (let i = 0; i < keymaps.length; ++i) {
|
||||||
if (keymapId === keyMaps[i].id) {
|
if (keymapId === keymaps[i].id) {
|
||||||
return keyMaps[i];
|
return keymaps[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
"description": "Prologue",
|
"description": "Prologue",
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"keyMaps": {
|
"keymaps": {
|
||||||
"description": "Array of keyMaps",
|
"description": "Array of keymaps",
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
"maxPointerSpeed": 200
|
"maxPointerSpeed": 200
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"keyMaps": [
|
"keymaps": [
|
||||||
{
|
{
|
||||||
"id": 0,
|
"id": 0,
|
||||||
"isDefault": true,
|
"isDefault": true,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
import {UhkConfigurationService} from '../../../services/uhk-configuration.service';
|
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';
|
import {SvgKeyboardComponent} from '../../svg-keyboard.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -30,12 +30,12 @@ import {SvgKeyboardComponent} from '../../svg-keyboard.component';
|
|||||||
})
|
})
|
||||||
export class KeymapTabComponent implements OnInit {
|
export class KeymapTabComponent implements OnInit {
|
||||||
|
|
||||||
private keymaps: KeyMap[];
|
private keymaps: Keymap[];
|
||||||
private selectedKeymapIndex: number;
|
private selectedKeymapIndex: number;
|
||||||
|
|
||||||
constructor(uhkConfigurationService: UhkConfigurationService) {
|
constructor(uhkConfigurationService: UhkConfigurationService) {
|
||||||
this.selectedKeymapIndex = -1;
|
this.selectedKeymapIndex = -1;
|
||||||
this.keymaps = uhkConfigurationService.getUhkConfiguration().keyMaps.elements;
|
this.keymaps = uhkConfigurationService.getUhkConfiguration().keymaps.elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() { }
|
ngOnInit() { }
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export class MainAppComponent implements OnInit, AfterViewInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.layers = this.uhkConfigurationService.getUhkConfiguration().keyMaps.elements[0].layers;
|
this.layers = this.uhkConfigurationService.getUhkConfiguration().keymaps.elements[0].layers;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
|
|||||||
Reference in New Issue
Block a user