mirror of
https://github.com/HiMeditator/auto-caption.git
synced 2026-02-15 20:34:47 +08:00
release v0.3.0
- 新增字幕字体粗细、文本阴影等设置选项 - 更新相关文档,增加新功能说明 - 修复系统主题载入颜色bug
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
|
||||
.switch-label {
|
||||
display: inline-block;
|
||||
min-width: 80px;
|
||||
text-align: right;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
v-model:value="currentFontFamily"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="input-item">
|
||||
<span class="input-label">{{ $t('style.fontColor') }}</span>
|
||||
<a-input
|
||||
@@ -41,6 +42,16 @@
|
||||
/>
|
||||
<div class="input-item-value">{{ currentFontSize }}px</div>
|
||||
</div>
|
||||
<div class="input-item">
|
||||
<span class="input-label">{{ $t('style.fontWeight') }}</span>
|
||||
<a-input
|
||||
class="input-area"
|
||||
type="range"
|
||||
min="1" max="9"
|
||||
v-model:value="currentFontWeight"
|
||||
/>
|
||||
<div class="input-item-value">{{ currentFontWeight*100 }}</div>
|
||||
</div>
|
||||
<div class="input-item">
|
||||
<span class="input-label">{{ $t('style.background') }}</span>
|
||||
<a-input
|
||||
@@ -70,6 +81,11 @@
|
||||
<span class="switch-label">{{ $t('style.translation') }}</span>
|
||||
<a-switch v-model:checked="currentTransDisplay" />
|
||||
</div>
|
||||
<span style="display:inline-block;width:20px;"></span>
|
||||
<div style="display: inline-block;">
|
||||
<span class="switch-label">{{ $t('style.textShadow') }}</span>
|
||||
<a-switch v-model:checked="currentTextShadow" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-show="currentTransDisplay">
|
||||
@@ -103,6 +119,60 @@
|
||||
/>
|
||||
<div class="input-item-value">{{ currentTransFontSize }}px</div>
|
||||
</div>
|
||||
<div class="input-item">
|
||||
<span class="input-label">{{ $t('style.fontWeight') }}</span>
|
||||
<a-input
|
||||
class="input-area"
|
||||
type="range"
|
||||
min="1" max="9"
|
||||
v-model:value="currentTransFontWeight"
|
||||
/>
|
||||
<div class="input-item-value">{{ currentTransFontWeight*100 }}</div>
|
||||
</div>
|
||||
</a-card>
|
||||
</div>
|
||||
|
||||
<div v-show="currentTextShadow" style="margin-top:10px;">
|
||||
<a-card size="small" :title="$t('style.shadow.title')">
|
||||
<div class="input-item">
|
||||
<span class="input-label">{{ $t('style.shadow.offsetX') }}</span>
|
||||
<a-input
|
||||
class="input-area"
|
||||
type="range"
|
||||
min="-10" max="10"
|
||||
v-model:value="currentOffsetX"
|
||||
/>
|
||||
<div class="input-item-value">{{ currentOffsetX }}px</div>
|
||||
</div>
|
||||
<div class="input-item">
|
||||
<span class="input-label">{{ $t('style.shadow.offsetY') }}</span>
|
||||
<a-input
|
||||
class="input-area"
|
||||
type="range"
|
||||
min="-10" max="10"
|
||||
v-model:value="currentOffsetY"
|
||||
/>
|
||||
<div class="input-item-value">{{ currentOffsetY }}px</div>
|
||||
</div>
|
||||
<div class="input-item">
|
||||
<span class="input-label">{{ $t('style.shadow.blur') }}</span>
|
||||
<a-input
|
||||
class="input-area"
|
||||
type="range"
|
||||
min="0" max="10"
|
||||
v-model:value="currentBlur"
|
||||
/>
|
||||
<div class="input-item-value">{{ currentBlur }}px</div>
|
||||
</div>
|
||||
<div class="input-item">
|
||||
<span class="input-label">{{ $t('style.shadow.color') }}</span>
|
||||
<a-input
|
||||
class="input-area"
|
||||
type="color"
|
||||
v-model:value="currentTextShadowColor"
|
||||
/>
|
||||
<div class="input-item-value">{{ currentTextShadowColor }}</div>
|
||||
</div>
|
||||
</a-card>
|
||||
</div>
|
||||
</a-card>
|
||||
@@ -112,14 +182,16 @@
|
||||
v-if="currentPreview"
|
||||
class="preview-container"
|
||||
:style="{
|
||||
backgroundColor: addOpicityToColor(currentBackground, currentOpacity)
|
||||
backgroundColor: addOpicityToColor(currentBackground, currentOpacity),
|
||||
textShadow: currentTextShadow ? `${currentOffsetX}px ${currentOffsetY}px ${currentBlur}px ${currentTextShadowColor}` : 'none'
|
||||
}"
|
||||
>
|
||||
<p :class="[currentLineBreak?'':'left-ellipsis']"
|
||||
:style="{
|
||||
fontFamily: currentFontFamily,
|
||||
fontSize: currentFontSize + 'px',
|
||||
color: currentFontColor
|
||||
color: currentFontColor,
|
||||
fontWeight: currentFontWeight * 100
|
||||
}">
|
||||
<span v-if="captionData.length">{{ captionData[captionData.length-1].text }}</span>
|
||||
<span v-else>{{ $t('example.original') }}</span>
|
||||
@@ -129,7 +201,8 @@
|
||||
:style="{
|
||||
fontFamily: currentTransFontFamily,
|
||||
fontSize: currentTransFontSize + 'px',
|
||||
color: currentTransFontColor
|
||||
color: currentTransFontColor,
|
||||
fontWeight: currentTransFontWeight * 100
|
||||
}"
|
||||
>
|
||||
<span v-if="captionData.length">{{ captionData[captionData.length-1].translation }}</span>
|
||||
@@ -147,7 +220,6 @@ import { storeToRefs } from 'pinia'
|
||||
import { notification } from 'ant-design-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useCaptionLogStore } from '@renderer/stores/captionLog';
|
||||
|
||||
const captionLog = useCaptionLogStore();
|
||||
const { captionData } = storeToRefs(captionLog);
|
||||
|
||||
@@ -160,6 +232,7 @@ const currentLineBreak = ref<number>(0)
|
||||
const currentFontFamily = ref<string>('sans-serif')
|
||||
const currentFontSize = ref<number>(24)
|
||||
const currentFontColor = ref<string>('#000000')
|
||||
const currentFontWeight = ref<number>(4)
|
||||
const currentBackground = ref<string>('#dbe2ef')
|
||||
const currentOpacity = ref<number>(50)
|
||||
const currentPreview = ref<boolean>(true)
|
||||
@@ -167,6 +240,12 @@ const currentTransDisplay = ref<boolean>(true)
|
||||
const currentTransFontFamily = ref<string>('sans-serif')
|
||||
const currentTransFontSize = ref<number>(24)
|
||||
const currentTransFontColor = ref<string>('#000000')
|
||||
const currentTransFontWeight = ref<number>(4)
|
||||
const currentTextShadow = ref<boolean>(false)
|
||||
const currentOffsetX = ref<number>(2)
|
||||
const currentOffsetY = ref<number>(2)
|
||||
const currentBlur = ref<number>(0)
|
||||
const currentTextShadowColor = ref<string>('#ffffff')
|
||||
|
||||
function addOpicityToColor(color: string, opicity: number) {
|
||||
const opicityValue = Math.round(opicity * 255 / 100);
|
||||
@@ -185,6 +264,7 @@ function applyStyle(){
|
||||
captionStyle.fontFamily = currentFontFamily.value;
|
||||
captionStyle.fontSize = currentFontSize.value;
|
||||
captionStyle.fontColor = currentFontColor.value;
|
||||
captionStyle.fontWeight = currentFontWeight.value;
|
||||
captionStyle.background = currentBackground.value;
|
||||
captionStyle.opacity = currentOpacity.value;
|
||||
captionStyle.showPreview = currentPreview.value;
|
||||
@@ -192,6 +272,12 @@ function applyStyle(){
|
||||
captionStyle.transFontFamily = currentTransFontFamily.value;
|
||||
captionStyle.transFontSize = currentTransFontSize.value;
|
||||
captionStyle.transFontColor = currentTransFontColor.value;
|
||||
captionStyle.transFontWeight = currentTransFontWeight.value;
|
||||
captionStyle.textShadow = currentTextShadow.value;
|
||||
captionStyle.offsetX = currentOffsetX.value;
|
||||
captionStyle.offsetY = currentOffsetY.value;
|
||||
captionStyle.blur = currentBlur.value;
|
||||
captionStyle.textShadowColor = currentTextShadowColor.value;
|
||||
|
||||
captionStyle.sendStylesChange();
|
||||
|
||||
@@ -206,6 +292,7 @@ function backStyle(){
|
||||
currentFontFamily.value = captionStyle.fontFamily;
|
||||
currentFontSize.value = captionStyle.fontSize;
|
||||
currentFontColor.value = captionStyle.fontColor;
|
||||
currentFontWeight.value = captionStyle.fontWeight;
|
||||
currentBackground.value = captionStyle.background;
|
||||
currentOpacity.value = captionStyle.opacity;
|
||||
currentPreview.value = captionStyle.showPreview;
|
||||
@@ -213,6 +300,12 @@ function backStyle(){
|
||||
currentTransFontFamily.value = captionStyle.transFontFamily;
|
||||
currentTransFontSize.value = captionStyle.transFontSize;
|
||||
currentTransFontColor.value = captionStyle.transFontColor;
|
||||
currentTransFontWeight.value = captionStyle.transFontWeight;
|
||||
currentTextShadow.value = captionStyle.textShadow;
|
||||
currentOffsetX.value = captionStyle.offsetX;
|
||||
currentOffsetY.value = captionStyle.offsetY;
|
||||
currentBlur.value = captionStyle.blur;
|
||||
currentTextShadowColor.value = captionStyle.textShadowColor;
|
||||
}
|
||||
|
||||
function resetStyle() {
|
||||
@@ -229,6 +322,16 @@ watch(changeSignal, (val) => {
|
||||
|
||||
<style scoped>
|
||||
@import url(../assets/input.css);
|
||||
.general-note {
|
||||
padding: 10px 10px 0;
|
||||
max-width: min(36vw, 400px);
|
||||
}
|
||||
|
||||
.hover-label {
|
||||
color: #1668dc;
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.preview-container {
|
||||
line-height: 2em;
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
<p class="about-desc">{{ $t('status.about.desc') }}</p>
|
||||
<a-divider />
|
||||
<div class="about-info">
|
||||
<p><b>{{ $t('status.about.version') }}</b><a-tag color="green">v0.2.0</a-tag></p>
|
||||
<p><b>{{ $t('status.about.version') }}</b><a-tag color="green">v0.3.0</a-tag></p>
|
||||
<p>
|
||||
<b>{{ $t('status.about.author') }}</b>
|
||||
<a
|
||||
|
||||
@@ -66,6 +66,7 @@ export default {
|
||||
"fontFamily": "Font Family",
|
||||
"fontColor": "Font Color",
|
||||
"fontSize": "Font Size",
|
||||
"fontWeight": "Font Weight",
|
||||
"background": "Background",
|
||||
"opacity": "Opacity",
|
||||
"preview": "Preview",
|
||||
@@ -73,6 +74,14 @@ export default {
|
||||
trans: {
|
||||
"title": "Translation Style Settings",
|
||||
"useSame": "Use Original Style"
|
||||
},
|
||||
"textShadow": "Text Shadow",
|
||||
shadow: {
|
||||
"title": "Text Shadow Settings",
|
||||
"offsetX": "Offset X",
|
||||
"offsetY": "Offset Y",
|
||||
"blur": "Blur",
|
||||
"color": "Color"
|
||||
}
|
||||
},
|
||||
status: {
|
||||
@@ -96,7 +105,7 @@ export default {
|
||||
"projLink": "Project Link",
|
||||
"manual": "User Manual",
|
||||
"engineDoc": "Caption Engine Manual",
|
||||
"date": "July 5, 2026"
|
||||
"date": "July 9, 2026"
|
||||
}
|
||||
},
|
||||
log: {
|
||||
|
||||
@@ -66,6 +66,7 @@ export default {
|
||||
"fontFamily": "フォント",
|
||||
"fontColor": "カラー",
|
||||
"fontSize": "サイズ",
|
||||
"fontWeight": "文字の太さ",
|
||||
"background": "背景色",
|
||||
"opacity": "不透明度",
|
||||
"preview": "プレビュー",
|
||||
@@ -73,6 +74,14 @@ export default {
|
||||
trans: {
|
||||
"title": "翻訳スタイル設定",
|
||||
"useSame": "原文のスタイルを使用"
|
||||
},
|
||||
"textShadow": "文字影",
|
||||
shadow: {
|
||||
"title": "テキストの影設定",
|
||||
"offsetX": "Offset X",
|
||||
"offsetY": "Offset Y",
|
||||
"blur": "ぼかし半径",
|
||||
"color": "影の色"
|
||||
}
|
||||
},
|
||||
status: {
|
||||
@@ -96,7 +105,7 @@ export default {
|
||||
"projLink": "プロジェクトリンク",
|
||||
"manual": "ユーザーマニュアル",
|
||||
"engineDoc": "字幕エンジンマニュアル",
|
||||
"date": "2025 年 7 月 5 日"
|
||||
"date": "2025 年 7 月 9 日"
|
||||
}
|
||||
},
|
||||
log: {
|
||||
|
||||
@@ -66,6 +66,7 @@ export default {
|
||||
"fontFamily": "字体族",
|
||||
"fontColor": "字体颜色",
|
||||
"fontSize": "字体大小",
|
||||
"fontWeight": "字体粗细",
|
||||
"background": "背景颜色",
|
||||
"opacity": "不透明度",
|
||||
"preview": "显示预览",
|
||||
@@ -73,6 +74,14 @@ export default {
|
||||
trans: {
|
||||
"title": "翻译样式设置",
|
||||
"useSame": "使用原文样式"
|
||||
},
|
||||
"textShadow": "文本阴影",
|
||||
shadow: {
|
||||
"title": "文本阴影设置",
|
||||
"offsetX": "X轴偏移",
|
||||
"offsetY": "Y轴偏移",
|
||||
"blur": "模糊半径",
|
||||
"color": "阴影颜色"
|
||||
}
|
||||
},
|
||||
status: {
|
||||
@@ -96,7 +105,7 @@ export default {
|
||||
"projLink": "项目链接",
|
||||
"manual": "用户手册",
|
||||
"engineDoc": "字幕引擎手册",
|
||||
"date": "2025 年 7 月 5 日"
|
||||
"date": "2025 年 7 月 9 日"
|
||||
}
|
||||
},
|
||||
log: {
|
||||
|
||||
@@ -8,6 +8,7 @@ export const useCaptionStyleStore = defineStore('captionStyle', () => {
|
||||
const fontFamily = ref<string>('sans-serif')
|
||||
const fontSize = ref<number>(24)
|
||||
const fontColor = ref<string>('#000000')
|
||||
const fontWeight = ref<number>(4)
|
||||
const background = ref<string>('#dbe2ef')
|
||||
const opacity = ref<number>(80)
|
||||
const showPreview = ref<boolean>(true)
|
||||
@@ -15,6 +16,12 @@ export const useCaptionStyleStore = defineStore('captionStyle', () => {
|
||||
const transFontFamily = ref<string>('sans-serif')
|
||||
const transFontSize = ref<number>(24)
|
||||
const transFontColor = ref<string>('#000000')
|
||||
const transFontWeight = ref<number>(4)
|
||||
const textShadow = ref<boolean>(false)
|
||||
const offsetX = ref<number>(2)
|
||||
const offsetY = ref<number>(2)
|
||||
const blur = ref<number>(0)
|
||||
const textShadowColor = ref<string>('#ffffff')
|
||||
|
||||
const iBreakOptions = ref(breakOptions['zh'])
|
||||
const changeSignal = ref<boolean>(false)
|
||||
@@ -35,13 +42,20 @@ export const useCaptionStyleStore = defineStore('captionStyle', () => {
|
||||
fontFamily: fontFamily.value,
|
||||
fontSize: fontSize.value,
|
||||
fontColor: fontColor.value,
|
||||
fontWeight: fontWeight.value,
|
||||
background: background.value,
|
||||
opacity: opacity.value,
|
||||
showPreview: showPreview.value,
|
||||
transDisplay: transDisplay.value,
|
||||
transFontFamily: transFontFamily.value,
|
||||
transFontSize: transFontSize.value,
|
||||
transFontColor: transFontColor.value
|
||||
transFontColor: transFontColor.value,
|
||||
transFontWeight: transFontWeight.value,
|
||||
textShadow: textShadow.value,
|
||||
offsetX: offsetX.value,
|
||||
offsetY: offsetY.value,
|
||||
blur: blur.value,
|
||||
textShadowColor: textShadowColor.value
|
||||
}
|
||||
window.electron.ipcRenderer.send('control.styles.change', styles)
|
||||
}
|
||||
@@ -55,13 +69,20 @@ export const useCaptionStyleStore = defineStore('captionStyle', () => {
|
||||
fontFamily.value = args.fontFamily
|
||||
fontSize.value = args.fontSize
|
||||
fontColor.value = args.fontColor
|
||||
fontWeight.value = args.fontWeight
|
||||
background.value = args.background
|
||||
opacity.value = args.opacity
|
||||
showPreview.value = args.showPreview
|
||||
transDisplay.value = args.transDisplay
|
||||
transFontFamily.value = args.transFontFamily
|
||||
transFontSize.value = args.transFontSize
|
||||
transFontColor.value = args.transFontColor
|
||||
transFontColor.value = args.transFontColor,
|
||||
transFontWeight.value = args.transFontWeight
|
||||
textShadow.value = args.textShadow
|
||||
offsetX.value = args.offsetX
|
||||
offsetY.value = args.offsetY
|
||||
blur.value = args.blur
|
||||
textShadowColor.value = args.textShadowColor
|
||||
changeSignal.value = true
|
||||
}
|
||||
|
||||
@@ -74,6 +95,7 @@ export const useCaptionStyleStore = defineStore('captionStyle', () => {
|
||||
fontFamily, // 字体族
|
||||
fontSize, // 字体大小
|
||||
fontColor, // 字体颜色
|
||||
fontWeight, // 字体粗细
|
||||
background, // 背景颜色
|
||||
opacity, // 背景透明度
|
||||
showPreview, // 是否显示预览
|
||||
@@ -81,6 +103,12 @@ export const useCaptionStyleStore = defineStore('captionStyle', () => {
|
||||
transFontFamily, // 翻译字体族
|
||||
transFontSize, // 翻译字体大小
|
||||
transFontColor, // 翻译字体颜色
|
||||
transFontWeight, // 翻译字体粗细
|
||||
textShadow, // 是否显示文本阴影
|
||||
offsetX, // 阴影X轴偏移
|
||||
offsetY, // 阴影Y轴偏移
|
||||
blur, // 阴影模糊度半径
|
||||
textShadowColor, // 阴影颜色
|
||||
backgroundRGBA, // 带透明度的背景颜色
|
||||
setStyles, // 设置样式
|
||||
sendStylesChange, // 发送样式改变
|
||||
|
||||
@@ -14,6 +14,11 @@ export const useGeneralSettingStore = defineStore('generalSetting', () => {
|
||||
|
||||
const antdTheme = ref<Object>(antDesignTheme['light'])
|
||||
|
||||
window.electron.ipcRenderer.invoke('control.nativeTheme.get').then((theme) => {
|
||||
if(theme === 'light') setLightTheme()
|
||||
else if(theme === 'dark') setDarkTheme()
|
||||
})
|
||||
|
||||
watch(uiLanguage, (newValue) => {
|
||||
i18n.global.locale.value = newValue
|
||||
useEngineControlStore().captionEngine = engines[newValue]
|
||||
|
||||
@@ -20,13 +20,20 @@ export interface Styles {
|
||||
fontFamily: string,
|
||||
fontSize: number,
|
||||
fontColor: string,
|
||||
fontWeight: number,
|
||||
background: string,
|
||||
opacity: number,
|
||||
showPreview: boolean,
|
||||
transDisplay: boolean,
|
||||
transFontFamily: string,
|
||||
transFontSize: number,
|
||||
transFontColor: string
|
||||
transFontColor: string,
|
||||
transFontWeight: number,
|
||||
textShadow: boolean,
|
||||
offsetX: number,
|
||||
offsetY: number,
|
||||
blur: number,
|
||||
textShadowColor: string
|
||||
}
|
||||
|
||||
export interface CaptionItem {
|
||||
|
||||
@@ -19,11 +19,17 @@
|
||||
<CloseOutlined />
|
||||
</div>
|
||||
</div>
|
||||
<div class="caption-container">
|
||||
<div
|
||||
class="caption-container"
|
||||
:style="{
|
||||
textShadow: captionStyle.textShadow ? `${captionStyle.offsetX}px ${captionStyle.offsetY}px ${captionStyle.blur}px ${captionStyle.textShadowColor}` : 'none'
|
||||
}"
|
||||
>
|
||||
<p :class="[captionStyle.lineBreak?'':'left-ellipsis']" :style="{
|
||||
fontFamily: captionStyle.fontFamily,
|
||||
fontSize: captionStyle.fontSize + 'px',
|
||||
color: captionStyle.fontColor
|
||||
color: captionStyle.fontColor,
|
||||
fontWeight: captionStyle.fontWeight * 100
|
||||
}">
|
||||
<span v-if="captionData.length">{{ captionData[captionData.length-1].text }}</span>
|
||||
<span v-else>{{ $t('example.original') }}</span>
|
||||
@@ -33,7 +39,8 @@
|
||||
:style="{
|
||||
fontFamily: captionStyle.transFontFamily,
|
||||
fontSize: captionStyle.transFontSize + 'px',
|
||||
color: captionStyle.transFontColor
|
||||
color: captionStyle.transFontColor,
|
||||
fontWeight: captionStyle.transFontWeight * 100
|
||||
}">
|
||||
<span v-if="captionData.length">{{ captionData[captionData.length-1].translation }}</span>
|
||||
<span v-else>{{ $t('example.translation') }}</span>
|
||||
|
||||
Reference in New Issue
Block a user