settings: merged raster/vector background

This commit is contained in:
Thibault Deckers 2021-07-08 11:08:28 +09:00
parent 876b2af432
commit b965063c8c
8 changed files with 15 additions and 32 deletions

View file

@ -565,10 +565,8 @@
"settingsSectionViewer": "Viewer", "settingsSectionViewer": "Viewer",
"@settingsSectionViewer": {}, "@settingsSectionViewer": {},
"settingsRasterImageBackground": "Raster image background", "settingsImageBackground": "Image background",
"@settingsRasterImageBackground": {}, "@settingsImageBackground": {},
"settingsVectorImageBackground": "Vector image background",
"@settingsVectorImageBackground": {},
"settingsViewerShowMinimap": "Show minimap", "settingsViewerShowMinimap": "Show minimap",
"@settingsViewerShowMinimap": {}, "@settingsViewerShowMinimap": {},
"settingsViewerShowInformation": "Show information", "settingsViewerShowInformation": "Show information",

View file

@ -265,8 +265,7 @@
"settingsThumbnailShowVideoDuration": "동영상 길이 표시", "settingsThumbnailShowVideoDuration": "동영상 길이 표시",
"settingsSectionViewer": "뷰어", "settingsSectionViewer": "뷰어",
"settingsRasterImageBackground": "래스터 그래픽스 배경", "settingsImageBackground": "사진 배경",
"settingsVectorImageBackground": "벡터 그래픽스 배경",
"settingsViewerShowMinimap": "미니맵 표시", "settingsViewerShowMinimap": "미니맵 표시",
"settingsViewerShowInformation": "상세 정보 표시", "settingsViewerShowInformation": "상세 정보 표시",
"settingsViewerShowInformationSubtitle": "제목, 날짜, 장소 등 표시", "settingsViewerShowInformationSubtitle": "제목, 날짜, 장소 등 표시",

View file

@ -86,8 +86,7 @@ class Settings extends ChangeNotifier {
static const coordinateFormatKey = 'coordinates_format'; static const coordinateFormatKey = 'coordinates_format';
// rendering // rendering
static const rasterBackgroundKey = 'raster_background'; static const imageBackgroundKey = 'image_background';
static const vectorBackgroundKey = 'vector_background';
// search // search
static const saveSearchHistoryKey = 'save_search_history'; static const saveSearchHistoryKey = 'save_search_history';
@ -317,13 +316,9 @@ class Settings extends ChangeNotifier {
// rendering // rendering
EntryBackground get rasterBackground => getEnumOrDefault(rasterBackgroundKey, EntryBackground.white, EntryBackground.values); EntryBackground get imageBackground => getEnumOrDefault(imageBackgroundKey, EntryBackground.white, EntryBackground.values);
set rasterBackground(EntryBackground newValue) => setAndNotify(rasterBackgroundKey, newValue.toString()); set imageBackground(EntryBackground newValue) => setAndNotify(imageBackgroundKey, newValue.toString());
EntryBackground get vectorBackground => getEnumOrDefault(vectorBackgroundKey, EntryBackground.white, EntryBackground.values);
set vectorBackground(EntryBackground newValue) => setAndNotify(vectorBackgroundKey, newValue.toString());
// search // search
@ -480,8 +475,7 @@ class Settings extends ChangeNotifier {
case subtitleTextAlignmentKey: case subtitleTextAlignmentKey:
case infoMapStyleKey: case infoMapStyleKey:
case coordinateFormatKey: case coordinateFormatKey:
case rasterBackgroundKey: case imageBackgroundKey:
case vectorBackgroundKey:
if (value is String) { if (value is String) {
_prefs!.setString(key, value); _prefs!.setString(key, value);
} else { } else {

View file

@ -185,7 +185,7 @@ class VideoMetadataFormatter {
profileString = profile.toString(); profileString = profile.toString();
break; break;
} }
save('Codec Profile', profileString); save('Format Profile', profileString);
} }
break; break;
} }

