Skip to content

Commit

Permalink
feat: 图形化设置支持键盘设置
Browse files Browse the repository at this point in the history
  • Loading branch information
huailei000 committed May 8, 2023
1 parent 270e814 commit fe0f5de
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 16 deletions.
4 changes: 4 additions & 0 deletions src/app/elements/setting/setting.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
}

.mat-form-field { width: 100%;}

.space {
padding-top: 15px;
}
40 changes: 25 additions & 15 deletions src/app/elements/setting/setting.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,39 @@ <h1 mat-dialog-title>
</mat-form-field>
</div>
<div *ngIf="type === 'gui'">
<mat-form-field style="padding-top: 15px">
<mat-form-field>
<mat-select [(value)]="setting.rdpResolution"
placeholder="{{'RDP resolution'| translate}}" >
<mat-option *ngFor="let s of resolutionsChoices" value="{{s}}">{{s}}</mat-option>
</mat-select>
</mat-form-field>

<div *ngIf="hasLicense()">
<label class="field-label">{{ 'RDP client options' | translate }}</label>
<section>
<mat-checkbox [(ngModel)]="setting.rdpFullScreen">{{ 'Full screen'| translate}}</mat-checkbox>
<mat-checkbox [(ngModel)]="setting.rdpDrivesRedirect" style="padding-left: 20px">{{ 'Driver redirect'| translate}}</mat-checkbox>
</section>
<label class="field-label">{{ 'RDP client options' | translate }}</label>
<section>
<mat-checkbox [(ngModel)]="setting.rdpFullScreen">{{ 'Full screen'| translate}}</mat-checkbox>
<mat-checkbox [(ngModel)]="setting.rdpDrivesRedirect" style="padding-left: 20px">{{ 'Driver redirect'| translate}}</mat-checkbox>
</section>

<label class="field-label space">{{ 'Applet connect method' | translate }}</label>
<mat-radio-group
aria-label="Select an option"
[(ngModel)]="setting.appletConnectMethod"
>
<mat-radio-button value="web">Web</mat-radio-button>
<mat-radio-button value="client" style="padding-left: 20px">{{ 'Client' | translate }}</mat-radio-button>
</mat-radio-group>

<label class="field-label" style="padding-top: 15px">{{ 'Applet connect method' | translate }}</label>
<mat-radio-group
aria-label="Select an option"
[(ngModel)]="setting.appletConnectMethod"
>
<mat-radio-button value="web">Web</mat-radio-button>
<mat-radio-button value="client" style="padding-left: 20px">{{ 'Client' | translate }}</mat-radio-button>
</mat-radio-group>
<mat-form-field>
<label class="field-label" style="padding-bottom: 7px;">
{{'Keyboard layout'| translate }}
</label>
<mat-select [(value)]="setting.keyboardLayout">
<mat-option *ngFor="let item of keyboardLayoutOptions" value="{{item.value}}">
{{item.label}}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>

Expand All @@ -48,7 +59,6 @@ <h1 mat-dialog-title>
</mat-select>
</mat-form-field>


<mat-form-field>
<mat-select [(value)]="setting.quickPaste"
placeholder="{{'Right mouse quick paste'| translate }}" >
Expand Down
9 changes: 9 additions & 0 deletions src/app/elements/setting/setting.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {MAT_DIALOG_DATA} from '@angular/material/dialog';
export class ElementSettingComponent implements OnInit {
resolutionsChoices = ['Auto', '1024x768', '1366x768', '1600x900', '1920x1080'];
public boolChoices: any[];
public keyboardLayoutOptions: any[];
setting: Setting;
globalSetting: GlobalSetting;
type = 'general';
Expand All @@ -26,6 +27,14 @@ export class ElementSettingComponent implements OnInit {
{name: _i18n.instant('Yes'), value: '1'},
{name: _i18n.instant('No'), value: '0'}
];
this.keyboardLayoutOptions = [
{ value: 'en-us-qwerty', label: _i18n.instant('US English keyboard layout') },
{ value: 'en-gb-qwerty', label: _i18n.instant('UK English keyboard layout') },
{ value: 'ja-jp-qwerty', label: _i18n.instant('Japanese keyboard layout') },
{ value: 'fr-fr-azerty', label: _i18n.instant('French keyboard layout') },
{ value: 'fr-ch-qwertz', label: _i18n.instant('Swiss French keyboard layout') },
{ value: 'fr-be-azerty', label: _i18n.instant('Belgian French keyboard layout') }
];
}

