diff --git a/src/ts/components/dynamicsettingspanelitem.ts b/src/ts/components/dynamicsettingspanelitem.ts index 54c85614f..72ae6a01b 100644 --- a/src/ts/components/dynamicsettingspanelitem.ts +++ b/src/ts/components/dynamicsettingspanelitem.ts @@ -25,7 +25,7 @@ export interface DynamicSettingsPanelItemConfig extends SettingsPanelItemConfig /** * The list selector component which will be used to build the sub page. */ - setting: ListSelector; + settingComponent: ListSelector; /** * The enclosing {@link SettingsPanel} where the sub page will be added. */ @@ -40,7 +40,7 @@ export interface DynamicSettingsPanelItemConfig extends SettingsPanelItemConfig */ export class DynamicSettingsPanelItem extends SettingsPanelItem { private selectedOptionLabel: Label; - protected setting: ListSelector; + protected settingComponent: ListSelector; private player: PlayerAPI; private uimanager: UIInstanceManager; @@ -48,7 +48,7 @@ export class DynamicSettingsPanelItem extends SettingsPanelItem { - let selectedItem = this.setting.getItemForKey(this.setting.getSelectedItem()); + let selectedItem = this.settingComponent.getItemForKey(this.settingComponent.getSelectedItem()); if (selectedItem == null) { this.selectedOptionLabel.hide(); return; @@ -89,13 +89,13 @@ export class DynamicSettingsPanelItem extends SettingsPanelItem { return new SettingsPanelSelectOption({ label: option.label, - setting: this.setting, + settingComponent: this.settingComponent, settingsValue: option.key, addSettingAsComponent: false, }); @@ -141,7 +141,7 @@ export class DynamicSettingsPanelItem extends SettingsPanelItem setting.overlay.enablePreviewSubtitleLabel()); diff --git a/src/ts/components/ecomodecontainer.ts b/src/ts/components/ecomodecontainer.ts index dac5dc589..77bb7b4e5 100644 --- a/src/ts/components/ecomodecontainer.ts +++ b/src/ts/components/ecomodecontainer.ts @@ -29,10 +29,10 @@ export class EcoModeContainer extends Container { cssClass: 'ui-label-savedEnergy', }); - this.ecoModeToggleButtonItem = new SettingsPanelItem({ label: labelEcoMode, setting: ecoModeToggleButton }); + this.ecoModeToggleButtonItem = new SettingsPanelItem({ label: labelEcoMode, settingComponent: ecoModeToggleButton }); this.ecoModeSavedEmissionsItem = new SettingsPanelItem({ label: 'Saved Emissions', - setting: this.emissionsSavedLabel, + settingComponent: this.emissionsSavedLabel, hidden: true, }); diff --git a/src/ts/components/settingspanel.ts b/src/ts/components/settingspanel.ts index 9bb25779c..dade69b86 100644 --- a/src/ts/components/settingspanel.ts +++ b/src/ts/components/settingspanel.ts @@ -399,7 +399,7 @@ export class SettingsPanel extends Container { */ private hideHoveredSelectBoxes(): void { this.getComputedItems() - .map(item => item['setting']) + .map(item => item['settingComponent']) .filter(component => component instanceof SelectBox) .forEach((selectBox: SelectBox) => selectBox.closeDropdown()); } diff --git a/src/ts/components/settingspanelitem.ts b/src/ts/components/settingspanelitem.ts index e3fd4c020..50a8fddea 100644 --- a/src/ts/components/settingspanelitem.ts +++ b/src/ts/components/settingspanelitem.ts @@ -24,7 +24,7 @@ export interface SettingsPanelItemConfig extends ContainerConfig { /** * The component that configures a setting. */ - setting?: Component; + settingComponent?: Component; /** * If the setting should be added as a component to this item. */ @@ -41,7 +41,7 @@ export interface SettingsPanelItemConfig extends ContainerConfig { export class SettingsPanelItem extends Container { private label: Component; - protected setting: Component | null; + protected settingComponent: Component | null; private settingsPanelItemEvents = { onActiveChanged: new EventDispatcher, NoArgs>(), @@ -51,7 +51,7 @@ export class SettingsPanelItem extends C constructor(config: Config) { super(config); - this.setting = config.setting; + this.settingComponent = config.settingComponent; this.config = this.mergeConfig(config, { cssClass: 'ui-settings-panel-item', @@ -74,14 +74,14 @@ export class SettingsPanelItem extends C configure(player: PlayerAPI, uimanager: UIInstanceManager): void { super.configure(player, uimanager); - if (this.setting != null && this.config.addSettingAsComponent) { - this.addComponent(this.setting); + if (this.settingComponent != null && this.config.addSettingAsComponent) { + this.addComponent(this.settingComponent); this.updateComponents(); } - if (this.setting instanceof SelectBox || this.setting instanceof ListBox) { + if (this.settingComponent instanceof SelectBox || this.settingComponent instanceof ListBox) { let handleConfigItemChanged = () => { - if (!(this.setting instanceof SelectBox) && !(this.setting instanceof ListBox)) { + if (!(this.settingComponent instanceof SelectBox) && !(this.settingComponent instanceof ListBox)) { return; } // The minimum number of items that must be available for the setting to be displayed @@ -89,15 +89,15 @@ export class SettingsPanelItem extends C let minItemsToDisplay = 2; // Audio/video quality select boxes contain an additional 'auto' mode, which in combination with a single // available quality also does not make sense - if ((this.setting instanceof VideoQualitySelectBox && this.setting.hasAutoItem()) - || this.setting instanceof AudioQualitySelectBox) { + if ((this.settingComponent instanceof VideoQualitySelectBox && this.settingComponent.hasAutoItem()) + || this.settingComponent instanceof AudioQualitySelectBox) { minItemsToDisplay = 3; } - if (this.setting.itemCount() < minItemsToDisplay) { + if (this.settingComponent.itemCount() < minItemsToDisplay) { // Hide the setting if no meaningful choice is available this.hide(); - } else if (this.setting instanceof PlaybackSpeedSelectBox + } else if (this.settingComponent instanceof PlaybackSpeedSelectBox && !uimanager.getConfig().playbackSpeedSelectionEnabled) { // Hide the PlaybackSpeedSelectBox if disabled in config this.hide(); @@ -112,8 +112,8 @@ export class SettingsPanelItem extends C this.getDomElement().attr('aria-haspopup', 'true'); }; - this.setting.onItemAdded.subscribe(handleConfigItemChanged); - this.setting.onItemRemoved.subscribe(handleConfigItemChanged); + this.settingComponent.onItemAdded.subscribe(handleConfigItemChanged); + this.settingComponent.onItemRemoved.subscribe(handleConfigItemChanged); // Initialize hidden state handleConfigItemChanged(); diff --git a/src/ts/components/settingspanelselectoption.ts b/src/ts/components/settingspanelselectoption.ts index 99af1b56b..bb1a55b5b 100644 --- a/src/ts/components/settingspanelselectoption.ts +++ b/src/ts/components/settingspanelselectoption.ts @@ -12,7 +12,7 @@ export interface SettingsPanelSelectOptionConfig extends SettingsPanelItemConfig /** * The setting that will be changed when this option is clicked. */ - setting: ListSelector; + settingComponent: ListSelector; /** * The value of the setting that will be selected when this option is clicked. */ @@ -27,7 +27,7 @@ export interface SettingsPanelSelectOptionConfig extends SettingsPanelItemConfig */ export class SettingsPanelSelectOption extends SettingsPanelItem { private settingsValue: string | undefined; - protected setting: ListSelector; + protected settingComponent: ListSelector; constructor(config: SettingsPanelSelectOptionConfig) { super(config); @@ -44,7 +44,7 @@ export class SettingsPanelSelectOption extends SettingsPanelItem { - let selectedItem = this.setting.getSelectedItem(); + let selectedItem = this.settingComponent.getSelectedItem(); if (this.settingsValue === selectedItem) { this.getDomElement().addClass(this.prefixCss('selected')); @@ -52,10 +52,10 @@ export class SettingsPanelSelectOption extends SettingsPanelItem { - this.setting.selectItem(this.settingsValue); + this.settingComponent.selectItem(this.settingsValue); }; this.getDomElement().on('click', () => handleItemClick()); diff --git a/src/ts/components/subtitlesettings/subtitlesettingspanelpage.ts b/src/ts/components/subtitlesettings/subtitlesettingspanelpage.ts index 55c3147e0..235229ed1 100644 --- a/src/ts/components/subtitlesettings/subtitlesettingspanelpage.ts +++ b/src/ts/components/subtitlesettings/subtitlesettingspanelpage.ts @@ -113,7 +113,7 @@ export class SubtitleSettingsPanelPage extends SettingsPanelPage { label: new SettingsPanelPageBackButton({ container: this.settingsPanel, }), - setting: new SubtitleSettingsResetButton({}), + settingComponent: new SubtitleSettingsResetButton({}), cssClasses: ['title-item'], }); @@ -148,13 +148,13 @@ export class SubtitleSettingsPanelPage extends SettingsPanelPage { if (useDynamicSettingsPanelItem) { return new DynamicSettingsPanelItem({ label: label, - setting: setting, + settingComponent: setting, container: this.settingsPanel, }); } else { return new SettingsPanelItem({ label: label, - setting: setting, + settingComponent: setting, }); } } diff --git a/src/ts/demofactory.ts b/src/ts/demofactory.ts index 596af48b3..125e27c2c 100644 --- a/src/ts/demofactory.ts +++ b/src/ts/demofactory.ts @@ -70,9 +70,9 @@ export namespace DemoFactory { components: [ new SettingsPanelPage({ components: [ - new SettingsPanelItem({ label: 'Video Quality', setting: new VideoQualitySelectBox() }), - new SettingsPanelItem({ label: 'Speed', setting: new PlaybackSpeedSelectBox() }), - new SettingsPanelItem({ label: 'Audio Quality', setting: new AudioQualitySelectBox() }), + new SettingsPanelItem({ label: 'Video Quality', settingComponent: new VideoQualitySelectBox() }), + new SettingsPanelItem({ label: 'Speed', settingComponent: new PlaybackSpeedSelectBox() }), + new SettingsPanelItem({ label: 'Audio Quality', settingComponent: new AudioQualitySelectBox() }), ], }), ], @@ -84,7 +84,7 @@ export namespace DemoFactory { components: [ new SettingsPanelPage({ components: [ - new SettingsPanelItem({ label: null, setting: subtitleListBox }), + new SettingsPanelItem({ label: null, settingComponent: subtitleListBox }), ], }), ], @@ -96,7 +96,7 @@ export namespace DemoFactory { components: [ new SettingsPanelPage({ components: [ - new SettingsPanelItem({ label: null, setting: audioTrackListBox }), + new SettingsPanelItem({ label: null, settingComponent: audioTrackListBox }), ], }), ], diff --git a/src/ts/uifactory.ts b/src/ts/uifactory.ts index 627e47308..4abc5d01d 100644 --- a/src/ts/uifactory.ts +++ b/src/ts/uifactory.ts @@ -81,10 +81,10 @@ export namespace UIFactory { let mainSettingsPanelPage: SettingsPanelPage; const components: Container[] = [ - new SettingsPanelItem({ label: i18n.getLocalizer('settings.video.quality'), setting: new VideoQualitySelectBox() }), - new SettingsPanelItem({ label: i18n.getLocalizer('speed'), setting: new PlaybackSpeedSelectBox() }), - new SettingsPanelItem({ label: i18n.getLocalizer('settings.audio.track'), setting: new AudioTrackSelectBox() }), - new SettingsPanelItem({ label: i18n.getLocalizer('settings.audio.quality'), setting: new AudioQualitySelectBox() }), + new SettingsPanelItem({ label: i18n.getLocalizer('settings.video.quality'), settingComponent: new VideoQualitySelectBox() }), + new SettingsPanelItem({ label: i18n.getLocalizer('speed'), settingComponent: new PlaybackSpeedSelectBox() }), + new SettingsPanelItem({ label: i18n.getLocalizer('settings.audio.track'), settingComponent: new AudioTrackSelectBox() }), + new SettingsPanelItem({ label: i18n.getLocalizer('settings.audio.quality'), settingComponent: new AudioQualitySelectBox() }), ]; if (config.ecoMode) { @@ -127,7 +127,7 @@ export namespace UIFactory { text: i18n.getLocalizer('settings.subtitles'), opener: subtitleSettingsOpenButton, }), - setting: subtitleSelectBox, + settingComponent: subtitleSelectBox, role: 'menubar', }), ); @@ -231,10 +231,10 @@ export namespace UIFactory { let mainSettingsPanelPage = new SettingsPanelPage({ components: [ - new SettingsPanelItem({ label: i18n.getLocalizer('settings.video.quality'), setting: new VideoQualitySelectBox() }), - new SettingsPanelItem({ label: i18n.getLocalizer('speed'), setting: new PlaybackSpeedSelectBox() }), - new SettingsPanelItem({ label: i18n.getLocalizer('settings.audio.track'), setting: new AudioTrackSelectBox() }), - new SettingsPanelItem({ label: i18n.getLocalizer('settings.audio.quality'), setting: new AudioQualitySelectBox() }), + new SettingsPanelItem({ label: i18n.getLocalizer('settings.video.quality'), settingComponent: new VideoQualitySelectBox() }), + new SettingsPanelItem({ label: i18n.getLocalizer('speed'), settingComponent: new PlaybackSpeedSelectBox() }), + new SettingsPanelItem({ label: i18n.getLocalizer('settings.audio.track'), settingComponent: new AudioTrackSelectBox() }), + new SettingsPanelItem({ label: i18n.getLocalizer('settings.audio.quality'), settingComponent: new AudioQualitySelectBox() }), ], }); @@ -265,7 +265,7 @@ export namespace UIFactory { text: i18n.getLocalizer('settings.subtitles'), opener: subtitleSettingsOpenButton, }), - setting: subtitleSelectBox, + settingComponent: subtitleSelectBox, role: 'menubar', }), ); @@ -461,22 +461,22 @@ export namespace UIFactory { components: [ new DynamicSettingsPanelItem({ label: i18n.getLocalizer('settings.video.quality'), - setting: new VideoQualitySelectBox(), + settingComponent: new VideoQualitySelectBox(), container: settingsPanel, }), new DynamicSettingsPanelItem({ label: i18n.getLocalizer('speed'), - setting: new PlaybackSpeedSelectBox(), + settingComponent: new PlaybackSpeedSelectBox(), container: settingsPanel, }), new DynamicSettingsPanelItem({ label: i18n.getLocalizer('settings.audio.track'), - setting: new AudioTrackSelectBox() , + settingComponent: new AudioTrackSelectBox() , container: settingsPanel, }), new DynamicSettingsPanelItem({ label: i18n.getLocalizer('settings.audio.quality'), - setting: new AudioQualitySelectBox(), + settingComponent: new AudioQualitySelectBox(), container: settingsPanel, }), ], @@ -503,7 +503,7 @@ export namespace UIFactory { text: i18n.getLocalizer('settings.subtitles'), opener: subtitleSettingsOpenButton, }), - setting: subtitleSelectBox, + settingComponent: subtitleSelectBox, role: 'menubar', container: settingsPanel, }); @@ -583,22 +583,22 @@ export namespace UIFactory { const components: Container[] = [ new DynamicSettingsPanelItem({ label: i18n.getLocalizer('settings.video.quality'), - setting: new VideoQualitySelectBox(), + settingComponent: new VideoQualitySelectBox(), container: settingsPanel, }), new DynamicSettingsPanelItem({ label: i18n.getLocalizer('speed'), - setting: new PlaybackSpeedSelectBox(), + settingComponent: new PlaybackSpeedSelectBox(), container: settingsPanel, }), new DynamicSettingsPanelItem({ label: i18n.getLocalizer('settings.audio.track'), - setting: new AudioTrackSelectBox(), + settingComponent: new AudioTrackSelectBox(), container: settingsPanel, }), new DynamicSettingsPanelItem({ label: i18n.getLocalizer('settings.audio.quality'), - setting: new AudioQualitySelectBox(), + settingComponent: new AudioQualitySelectBox(), container: settingsPanel, }), ]; @@ -639,7 +639,7 @@ export namespace UIFactory { text: i18n.getLocalizer('settings.subtitles'), opener: subtitleSettingsOpenButton, }), - setting: subtitleSelectBox, + settingComponent: subtitleSelectBox, role: 'menubar', container: settingsPanel, }); @@ -809,7 +809,7 @@ export namespace UIFactory { const subtitleListPanel = new SettingsPanel({ components: [ new SettingsPanelPage({ - components: [new SettingsPanelItem({ setting: subtitleListBox })], + components: [new SettingsPanelItem({ settingComponent: subtitleListBox })], }), ], hidden: true, @@ -819,7 +819,7 @@ export namespace UIFactory { const audioTrackListPanel = new SettingsPanel({ components: [ new SettingsPanelPage({ - components: [new SettingsPanelItem({ setting: audioTrackListBox })], + components: [new SettingsPanelItem({ settingComponent: audioTrackListBox })], }), ], hidden: true,