Skip to content

Commit

Permalink
Fixes #476: Add Mute/Unmute tooltip on volume icon
Browse files Browse the repository at this point in the history
  • Loading branch information
digimezzo committed Nov 8, 2023
1 parent 1031300 commit 8248b79
Show file tree
Hide file tree
Showing 21 changed files with 54 additions and 42 deletions.
1 change: 0 additions & 1 deletion src/app/common/settings/settings.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,5 @@ export abstract class SettingsBase {
public abstract showLove: boolean;
public abstract enableMultimediaKeys: boolean;
public abstract downloadArtistInformationFromLastFm: boolean;
public abstract isMuted: boolean;
public abstract downloadLyricsOnline: boolean;
}
13 changes: 0 additions & 13 deletions src/app/common/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,15 +610,6 @@ export class Settings implements SettingsBase {
this.settings.set('downloadArtistInformationFromLastFm', v);
}

// isMuted
public get isMuted(): boolean {
return <boolean>this.settings.get('isMuted');
}

public set isMuted(v: boolean) {
this.settings.set('isMuted', v);
}

// downloadLyricsOnline
public get downloadLyricsOnline(): boolean {
return <boolean>this.settings.get('downloadLyricsOnline');
Expand Down Expand Up @@ -890,10 +881,6 @@ export class Settings implements SettingsBase {
this.settings.set('downloadArtistInformationFromLastFm', true);
}

if (!this.settings.has('isMuted')) {
this.settings.set('isMuted', false);
}

if (!this.settings.has('downloadLyricsOnline')) {
this.settings.set('downloadLyricsOnline', true);
}
Expand Down
12 changes: 2 additions & 10 deletions src/app/services/playback/playback.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ import { AlbumModel } from '../album/album-model';
import { ArtistModel } from '../artist/artist-model';
import { ArtistType } from '../artist/artist-type';
import { GenreModel } from '../genre/genre-model';

import { PlaylistModel } from '../playlist/playlist-model';

import { TrackModel } from '../track/track-model';
import { TrackModels } from '../track/track-models';

import { LoopMode } from './loop-mode';
import { PlaybackProgress } from './playback-progress';
import { PlaybackStarted } from './playback-started';
Expand Down Expand Up @@ -40,7 +37,6 @@ export class PlaybackService implements PlaybackServiceBase {
private _isPlaying: boolean = false;
private _canPause: boolean = false;
private _canResume: boolean = true;
private _isMuted: boolean = false;
private _volumeBeforeMute: number = 0;
private subscription: Subscription = new Subscription();

Expand Down Expand Up @@ -337,15 +333,12 @@ export class PlaybackService implements PlaybackServiceBase {
}

public toggleMute(): void {
if (this._isMuted) {
if (this._volume === 0) {
this.applyVolume(this._volumeBeforeMute > 0 ? this._volumeBeforeMute : 0.5);
} else {
this._volumeBeforeMute = this._volume;
this.applyVolume(0);
}

this._isMuted = !this._isMuted;
this.settings.isMuted = this._isMuted;
}

private play(trackToPlay: TrackModel, isPlayingPreviousTrack: boolean): void {
Expand Down Expand Up @@ -455,8 +448,7 @@ export class PlaybackService implements PlaybackServiceBase {
}

private applyVolumeFromSettings(): void {
this._isMuted = this.settings.isMuted;
this._volume = this._isMuted ? 0 : this.settings.volume;
this._volume = this.settings.volume;
this.audioPlayer.setVolume(this._volume);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="app-volume-control">
<div class="pointer" (click)="this.toggleMute()">
<div class="pointer" (click)="this.toggleMute()" matTooltip="{{ (this.volume === 0 ? 'unmute' : 'mute') | translate }}">
<i class="app-volume-control__icon__alt las la-volume-mute" *ngIf="this.volume === 0"></i>
<i class="app-volume-control__icon__alt las la-volume-down" *ngIf="this.volume > 0 && this.volume < 0.5"></i>
<i class="app-volume-control__icon las la-volume-up" *ngIf="this.volume >= 0.5"></i>
Expand Down
4 changes: 3 additions & 1 deletion src/assets/i18n/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,7 @@
"no-lyrics": "No lyrics",
"embedded-lyrics": "Embedded lyrics",
"lrc-lyrics": "LRC lyrics",
"online-lyrics": "Online lyrics"
"online-lyrics": "Online lyrics",
"mute": "Mute",
"unmute": "Unmute"
}
4 changes: 3 additions & 1 deletion src/assets/i18n/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,7 @@
"no-lyrics": "No lyrics",
"embedded-lyrics": "Embedded lyrics",
"lrc-lyrics": "LRC lyrics",
"online-lyrics": "Online lyrics"
"online-lyrics": "Online lyrics",
"mute": "Mute",
"unmute": "Unmute"
}
4 changes: 3 additions & 1 deletion src/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,7 @@
"no-lyrics": "No lyrics",
"embedded-lyrics": "Embedded lyrics",
"lrc-lyrics": "LRC lyrics",
"online-lyrics": "Online lyrics"
"online-lyrics": "Online lyrics",
"mute": "Mute",
"unmute": "Unmute"
}
4 changes: 3 additions & 1 deletion src/assets/i18n/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,7 @@
"no-lyrics": "No lyrics",
"embedded-lyrics": "Embedded lyrics",
"lrc-lyrics": "LRC lyrics",
"online-lyrics": "Online lyrics"
"online-lyrics": "Online lyrics",
"mute": "Mute",
"unmute": "Unmute"
}
4 changes: 3 additions & 1 deletion src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,7 @@
"no-lyrics": "No lyrics",
"embedded-lyrics": "Embedded lyrics",
"lrc-lyrics": "LRC lyrics",
"online-lyrics": "Online lyrics"
"online-lyrics": "Online lyrics",
"mute": "Mute",
"unmute": "Unmute"
}
4 changes: 3 additions & 1 deletion src/assets/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,7 @@
"no-lyrics": "No lyrics",
"embedded-lyrics": "Embedded lyrics",
"lrc-lyrics": "LRC lyrics",
"online-lyrics": "Online lyrics"
"online-lyrics": "Online lyrics",
"mute": "Mute",
"unmute": "Unmute"
}
4 changes: 3 additions & 1 deletion src/assets/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,7 @@
"no-lyrics": "Pas de paroles",
"embedded-lyrics": "Paroles intégrées",
"lrc-lyrics": "Paroles LRC",
"online-lyrics": "Paroles en ligne"
"online-lyrics": "Paroles en ligne",
"mute": "Mute",
"unmute": "Unmute"
}
4 changes: 3 additions & 1 deletion src/assets/i18n/hr.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,7 @@
"no-lyrics": "No lyrics",
"embedded-lyrics": "Embedded lyrics",
"lrc-lyrics": "LRC lyrics",
"online-lyrics": "Online lyrics"
"online-lyrics": "Online lyrics",
"mute": "Mute",
"unmute": "Unmute"
}
4 changes: 3 additions & 1 deletion src/assets/i18n/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,7 @@
"no-lyrics": "No lyrics",
"embedded-lyrics": "Embedded lyrics",
"lrc-lyrics": "LRC lyrics",
"online-lyrics": "Online lyrics"
"online-lyrics": "Online lyrics",
"mute": "Mute",
"unmute": "Unmute"
}
4 changes: 3 additions & 1 deletion src/assets/i18n/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,7 @@
"no-lyrics": "No lyrics",
"embedded-lyrics": "Embedded lyrics",
"lrc-lyrics": "LRC lyrics",
"online-lyrics": "Online lyrics"
"online-lyrics": "Online lyrics",
"mute": "Mute",
"unmute": "Unmute"
}
4 changes: 3 additions & 1 deletion src/assets/i18n/ku.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,7 @@
"no-lyrics": "No lyrics",
"embedded-lyrics": "Embedded lyrics",
"lrc-lyrics": "LRC lyrics",
"online-lyrics": "Online lyrics"
"online-lyrics": "Online lyrics",
"mute": "Mute",
"unmute": "Unmute"
}
4 changes: 3 additions & 1 deletion src/assets/i18n/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,7 @@
"no-lyrics": "Geen songteksten",
"embedded-lyrics": "Ingebedde songteksten",
"lrc-lyrics": "LRC songteksten",
"online-lyrics": "Online songteksten"
"online-lyrics": "Online songteksten",
"mute": "Mute",
"unmute": "Unmute"
}
4 changes: 3 additions & 1 deletion src/assets/i18n/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,7 @@
"no-lyrics": "No lyrics",
"embedded-lyrics": "Embedded lyrics",
"lrc-lyrics": "LRC lyrics",
"online-lyrics": "Online lyrics"
"online-lyrics": "Online lyrics",
"mute": "Mute",
"unmute": "Unmute"
}
4 changes: 3 additions & 1 deletion src/assets/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,7 @@
"no-lyrics": "No lyrics",
"embedded-lyrics": "Embedded lyrics",
"lrc-lyrics": "LRC lyrics",
"online-lyrics": "Online lyrics"
"online-lyrics": "Online lyrics",
"mute": "Mute",
"unmute": "Unmute"
}
4 changes: 3 additions & 1 deletion src/assets/i18n/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,7 @@
"no-lyrics": "No lyrics",
"embedded-lyrics": "Embedded lyrics",
"lrc-lyrics": "LRC lyrics",
"online-lyrics": "Online lyrics"
"online-lyrics": "Online lyrics",
"mute": "Mute",
"unmute": "Unmute"
}
4 changes: 3 additions & 1 deletion src/assets/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,7 @@
"no-lyrics": "No lyrics",
"embedded-lyrics": "Embedded lyrics",
"lrc-lyrics": "LRC lyrics",
"online-lyrics": "Online lyrics"
"online-lyrics": "Online lyrics",
"mute": "Mute",
"unmute": "Unmute"
}
4 changes: 3 additions & 1 deletion src/assets/i18n/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,7 @@
"no-lyrics": "No lyrics",
"embedded-lyrics": "Embedded lyrics",
"lrc-lyrics": "LRC lyrics",
"online-lyrics": "Online lyrics"
"online-lyrics": "Online lyrics",
"mute": "Mute",
"unmute": "Unmute"
}

0 comments on commit 8248b79

Please sign in to comment.