mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 21:58:03 +00:00
fix: remove osdlyrics
This commit is contained in:
parent
c7681df0e8
commit
caaf62ea20
9 changed files with 3 additions and 391 deletions
|
|
@ -1,23 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" focusable="false" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
x="0px" y="0px" viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve">
|
||||
<path fill="currentColor" d="M15,0C6.7,0,0,6.7,0,15s6.7,15,15,15s15-6.7,15-15S23.3,0,15,0z M11.9,10.6c0.4,0,0.7,0.1,1,0.1s0.6,0,0.9,0.1
|
||||
c0.3,0,0.6,0,1,0c0.3,0,0.7,0,1.2,0c0.5,0,0.9,0,1.2,0c0.3,0,0.6,0,0.9,0c0.3,0,0.5,0,0.7,0c0.2,0,0.5-0.1,0.8-0.1v1.7l0,0l0,0l0,0
|
||||
c-0.3,0-0.5,0-0.8-0.1s-0.5,0-0.7,0c-0.3,0-0.6,0-0.9,0c-0.3,0-0.8,0-1.2,0c-0.5,0-0.9,0-1.2,0c-0.3,0-0.7,0-1,0c-0.3,0-0.6,0-0.9,0
|
||||
c-0.3,0-0.6,0-0.9,0.1L11.9,10.6L11.9,10.6z M9.1,6C9.4,6.4,9.7,6.9,10,7.3s0.6,1,0.9,1.5l-1.7,1l0,0C8.9,9.2,8.6,8.7,8.4,8.2
|
||||
C8.1,7.7,7.8,7.3,7.5,6.9L9.1,6z M9.9,21.6c-0.1,0.1-0.3,0.3-0.4,0.4c-0.1,0.1-0.2,0.2-0.3,0.4c-0.1,0.1-0.2,0.3-0.3,0.4
|
||||
c-0.1,0.1-0.2,0.3-0.3,0.5c-0.2-0.3-0.4-0.6-0.6-0.9c-0.2-0.3-0.4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-0.2
|
||||
c0.1-0.1,0.1-0.2,0.1-0.4V8.7h-4.1c-0.5,0-0.9,0-1.2,0c-0.4,0-0.7,0-1.1,0c-0.3,0-0.7,0-1,0.1c-0.3,0-0.6,0.1-1,0.1V7.2
|
||||
c0.3,0,0.6,0,0.9,0.1c0.3,0,0.6,0,0.9,0c0.3,0,0.7,0,1.2,0H17c0.8,0,1.4,0,2,0c0.5,0,1,0,1.4,0c0.4,0,0.8,0,1.1,0
|
||||
c0.3,0,0.7-0.1,1.1-0.1l0,0C22.6,7.3,22.6,7.4,22.6,7.5z"/>
|
||||
<path fill="currentColor" d="M14.3,15h2.8v3.4h-2.8L14.3,15L14.3,15z"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 2.4 KiB |
|
|
@ -29,7 +29,6 @@ const log = text => {
|
|||
class Background {
|
||||
constructor() {
|
||||
this.window = null;
|
||||
this.osdlyrics = null;
|
||||
this.tray = null;
|
||||
this.store = new Store({
|
||||
windowWidth: {
|
||||
|
|
@ -165,71 +164,6 @@ class Background {
|
|||
}
|
||||
}
|
||||
|
||||
createOSDWindow() {
|
||||
this.osdlyrics = new BrowserWindow({
|
||||
x: this.store.get('osdlyrics.x-pos') || 0,
|
||||
y: this.store.get('osdlyrics.y-pos') || 0,
|
||||
width: this.store.get('osdlyrics.width') || 840,
|
||||
height: this.store.get('osdlyrics.height') || 110,
|
||||
title: 'OSD Lyrics',
|
||||
transparent: true,
|
||||
frame: false,
|
||||
webPreferences: {
|
||||
webSecurity: false,
|
||||
nodeIntegration: true,
|
||||
enableRemoteModule: true,
|
||||
contextIsolation: false,
|
||||
},
|
||||
});
|
||||
this.osdlyrics.setAlwaysOnTop(true, 'screen');
|
||||
|
||||
if (process.env.WEBPACK_DEV_SERVER_URL) {
|
||||
// Load the url of the dev server if in development mode
|
||||
this.osdlyrics.loadURL(
|
||||
process.env.WEBPACK_DEV_SERVER_URL + '/osdlyrics.html'
|
||||
);
|
||||
if (!process.env.IS_TEST) this.osdlyrics.webContents.openDevTools();
|
||||
} else {
|
||||
this.osdlyrics.loadURL('http://localhost:27232/osdlyrics.html');
|
||||
}
|
||||
}
|
||||
|
||||
initOSDLyrics() {
|
||||
const osdState = this.store.get('osdlyrics.show') || false;
|
||||
if (osdState) {
|
||||
this.showOSDLyrics();
|
||||
}
|
||||
}
|
||||
|
||||
toggleOSDLyrics() {
|
||||
const osdState = this.store.get('osdlyrics.show') || false;
|
||||
if (osdState) {
|
||||
this.hideOSDLyrics();
|
||||
} else {
|
||||
this.showOSDLyrics();
|
||||
}
|
||||
}
|
||||
|
||||
showOSDLyrics() {
|
||||
this.store.set('osdlyrics.show', true);
|
||||
if (!this.osdlyrics) {
|
||||
this.createOSDWindow();
|
||||
this.handleOSDEvents();
|
||||
}
|
||||
}
|
||||
|
||||
hideOSDLyrics() {
|
||||
this.store.set('osdlyrics.show', false);
|
||||
if (this.osdlyrics) {
|
||||
this.osdlyrics.close();
|
||||
}
|
||||
}
|
||||
|
||||
resizeOSDLyrics(height) {
|
||||
const width = this.store.get('osdlyrics.width') || 840;
|
||||
this.osdlyrics.setSize(width, height);
|
||||
}
|
||||
|
||||
checkForUpdates() {
|
||||
if (process.env.NODE_ENV === 'development') return;
|
||||
log('checkForUpdates');
|
||||
|
|
@ -259,30 +193,6 @@ class Background {
|
|||
});
|
||||
}
|
||||
|
||||
handleOSDEvents() {
|
||||
this.osdlyrics.once('ready-to-show', () => {
|
||||
log('OSD ready-to-show event');
|
||||
this.osdlyrics.show();
|
||||
});
|
||||
|
||||
this.osdlyrics.on('closed', e => {
|
||||
log('OSD close event');
|
||||
this.osdlyrics = null;
|
||||
});
|
||||
|
||||
this.osdlyrics.on('resized', () => {
|
||||
let { height, width } = this.osdlyrics.getBounds();
|
||||
this.store.set('osdlyrics.width', width);
|
||||
this.store.set('osdlyrics.height', height);
|
||||
});
|
||||
|
||||
this.osdlyrics.on('moved', () => {
|
||||
var pos = this.osdlyrics.getPosition();
|
||||
this.store.set('osdlyrics.x-pos', pos[0]);
|
||||
this.store.set('osdlyrics.y-pos', pos[1]);
|
||||
});
|
||||
}
|
||||
|
||||
handleWindowEvents() {
|
||||
this.window.once('ready-to-show', () => {
|
||||
log('windows ready-to-show event');
|
||||
|
|
@ -363,13 +273,8 @@ class Background {
|
|||
});
|
||||
this.handleWindowEvents();
|
||||
|
||||
this.initOSDLyrics();
|
||||
|
||||
// init ipcMain
|
||||
initIpcMain(this.window, this.store, {
|
||||
resizeOSDLyrics: height => this.resizeOSDLyrics(height),
|
||||
toggleOSDLyrics: () => this.toggleOSDLyrics(),
|
||||
});
|
||||
initIpcMain(this.window, this.store);
|
||||
|
||||
// set proxy
|
||||
const proxyRules = this.store.get('proxy');
|
||||
|
|
|
|||
|
|
@ -95,12 +95,6 @@
|
|||
<div class="right-control-buttons">
|
||||
<div class="blank"></div>
|
||||
<div class="container" @click.stop>
|
||||
<button-icon
|
||||
v-if="osdState"
|
||||
:title="$t('player.osdLyrics')"
|
||||
@click.native="toggleOSDLyrics"
|
||||
><svg-icon icon-class="osd-lyrics"
|
||||
/></button-icon>
|
||||
<button-icon
|
||||
:title="$t('player.nextUp')"
|
||||
:class="{
|
||||
|
|
@ -174,10 +168,6 @@
|
|||
</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';
|
||||
|
||||
|
|
@ -211,18 +201,10 @@ export default {
|
|||
? '音源来自酷我音乐'
|
||||
: '';
|
||||
},
|
||||
osdState() {
|
||||
return Boolean(ipcRenderer);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['toggleLyrics']),
|
||||
...mapActions(['showToast', 'likeATrack']),
|
||||
toggleOSDLyrics() {
|
||||
if (ipcRenderer) {
|
||||
ipcRenderer.send('toggleOSDLyrics');
|
||||
}
|
||||
},
|
||||
goToNextTracksPage() {
|
||||
if (this.player.isPersonalFM) return;
|
||||
this.$route.name === 'next'
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ const log = text => {
|
|||
|
||||
const client = require('discord-rich-presence')('818936529484906596');
|
||||
|
||||
export function initIpcMain(win, store, lrc) {
|
||||
export function initIpcMain(win, store) {
|
||||
ipcMain.on('unblock-music', (event, track) => {
|
||||
// 兼容 unblockneteasemusic 所使用的 api 字段
|
||||
track.alias = track.alia || [];
|
||||
|
|
@ -128,14 +128,6 @@ export function initIpcMain(win, store, lrc) {
|
|||
store.set('proxy', '');
|
||||
});
|
||||
|
||||
ipcMain.on('resizeOSDLyrics', (event, arg) => {
|
||||
lrc.resizeOSDLyrics(arg);
|
||||
});
|
||||
|
||||
ipcMain.on('toggleOSDLyrics', () => {
|
||||
lrc.toggleOSDLyrics();
|
||||
});
|
||||
|
||||
ipcMain.on('switchGlobalShortcutStatusTemporary', (e, status) => {
|
||||
if (status === 'disable') {
|
||||
globalShortcut.unregisterAll();
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ const { app, Menu } = require('electron');
|
|||
|
||||
const isMac = process.platform === 'darwin';
|
||||
|
||||
export function createMenu(win, store, lrc) {
|
||||
export function createMenu(win, store) {
|
||||
let shortcuts = store.get('settings.shortcuts');
|
||||
if (shortcuts === undefined) {
|
||||
shortcuts = defaultShortcuts;
|
||||
|
|
@ -188,7 +188,6 @@ export function createMenu(win, store, lrc) {
|
|||
accelerator: 'F12',
|
||||
click: () => {
|
||||
win.webContents.openDevTools();
|
||||
lrc.openDevTools();
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -100,7 +100,6 @@ export default {
|
|||
pause: 'Pause',
|
||||
mute: 'Mute',
|
||||
nextUp: 'Next Up',
|
||||
osdLyrics: 'OSD Lyrics',
|
||||
},
|
||||
modal: {
|
||||
close: 'Close',
|
||||
|
|
|
|||
|
|
@ -100,7 +100,6 @@ export default {
|
|||
pause: 'Durdur',
|
||||
mute: 'Sesi kapat',
|
||||
nextUp: 'Sıradaki',
|
||||
osdLyrics: 'masaüstü şarkı sözleri',
|
||||
},
|
||||
modal: {
|
||||
close: 'Kapat',
|
||||
|
|
|
|||
|
|
@ -101,7 +101,6 @@ export default {
|
|||
pause: '暂停',
|
||||
mute: '静音',
|
||||
nextUp: '播放列表',
|
||||
osdLyrics: '桌面歌词',
|
||||
},
|
||||
modal: {
|
||||
close: '关闭',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue