新增托盘图标样式设置
|
@ -3,7 +3,7 @@ const os = require('os')
|
|||
const { isMac } = require('./utils')
|
||||
|
||||
const defaultSetting = {
|
||||
version: '1.0.31',
|
||||
version: '1.0.32',
|
||||
player: {
|
||||
togglePlayMethod: 'listLoop',
|
||||
highQuality: false,
|
||||
|
@ -76,6 +76,7 @@ const defaultSetting = {
|
|||
tray: {
|
||||
isShow: false,
|
||||
isToTray: false,
|
||||
themeId: 0,
|
||||
},
|
||||
windowSizeId: 2,
|
||||
themeId: 0,
|
||||
|
|
|
@ -17,9 +17,14 @@ global.lx_event.mainWindow.on(MAIN_WINDOW_EVENT_NAME.quit, () => {
|
|||
global.modules.mainWindow.close()
|
||||
})
|
||||
global.lx_event.mainWindow.on(MAIN_WINDOW_EVENT_NAME.toggle_minimize, () => {
|
||||
global.modules.mainWindow.isMinimized()
|
||||
? global.modules.mainWindow.restore()
|
||||
: global.modules.mainWindow.minimize()
|
||||
if (global.modules.mainWindow.isMinimized()) {
|
||||
if (!global.modules.mainWindow.isVisible()) {
|
||||
global.modules.mainWindow.show()
|
||||
}
|
||||
global.modules.mainWindow.restore()
|
||||
} else {
|
||||
global.modules.mainWindow.minimize()
|
||||
}
|
||||
})
|
||||
global.lx_event.mainWindow.on(MAIN_WINDOW_EVENT_NAME.toggle_hide, () => {
|
||||
global.modules.mainWindow.isVisible()
|
||||
|
|
|
@ -3,8 +3,25 @@ const { isWin } = require('../../common/utils')
|
|||
const { tray: TRAY_EVENT_NAME, common: COMMON_EVENT_NAME } = require('../events/_name')
|
||||
const path = require('path')
|
||||
let isEnableTray = null
|
||||
let themeId = null
|
||||
const themeList = [
|
||||
{
|
||||
id: 0,
|
||||
fileName: 'tray0Template',
|
||||
isNative: true,
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
fileName: 'tray1Template',
|
||||
isNative: false,
|
||||
},
|
||||
]
|
||||
global.lx_event.common.on(COMMON_EVENT_NAME.config, sourceName => {
|
||||
if (sourceName === TRAY_EVENT_NAME.name) return
|
||||
if (themeId !== global.appSetting.tray.themeId) {
|
||||
themeId = global.appSetting.tray.themeId
|
||||
setTrayImage(themeId)
|
||||
}
|
||||
if (isEnableTray !== global.appSetting.tray.isToTray) {
|
||||
isEnableTray = global.appSetting.tray.isToTray
|
||||
global.appSetting.tray.isToTray ? createTray() : destroyTray()
|
||||
|
@ -15,7 +32,9 @@ global.lx_event.common.on(COMMON_EVENT_NAME.config, sourceName => {
|
|||
const createTray = () => {
|
||||
if ((global.modules.tray && !global.modules.tray.isDestroyed()) || !global.appSetting.tray || !global.appSetting.tray.isShow) return
|
||||
|
||||
const iconPath = path.join(global.__static, 'images/tray', isWin ? 'trayTemplate@2x.ico' : 'trayTemplate.png')
|
||||
themeId = global.appSetting.tray.themeId
|
||||
let themeName = (themeList.find(item => item.id === themeId) || themeList[0]).fileName
|
||||
const iconPath = path.join(global.__static, 'images/tray', isWin ? themeName + '@2x.ico' : themeName + '.png')
|
||||
|
||||
// 托盘
|
||||
global.modules.tray = new Tray(iconPath)
|
||||
|
@ -85,3 +104,9 @@ const createMenu = tray => {
|
|||
tray.setContextMenu(contextMenu)
|
||||
}
|
||||
|
||||
const setTrayImage = themeId => {
|
||||
if (!global.modules.tray) return
|
||||
let themeName = (themeList.find(item => item.id === themeId) || themeList[0]).fileName
|
||||
const iconPath = path.join(global.__static, 'images/tray', isWin ? themeName + '@2x.ico' : themeName + '.png')
|
||||
global.modules.tray.setImage(iconPath)
|
||||
}
|
||||
|
|
|
@ -128,6 +128,9 @@
|
|||
"backup_part_export_list_desc": "Save the list to...",
|
||||
|
||||
"other": "Extras",
|
||||
"other_tray_theme": "Tray Icon Style",
|
||||
"other_tray_theme_native": "Solid Color",
|
||||
"other_tray_theme_origin": "Primary Color",
|
||||
"other_cache": "Cache size (Not recommended since resources such as pictures after the cache is cleaned need re-downloading. The software will dynamically manage the cache size based on disk space)",
|
||||
"other_cache_label": "Cache size used: ",
|
||||
"other_cache_label_title": "Currently used cache size",
|
||||
|
|
|
@ -128,6 +128,9 @@
|
|||
"backup_part_export_list_desc": "选择歌单保存位置",
|
||||
|
||||
"other": "其他",
|
||||
"other_tray_theme": "托盘图标样式",
|
||||
"other_tray_theme_native": "纯色",
|
||||
"other_tray_theme_origin": "原色",
|
||||
"other_cache": "缓存大小(清理缓存后图片等资源将需要重新下载,不建议清理,软件会根据磁盘空间动态管理缓存大小)",
|
||||
"other_cache_label": "软件已使用缓存大小:",
|
||||
"other_cache_label_title": "当前已用缓存",
|
||||
|
|
|
@ -118,6 +118,9 @@
|
|||
"backup_part_import_list_desc": "選擇列表文件",
|
||||
"backup_part_export_list_desc": "選擇列表保存位置",
|
||||
"other": "其他",
|
||||
"other_tray_theme": "托盤圖標樣式",
|
||||
"other_tray_theme_native": "純色",
|
||||
"other_tray_theme_origin": "原色",
|
||||
"other_cache": "緩存大小(清理緩存後圖片等資源將需要重新下載,不建議清理,軟件會根據磁盤空間動態管理緩存大小)",
|
||||
"other_cache_label": "軟件已使用緩存大小:",
|
||||
"other_cache_label_title": "當前已用緩存",
|
||||
|
|
|
@ -191,6 +191,11 @@ div.scroll(:class="$style.setting")
|
|||
material-btn(:class="[$style.btn, $style.gapLeft]" min @click="handleImportAllData") {{$t('view.setting.backup_all_import')}}
|
||||
material-btn(:class="[$style.btn, $style.gapLeft]" min @click="handleExportAllData") {{$t('view.setting.backup_all_export')}}
|
||||
dt {{$t('view.setting.other')}}
|
||||
dd
|
||||
h3 {{$t('view.setting.other_tray_theme')}}
|
||||
div
|
||||
material-checkbox(:id="'setting_tray_theme_' + item.id" v-model="current_setting.tray.themeId" name="setting_tray_theme" need :class="$style.gapLeft"
|
||||
:label="$t('view.setting.other_tray_theme_' + item.name)" :key="item.id" :value="item.id" v-for="item in trayThemeList")
|
||||
dd
|
||||
h3 {{$t('view.setting.other_cache')}}
|
||||
div
|
||||
|
@ -358,6 +363,18 @@ export default {
|
|||
},
|
||||
]
|
||||
},
|
||||
trayThemeList() {
|
||||
return [
|
||||
{
|
||||
id: 0,
|
||||
name: 'native',
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
name: 'origin',
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -418,6 +435,7 @@ export default {
|
|||
tray: {
|
||||
isShow: false,
|
||||
isToTray: false,
|
||||
themeId: 0,
|
||||
},
|
||||
windowSizeId: 1,
|
||||
langId: 'cns',
|
||||
|
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 359 B After Width: | Height: | Size: 359 B |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 681 B After Width: | Height: | Size: 681 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 417 B |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 770 B |