+ openLanguageChooser () {
+ this.languageChooserModal.show()
+ }
+
+ openHotkeysCheatSheet () {
+ this.hotkeysService.cheatSheetToggle.next(!this.helpVisible)
+ }
+
+ openQuickSettings () {
+ this.quickSettingsModal.show()
+ }
+
+ toggleUseP2P () {
+ if (!this.user) return
+ this.user.webTorrentEnabled = !this.user.webTorrentEnabled
+
+ this.userService.updateMyProfile({ webTorrentEnabled: this.user.webTorrentEnabled })
+ .subscribe(() => this.authService.refreshUserInformation())
+ }
+
+ langForLocale (localeId: string) {
+ if (localeId === '_unknown') return this.i18n('Unknown')
+
+ return this.languages.find(lang => lang.id === localeId).label
+ }
+
+ private buildUserLanguages () {
+ if (!this.user) {
+ this.videoLanguages = []
+ return
+ }
+
+ if (!this.user.videoLanguages) {
+ this.videoLanguages = [ this.i18n('any language') ]
+ return
+ }
+
+ this.videoLanguages = this.user.videoLanguages
+ .map(locale => this.langForLocale(locale))
+ .map(value => value === undefined ? '?' : value)
+ }
+