Feature(custom): add new set item to open config file path

This commit is contained in:
Kuingsmile 2024-02-21 23:13:47 -08:00
parent 97d083df5a
commit 4be82e0afc
7 changed files with 52 additions and 1 deletions

View File

@ -195,6 +195,8 @@ SETTINGS_CURRENT_VERSION: Current Version
SETTINGS_NEWEST_VERSION: Newest Version
SETTINGS_GETING: Getting...
SETTINGS_TIPS_HAS_NEW_VERSION: PicList has a new version, please click confirm to open download page
SETTINGS_LOG_FILE_PATH: Log File Path
SETTINGS_CONFIG_FILE_PATH: Config File Path
SETTINGS_LOG_FILE: Log File
SETTINGS_GUI_LOG_FILE: GUI Log File
SETTINGS_MANAGE_LOG_FILE: Manage Log File

View File

@ -197,6 +197,8 @@ SETTINGS_CURRENT_VERSION: 当前版本
SETTINGS_NEWEST_VERSION: 最新版本
SETTINGS_GETING: 正在获取中
SETTINGS_TIPS_HAS_NEW_VERSION: PicList更新啦请点击确定打开下载页面
SETTINGS_LOG_FILE_PATH: 日志文件路径
SETTINGS_CONFIG_FILE_PATH: 配置文件路径
SETTINGS_LOG_FILE: 常规日志文件
SETTINGS_GUI_LOG_FILE: GUI日志文件
SETTINGS_MANAGE_LOG_FILE: 管理日志文件

View File

@ -195,6 +195,8 @@ SETTINGS_CURRENT_VERSION: 當前版本
SETTINGS_NEWEST_VERSION: 最新版本
SETTINGS_GETING: 正在取得中
SETTINGS_TIPS_HAS_NEW_VERSION: PicList更新啦請點擊確定開啟下載頁面
SETTINGS_LOG_FILE_PATH: 記錄檔案路徑
SETTINGS_CONFIG_FILE_PATH: 設定檔案路徑
SETTINGS_LOG_FILE: 記錄檔案
SETTINGS_GUI_LOG_FILE: GUI記錄檔案
SETTINGS_MANAGE_LOG_FILE: 管理記錄檔案

View File

@ -40,6 +40,7 @@ import {
PICGO_GET_BY_ID_DB,
PICGO_REMOVE_BY_ID_DB,
PICGO_OPEN_FILE,
PICGO_OPEN_DIRECTORY,
PASTE_TEXT,
OPEN_WINDOW,
GET_LANGUAGE_LIST,
@ -379,6 +380,18 @@ const handleOpenFile = () => {
})
}
const handleOpenDirectory = () => {
ipcMain.on(PICGO_OPEN_DIRECTORY, (event: IpcMainEvent, dirPath?: string, inStorePath: boolean = true) => {
if (inStorePath) {
dirPath = path.join(STORE_PATH, dirPath || '')
}
if (!dirPath || !fs.existsSync(dirPath)) {
return
}
shell.openPath(dirPath)
})
}
const handleOpenWindow = () => {
ipcMain.on(OPEN_WINDOW, (event: IpcMainEvent, windowName: IWindowList) => {
const window = windowManager.get(windowName)
@ -431,6 +444,7 @@ export default {
handleImportLocalPlugin()
handleUpdateAllPlugin()
handleOpenFile()
handleOpenDirectory()
handleOpenWindow()
handleI18n()
handleRPCActions()

View File

@ -283,6 +283,18 @@
{{ $T('SETTINGS_CLICK_TO_OPEN') }}
</el-button>
</el-form-item>
<el-form-item
:label="$T('SETTINGS_CONFIG_FILE_PATH')"
>
<el-button
type="primary"
round
size="small"
@click="openDirectory()"
>
{{ $T('SETTINGS_CLICK_TO_OPEN') }}
</el-button>
</el-form-item>
</el-form>
</el-row>
</el-col>
@ -582,6 +594,18 @@
label-width="50%"
size="small"
>
<el-form-item
:label="$T('SETTINGS_LOG_FILE_PATH')"
>
<el-button
type="primary"
round
size="small"
@click="openDirectory()"
>
{{ $T('SETTINGS_CLICK_TO_OPEN') }}
</el-button>
</el-form-item>
<el-form-item
:label="$T('SETTINGS_SET_LOG_FILE')"
>
@ -1603,7 +1627,7 @@ import { Reading, Close, Edit, InfoFilled } from '@element-plus/icons-vue'
import pkg from 'root/package.json'
//
import { PICGO_OPEN_FILE, OPEN_URL, GET_PICBEDS, HIDE_DOCK } from '#/events/constants'
import { PICGO_OPEN_FILE, PICGO_OPEN_DIRECTORY, OPEN_URL, GET_PICBEDS, HIDE_DOCK } from '#/events/constants'
import { IRPCActionType } from '~/universal/types/enum'
// Electron
@ -2046,6 +2070,10 @@ function openFile (file: string) {
sendToMain(PICGO_OPEN_FILE, file)
}
function openDirectory (directory?: string, inStorePath = true) {
sendToMain(PICGO_OPEN_DIRECTORY, directory, inStorePath)
}
function openLogSetting () {
logFileVisible.value = true
}

View File

@ -13,6 +13,7 @@ export const PICGO_UPDATE_BY_ID_DB = 'PICGO_UPDATE_BY_ID_DB'
export const PICGO_GET_BY_ID_DB = 'PICGO_GET_BY_ID_DB'
export const PICGO_REMOVE_BY_ID_DB = 'PICGO_REMOVE_BY_ID_DB'
export const PICGO_OPEN_FILE = 'PICGO_OPEN_FILE'
export const PICGO_OPEN_DIRECTORY = 'PICGO_OPEN_DIRECTORY'
export const OPEN_DEVTOOLS = 'OPEN_DEVTOOLS'
export const SHOW_MINI_PAGE_MENU = 'SHOW_MINI_PAGE_MENU'
export const SHOW_MAIN_PAGE_MENU = 'SHOW_MAIN_PAGE_MENU'

View File

@ -190,6 +190,8 @@ interface ILocales {
SETTINGS_NEWEST_VERSION: string
SETTINGS_GETING: string
SETTINGS_TIPS_HAS_NEW_VERSION: string
SETTINGS_LOG_FILE_PATH: string
SETTINGS_CONFIG_FILE_PATH: string
SETTINGS_LOG_FILE: string
SETTINGS_GUI_LOG_FILE: string
SETTINGS_MANAGE_LOG_FILE: string