From b965063c8c902de224f1003b936c0990486bea9f Mon Sep 17 00:00:00 2001 From: Thibault Deckers Date: Thu, 8 Jul 2021 11:08:28 +0900 Subject: [PATCH] settings: merged raster/vector background --- lib/l10n/app_en.arb | 6 ++---- lib/l10n/app_ko.arb | 3 +-- lib/model/settings/settings.dart | 14 ++++---------- lib/model/video/metadata.dart | 2 +- lib/widgets/collection/thumbnail/image.dart | 2 +- lib/widgets/settings/viewer/viewer.dart | 16 ++++------------ lib/widgets/viewer/visual/raster.dart | 2 +- lib/widgets/viewer/visual/vector.dart | 2 +- 8 files changed, 15 insertions(+), 32 deletions(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 9d549bcea..0afd10e06 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -565,10 +565,8 @@ "settingsSectionViewer": "Viewer", "@settingsSectionViewer": {}, - "settingsRasterImageBackground": "Raster image background", - "@settingsRasterImageBackground": {}, - "settingsVectorImageBackground": "Vector image background", - "@settingsVectorImageBackground": {}, + "settingsImageBackground": "Image background", + "@settingsImageBackground": {}, "settingsViewerShowMinimap": "Show minimap", "@settingsViewerShowMinimap": {}, "settingsViewerShowInformation": "Show information", diff --git a/lib/l10n/app_ko.arb b/lib/l10n/app_ko.arb index b32bbba8f..006a65387 100644 --- a/lib/l10n/app_ko.arb +++ b/lib/l10n/app_ko.arb @@ -265,8 +265,7 @@ "settingsThumbnailShowVideoDuration": "동영상 길이 표시", "settingsSectionViewer": "뷰어", - "settingsRasterImageBackground": "래스터 그래픽스 배경", - "settingsVectorImageBackground": "벡터 그래픽스 배경", + "settingsImageBackground": "사진 배경", "settingsViewerShowMinimap": "미니맵 표시", "settingsViewerShowInformation": "상세 정보 표시", "settingsViewerShowInformationSubtitle": "제목, 날짜, 장소 등 표시", diff --git a/lib/model/settings/settings.dart b/lib/model/settings/settings.dart index b5177ab0f..7fa73b13a 100644 --- a/lib/model/settings/settings.dart +++ b/lib/model/settings/settings.dart @@ -86,8 +86,7 @@ class Settings extends ChangeNotifier { static const coordinateFormatKey = 'coordinates_format'; // rendering - static const rasterBackgroundKey = 'raster_background'; - static const vectorBackgroundKey = 'vector_background'; + static const imageBackgroundKey = 'image_background'; // search static const saveSearchHistoryKey = 'save_search_history'; @@ -317,13 +316,9 @@ class Settings extends ChangeNotifier { // 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()); - - EntryBackground get vectorBackground => getEnumOrDefault(vectorBackgroundKey, EntryBackground.white, EntryBackground.values); - - set vectorBackground(EntryBackground newValue) => setAndNotify(vectorBackgroundKey, newValue.toString()); + set imageBackground(EntryBackground newValue) => setAndNotify(imageBackgroundKey, newValue.toString()); // search @@ -480,8 +475,7 @@ class Settings extends ChangeNotifier { case subtitleTextAlignmentKey: case infoMapStyleKey: case coordinateFormatKey: - case rasterBackgroundKey: - case vectorBackgroundKey: + case imageBackgroundKey: if (value is String) { _prefs!.setString(key, value); } else { diff --git a/lib/model/video/metadata.dart b/lib/model/video/metadata.dart index 1724305b9..23131a53a 100644 --- a/lib/model/video/metadata.dart +++ b/lib/model/video/metadata.dart @@ -185,7 +185,7 @@ class VideoMetadataFormatter { profileString = profile.toString(); break; } - save('Codec Profile', profileString); + save('Format Profile', profileString); } break; } diff --git a/lib/widgets/collection/thumbnail/image.dart b/lib/widgets/collection/thumbnail/image.dart index 3356e283f..b768bf4de 100644 --- a/lib/widgets/collection/thumbnail/image.dart +++ b/lib/widgets/collection/thumbnail/image.dart @@ -189,7 +189,7 @@ class _ThumbnailImageState extends State { height: extent, ) : Selector( - selector: (context, s) => entry.isSvg ? s.vectorBackground : s.rasterBackground, + selector: (context, s) => s.imageBackground, builder: (context, background, child) { final backgroundColor = background.isColor ? background.color : null; diff --git a/lib/widgets/settings/viewer/viewer.dart b/lib/widgets/settings/viewer/viewer.dart index 1b1721439..669c69da7 100644 --- a/lib/widgets/settings/viewer/viewer.dart +++ b/lib/widgets/settings/viewer/viewer.dart @@ -23,8 +23,7 @@ class ViewerSection extends StatelessWidget { final currentShowOverlayMinimap = context.select((s) => s.showOverlayMinimap); final currentShowOverlayInfo = context.select((s) => s.showOverlayInfo); final currentShowOverlayShootingDetails = context.select((s) => s.showOverlayShootingDetails); - final currentRasterBackground = context.select((s) => s.rasterBackground); - final currentVectorBackground = context.select((s) => s.vectorBackground); + final currentImageBackground = context.select((s) => s.imageBackground); return AvesExpansionTile( leading: SettingsTileLeading( @@ -53,17 +52,10 @@ class ViewerSection extends StatelessWidget { title: Text(context.l10n.settingsViewerShowShootingDetails), ), ListTile( - title: Text(context.l10n.settingsRasterImageBackground), + title: Text(context.l10n.settingsImageBackground), trailing: EntryBackgroundSelector( - getter: () => currentRasterBackground, - setter: (value) => settings.rasterBackground = value, - ), - ), - ListTile( - title: Text(context.l10n.settingsVectorImageBackground), - trailing: EntryBackgroundSelector( - getter: () => currentVectorBackground, - setter: (value) => settings.vectorBackground = value, + getter: () => currentImageBackground, + setter: (value) => settings.imageBackground = value, ), ), ], diff --git a/lib/widgets/viewer/visual/raster.dart b/lib/widgets/viewer/visual/raster.dart index 2e56898cf..5873b1305 100644 --- a/lib/widgets/viewer/visual/raster.dart +++ b/lib/widgets/viewer/visual/raster.dart @@ -191,7 +191,7 @@ class _RasterImageViewState extends State { final decorationSize = (applyBoxFit(BoxFit.none, viewSize, viewportSize).source - const Offset(.5, .5)) as Size; Widget child; - final background = settings.rasterBackground; + final background = settings.imageBackground; if (background == EntryBackground.checkered) { final side = viewportSize.shortestSide; final checkSize = side / ((side / EntryPageView.decorationCheckSize).round()); diff --git a/lib/widgets/viewer/visual/vector.dart b/lib/widgets/viewer/visual/vector.dart index 8d1b6ef91..0fcda1180 100644 --- a/lib/widgets/viewer/visual/vector.dart +++ b/lib/widgets/viewer/visual/vector.dart @@ -159,7 +159,7 @@ class _VectorImageViewState extends State { final displayHeight = _displaySize.height; final viewRect = _getViewRect(displayWidth, displayHeight); final viewScale = viewState.scale!; - final background = settings.vectorBackground; + final background = settings.imageBackground; Color? backgroundColor; _BackgroundFrameBuilder? backgroundFrameBuilder;