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": {},
"settingsRasterImageBackground": "Raster image background",
"@settingsRasterImageBackground": {},
"settingsVectorImageBackground": "Vector image background",
"@settingsVectorImageBackground": {},
"settingsImageBackground": "Image background",
"@settingsImageBackground": {},
"settingsViewerShowMinimap": "Show minimap",
"@settingsViewerShowMinimap": {},
"settingsViewerShowInformation": "Show information",

View file

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

View file

@ -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 {

View file

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

View file

@ -189,7 +189,7 @@ class _ThumbnailImageState extends State<ThumbnailImage> {
height: extent,
)
: Selector<Settings, EntryBackground>(
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;

View file

@ -23,8 +23,7 @@ class ViewerSection extends StatelessWidget {
final currentShowOverlayMinimap = context.select<Settings, bool>((s) => s.showOverlayMinimap);
final currentShowOverlayInfo = context.select<Settings, bool>((s) => s.showOverlayInfo);
final currentShowOverlayShootingDetails = context.select<Settings, bool>((s) => s.showOverlayShootingDetails);
final currentRasterBackground = context.select<Settings, EntryBackground>((s) => s.rasterBackground);
final currentVectorBackground = context.select<Settings, EntryBackground>((s) => s.vectorBackground);
final currentImageBackground = context.select<Settings, EntryBackground>((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,
),
),
],

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;
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());

View file

@ -159,7 +159,7 @@ class _VectorImageViewState extends State<VectorImageView> {
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;