💡 预期的功能 | Expected Feature
在显示缩略图的地方,增加NSFW的开关,来控制缩略图的显示与否。
现在我是手动实现的,每次更新都得去改。还请官方直接支持
以下是我的手动版本,v1.4.2时的记录。
增加 NSFW 开关
用于控制缩略图的显示与否
videocaptioner\ui\common\config.py 中 软件页面配置 添加
# NSFW 开关:控制是否渲染缩略图
nsfw_switch = ConfigItem("MainWindow", "NsfwSwitch", False, BoolValidator())
videocaptioner\ui\view\transcription_interface.py 中 update_thumbnail 更改为
def set_nsfw_mode(self, enabled: bool):
"""设置NSFW模式,控制是否显示缩略图"""
self.nsfw_enabled = enabled
if self.video_info:
self.update_thumbnail(self.video_info.thumbnail_path)
def update_thumbnail(self, thumbnail_path):
"""更新视频缩略图"""
# NSFW 开关开启:不渲染缩略图,显示默认背景
if hasattr(self, 'nsfw_enabled') and self.nsfw_enabled:
pixmap = QPixmap(str(DEFAULT_THUMBNAIL_PATH)).scaled(
self.video_thumbnail.size(),
Qt.AspectRatioMode.KeepAspectRatio,
Qt.SmoothTransformation, # type: ignore
)
self.video_thumbnail.setPixmap(pixmap)
return
# 正常渲染逻辑
if not Path(thumbnail_path).exists():
thumbnail_path = RESOURCE_PATH / "assets" / "audio-thumbnail.png"
pixmap = QPixmap(str(thumbnail_path)).scaled(
self.video_thumbnail.size(),
Qt.AspectRatioMode.KeepAspectRatio,
Qt.SmoothTransformation, # type: ignore
)
self.video_thumbnail.setPixmap(pixmap)
videocaptioner\ui\view\transcription_interface.py 中的 self.command_bar.addAction 上方添加
self.nsfw_label = BodyLabel(self.tr("NSFW"), self)
self.command_bar.addWidget(self.nsfw_label)
self.nsfw_switch = SwitchButton(self)
self.nsfw_switch.setChecked(cfg.nsfw_switch.value)
self.nsfw_switch.checkedChanged.connect(lambda v: cfg.set(cfg.nsfw_switch, v))
self.command_bar.addWidget(self.nsfw_switch)
_setup_signals 命令末尾增加
cfg.nsfw_switch.valueChanged.connect(self._on_nsfw_switch_changed)
_set_value 命令更改为
def _on_nsfw_switch_changed(self, enabled: bool):
"""NSFW开关变化,更新缩略图显示状态"""
self.video_info_card.set_nsfw_mode(enabled)
def _set_value(self) -> None:
"""设置转录模型"""
model_name = cfg.get(cfg.transcribe_model).value
# self.model_button.setText(self.tr(model_name))
self.on_transcription_model_changed(model_name)
# 初始化NSFW状态
self._on_nsfw_switch_changed(cfg.get(cfg.nsfw_switch))
💡 预期的功能 | Expected Feature
在显示缩略图的地方,增加NSFW的开关,来控制缩略图的显示与否。
现在我是手动实现的,每次更新都得去改。还请官方直接支持
以下是我的手动版本,v1.4.2时的记录。
增加 NSFW 开关
用于控制缩略图的显示与否
videocaptioner\ui\common\config.py中软件页面配置添加videocaptioner\ui\view\transcription_interface.py中update_thumbnail更改为videocaptioner\ui\view\transcription_interface.py中的self.command_bar.addAction上方添加_setup_signals命令末尾增加_set_value命令更改为