import '../../core/playlist.dart'; import 'settings_group.dart'; /// 약속 (설정 A): 환경 설정 > 재생 (동영상 열기 · 재생 목록 · 외부 플레이어 · 자막 크기 · 기본 자막 언어) - 자기 키 (이름 · 처음 값 · 읽기 · 쓰기) 를 스스로 갖는다. /// 설정 하나를 더할 때는 이 파일만 고친다. 저장 파일의 키 이름은 예전 그대로 (평평한 키) class PlaybackSettings implements SettingsGroup { /// 탐색기에서 동영상을 열었을 때 (더블클릭 · 연결 프로그램): 'play' 바로 재생 / 'add' 편집 목록에 추가 String openFileAction = 'play'; /// 프로그램이 켜져 있을 때 탐색기에서 연 동영상 재생: 'same' 켜져 있는 창에서 / 'new' 새 재생 창 String openFileWindow = 'same'; /// 61: 기본 자막 언어 (MKV 의 기본 자막 트랙 · 플레이어가 먼저 켜는 자막). '' = 화면 언어 따르기, 그 밖은 자막 언어 코드 (ko · ja …) String preferredSubtitleLanguage = ''; /// 내장 플레이어 자막 글자 크기 배율 (0.5 ~ 2.5, 기본 1) double subtitleScale = 1.0; /// 동영상 하나를 재생할 때 재생 목록 (기본: 같은 시리즈) PlaylistMode playlistMode = PlaylistMode.series; /// 확장자별 재생 프로그램 (없으면 내장 플레이어): 'system' 또는 실행 파일 경로 Map externalPlayers = {}; @override void write(Map j, {required bool plainSecrets}) { j['openFileAction'] = openFileAction; j['openFileWindow'] = openFileWindow; j['playlistMode'] = playlistMode.name; j['externalPlayers'] = externalPlayers; j['subtitleScale'] = subtitleScale; j['preferredSubtitleLanguage'] = preferredSubtitleLanguage; } @override void read(Map j) { openFileAction = j['openFileAction'] == 'add' ? 'add' : 'play'; openFileWindow = j['openFileWindow'] == 'new' ? 'new' : 'same'; preferredSubtitleLanguage = j['preferredSubtitleLanguage'] is String ? j['preferredSubtitleLanguage'] as String : ''; subtitleScale = ((j['subtitleScale'] as num?)?.toDouble() ?? 1.0).clamp(0.5, 2.5); playlistMode = pickEnum(PlaylistMode.values, j['playlistMode'], PlaylistMode.series); externalPlayers = ((j['externalPlayers'] as Map?) ?? const {}).cast(); } }