16 Commits

Author SHA1 Message Date
László Monda
d3295c5666 Bump package.json and changelog to version 1.0.4 2017-12-30 15:29:02 +01:00
László Monda
216793bbb8 Add get-{left,right}-firmware-version.js 2017-12-29 13:34:49 +01:00
László Monda
558c8b0dbf Merge branch 'master' of github.com:UltimateHackingKeyboard/agent 2017-12-29 13:24:26 +01:00
László Monda
e3c65f77df Rename getProperty to getDeviceProperty and getModuleProperties to getModuleProperty. 2017-12-29 13:23:58 +01:00
László Monda
227f8f0d2c Update package-lock.json files. 2017-12-29 13:23:32 +01:00
Mikko Lakomaa
7e0bc39de1 Mouse speed UI (#537)
* Add SliderProps interface to SliderWrapperComponent

* Implement mouse speed page

* Remove duplicate DefaultUserConfigurationService from shared module

* Add Reset speeds to default button

* Move reset button to bottom of mouse speed page

* Change mouse move slider step to 25

* Add label and tooltip handling to SliderWrapperComponent

* Use altered SliderWrapperComponent in mouse speed page

* Use altered SliderWrapperComponent in LED brightness page

* Move Reset mouse speeds confirmation popover to above button

* Add reset mouse speed settings action and effect

* Use ResetMouseSpeedSettingsAction in mouse speed page to reset settings

* Remove unused import
2017-12-29 13:07:01 +01:00
Spencer Owen
c4d3648f73 Invert scroll on mac (#536) 2017-12-28 13:50:11 +01:00
László Monda
547ab738c2 Update package.json and changelog to version 1.0.3 2017-12-28 01:31:38 +01:00
László Monda
3de9e9aa84 Downgrade to firmware 8.0.0 because the left I2C watchdog of firmware 8.0.1 is not proven yet and might make things worse. 2017-12-28 01:09:01 +01:00
László Monda
01ac4c1e8b Note that macro playback is not implemented yet. 2017-12-27 23:30:08 +01:00
László Monda
a0c8849f13 Comment out the add keymap button because the add keymap page is practically useless now. It'll be reimplemented. 2017-12-27 23:06:58 +01:00
László Monda
2a3dfcb0d0 Improve firmware update messages. 2017-12-27 22:47:53 +01:00
László Monda
2b3462c33f Display retry firmware update messages with regular color because they're not errors. 2017-12-27 22:38:07 +01:00
László Monda
a0b838b2e9 Remove the secondary scroll bar that appears on the LED brightness page. 2017-12-27 20:43:25 +01:00
Mikko Lakomaa
90f56c350e LED brightness UI (#520)
* Add nouislider

* Add LEDBrightnessComponent

* Move LEDBrightnessComponent to correct folder

* Add LED brightness page to side menu and device routes

* Add LEDBrightnessComponent to device index file

* Add LEDBrightnessComponent and NouisliderModule to shared module

* Remove ngModelChange from LEDBrightnessComponent until onChange is implemented

* Fix stylelint issue in led brightness component

* Add nouislider files to webpack.config.js

* Add adjusting LED brightness sliders with arrow keys

* Various tweaks to LEDBrightnessComponent

* Fix linting issues in LEDBrightnessComponent

* Allow "::ng-deep" pseudo element in stylelint config

* Add reading LED brightness settings from user configuration

* led-brightness save

* Move slider to its own wrapper component, add debounce for slider change events

* Small fixes to imports and exports of SliderWrapperComponent

* Fix slide component making change event when initial value is set

* Export SliderPips interface

* Fix LED Brightness slider pips

* Add support for value unit in SliderWrapperComponent

* Add a bit of space before LED brightness sliders so the slider handle doesn't go beyond the page in the min position

* Implement onDestroy, fix slider pip values and imports in LEDBrightnessComponent

* Fix imports, implement onDestroy in SliderWrapperComponent

* Move fix for slider pip value style to global styles file

* Reorder stylelint rules
2017-12-27 20:10:55 +01:00
József Farkas
5ceca41e0f feat(renderer): show icon when possible even if the keystroke action has modifier (#533)
Closes #513
2017-12-26 23:23:32 +01:00
44 changed files with 652 additions and 48 deletions

View File

@@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.
The format is loosely based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
## [1.0.4] - 2017-12-30
Firmware: [8.0.0](https://github.com/UltimateHackingKeyboard/firmware/releases/tag/8.0.0) | Device Protocol: 4.0.0 | User Config: 4.0.0 | Hardware Config: 1.0.0
- Add mouse speed settings.
## [1.0.3] - 2017-12-28
Firmware: [8.0.**0**](https://github.com/UltimateHackingKeyboard/firmware/releases/tag/8.0.**0**) | Device Protocol: 4.0.0 | User Config: 4.0.0 | Hardware Config: 1.0.0
- Add LED brightness settings.
- Some key actions, for example Left Arrow were displayed as text with modifiers and as icon without modifires. Now, they're always displayed as icons.
- Clean up firmware update console messages a bit.
- Remove the add keymap button because this feature is not only useless but confusing until it gets reimplemented.
- Explicitly mention on the macro tab of the key action popover that macro playback is not implemented yet.
- Downgrade to firmware 8.0.0 because the left I2C watchdog of firmware 8.0.1 is not proven yet.
## [1.0.2] - 2017-12-25
Firmware: [**8.0.1**](https://github.com/UltimateHackingKeyboard/firmware/releases/tag/8.0.1) | Device Protocol: 4.0.0 | User Config: 4.0.0 | Hardware Config: 1.0.0

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "uhk-agent",
"version": "1.0.1",
"version": "1.0.3",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -3,7 +3,7 @@
"private": true,
"author": "Ultimate Gadget Laboratories",
"main": "electron/dist/electron-main.js",
"version": "1.0.2",
"version": "1.0.4",
"description": "Agent is the configuration application of the Ultimate Hacking Keyboard.",
"repository": {
"type": "git",

View File

@@ -16,7 +16,7 @@
"dependencies": {
"node-hid": "0.5.7"
},
"firmwareVersion": "8.0.1",
"firmwareVersion": "8.0.0",
"deviceProtocolVersion": "4.0.0",
"userConfigVersion": "4.0.0",
"hardwareConfigVersion": "1.0.0"

View File

@@ -26,7 +26,7 @@ export class UhkOperations {
await this.blhost.runBlhostCommand([...prefix, 'flash-erase-region', '0xc000', '475136']);
await this.blhost.runBlhostCommand([...prefix, 'flash-image', `"${firmwarePath}"`]);
await this.blhost.runBlhostCommand([...prefix, 'reset']);
this.logService.debug('[UhkOperations] End flashing right firmware');
this.logService.debug('[UhkOperations] Right firmware successfully flashed');
}
public async updateLeftModule(firmwarePath = this.getLeftModuleFirmwarePath()) {
@@ -58,7 +58,8 @@ export class UhkOperations {
await this.device.sendKbootCommandToModule(ModuleSlotToI2cAddress.leftHalf, KbootCommands.idle);
this.device.close();
this.logService.debug('[UhkOperations] End flashing left module firmware');
this.logService.debug('[UhkOperations] Left firmware successfully flashed');
this.logService.debug('[UhkOperations] Both left and right firmwares successfully flashed');
}
/**

View File

@@ -89,7 +89,7 @@ export async function retry(command: Function, maxTry = 3, logService?: LogServi
throw err;
} else {
if (logService) {
logService.error(`[retry] failed, but try run FUNCTION:\n ${command}, \n retry: ${retryCount}`);
logService.info(`[retry] failed, but try run FUNCTION:\n ${command}, \n retry: ${retryCount}`);
}
}
}

View File

@@ -21,11 +21,13 @@
"prefix": "app",
"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"../node_modules/nouislider/distribute/nouislider.min.css",
"styles.scss"
],
"scripts": [
"../node_modules/bootstrap/dist/js/bootstrap.js",
"../node_modules/select2/dist/js/select2.full.js"
"../node_modules/select2/dist/js/select2.full.js",
"../node_modules/nouislider/distribute/nouislider.js"
],
"environmentSource": "environments/environment.ts",
"environments": {

View File

@@ -5828,6 +5828,11 @@
"dragula": "3.7.2"
}
},
"ng2-nouislider": {
"version": "1.7.6",
"resolved": "https://registry.npmjs.org/ng2-nouislider/-/ng2-nouislider-1.7.6.tgz",
"integrity": "sha1-YMq2P7hUbT+HGT4ImcUn0N2A3gs="
},
"ng2-select2": {
"version": "1.0.0-beta.10",
"resolved": "https://registry.npmjs.org/ng2-select2/-/ng2-select2-1.0.0-beta.10.tgz",
@@ -6843,6 +6848,11 @@
"sort-keys": "1.1.2"
}
},
"nouislider": {
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/nouislider/-/nouislider-10.1.0.tgz",
"integrity": "sha512-lENwxlpoYg4/5gjdaY/PMNHeVL+CMJyrO+7RzXi1MqhSSGwuJsQSJteXCQV5bE2UKEdSLARWrqIF8XSWAq7h+A=="
},
"npm-run-path": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",

View File

@@ -69,9 +69,11 @@
"less-loader": "4.0.5",
"lodash": "4.17.4",
"ng2-dragula": "1.5.0",
"ng2-nouislider": "^1.7.6",
"ng2-select2": "1.0.0-beta.10",
"ngrx-store-freeze": "0.1.9",
"node-hid": "0.5.4",
"nouislider": "^10.1.0",
"postcss-loader": "1.3.3",
"postcss-url": "5.1.2",
"protractor": "5.1.2",

View File

@@ -3,6 +3,7 @@ import { Routes } from '@angular/router';
import { DeviceConfigurationComponent } from './configuration/device-configuration.component';
import { DeviceFirmwareComponent } from './firmware/device-firmware.component';
import { MouseSpeedComponent } from './mouse-speed/mouse-speed.component';
import { LEDBrightnessComponent } from './led-brightness/led-brightness.component';
export const deviceRoutes: Routes = [
{
@@ -21,6 +22,10 @@ export const deviceRoutes: Routes = [
path: 'mouse-speed',
component: MouseSpeedComponent
},
{
path: 'led-brightness',
component: LEDBrightnessComponent
},
{
path: 'firmware',
component: DeviceFirmwareComponent

View File

@@ -1,4 +1,5 @@
export * from './configuration/device-configuration.component';
export * from './firmware/device-firmware.component';
export * from './mouse-speed/mouse-speed.component';
export * from './led-brightness/led-brightness.component';
export * from './device.routes';

View File

@@ -0,0 +1,40 @@
<h1>
<i class="fa fa-sliders"></i>
<span>LED brightness</span>
</h1>
<div class="row led-setting">
<div class="col-xs-12 col-md-6">
<slider-wrapper
label="LED display icon and layer texts brightness"
[min]="0"
[max]="255"
[step]="1"
[pips]="sliderPips"
[(ngModel)]="iconsAndLayerTextsBrightness"
(ngModelChange)="onSetPropertyValue('iconsAndLayerTextsBrightness', $event)"></slider-wrapper>
</div>
</div>
<div class="row led-setting">
<div class="col-xs-12 col-md-6">
<slider-wrapper
label="LED display alphanumeric segments brightness"
[min]="0"
[max]="255"
[step]="1"
[pips]="sliderPips"
[(ngModel)]="alphanumericSegmentsBrightness"
(ngModelChange)="onSetPropertyValue('alphanumericSegmentsBrightness', $event)"></slider-wrapper>
</div>
</div>
<div class="row led-setting">
<div class="col-xs-12 col-md-6">
<slider-wrapper
label="Key backlight brightness"
[min]="0"
[max]="255"
[step]="1"
[pips]="sliderPips"
[(ngModel)]="keyBacklightBrightness"
(ngModelChange)="onSetPropertyValue('keyBacklightBrightness', $event)"></slider-wrapper>
</div>
</div>

View File

@@ -0,0 +1,15 @@
:host {
overflow-y: auto;
display: block;
height: 100%;
width: 100%;
label {
display: block;
font-weight: normal;
}
.led-setting {
margin-bottom: 6rem;
}
}

View File

@@ -0,0 +1,53 @@
import { AfterViewInit, Component, OnInit, OnDestroy, ViewChildren, QueryList } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppState, getUserConfiguration } from '../../../store';
import { SetUserConfigurationValueAction } from '../../../store/actions/user-config';
import { SliderPips } from '../../slider-wrapper/slider-wrapper.component';
import { Observable } from 'rxjs/Observable';
import { Subscription } from 'rxjs/Subscription';
import { UserConfiguration } from 'uhk-common';
@Component({
selector: 'device-led-brightness',
templateUrl: './led-brightness.component.html',
styleUrls: ['./led-brightness.component.scss'],
host: {
'class': 'container-fluid'
}
})
export class LEDBrightnessComponent implements OnInit, OnDestroy {
public iconsAndLayerTextsBrightness: number = 0;
public alphanumericSegmentsBrightness: number = 0;
public keyBacklightBrightness: number = 0;
public sliderPips: SliderPips = {
mode: 'positions',
values: [0, 50, 100],
density: 6,
stepped: true
};
private userConfig$: Store<UserConfiguration>;
private userConfigSubscription: Subscription;
constructor(private store: Store<AppState>) {}
ngOnInit() {
this.userConfig$ = this.store.select(getUserConfiguration);
this.userConfigSubscription = this.userConfig$.subscribe(config => {
this.iconsAndLayerTextsBrightness = config.iconsAndLayerTextsBrightness;
this.alphanumericSegmentsBrightness = config.alphanumericSegmentsBrightness;
this.keyBacklightBrightness = config.keyBacklightBrightness;
});
}
ngOnDestroy() {
this.userConfigSubscription.unsubscribe();
}
onSetPropertyValue(propertyName: string, value: number): void {
this.store.dispatch(new SetUserConfigurationValueAction({
propertyName,
value
}));
}
}

View File

@@ -2,6 +2,41 @@
<i class="fa fa-sliders"></i>
<span>Mouse speed</span>
</h1>
<p>
Coming soon ...
</p>
<h3>Mouse pointer speed</h3>
<div class="row mouse-speed-setting" *ngFor="let prop of moveProps">
<div class="col-xs-12 col-md-6">
<slider-wrapper
[label]="prop.title"
[tooltip]="prop.tooltip"
[min]="moveSettings.min"
[max]="moveSettings.max"
[step]="moveSettings.step"
[pips]="sliderPips"
[valueUnit]="prop.valueUnit"
[(ngModel)]="prop.value"
(ngModelChange)="onSetPropertyValue(prop.prop, $event)"></slider-wrapper>
</div>
</div>
<h3>Mouse scroll speed</h3>
<div class="row mouse-speed-setting" *ngFor="let prop of scrollProps">
<div class="col-xs-12 col-md-6">
<slider-wrapper
[label]="prop.title"
[tooltip]="prop.tooltip"
[min]="scrollSettings.min"
[max]="scrollSettings.max"
[step]="scrollSettings.step"
[pips]="sliderPips"
[valueUnit]="prop.valueUnit"
[(ngModel)]="prop.value"
(ngModelChange)="onSetPropertyValue(prop.prop, $event)"></slider-wrapper>
</div>
</div>
<button class="btn btn-danger mouse-speed-reset-button"
mwlConfirmationPopover
title="Are you sure?"
placement="top"
confirmText="Yes"
cancelText="No"
(confirm)="resetToDefault()">Reset speeds to default
</button>

View File

@@ -4,4 +4,25 @@
height: 100%;
width: 100%;
label {
display: block;
font-weight: normal;
icon {
display: inline-block;
}
}
.mouse-speed-reset-button {
display: block;
margin-bottom: 4rem;
}
.mouse-speed-setting {
margin-bottom: 6rem;
+ h3 {
margin-top: 2rem;
}
}
}

View File

@@ -1,4 +1,14 @@
import { Component } from '@angular/core';
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppState, getUserConfiguration } from '../../../store';
import { SetUserConfigurationValueAction } from '../../../store/actions/user-config';
import { DefaultUserConfigurationService } from '../../../services/default-user-configuration.service';
import { SliderPips, SliderProps } from '../../slider-wrapper/slider-wrapper.component';
import { Subscription } from 'rxjs/Subscription';
import { UserConfiguration } from 'uhk-common';
import { ResetMouseSpeedSettingsAction } from '../../../store/actions/device';
const MOUSE_MOVE_VALUE_MULTIPLIER = 25;
@Component({
selector: 'device-mouse-speed',
@@ -8,5 +18,131 @@ import { Component } from '@angular/core';
'class': 'container-fluid'
}
})
export class MouseSpeedComponent {
export class MouseSpeedComponent implements OnInit, OnDestroy {
public moveProps = [
{
prop: 'mouseMoveInitialSpeed',
title: 'Initial speed',
tooltip: 'When mouse movement begins, this is the starting speed.',
valueUnit: 'px/s',
value: 0
},
{
prop: 'mouseMoveBaseSpeed',
title: 'Base speed',
tooltip: 'This speed is reached after the initial moving speed sufficiently ramps up.',
valueUnit: 'px/s',
value: 0
},
{
prop: 'mouseMoveAcceleration',
title: 'Acceleration',
tooltip: 'The rate of acceleration from the initial movement speed to the base speed.',
valueUnit: 'px/s²',
value: 0
},
{
prop: 'mouseMoveDeceleratedSpeed',
title: 'Decelerated speed',
tooltip: 'This speed is used while moving with the <i>decelerate key</i> pressed.',
valueUnit: 'px/s',
value: 0
},
{
prop: 'mouseMoveAcceleratedSpeed',
title: 'Accelerated speed',
tooltip: 'This speed is used while moving with the <i>accelerate key</i> pressed.',
valueUnit: 'px/s',
value: 0
}
];
public scrollProps = [
{
prop: 'mouseScrollInitialSpeed',
title: 'Initial speed',
tooltip: 'When mouse scrolling begins, this is the starting speed.',
valueUnit: 'pulse/s',
value: 0
},
{
prop: 'mouseScrollBaseSpeed',
title: 'Base speed',
tooltip: 'This speed is reached after the initial scrolling speed sufficiently ramps up.',
valueUnit: 'pulse/s',
value: 0
},
{
prop: 'mouseScrollAcceleration',
title: 'Acceleration',
tooltip: 'The rate of acceleration from the initial scrolling speed to the base speed.',
valueUnit: 'pulse/s²',
value: 0
},
{
prop: 'mouseScrollDeceleratedSpeed',
title: 'Decelerated speed',
tooltip: 'This speed is used while scrolling with the <i>decelerate key</i> pressed.',
valueUnit: 'pulse/s',
value: 0
},
{
prop: 'mouseScrollAcceleratedSpeed',
title: 'Accelerated speed',
tooltip: 'This speed is used while scrolling with the <i>accelerate key</i> pressed.',
valueUnit: 'pulse/s',
value: 0
}
];
public sliderPips: SliderPips = {
mode: 'positions',
values: [0, 50, 100],
density: 6,
stepped: true
};
public moveSettings: SliderProps = {
min: MOUSE_MOVE_VALUE_MULTIPLIER,
max: 6375,
step: MOUSE_MOVE_VALUE_MULTIPLIER
};
public scrollSettings: SliderProps = {
min: 1,
max: 255,
step: 1
};
private userConfig$: Store<UserConfiguration>;
private userConfigSubscription: Subscription;
constructor(private store: Store<AppState>, private defaultUserConfigurationService: DefaultUserConfigurationService) {}
ngOnInit(): void {
this.userConfig$ = this.store.select(getUserConfiguration);
this.userConfigSubscription = this.userConfig$.subscribe(config => {
this.moveProps.forEach(moveProp => {
moveProp.value = config[moveProp.prop] * MOUSE_MOVE_VALUE_MULTIPLIER || 0;
});
this.scrollProps.forEach(scrollProp => {
scrollProp.value = config[scrollProp.prop] || 0;
});
});
}
ngOnDestroy(): void {
this.userConfigSubscription.unsubscribe();
}
onSetPropertyValue(propertyName: string, value: number): void {
this.store.dispatch(new SetUserConfigurationValueAction({
propertyName,
value: propertyName.indexOf('mouseMove') !== -1 ? value / MOUSE_MOVE_VALUE_MULTIPLIER : value
}));
}
resetToDefault() {
this.store.dispatch(new ResetMouseSpeedSettingsAction());
}
}

View File

@@ -2,6 +2,7 @@
<span> No macros are available to choose from. Create a macro first! </span>
</ng-template>
<ng-template [ngIf]="macroOptions.length > 0">
<p><i>Please note that macro playback is not implemented yet. You can bind macros, but they don't have any effect.</i></p>
<div class="macro-selector">
<b> Play macro: </b>
<select2 [data]="macroOptions" [value]="macroOptions[selectedMacroIndex].id" (valueChanged)="onChange($event)" [width]="'100%'"></select2>

View File

@@ -23,6 +23,12 @@
[class.disabled]="updatingFirmware$ | async">Mouse speed</a>
</div>
</li>
<li class="sidebar__level-2--item">
<div class="sidebar__level-2" [routerLinkActive]="['active']">
<a [routerLink]="['/device/led-brightness']"
[class.disabled]="updatingFirmware$ | async">LED brightness</a>
</div>
</li>
<li class="sidebar__level-2--item">
<div class="sidebar__level-2" [routerLinkActive]="['active']">
<a [routerLink]="['/device/configuration']"
@@ -40,11 +46,11 @@
<li class="sidebar__level-1--item">
<div class="sidebar__level-1">
<i class="fa fa-keyboard-o"></i> Keymaps
<a [routerLink]="['/keymap/add']"
<!--a [routerLink]="['/keymap/add']"
class="btn btn-default pull-right btn-sm"
[class.disabled]="updatingFirmware$ | async">
<i class="fa fa-plus"></i>
</a>
</a-->
<i class="fa fa-chevron-up pull-right"
(click)="toggleHide($event, 'keymap')"></i>
</div>

View File

@@ -0,0 +1,24 @@
<label *ngIf="label">
<span>{{label}}</span>
<icon name="question-circle"
data-toggle="tooltip"
[title]="tooltip"
html="true"
data-placement="bottom"
*ngIf="tooltip"></icon>
</label>
<div class="slider-wrapper">
<div class="slider-container">
<nouislider
[min]="min"
[max]="max"
[step]="step"
[keyboard]="true"
[tooltips]="true"
[(ngModel)]="value"
(ngModelChange)="onSliderChange($event)"></nouislider>
</div>
<div class="slider-value">
<div class="value-indicator">{{value}} {{valueUnit}}</div>
</div>
</div>

View File

@@ -0,0 +1,29 @@
:host {
label {
display: block;
font-weight: normal;
icon {
display: inline-block;
}
}
.slider-wrapper {
display: flex;
flex-direction: row;
padding-left: 1.6rem;
}
.slider-container {
width: 80%;
}
.slider-value {
width: 20%;
}
.value-indicator {
margin: 1rem 1rem 1rem 3rem;
vertical-align: middle;
}
}

View File

@@ -0,0 +1,93 @@
import { AfterViewInit, Component, EventEmitter, forwardRef, Input, Output, OnDestroy, ViewChild } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { NouisliderComponent } from 'ng2-nouislider/src/nouislider';
import { Observable } from 'rxjs/Observable';
import { Observer } from 'rxjs/Observer';
import 'rxjs/add/operator/debounceTime';
import 'rxjs/add/operator/distinctUntilChanged';
export interface SliderPips {
mode: string;
values: number[];
density: number;
stepped?: boolean;
}
export interface SliderProps {
min: number;
max: number;
step?: number;
pips?: SliderPips;
valueUnit?: string;
}
@Component({
selector: 'slider-wrapper',
templateUrl: './slider-wrapper.component.html',
styleUrls: ['./slider-wrapper.component.scss'],
providers: [
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SliderWrapperComponent), multi: true }
]
})
export class SliderWrapperComponent implements AfterViewInit, ControlValueAccessor, OnDestroy {
@ViewChild(NouisliderComponent) slider: NouisliderComponent;
@Input() label: string;
@Input() tooltip: string;
@Input() min: number;
@Input() max: number;
@Input() step: number;
@Input() pips: SliderPips;
@Input() valueUnit: string;
@Output() onChange = new EventEmitter<number>();
public value: number;
private changeObserver$: Observer<number>;
private changeDebounceTime: number = 300;
ngAfterViewInit(): void {
if (this.pips) {
this.slider.slider.pips(this.pips);
}
// Hide tooltips and show them when dragging slider handle
this.slider.slider.target.querySelector('.noUi-tooltip').style.display = 'none';
this.slider.slider.on('start', function() {
this.target.querySelector('.noUi-tooltip').style.display = 'block';
});
this.slider.slider.on('end', function() {
this.target.querySelector('.noUi-tooltip').style.display = 'none';
});
}
ngOnDestroy() {
if (this.changeObserver$) {
this.changeObserver$.complete();
}
}
writeValue(value: number): void {
this.value = value || this.min;
}
registerOnChange(fn: any): void {
this.propagateChange = fn;
}
registerOnTouched() {}
onSliderChange(value: number): void {
if (!this.changeObserver$) {
Observable.create(observer => {
this.changeObserver$ = observer;
}).debounceTime(this.changeDebounceTime)
.distinctUntilChanged()
.subscribe(this.propagateChange);
return; // No change event on first change as the value is just being set
}
this.changeObserver$.next(value);
}
private propagateChange: any = () => {};
}

View File

@@ -1,5 +1,10 @@
<svg [attr.viewBox]="viewBox" [attr.width]="textContainer.width" [attr.height]="textContainer.height"
[attr.x]="textContainer.x" [attr.y]="textContainer.y" [ngSwitch]="labelType">
<svg:g svg-single-icon-key *ngSwitchCase="'icon'"
[height]="height"
[width]="width"
[icon]="labelSource">
</svg:g>
<svg:g svg-one-line-text-key *ngSwitchCase="'one-line'"
[height]="height"
[width]="width"

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -127,21 +127,23 @@ export class SvgKeystrokeKeyComponent implements OnInit, OnChanges {
}
ngOnChanges() {
let newLabelSource: string[];
if (this.keystrokeAction.hasScancode()) {
const scancode: number = this.keystrokeAction.scancode;
newLabelSource = this.mapper.scanCodeToText(scancode, this.keystrokeAction.type);
if (newLabelSource) {
if (newLabelSource.length === 1) {
this.labelSource = newLabelSource[0];
this.labelType = 'one-line';
} else {
this.labelSource = newLabelSource;
this.labelType = 'two-line';
}
} else {
this.labelSource = this.mapper.scanCodeToSvgImagePath(scancode, this.keystrokeAction.type);
this.labelSource = this.mapper.scanCodeToSvgImagePath(scancode, this.keystrokeAction.type);
if (this.labelSource) {
this.labelType = 'icon';
} else {
let newLabelSource: string[];
newLabelSource = this.mapper.scanCodeToText(scancode, this.keystrokeAction.type);
if (newLabelSource) {
if (newLabelSource.length === 1) {
this.labelSource = newLabelSource[0];
this.labelType = 'one-line';
} else {
this.labelSource = newLabelSource;
this.labelType = 'two-line';
}
}
}
} else {
this.labelType = 'empty';

View File

@@ -0,0 +1,4 @@
export interface UserConfigurationValue {
propertyName: string;
value: number;
}

View File

@@ -3,7 +3,7 @@ import { Component } from '@angular/core';
@Component({
selector: 'main-page',
templateUrl: './main.page.html',
styles: [':host{height:100%; display: inline-block; width: 100%}']
styles: [':host{height:100%; width:100%}']
})
export class MainPage {

View File

@@ -71,7 +71,11 @@ export class MapperService {
default:
return undefined;
}
return 'assets/compiled_sprite.svg#' + map.get(scanCode);
const id = map.get(scanCode);
if (!id) {
return undefined;
}
return `assets/compiled_sprite.svg#${id}`;
}
public getIcon(iconName: string): string {

View File

@@ -4917,7 +4917,7 @@
null,
{
"keyActionType": "mouse",
"mouseAction": "scrollUp"
"mouseAction": "scrollDown"
},
{
"keyActionType": "mouse",
@@ -4936,7 +4936,7 @@
null,
{
"keyActionType": "mouse",
"mouseAction": "scrollDown"
"mouseAction": "scrollUp"
},
null,
null,
@@ -5926,7 +5926,7 @@
null,
{
"keyActionType": "mouse",
"mouseAction": "scrollUp"
"mouseAction": "scrollDown"
},
{
"keyActionType": "mouse",
@@ -5945,7 +5945,7 @@
null,
{
"keyActionType": "mouse",
"mouseAction": "scrollDown"
"mouseAction": "scrollUp"
},
null,
null,
@@ -6927,7 +6927,7 @@
null,
{
"keyActionType": "mouse",
"mouseAction": "scrollUp"
"mouseAction": "scrollDown"
},
{
"keyActionType": "mouse",
@@ -6946,7 +6946,7 @@
null,
{
"keyActionType": "mouse",
"mouseAction": "scrollDown"
"mouseAction": "scrollUp"
},
null,
null,
@@ -7105,4 +7105,4 @@
]
}
]
}
}

View File

@@ -7,13 +7,15 @@ import { ConfirmationPopoverModule } from 'angular-confirmation-popover';
import { DragulaModule } from 'ng2-dragula/ng2-dragula';
import { Select2Module } from 'ng2-select2/ng2-select2';
import { NouisliderModule } from 'ng2-nouislider';
import { AddOnComponent } from './components/add-on';
import { KeyboardSliderComponent } from './components/keyboard/slider';
import {
DeviceConfigurationComponent,
DeviceFirmwareComponent,
MouseSpeedComponent
MouseSpeedComponent,
LEDBrightnessComponent
} from './components/device';
import { KeymapAddComponent, KeymapEditComponent, KeymapHeaderComponent } from './components/keymap';
import { LayersComponent } from './components/layers';
@@ -98,6 +100,7 @@ import { LoadingDevicePageComponent } from './pages/loading-page/loading-device.
import { UhkDeviceLoadingGuard } from './services/uhk-device-loading.guard';
import { UhkDeviceLoadedGuard } from './services/uhk-device-loaded.guard';
import { XtermComponent } from './components/xterm/xterm.component';
import { SliderWrapperComponent } from './components/slider-wrapper/slider-wrapper.component';
@NgModule({
declarations: [
@@ -105,6 +108,7 @@ import { XtermComponent } from './components/xterm/xterm.component';
DeviceConfigurationComponent,
DeviceFirmwareComponent,
MouseSpeedComponent,
LEDBrightnessComponent,
KeymapEditComponent,
KeymapHeaderComponent,
NotificationComponent,
@@ -163,7 +167,8 @@ import { XtermComponent } from './components/xterm/xterm.component';
MainPage,
ProgressButtonComponent,
LoadingDevicePageComponent,
XtermComponent
XtermComponent,
SliderWrapperComponent
],
imports: [
CommonModule,
@@ -172,6 +177,7 @@ import { XtermComponent } from './components/xterm/xterm.component';
DragulaModule,
routing,
Select2Module,
NouisliderModule,
NotifierModule.withConfig(angularNotifierConfig),
ConfirmationPopoverModule.forRoot({
confirmButtonType: 'danger' // set defaults here
@@ -187,7 +193,6 @@ import { XtermComponent } from './components/xterm/xterm.component';
DataStorageRepositoryService,
DefaultUserConfigurationService,
LogService,
DefaultUserConfigurationService,
AppUpdateRendererService,
AppRendererService,
IpcCommonRenderer,

View File

@@ -16,6 +16,7 @@ export const ActionTypes = {
SAVE_TO_KEYBOARD_FAILED: type(PREFIX + 'save to keyboard failed'),
HIDE_SAVE_TO_KEYBOARD_BUTTON: type(PREFIX + 'hide save to keyboard button'),
RESET_USER_CONFIGURATION: type(PREFIX + 'reset user configuration'),
RESET_MOUSE_SPEED_SETTINGS: type(PREFIX + 'reset mouse speed settings'),
UPDATE_FIRMWARE: type(PREFIX + 'update firmware'),
UPDATE_FIRMWARE_WITH: type(PREFIX + 'update firmware with'),
UPDATE_FIRMWARE_REPLY: type(PREFIX + 'update firmware reply'),
@@ -109,6 +110,10 @@ export class UpdateFirmwareOkButtonAction implements Action {
type = ActionTypes.UPDATE_FIRMWARE_OK_BUTTON;
}
export class ResetMouseSpeedSettingsAction implements Action {
type = ActionTypes.RESET_MOUSE_SPEED_SETTINGS;
}
export type Actions
= SetPrivilegeOnLinuxAction
| SetPrivilegeOnLinuxReplyAction
@@ -119,6 +124,7 @@ export type Actions
| SaveToKeyboardSuccessAction
| SaveToKeyboardSuccessFailed
| HideSaveToKeyboardButton
| ResetMouseSpeedSettingsAction
| ResetUserConfigurationAction
| UpdateFirmwareAction
| UpdateFirmwareWithAction

View File

@@ -1,5 +1,6 @@
import { Action } from '@ngrx/store';
import { type, UserConfiguration, ConfigurationReply } from 'uhk-common';
import { UserConfigurationValue } from '../../models/user-configuration-value';
const PREFIX = '[user-config] ';
@@ -13,7 +14,8 @@ export const ActionTypes = {
SAVE_USER_CONFIG_IN_JSON_FILE: type(PREFIX + 'Save User Config in JSON file'),
SAVE_USER_CONFIG_IN_BIN_FILE: type(PREFIX + 'Save User Config in binary file'),
LOAD_RESET_USER_CONFIGURATION: type(PREFIX + 'Load reset user configuration'),
RENAME_USER_CONFIGURATION: type(PREFIX + 'Rename user configuration')
RENAME_USER_CONFIGURATION: type(PREFIX + 'Rename user configuration'),
SET_USER_CONFIGURATION_VALUE: type(PREFIX + 'Set user configuration value')
};
export class LoadUserConfigAction implements Action {
@@ -67,6 +69,13 @@ export class RenameUserConfigurationAction implements Action {
}
}
export class SetUserConfigurationValueAction implements Action {
type = ActionTypes.SET_USER_CONFIGURATION_VALUE;
constructor(public payload: UserConfigurationValue) {
}
}
export type Actions
= LoadUserConfigAction
| LoadUserConfigSuccessAction
@@ -77,4 +86,5 @@ export type Actions
| SaveUserConfigInBinaryFileAction
| LoadResetUserConfigurationAction
| RenameUserConfigurationAction
| SetUserConfigurationValueAction
;

View File

@@ -130,6 +130,30 @@ export class DeviceEffects {
.switchMap(() => Observable.of(new HideSaveToKeyboardButton()))
);
@Effect()
resetMouseSpeedSettings$: Observable<Action> = this.actions$
.ofType(ActionTypes.RESET_MOUSE_SPEED_SETTINGS)
.switchMap(() => {
const config = this.defaultUserConfigurationService.getDefault();
const mouseSpeedDefaultSettings = {};
const mouseSpeedProps = [
'mouseMoveInitialSpeed',
'mouseMoveAcceleration',
'mouseMoveDeceleratedSpeed',
'mouseMoveBaseSpeed',
'mouseMoveAcceleratedSpeed',
'mouseScrollInitialSpeed',
'mouseScrollAcceleration',
'mouseScrollDeceleratedSpeed',
'mouseScrollBaseSpeed',
'mouseScrollAcceleratedSpeed'
];
mouseSpeedProps.forEach(prop => {
mouseSpeedDefaultSettings[prop] = config[prop];
});
return Observable.of(new LoadResetUserConfigurationAction(<UserConfiguration>mouseSpeedDefaultSettings));
});
@Effect() resetUserConfiguration$: Observable<Action> = this.actions$
.ofType(ActionTypes.RESET_USER_CONFIGURATION)
.switchMap(() => {

View File

@@ -72,7 +72,7 @@ export class UserConfigEffects {
KeymapActions.SET_DEFAULT, KeymapActions.REMOVE, KeymapActions.SAVE_KEY,
MacroActions.ADD, MacroActions.DUPLICATE, MacroActions.EDIT_NAME, MacroActions.REMOVE, MacroActions.ADD_ACTION,
MacroActions.SAVE_ACTION, MacroActions.DELETE_ACTION, MacroActions.REORDER_ACTION,
ActionTypes.RENAME_USER_CONFIGURATION) as
ActionTypes.RENAME_USER_CONFIGURATION, ActionTypes.SET_USER_CONFIGURATION_VALUE) as
Observable<KeymapAction | MacroAction | RenameUserConfigurationAction>)
.withLatestFrom(this.store.select(getUserConfiguration), this.store.select(getPrevUserConfiguration))
.mergeMap(([action, config, prevUserConfiguration]) => {

View File

@@ -246,6 +246,11 @@ export function reducer(state = initialState, action: Action & { payload?: any }
break;
}
case ActionTypes.SET_USER_CONFIGURATION_VALUE: {
changedUserConfiguration[action.payload.propertyName] = action.payload.value;
break;
}
default:
break;
}

View File

@@ -90,3 +90,7 @@ a.disabled {
width: 100%;
display: inline-block;
}
.noUi-value {
top: 2rem;
}

View File

@@ -85,10 +85,12 @@ module.exports = {
],
"scripts": [
"script-loader!./node_modules/bootstrap/dist/js/bootstrap.js",
"script-loader!./node_modules/select2/dist/js/select2.full.js"
"script-loader!./node_modules/select2/dist/js/select2.full.js",
"script-loader!./node_modules/nouislider/distribute/nouislider.js"
],
"styles": [
"./node_modules/bootstrap/dist/css/bootstrap.min.css",
"./node_modules/nouislider/distribute/nouislider.min.css",
"./src/styles.scss"
]
},
@@ -126,6 +128,7 @@ module.exports = {
{
"exclude": [
path.join(process.cwd(), "node_modules/bootstrap/dist/css/bootstrap.min.css"),
path.join(process.cwd(), "node_modules/nouislider/distribute/nouislider.min.css"),
path.join(process.cwd(), "src/styles.scss")
],
"test": /\.css$/,
@@ -150,6 +153,7 @@ module.exports = {
{
"exclude": [
path.join(process.cwd(), "node_modules/bootstrap/dist/css/bootstrap.min.css"),
path.join(process.cwd(), "node_modules/nouislider/distribute/nouislider.min.css"),
path.join(process.cwd(), "src/styles.scss")
],
"test": /\.scss$|\.sass$/,
@@ -182,6 +186,7 @@ module.exports = {
{
"exclude": [
path.join(process.cwd(), "node_modules/bootstrap/dist/css/bootstrap.min.css"),
path.join(process.cwd(), "node_modules/nouislider/distribute/nouislider.min.css"),
path.join(process.cwd(), "src/styles.scss")
],
"test": /\.less$/,
@@ -212,6 +217,7 @@ module.exports = {
{
"exclude": [
path.join(process.cwd(), "node_modules/bootstrap/dist/css/bootstrap.min.css"),
path.join(process.cwd(), "node_modules/nouislider/distribute/nouislider.min.css"),
path.join(process.cwd(), "src/styles.scss")
],
"test": /\.styl$/,
@@ -243,6 +249,7 @@ module.exports = {
{
"include": [
path.join(process.cwd(), "node_modules/bootstrap/dist/css/bootstrap.min.css"),
path.join(process.cwd(), "node_modules/nouislider/distribute/nouislider.min.css"),
path.join(process.cwd(), "src/styles.scss")
],
"test": /\.css$/,
@@ -267,6 +274,7 @@ module.exports = {
{
"include": [
path.join(process.cwd(), "node_modules/bootstrap/dist/css/bootstrap.min.css"),
path.join(process.cwd(), "node_modules/nouislider/distribute/nouislider.min.css"),
path.join(process.cwd(), "src/styles.scss")
],
"test": /\.scss$|\.sass$/,
@@ -299,6 +307,7 @@ module.exports = {
{
"include": [
path.join(process.cwd(), "node_modules/bootstrap/dist/css/bootstrap.min.css"),
path.join(process.cwd(), "node_modules/nouislider/distribute/nouislider.min.css"),
path.join(process.cwd(), "src/styles.scss")
],
"test": /\.less$/,
@@ -329,6 +338,7 @@ module.exports = {
{
"include": [
path.join(process.cwd(), "node_modules/bootstrap/dist/css/bootstrap.min.css"),
path.join(process.cwd(), "node_modules/nouislider/distribute/nouislider.min.css"),
path.join(process.cwd(), "src/styles.scss")
],
"test": /\.styl$/,

View File

@@ -2,7 +2,7 @@
const uhk = require('./uhk');
const device = uhk.getUhkDevice();
const sendData = new Buffer([uhk.usbCommands.getProperty, uhk.devicePropertyIds.configSizes]);
const sendData = new Buffer([uhk.usbCommands.getDeviceProperty, uhk.devicePropertyIds.configSizes]);
device.write(uhk.getTransferData(sendData));
const response = Buffer.from(device.readSync());

View File

@@ -0,0 +1,16 @@
#!/usr/bin/env node
const uhk = require('./uhk');
const device = uhk.getUhkDevice();
const sendData = new Buffer([uhk.usbCommands.getModuleProperty, uhk.modulePropertyIds.protocolVersions]);
console.log(sendData)
device.write(uhk.getTransferData(sendData));
const response = Buffer.from(device.readSync());
console.log(response)
const firmwareMajorVersion = response[7] + (response[8]<<8);
const firmwareMinorVersion = response[9] + (response[10]<<8);
const firmwarePatchVersion = response[11] + (response[12]<<8);
console.log(`firmwareMajorVersion: ${firmwareMajorVersion}`);
console.log(`firmwareMinorVersion: ${firmwareMinorVersion}`);
console.log(`firmwarePatchVersion: ${firmwarePatchVersion}`);

View File

@@ -3,7 +3,7 @@ const uhk = require('./uhk');
const device = uhk.getUhkDevice();
function getModuleState() {
const payload = new Buffer([uhk.usbCommands.getModuleProperties, 1]);
const payload = new Buffer([uhk.usbCommands.getModuleProperty, 1]);
console.log('Sending ', uhk.bufferToString(payload));
device.write(uhk.getTransferData(payload));
const receivedBuffer = device.readSync();

View File

@@ -0,0 +1,15 @@
#!/usr/bin/env node
const uhk = require('./uhk');
const device = uhk.getUhkDevice();
const sendData = new Buffer([uhk.usbCommands.getDeviceProperty, uhk.devicePropertyIds.protocolVersions]);
device.write(uhk.getTransferData(sendData));
const response = Buffer.from(device.readSync());
const firmwareMajorVersion = response[1] + (response[2]<<8);
const firmwareMinorVersion = response[3] + (response[4]<<8);
const firmwarePatchVersion = response[5] + (response[6]<<8);
console.log(`firmwareMajorVersion: ${firmwareMajorVersion}`);
console.log(`firmwareMinorVersion: ${firmwareMinorVersion}`);
console.log(`firmwarePatchVersion: ${firmwarePatchVersion}`);

View File

@@ -6,7 +6,7 @@ let counter = 1;
while (true) {
console.log(`hidapi sync test ${counter++}`);
const sendData = new Buffer([uhk.usbCommands.getProperty, uhk.devicePropertyIds.configSizes]);
const sendData = new Buffer([uhk.usbCommands.getDeviceProperty, uhk.devicePropertyIds.configSizes]);
device.write(uhk.getTransferData(sendData));
device.readSync()
}

View File

@@ -10,7 +10,7 @@ let offset = 0;
let configBuffer = new Buffer(0);
let chunkSizeToRead;
const payload = new Buffer([uhk.usbCommands.getProperty, uhk.devicePropertyIds.configSizes]);
const payload = new Buffer([uhk.usbCommands.getDeviceProperty, uhk.devicePropertyIds.configSizes]);
device.write(uhk.getTransferData(payload));
let buffer = Buffer.from(device.readSync());
const hardwareConfigMaxSize = buffer[1] + (buffer[2]<<8);

View File

@@ -62,7 +62,7 @@ exports = module.exports = moduleExports = {
getTransferData,
checkModuleSlot,
usbCommands: {
getProperty : 0x00,
getDeviceProperty : 0x00,
reenumerate : 0x01,
jumpToModuleBootloader : 0x02,
sendKbootCommandToModule: 0x03,
@@ -76,7 +76,7 @@ exports = module.exports = moduleExports = {
getDebugBuffer : 0x0b,
getAdcValue : 0x0c,
setLedPwmBrightness : 0x0d,
getModuleProperties : 0x0e,
getModuleProperty : 0x0e,
},
enumerationModes: {
bootloader: 0,
@@ -102,6 +102,9 @@ exports = module.exports = moduleExports = {
protocolVersions: 1,
configSizes: 2,
},
modulePropertyIds: {
protocolVersions: 0,
},
configBufferIds,
eepromOperations,
eepromTransfer: {

View File

@@ -23,7 +23,7 @@ let offset = 0;
let configBuffer = fs.readFileSync(configBin);
let chunkSizeToRead;
const payload = new Buffer([uhk.usbCommands.getProperty, uhk.devicePropertyIds.configSizes]);
const payload = new Buffer([uhk.usbCommands.getDeviceProperty, uhk.devicePropertyIds.configSizes]);
device.write(uhk.getTransferData(payload));
let buffer = Buffer.from(device.readSync());