feat. OSD Lyrics | 增加桌面歌词功能 (#685)

* Add OSD Lyrics

* tidy files

* fix OSDLyrics: last line of lyrics not showing, performance

* tidy files

* make user can resize the lyrics window

* Fix bug of initial window size

* Fix: 1. auto resize osdlyrics window after packaging; 2. lyric parser problem with %;

* tidy files
This commit is contained in:
Shi Liang 2021-05-21 17:15:30 +08:00 committed by GitHub
parent d464e30d83
commit 85592142af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 405 additions and 5 deletions

View file

@ -95,6 +95,15 @@
<div class="right-control-buttons">
<div class="blank"></div>
<div class="container" @click.stop>
<button-icon
:title="$t('player.osdlyrics')"
:class="{
active: osdState,
disabled: !osdState,
}"
@click.native="toggleOSDLyrics"
><svg-icon icon-class="osd-lyrics"
/></button-icon>
<button-icon
:title="$t('player.nextUp')"
:class="{
@ -168,6 +177,10 @@
</template>
<script>
const electron =
process.env.IS_ELECTRON === true ? window.require('electron') : null;
const ipcRenderer =
process.env.IS_ELECTRON === true ? electron.ipcRenderer : null;
import { mapState, mapMutations, mapActions } from 'vuex';
import '@/assets/css/slider.css';
@ -201,10 +214,18 @@ export default {
? '音源来自酷我音乐'
: '';
},
osdState() {
return true; //this.$store.osdlyrics.show || false;
},
},
methods: {
...mapMutations(['toggleLyrics']),
...mapActions(['showToast', 'likeATrack']),
toggleOSDLyrics() {
if (ipcRenderer) {
ipcRenderer.send('toggleOSDLyrics');
}
},
goToNextTracksPage() {
if (this.player.isPersonalFM) return;
this.$route.name === 'next'