View file

@ -189,7 +189,7 @@ class _ThumbnailImageState extends State<ThumbnailImage> {
height: extent, height: extent,
) )
: Selector<Settings, EntryBackground>( : Selector<Settings, EntryBackground>(
selector: (context, s) => entry.isSvg ? s.vectorBackground : s.rasterBackground, selector: (context, s) => s.imageBackground,
builder: (context, background, child) { builder: (context, background, child) {
final backgroundColor = background.isColor ? background.color : null; final backgroundColor = background.isColor ? background.color : null;

View file

@ -23,8 +23,7 @@ class ViewerSection extends StatelessWidget {
final currentShowOverlayMinimap = context.select<Settings, bool>((s) => s.showOverlayMinimap); final currentShowOverlayMinimap = context.select<Settings, bool>((s) => s.showOverlayMinimap);
final currentShowOverlayInfo = context.select<Settings, bool>((s) => s.showOverlayInfo); final currentShowOverlayInfo = context.select<Settings, bool>((s) => s.showOverlayInfo);
final currentShowOverlayShootingDetails = context.select<Settings, bool>((s) => s.showOverlayShootingDetails); final currentShowOverlayShootingDetails = context.select<Settings, bool>((s) => s.showOverlayShootingDetails);
final currentRasterBackground = context.select<Settings, EntryBackground>((s) => s.rasterBackground); final currentImageBackground = context.select<Settings, EntryBackground>((s) => s.imageBackground);
final currentVectorBackground = context.select<Settings, EntryBackground>((s) => s.vectorBackground);
return AvesExpansionTile( return AvesExpansionTile(
leading: SettingsTileLeading( leading: SettingsTileLeading(
@ -53,17 +52,10 @@ class ViewerSection extends StatelessWidget {
title: Text(context.l10n.settingsViewerShowShootingDetails), title: Text(context.l10n.settingsViewerShowShootingDetails),
), ),
ListTile( ListTile(
title: Text(context.l10n.settingsRasterImageBackground), title: Text(context.l10n.settingsImageBackground),
trailing: EntryBackgroundSelector( trailing: EntryBackgroundSelector(
getter: () => currentRasterBackground, getter: () => currentImageBackground,
setter: (value) => settings.rasterBackground = value, setter: (value) => settings.imageBackground = value,
),
),
ListTile(
title: Text(context.l10n.settingsVectorImageBackground),
trailing: EntryBackgroundSelector(
getter: () => currentVectorBackground,
setter: (value) => settings.vectorBackground = value,
), ),
), ),
], ],

View file

@ -191,7 +191,7 @@ class _RasterImageViewState extends State<RasterImageView> {
final decorationSize = (applyBoxFit(BoxFit.none, viewSize, viewportSize).source - const Offset(.5, .5)) as Size; final decorationSize = (applyBoxFit(BoxFit.none, viewSize, viewportSize).source - const Offset(.5, .5)) as Size;
Widget child; Widget child;
final background = settings.rasterBackground; final background = settings.imageBackground;
if (background == EntryBackground.checkered) { if (background == EntryBackground.checkered) {
final side = viewportSize.shortestSide; final side = viewportSize.shortestSide;
final checkSize = side / ((side / EntryPageView.decorationCheckSize).round()); final checkSize = side / ((side / EntryPageView.decorationCheckSize).round());

View file

@ -159,7 +159,7 @@ class _VectorImageViewState extends State<VectorImageView> {
final displayHeight = _displaySize.height; final displayHeight = _displaySize.height;
final viewRect = _getViewRect(displayWidth, displayHeight); final viewRect = _getViewRect(displayWidth, displayHeight);
final viewScale = viewState.scale!; final viewScale = viewState.scale!;
final background = settings.vectorBackground; final background = settings.imageBackground;
Color? backgroundColor; Color? backgroundColor;
_BackgroundFrameBuilder? backgroundFrameBuilder; _BackgroundFrameBuilder? backgroundFrameBuilder;