Skip to content

Commit 2ea8058

Browse files
committed
Merge branch 'add_deactivate_keyboard_control_button' into 'upcoming-release'
Add deactivate keyboard control button See merge request tuxedocomputers/development/tuxedo-control-center!97
2 parents 8f0c0b6 + 2a341c3 commit 2ea8058

File tree

12 files changed

+450
-253
lines changed

12 files changed

+450
-253
lines changed

src/common/models/TccSettings.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export interface ITccSettings {
4848
shutdownTime: string | null;
4949
cpuSettingsEnabled: boolean;
5050
fanControlEnabled: boolean;
51+
keyboardBacklightControlEnabled: boolean;
5152
ycbcr420Workaround: Array<Object>;
5253
chargingProfile: string | null;
5354
chargingPriority: string | null;
@@ -64,6 +65,7 @@ export const defaultSettings: ITccSettings = {
6465
shutdownTime: null,
6566
cpuSettingsEnabled: true,
6667
fanControlEnabled: true,
68+
keyboardBacklightControlEnabled: true,
6769
ycbcr420Workaround: [],
6870
chargingProfile: null,
6971
chargingPriority: null,
@@ -80,6 +82,7 @@ export const defaultSettingsXP1508UHD: ITccSettings = {
8082
shutdownTime: null,
8183
cpuSettingsEnabled: true,
8284
fanControlEnabled: true,
85+
keyboardBacklightControlEnabled: true,
8386
ycbcr420Workaround: [],
8487
chargingProfile: null,
8588
chargingPriority: null,

src/ng-app/app/config.service.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ export class ConfigService implements OnDestroy {
123123
return $localize `:@@messageFanControlOff:Fan control deactivated in Tools→Global\u00A0Settings`;
124124
}
125125

126+
get keyboardBacklightControlDisabledMessage(): string {
127+
return $localize `:@@messageKeyboardBacklightControlOff:Keyboard backlight control deactivated in Tools→Global\u00A0Settings`;
128+
}
129+
126130
public getCustomProfiles(): ITccProfile[] {
127131
return this.customProfiles;
128132
}

src/ng-app/app/global-settings/global-settings.component.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,26 @@
7777
</mat-grid-tile>
7878
</mat-grid-list>
7979
<div i18n>On deactivate, the default automatic fan control is restored directly.</div>
80+
81+
<mat-grid-list [cols]="gridParams.cols" rowHeight="3em" class="global-settings-grid">
82+
<mat-grid-tile [colspan]="gridParams.headerSpan"><header i18n="@@cGlobalSettingsKeyboardBacklightControlLabel">Keyboard Backlight Control</header></mat-grid-tile>
83+
<mat-grid-tile [colspan]="gridParams.valueSpan">
84+
<content class="value">
85+
<span [hidden]="!inputKeyboardBacklightControl.checked" i18n="@@cGlobalSettingsKeyboardBacklightControlActivated">activated</span>
86+
<span [hidden]="inputKeyboardBacklightControl.checked" i18n="@@cGlobalSettingsKeyboardBacklightControlDeactivated">deactivated</span>
87+
</content>
88+
</mat-grid-tile>
89+
<mat-grid-tile [colspan]="gridParams.inputSpan">
90+
<content class="input">
91+
<mat-checkbox #inputKeyboardBacklightControl
92+
color="primary"
93+
[(ngModel)]="keyboardBacklightControlEnabled"
94+
(change)="onKeyboardBacklightControlEnabledChanged($event)">
95+
</mat-checkbox>
96+
</content>
97+
</mat-grid-tile>
98+
</mat-grid-list>
99+
<div i18n>On deactivate, keyboard backlight settings are <strong>not</strong> reset to default. Default settings need to be restored by hand or a system reboot.</div>
80100
</div>
81101
</mat-expansion-panel>
82102

src/ng-app/app/global-settings/global-settings.component.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export class GlobalSettingsComponent implements OnInit {
4242

4343
public cpuSettingsEnabled: boolean = true;
4444
public fanControlEnabled: boolean = true;
45+
public keyboardBacklightControlEnabled: boolean = true;
4546
public forceYUV420OutputSwitchAvailable: boolean = false;
4647
public ycbcr420Workaround: Array<Object> = [];
4748

@@ -66,6 +67,7 @@ export class GlobalSettingsComponent implements OnInit {
6667

6768
this.cpuSettingsEnabled = this.config.getSettings().cpuSettingsEnabled;
6869
this.fanControlEnabled = this.config.getSettings().fanControlEnabled;
70+
this.keyboardBacklightControlEnabled = this.config.getSettings().keyboardBacklightControlEnabled;
6971
for (let card = 0; card < this.config.getSettings().ycbcr420Workaround.length; card++) {
7072
this.ycbcr420Workaround[card] = {};
7173
for (let port in this.config.getSettings().ycbcr420Workaround[card]) {
@@ -108,6 +110,22 @@ export class GlobalSettingsComponent implements OnInit {
108110
});
109111
}
110112

113+
onKeyboardBacklightControlEnabledChanged(event: any) {
114+
this.utils.pageDisabled = true;
115+
116+
this.config.getSettings().keyboardBacklightControlEnabled = event.checked;
117+
118+
this.config.saveSettings().then(success => {
119+
if (!success) {
120+
this.config.getSettings().keyboardBacklightControlEnabled = !event.checked;
121+
}
122+
123+
this.keyboardBacklightControlEnabled = this.config.getSettings().keyboardBacklightControlEnabled;
124+
125+
this.utils.pageDisabled = false;
126+
});
127+
}
128+
111129
onYCbCr420WorkaroundChanged(event: any, card: number, port: string) {
112130
if (this.config.getSettings().ycbcr420Workaround.length > card && port in this.config.getSettings().ycbcr420Workaround[card]) {
113131
this.utils.pageDisabled = true;

src/ng-app/app/keyboard-backlight/keyboard-backlight.component.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@
3131
<p i18n="@@cKeyboardBacklightNotSupported">Your device has no keyboard backlight or is not (yet) supported by this control interface.</p>
3232
</div>
3333

34-
<div class="keyboard-backlight-content content" *ngIf="keyboardBacklightCapabilities !== undefined">
34+
<div class="keyboard-backlight-content content" *ngIf="keyboardBacklightCapabilities !== undefined"
35+
[ngClass]="{'not-available': !this.config.getSettings().keyboardBacklightControlEnabled }"
36+
[matTooltip]="!this.config.getSettings().keyboardBacklightControlEnabled ? this.config.keyboardBacklightControlDisabledMessage : ''"
37+
matTooltipClass="wider-tooltip">
38+
3539
<div *ngIf="keyboardBacklightCapabilities.maxRed > 0 && keyboardBacklightCapabilities.maxGreen > 0 && keyboardBacklightCapabilities.maxBlue > 0">
3640
<div *ngIf="keyboardBacklightCapabilities.zones >= 1">
3741
<mat-grid-list [cols]="9" rowHeight="1227:2709" class="keyboard-color-grid">

src/ng-app/app/keyboard-backlight/keyboard-backlight.component.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,8 @@ content.value {
4545
stroke:LightGrey;
4646
}
4747
}
48+
}
49+
50+
.wider-tooltip {
51+
max-width: 275px !important;
4852
}

src/ng-app/app/keyboard-backlight/keyboard-backlight.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* along with TUXEDO Control Center. If not, see <https://www.gnu.org/licenses/>.
1818
*/
1919

20-
import { Component, OnInit } from '@angular/core';
20+
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
2121
import { ConfigService } from '../config.service';
2222
import { Subscription } from 'rxjs';
2323
import { TccDBusClientService } from '../tcc-dbus-client.service';
@@ -26,7 +26,8 @@ import { KeyboardBacklightCapabilitiesInterface, KeyboardBacklightColorModes, Ke
2626
@Component({
2727
selector: 'app-keyboard-backlight',
2828
templateUrl: './keyboard-backlight.component.html',
29-
styleUrls: ['./keyboard-backlight.component.scss']
29+
styleUrls: ['./keyboard-backlight.component.scss'],
30+
encapsulation: ViewEncapsulation.None
3031
})
3132
export class KeyboardBacklightComponent implements OnInit {
3233
Object = Object;

0 commit comments

Comments
 (0)