hasLicense() {
Expand Down
1 change: 1 addition & 0 deletions src/app/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ export class Setting {
sqlClient = '1';
commandExecution: boolean = true;
appletConnectMethod: string = 'web';
keyboardLayout: string = '';
}


Expand Down
8 changes: 8 additions & 0 deletions src/app/services/setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export class SettingService {
private inited = false;
public isLoadTreeAsync$ = new BehaviorSubject<boolean>(true);
public appletConnectMethod$ = new BehaviorSubject<string>('');
public keyboardLayout$ = new BehaviorSubject<string>('');


constructor(
private _localStorage: LocalStorageService,
Expand All @@ -25,6 +27,7 @@ export class SettingService {
this.setting = settingData;
this.setIsLoadTreeAsync();
this.setAppletConnectMethod();
this.setKeyboardLayout();
} else {
this.setting = new Setting();
}
Expand Down Expand Up @@ -93,6 +96,7 @@ export class SettingService {
this._localStorage.set(this.settingKey, this.setting);
this.setIsLoadTreeAsync();
this.setAppletConnectMethod();
this.setKeyboardLayout();
}

setIsLoadTreeAsync() {
Expand All @@ -103,6 +107,10 @@ export class SettingService {
this.appletConnectMethod$.next(this.setting.appletConnectMethod);
}

setKeyboardLayout() {
this.keyboardLayout$.next(this.setting.keyboardLayout);
}

// 全局跳过手动输入windows账号密码
globalSkipAllManualPassword(): boolean {
return this.globalSetting.WINDOWS_SKIP_ALL_MANUAL_PASSWORD;
Expand Down
9 changes: 9 additions & 0 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,16 @@
"General": "General",
"GUI": "GUI",
"CLI": "CLI",
"Applet connect method": "Applet connect method",
"Client": "Client",

"Keyboard layout": "Keyboard layout",
"UK English keyboard layout": "UK English (Qwerty)",
"US English keyboard layout": "US English (Qwerty)",
"Japanese keyboard layout": "Japanese (Qwerty)",
"French keyboard layout": "French (Azerty)",
"Swiss French keyboard layout": "Swiss French (Qwertz)",
"Belgian French keyboard layout": "Belgian French (Azerty)",
"Login reminder": "Login reminder",
"ACL reject login asset": "This login has been rejected due to access control policy restrictions",
"Need review for login asset": "This login needs manual review. Do you want to continue?",
Expand Down
10 changes: 10 additions & 0 deletions src/assets/i18n/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,16 @@
"Normal accounts": "通常のログインアカウント",
"Special accounts": "特別ログインアカウント",
"Tips": "ヒント",
"Applet connect method": "アプレット接続方法",
"Client": "お客様",

"Keyboard layout": "キーボードレイアウト",
"UK English keyboard layout": "UK English (Qwerty)",
"US English keyboard layout": "US English (Qwerty)",
"Japanese keyboard layout": "Japanese (Qwerty)",
"French keyboard layout": "French (Azerty)",
"Swiss French keyboard layout": "Swiss French (Qwertz)",
"Belgian French keyboard layout": "Belgian French (Azerty)",
"Login reminder": "ログインリマインダー",
"ACL reject login asset": "アクセス制御ポリシーの制限により、このログインは拒否されました",
"Need review for login asset": "このログインは手動で確認する必要があります。続行しますか?",
Expand Down
9 changes: 8 additions & 1 deletion src/assets/i18n/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,14 @@
"General": "基本配置",
"Applet connect method": "远程应用连接方式",
"Client": "客户端",


"Keyboard layout": "键盘布局",
"UK English keyboard layout": "UK English (Qwerty)",
"US English keyboard layout": "US English (Qwerty)",
"Japanese keyboard layout": "Japanese (Qwerty)",
"French keyboard layout": "French (Azerty)",
"Swiss French keyboard layout": "Swiss French (Qwertz)",
"Belgian French keyboard layout": "Belgian French (Azerty)",
"Login reminder": "登录提醒",
"ACL reject login asset": "本次登录已拒绝,原因是访问控制策略的限制",
"Need review for login asset": "本次登录需要进行人工审核,是否继续?",
Expand Down

0 comments on commit fe0f5de

Please sign in to comment.