Add new system scan codes (#316)

Closes #304
This commit is contained in:
Attila Csanyi
2017-06-21 20:09:39 +02:00
committed by József Farkas
parent 6e23b2a91b
commit 2598109f8c
6 changed files with 66 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generated by IcoMoon.io -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16">
<path fill="#000000" d="M10 2.29v2.124c0.566 0.247 1.086 0.6 1.536 1.050 0.944 0.944 1.464 2.2 1.464 3.536s-0.52 2.591-1.464 3.536c-0.944 0.944-2.2 1.464-3.536 1.464s-2.591-0.52-3.536-1.464c-0.944-0.944-1.464-2.2-1.464-3.536s0.52-2.591 1.464-3.536c0.45-0.45 0.97-0.803 1.536-1.050v-2.124c-2.891 0.861-5 3.539-5 6.71 0 3.866 3.134 7 7 7s7-3.134 7-7c0-3.171-2.109-5.849-5-6.71zM7 0h2v8h-2z"></path>
</svg>

After

Width:  |  Height:  |  Size: 716 B

View File

Before

Width:  |  Height:  |  Size: 562 B

After

Width:  |  Height:  |  Size: 562 B

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generated by IcoMoon.io -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16">
<path fill="#000000" d="M16 13c-1.657 0-3-1.343-3-3v-4.455c0-2.199-1.718-4.033-4-4.454v-1.091h-2v1.091c-2.282 0.421-4 2.255-4 4.454v4.455c0 1.657-1.343 3-3 3v1h6.712c-0.081 0.178-0.127 0.377-0.127 0.586 0 0.781 0.633 1.414 1.414 1.414s1.414-0.633 1.414-1.414c0-0.209-0.045-0.407-0.127-0.586h6.713v-1z"></path>
<path fill="#000000" d="M15.483 6c-0.261 0-0.481-0.203-0.498-0.467-0.118-1.787-0.908-3.444-2.226-4.666-0.202-0.188-0.214-0.504-0.027-0.707s0.504-0.214 0.707-0.027c1.506 1.397 2.409 3.291 2.543 5.334 0.018 0.276-0.191 0.514-0.466 0.532-0.011 0.001-0.022 0.001-0.033 0.001z"></path>
<path fill="#000000" d="M0.517 6c-0.011 0-0.022-0-0.033-0.001-0.276-0.018-0.484-0.256-0.466-0.532 0.134-2.043 1.038-3.937 2.543-5.334 0.203-0.188 0.519-0.176 0.707 0.027s0.176 0.519-0.027 0.707c-1.318 1.222-2.108 2.879-2.226 4.666-0.017 0.264-0.237 0.467-0.498 0.467z"></path>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -195,7 +195,8 @@ export class KeypressTabComponent extends Tab implements OnChanges {
}
private findScancodeOptionByScancode(scancode: number, type: KeystrokeType): Select2OptionData {
const typeToFind: string = type === KeystrokeType.shortMedia || KeystrokeType.longMedia ? 'media' : KeystrokeType[type];
const typeToFind: string =
(type === KeystrokeType.shortMedia || type === KeystrokeType.longMedia) ? 'media' : KeystrokeType[type];
return this.findScancodeOptionBy((option: Select2OptionData) => {
const additional = option.additional;
if (additional && additional.scancode === scancode && additional.type === typeToFind) {

View File

@@ -654,5 +654,34 @@
}
}
]
},
{
"text": "System Keys",
"children": [
{
"id": "139",
"text": "Power Down",
"additional": {
"type": "system",
"scancode": 129
}
},
{
"id": "140",
"text": "Sleep",
"additional": {
"type": "system",
"scancode": 130
}
},
{
"id": "141",
"text": "Wake Up",
"additional": {
"type": "system",
"scancode": 131
}
}
]
}
]

View File

@@ -10,9 +10,11 @@ export class MapperService {
private basicScanCodeTextMap: Map<number, string[]>;
private mediaScanCodeTextMap: Map<number, string[]>;
private sytemScanCodeTextMap: Map<number, string[]>;
private basicScancodeIcons: Map<number, string>;
private mediaScancodeIcons: Map<number, string>;
private systemScancodeIcons: Map<number, string>;
private nameToFileName: Map<string, string>;
constructor() {
@@ -28,6 +30,9 @@ export class MapperService {
case KeystrokeType.longMedia:
map = this.mediaScanCodeTextMap;
break;
case KeystrokeType.system:
map = this.sytemScanCodeTextMap;
break;
default:
map = this.basicScanCodeTextMap;
break;
@@ -45,6 +50,9 @@ export class MapperService {
case KeystrokeType.longMedia:
map = this.mediaScancodeIcons;
break;
case KeystrokeType.system:
map = this.systemScancodeIcons;
break;
default:
map = new Map<number, string>();
}
@@ -61,6 +69,9 @@ export class MapperService {
case KeystrokeType.longMedia:
map = this.mediaScancodeIcons;
break;
case KeystrokeType.system:
map = this.systemScancodeIcons;
break;
default:
return undefined;
}
@@ -207,6 +218,11 @@ export class MapperService {
this.mediaScanCodeTextMap.set(226, ['Mute']);
this.mediaScanCodeTextMap.set(233, ['Vol +']);
this.mediaScanCodeTextMap.set(234, ['Vol -']);
this.sytemScanCodeTextMap = new Map<number, string[]>();
this.sytemScanCodeTextMap.set(129, ['Power Down']);
this.sytemScanCodeTextMap.set(130, ['Sleep']);
this.sytemScanCodeTextMap.set(131, ['Wake Up']);
}
private initScancodeIcons(): void {
@@ -227,6 +243,11 @@ export class MapperService {
this.mediaScancodeIcons.set(226, 'icon-kbd__media--mute');
this.mediaScancodeIcons.set(233, 'icon-kbd__media--vol-up');
this.mediaScancodeIcons.set(234, 'icon-kbd__media--vol-down');
this.systemScancodeIcons = new Map<number, string>();
this.systemScancodeIcons.set(129, 'icon-kbd__system_power_down');
this.systemScancodeIcons.set(130, 'icon-kbd__system_sleep');
this.systemScancodeIcons.set(131, 'icon-kbd__system_wake_up');
}
private initNameToFileNames(): void {