diff options
| author | mirror <mirror@localhost> | 2026-11-22 08:41:00 +0900 |
|---|---|---|
| committer | mirror <mirror@localhost> | 2026-11-22 08:41:00 +0900 |
| commit | 449d8b74bd6d9dae98a07254cdfad677b920e7b0 (patch) | |
| tree | c131c3528c4d517f56e19b854a7453fedb097d40 /plugins/aves_model/lib/src | |
| download | aves-src-master.tar.gz aves-src-master.zip | |
Diffstat (limited to 'plugins/aves_model/lib/src')
29 files changed, 1336 insertions, 0 deletions
diff --git a/plugins/aves_model/lib/src/actions/chip.dart b/plugins/aves_model/lib/src/actions/chip.dart new file mode 100644 index 0000000..b2b119c --- /dev/null +++ b/plugins/aves_model/lib/src/actions/chip.dart @@ -0,0 +1,13 @@ +enum ChipAction { + goToAlbumPage, + goToCountryPage, + goToPlacePage, + goToTagPage, + goToExplorerPage, + ratingOrGreater, + ratingOrLower, + decompose, + reverse, + hide, + lockVault, +} diff --git a/plugins/aves_model/lib/src/actions/chip_set.dart b/plugins/aves_model/lib/src/actions/chip_set.dart new file mode 100644 index 0000000..13db2f8 --- /dev/null +++ b/plugins/aves_model/lib/src/actions/chip_set.dart @@ -0,0 +1,74 @@ +enum ChipSetAction { + // general + configureView, + select, + selectAll, + selectNone, + // browsing + search, + toggleTitleSearch, + createGroup, + createAlbum, + createVault, + // browsing or selecting + map, + slideshow, + stats, + // selecting (single/multiple filters) + delete, + remove, + hide, + pin, + unpin, + group, + lockVault, + showCountryStates, + showCollection, + // selecting (single filter) + rename, + setCover, + configureVault, +} + +class ChipSetActions { + static const general = [ + ChipSetAction.configureView, + ChipSetAction.select, + ChipSetAction.selectAll, + ChipSetAction.selectNone, + ]; + + // `null` items are converted to dividers + static const browsing = [ + ChipSetAction.search, + ChipSetAction.toggleTitleSearch, + null, + ChipSetAction.map, + ChipSetAction.slideshow, + ChipSetAction.stats, + null, + ChipSetAction.createAlbum, + ChipSetAction.createVault, + ]; + + // `null` items are converted to dividers + static const selection = [ + ChipSetAction.setCover, + ChipSetAction.pin, + ChipSetAction.unpin, + ChipSetAction.delete, + ChipSetAction.remove, + ChipSetAction.rename, + ChipSetAction.showCountryStates, + ChipSetAction.hide, + ChipSetAction.group, + null, + ChipSetAction.showCollection, + ChipSetAction.map, + ChipSetAction.slideshow, + ChipSetAction.stats, + null, + ChipSetAction.configureVault, + ChipSetAction.lockVault, + ]; +} diff --git a/plugins/aves_model/lib/src/actions/entry.dart b/plugins/aves_model/lib/src/actions/entry.dart new file mode 100644 index 0000000..02becf1 --- /dev/null +++ b/plugins/aves_model/lib/src/actions/entry.dart @@ -0,0 +1,148 @@ +enum EntryAction { + info, + addShortcut, + copyToClipboard, + delete, + restore, + convert, + print, + rename, + copy, + move, + share, + toggleFavourite, + // raster + rotateCCW, + rotateCW, + flip, + // vector + viewSource, + // video + lockViewer, + videoCaptureFrame, + videoSelectStreams, + videoSetSpeed, + videoABRepeat, + videoToggleMute, + videoSettings, + videoTogglePlay, + videoReplay10, + videoSkip10, + videoShowPreviousFrame, + videoShowNextFrame, + // external + edit, + open, + openVideoPlayer, + openMap, + setAs, + cast, + // platform + rotateScreen, + // metadata + editDate, + editLocation, + editTitleDescription, + editRating, + editTags, + removeMetadata, + exportMetadata, + // metadata / GeoTIFF + showGeoTiffOnMap, + // metadata / motion photo + convertMotionPhotoToStillImage, + viewMotionPhotoVideo, + // debug + debug, +} + +class EntryActions { + static const topLevel = [ + EntryAction.info, + EntryAction.share, + EntryAction.edit, + EntryAction.rename, + EntryAction.delete, + EntryAction.copy, + EntryAction.move, + EntryAction.toggleFavourite, + EntryAction.rotateScreen, + EntryAction.viewSource, + ]; + + static const export = [ + ...exportInternal, + ...exportExternal, + ]; + + static const exportInternal = [ + EntryAction.convert, + EntryAction.addShortcut, + EntryAction.copyToClipboard, + EntryAction.print, + ]; + + static const exportExternal = [ + EntryAction.open, + EntryAction.openMap, + EntryAction.setAs, + EntryAction.cast, + ]; + + static const pageActions = { + EntryAction.videoCaptureFrame, + EntryAction.videoToggleMute, + EntryAction.videoSetSpeed, + EntryAction.videoABRepeat, + EntryAction.videoSelectStreams, + EntryAction.videoSettings, + ...videoPlayback, + ...orientationActions, + }; + + static const orientationActions = [ + EntryAction.rotateCCW, + EntryAction.rotateCW, + EntryAction.flip, + ]; + + static const trashed = [ + EntryAction.delete, + EntryAction.restore, + EntryAction.debug, + ]; + + static const video = [ + EntryAction.videoCaptureFrame, + EntryAction.videoToggleMute, + EntryAction.videoSetSpeed, + EntryAction.videoABRepeat, + EntryAction.videoSelectStreams, + EntryAction.videoSettings, + EntryAction.lockViewer, + ]; + + static const videoPlayback = [ + EntryAction.videoReplay10, + EntryAction.videoShowPreviousFrame, + EntryAction.videoTogglePlay, + EntryAction.videoShowNextFrame, + EntryAction.videoSkip10, + ]; + + static const commonMetadataActions = [ + EntryAction.editDate, + EntryAction.editLocation, + EntryAction.editTitleDescription, + EntryAction.editRating, + EntryAction.editTags, + EntryAction.removeMetadata, + EntryAction.exportMetadata, + ]; + + static const formatSpecificMetadataActions = [ + EntryAction.showGeoTiffOnMap, + EntryAction.convertMotionPhotoToStillImage, + EntryAction.viewMotionPhotoVideo, + ]; +} diff --git a/plugins/aves_model/lib/src/actions/entry_set.dart b/plugins/aves_model/lib/src/actions/entry_set.dart new file mode 100644 index 0000000..90bc1df --- /dev/null +++ b/plugins/aves_model/lib/src/actions/entry_set.dart @@ -0,0 +1,129 @@ +enum EntrySetAction { + // general + configureView, + select, + selectAll, + selectNone, + // browsing + searchCollection, + toggleTitleSearch, + addDynamicAlbum, + addShortcut, + setHome, + emptyBin, + // browsing or selecting + map, + slideshow, + stats, + rescan, + // selecting + share, + delete, + restore, + copy, + move, + rename, + convert, + toggleFavourite, + rotateCCW, + rotateCW, + flip, + editDate, + editLocation, + editTitleDescription, + editRating, + editTags, + removeMetadata, +} + +class EntrySetActions { + static const general = [ + EntrySetAction.configureView, + EntrySetAction.select, + EntrySetAction.selectAll, + EntrySetAction.selectNone, + ]; + + // `null` items are converted to dividers + static const pageBrowsing = [ + EntrySetAction.searchCollection, + EntrySetAction.toggleTitleSearch, + EntrySetAction.addDynamicAlbum, + EntrySetAction.addShortcut, + EntrySetAction.setHome, + null, + EntrySetAction.map, + EntrySetAction.slideshow, + EntrySetAction.stats, + null, + EntrySetAction.rescan, + EntrySetAction.emptyBin, + ]; + + // exclude bin related actions + static const collectionEditorBrowsing = [ + EntrySetAction.searchCollection, + EntrySetAction.toggleTitleSearch, + EntrySetAction.map, + EntrySetAction.slideshow, + EntrySetAction.stats, + // only available as a quick action + EntrySetAction.selectAll, + ]; + + // `null` items are converted to dividers + static const pageSelection = [ + EntrySetAction.share, + EntrySetAction.delete, + EntrySetAction.restore, + EntrySetAction.copy, + EntrySetAction.move, + EntrySetAction.rename, + EntrySetAction.convert, + EntrySetAction.toggleFavourite, + null, + EntrySetAction.map, + EntrySetAction.slideshow, + EntrySetAction.stats, + null, + EntrySetAction.rescan, + // editing actions are in their subsection + ]; + + // exclude bin related actions + static const collectionEditorSelectionRegular = [ + EntrySetAction.share, + EntrySetAction.delete, + EntrySetAction.copy, + EntrySetAction.move, + EntrySetAction.rename, + EntrySetAction.convert, + EntrySetAction.toggleFavourite, + EntrySetAction.map, + EntrySetAction.slideshow, + EntrySetAction.stats, + EntrySetAction.selectAll, + // editing actions are in their subsection + ]; + + static const collectionEditorSelectionEdit = [ + EntrySetAction.rotateCCW, + EntrySetAction.rotateCW, + EntrySetAction.flip, + EntrySetAction.editDate, + EntrySetAction.editLocation, + EntrySetAction.editTitleDescription, + EntrySetAction.editRating, + EntrySetAction.editTags, + EntrySetAction.removeMetadata, + ]; + + static const edit = [ + EntrySetAction.editDate, + EntrySetAction.editLocation, + EntrySetAction.editTitleDescription, + EntrySetAction.editRating, + EntrySetAction.editTags, + EntrySetAction.removeMetadata, + ]; +} diff --git a/plugins/aves_model/lib/src/actions/explorer.dart b/plugins/aves_model/lib/src/actions/explorer.dart new file mode 100644 index 0000000..58d595b --- /dev/null +++ b/plugins/aves_model/lib/src/actions/explorer.dart @@ -0,0 +1,6 @@ +enum ExplorerAction { + addShortcut, + setHome, + hide, + stats, +} diff --git a/plugins/aves_model/lib/src/actions/map.dart b/plugins/aves_model/lib/src/actions/map.dart new file mode 100644 index 0000000..1c71363 --- /dev/null +++ b/plugins/aves_model/lib/src/actions/map.dart @@ -0,0 +1,9 @@ +enum MapAction { + // any map panel + selectStyle, + openMapApp, + zoomIn, + zoomOut, + // full page only + addShortcut, +} diff --git a/plugins/aves_model/lib/src/actions/map_cluster.dart b/plugins/aves_model/lib/src/actions/map_cluster.dart new file mode 100644 index 0000000..d022934 --- /dev/null +++ b/plugins/aves_model/lib/src/actions/map_cluster.dart @@ -0,0 +1,4 @@ +enum MapClusterAction { + editLocation, + removeLocation, +} diff --git a/plugins/aves_model/lib/src/actions/move_type.dart b/plugins/aves_model/lib/src/actions/move_type.dart new file mode 100644 index 0000000..7c362b0 --- /dev/null +++ b/plugins/aves_model/lib/src/actions/move_type.dart @@ -0,0 +1,7 @@ +enum MoveType { + copy, + move, + export, + toBin, + fromBin, +} diff --git a/plugins/aves_model/lib/src/actions/settings.dart b/plugins/aves_model/lib/src/actions/settings.dart new file mode 100644 index 0000000..77e5a55 --- /dev/null +++ b/plugins/aves_model/lib/src/actions/settings.dart @@ -0,0 +1,4 @@ +enum SettingsAction { + export, + import, +} diff --git a/plugins/aves_model/lib/src/actions/share.dart b/plugins/aves_model/lib/src/actions/share.dart new file mode 100644 index 0000000..3be6fb6 --- /dev/null +++ b/plugins/aves_model/lib/src/actions/share.dart @@ -0,0 +1,4 @@ +enum ShareAction { + imageOnly, + videoOnly, +} diff --git a/plugins/aves_model/lib/src/actions/slideshow.dart b/plugins/aves_model/lib/src/actions/slideshow.dart new file mode 100644 index 0000000..a4f7825 --- /dev/null +++ b/plugins/aves_model/lib/src/actions/slideshow.dart @@ -0,0 +1,6 @@ +enum SlideshowAction { + resume, + showInCollection, + cast, + settings, +} diff --git a/plugins/aves_model/lib/src/editor/enums.dart b/plugins/aves_model/lib/src/editor/enums.dart new file mode 100644 index 0000000..7d03820 --- /dev/null +++ b/plugins/aves_model/lib/src/editor/enums.dart @@ -0,0 +1,66 @@ +enum EditorAction { transform } + +enum CropAspectRatio { free, original, square, ar_16_9, ar_4_3 } + +enum TransformActivity { none, pan, resize, straighten } + +enum TransformOrientation { normal, rotate90, rotate180, rotate270, transverse, flipVertical, transpose, flipHorizontal } + +extension ExtraTransformOrientation on TransformOrientation { + TransformOrientation flipHorizontally() { + switch (this) { + case TransformOrientation.normal: + return TransformOrientation.flipHorizontal; + case TransformOrientation.rotate90: + return TransformOrientation.transverse; + case TransformOrientation.rotate180: + return TransformOrientation.flipVertical; + case TransformOrientation.rotate270: + return TransformOrientation.transpose; + case TransformOrientation.transverse: + return TransformOrientation.rotate90; + case TransformOrientation.flipVertical: + return TransformOrientation.rotate180; + case TransformOrientation.transpose: + return TransformOrientation.rotate270; + case TransformOrientation.flipHorizontal: + return TransformOrientation.normal; + } + } + + bool get isFlipped { + switch (this) { + case TransformOrientation.normal: + case TransformOrientation.rotate90: + case TransformOrientation.rotate180: + case TransformOrientation.rotate270: + return false; + case TransformOrientation.transverse: + case TransformOrientation.flipVertical: + case TransformOrientation.transpose: + case TransformOrientation.flipHorizontal: + return true; + } + } + + TransformOrientation rotateClockwise() { + switch (this) { + case TransformOrientation.normal: + return TransformOrientation.rotate90; + case TransformOrientation.rotate90: + return TransformOrientation.rotate180; + case TransformOrientation.rotate180: + return TransformOrientation.rotate270; + case TransformOrientation.rotate270: + return TransformOrientation.normal; + case TransformOrientation.transverse: + return TransformOrientation.flipHorizontal; + case TransformOrientation.flipVertical: + return TransformOrientation.transverse; + case TransformOrientation.transpose: + return TransformOrientation.flipVertical; + case TransformOrientation.flipHorizontal: + return TransformOrientation.transpose; + } + } +} diff --git a/plugins/aves_model/lib/src/entry/base.dart b/plugins/aves_model/lib/src/entry/base.dart new file mode 100644 index 0000000..6d97bcf --- /dev/null +++ b/plugins/aves_model/lib/src/entry/base.dart @@ -0,0 +1,31 @@ +import 'dart:ui'; + +import 'package:flutter/foundation.dart'; + +mixin AvesEntryBase { + int get id; + + String get uri; + + int? get pageId; + + String get mimeType; + + String? get path; + + String? get bestTitle; + + int? get sizeBytes; + + int? get durationMillis; + + bool get isAnimated; + + int get rotationDegrees; + + Size get displaySize; + + double get displayAspectRatio; + + Listenable get visualChangeNotifier; +} diff --git a/plugins/aves_model/lib/src/events/actions.dart b/plugins/aves_model/lib/src/events/actions.dart new file mode 100644 index 0000000..8a82b1e --- /dev/null +++ b/plugins/aves_model/lib/src/events/actions.dart @@ -0,0 +1,22 @@ +import 'package:equatable/equatable.dart'; +import 'package:flutter/foundation.dart'; + +@immutable +class ActionEvent<T> extends Equatable { + final T action; + + @override + List<Object?> get props => [action]; + + const ActionEvent(this.action); +} + +@immutable +class ActionStartedEvent<T> extends ActionEvent<T> { + const ActionStartedEvent(super.action); +} + +@immutable +class ActionEndedEvent<T> extends ActionEvent<T> { + const ActionEndedEvent(super.action); +} diff --git a/plugins/aves_model/lib/src/metadata/enums.dart b/plugins/aves_model/lib/src/metadata/enums.dart new file mode 100644 index 0000000..2137d44 --- /dev/null +++ b/plugins/aves_model/lib/src/metadata/enums.dart @@ -0,0 +1,75 @@ +enum DateEditAction { + setCustom, + copyField, + copyItem, + extractFromTitle, + shift, + remove, +} + +enum DateFieldSource { + fileModifiedDate, + exifDate, + exifDateOriginal, + exifDateDigitized, + exifGpsDate, +} + +enum EntryConvertAction { convert, convertMotionPhotoToStillImage } + +enum LengthUnit { px, percent } + +enum LocationEditAction { + chooseOnMap, + copyItem, + setCustom, + importGpx, + remove, +} + +enum MetadataType { + // JPEG COM marker or GIF comment + comment, + // Exif: https://en.wikipedia.org/wiki/Exif + exif, + // ICC profile: https://en.wikipedia.org/wiki/ICC_profile + iccProfile, + // IPTC: https://en.wikipedia.org/wiki/IPTC_Information_Interchange_Model + iptc, + // JPEG APP0 / JFIF: https://en.wikipedia.org/wiki/JPEG_File_Interchange_Format + jfif, + // JPEG APP14 / Adobe: https://www.exiftool.org/TagNames/JPEG.html#Adobe + jpegAdobe, + // JPEG APP12 / Ducky: https://www.exiftool.org/TagNames/APP12.html#Ducky + jpegDucky, + // ISO User Data box content, etc. + mp4, + // Photoshop IRB: https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/ + photoshopIrb, + // XMP: https://en.wikipedia.org/wiki/Extensible_Metadata_Platform + xmp, + // others (hash, etc.) + file, +} + +class MetadataTypes { + static const main = { + MetadataType.exif, + MetadataType.xmp, + }; + + static const common = { + MetadataType.exif, + MetadataType.xmp, + MetadataType.comment, + MetadataType.iccProfile, + MetadataType.iptc, + MetadataType.photoshopIrb, + }; + + static const jpeg = { + MetadataType.jfif, + MetadataType.jpegAdobe, + MetadataType.jpegDucky, + }; +} diff --git a/plugins/aves_model/lib/src/metadata/fields.dart b/plugins/aves_model/lib/src/metadata/fields.dart new file mode 100644 index 0000000..0f5c0f5 --- /dev/null +++ b/plugins/aves_model/lib/src/metadata/fields.dart @@ -0,0 +1,97 @@ +enum MetadataSyntheticField { + aperture, + description, + exposureTime, + focalLength, + iso, +} + +enum MetadataField { + // exif + exifDate, + exifDateOriginal, + exifDateDigitized, + exifGpsAltitude, + exifGpsAltitudeRef, + exifGpsAreaInformation, + exifGpsDatestamp, + exifGpsDestBearing, + exifGpsDestBearingRef, + exifGpsDestDistance, + exifGpsDestDistanceRef, + exifGpsDestLatitude, + exifGpsDestLatitudeRef, + exifGpsDestLongitude, + exifGpsDestLongitudeRef, + exifGpsDifferential, + exifGpsDOP, + exifGpsHPositioningError, + exifGpsImgDirection, + exifGpsImgDirectionRef, + exifGpsLatitude, + exifGpsLatitudeRef, + exifGpsLongitude, + exifGpsLongitudeRef, + exifGpsMapDatum, + exifGpsMeasureMode, + exifGpsProcessingMethod, + exifGpsSatellites, + exifGpsSpeed, + exifGpsSpeedRef, + exifGpsStatus, + exifGpsTimestamp, + exifGpsTrack, + exifGpsTrackRef, + exifGpsVersionId, + exifImageDescription, + exifMake, + exifModel, + exifUserComment, + // mp4 + mp4GpsCoordinates, + mp4RotationDegrees, + mp4Xmp, + // xmp + xmpXmpCreateDate, + // file + hashMd5, + hashSha1, + hashSha256, +} + +class MetadataFields { + static const Set<MetadataField> exifGpsFields = { + MetadataField.exifGpsAltitude, + MetadataField.exifGpsAltitudeRef, + MetadataField.exifGpsAreaInformation, + MetadataField.exifGpsDatestamp, + MetadataField.exifGpsDestBearing, + MetadataField.exifGpsDestBearingRef, + MetadataField.exifGpsDestDistance, + MetadataField.exifGpsDestDistanceRef, + MetadataField.exifGpsDestLatitude, + MetadataField.exifGpsDestLatitudeRef, + MetadataField.exifGpsDestLongitude, + MetadataField.exifGpsDestLongitudeRef, + MetadataField.exifGpsDifferential, + MetadataField.exifGpsDOP, + MetadataField.exifGpsHPositioningError, + MetadataField.exifGpsImgDirection, + MetadataField.exifGpsImgDirectionRef, + MetadataField.exifGpsLatitude, + MetadataField.exifGpsLatitudeRef, + MetadataField.exifGpsLongitude, + MetadataField.exifGpsLongitudeRef, + MetadataField.exifGpsMapDatum, + MetadataField.exifGpsMeasureMode, + MetadataField.exifGpsProcessingMethod, + MetadataField.exifGpsSatellites, + MetadataField.exifGpsSpeed, + MetadataField.exifGpsSpeedRef, + MetadataField.exifGpsStatus, + MetadataField.exifGpsTimestamp, + MetadataField.exifGpsTrack, + MetadataField.exifGpsTrackRef, + MetadataField.exifGpsVersionId, + }; +} diff --git a/plugins/aves_model/lib/src/settings/access.dart b/plugins/aves_model/lib/src/settings/access.dart new file mode 100644 index 0000000..c87fe22 --- /dev/null +++ b/plugins/aves_model/lib/src/settings/access.dart @@ -0,0 +1,105 @@ +import 'package:aves_model/aves_model.dart'; +import 'package:collection/collection.dart'; + +mixin SettingsAccess { + bool get initialized; + + SettingsStore get store; + + Stream<SettingsChangedEvent> get updateStream; + + void notifyKeyChange(String key, dynamic oldValue, dynamic newValue); + + void notifyListeners(); + + void set(String key, dynamic newValue) { + var oldValue = store.get(key); + if (newValue == null) { + store.remove(key); + } else if (newValue is String) { + oldValue = getString(key); + store.setString(key, newValue); + } else if (newValue is List<String>) { + oldValue = getStringList(key); + store.setStringList(key, newValue); + } else if (newValue is int) { + oldValue = getInt(key); + store.setInt(key, newValue); + } else if (newValue is double) { + oldValue = getDouble(key); + store.setDouble(key, newValue); + } else if (newValue is bool) { + oldValue = getBool(key); + store.setBool(key, newValue); + } + if (oldValue != newValue) { + notifyKeyChange(key, oldValue, newValue); + notifyListeners(); + } + } + + // getters + + bool? getBool(String key) { + try { + return store.getBool(key); + } catch (error) { + // ignore, could be obsolete value of different type + return null; + } + } + + int? getInt(String key) { + try { + return store.getInt(key); + } catch (error) { + // ignore, could be obsolete value of different type + return null; + } + } + + double? getDouble(String key) { + try { + return store.getDouble(key); + } catch (error) { + // ignore, could be obsolete value of different type + return null; + } + } + + String? getString(String key) { + try { + return store.getString(key); + } catch (error) { + // ignore, could be obsolete value of different type + return null; + } + } + + List<String>? getStringList(String key) { + try { + return store.getStringList(key); + } catch (error) { + // ignore, could be obsolete value of different type + return null; + } + } + + T getEnumOrDefault<T>(String key, T defaultValue, Iterable<T> values) { + try { + final valueString = store.getString(key); + for (final v in values) { + if (v.toString() == valueString) { + return v; + } + } + } catch (error) { + // ignore, could be obsolete value of different type + } + return defaultValue; + } + + List<T> getEnumListOrDefault<T extends Object>(String key, List<T> defaultValue, Iterable<T> values) { + return store.getStringList(key)?.map((s) => values.firstWhereOrNull((v) => v.toString() == s)).nonNulls.toList() ?? defaultValue; + } +} diff --git a/plugins/aves_model/lib/src/settings/enums.dart b/plugins/aves_model/lib/src/settings/enums.dart new file mode 100644 index 0000000..fa6945d --- /dev/null +++ b/plugins/aves_model/lib/src/settings/enums.dart @@ -0,0 +1,71 @@ +enum AccessibilityAnimations { system, disabled, enabled } + +enum AccessibilityTimeout { system, s1, s3, s5, s10, s30 } + +enum AvesThemeBrightness { system, light, dark, black } + +enum AvesThemeColorMode { monochrome, polychrome } + +enum ConfirmationDialog { createVault, deleteForever, moveToBin, moveUndatedItems } + +enum CoordinateFormat { dms, ddm, decimal } + +enum DisplayRefreshRateMode { auto, highest, lowest } + +enum EntryBackground { black, white, checkered } + +enum HomePageSetting { collection, albums, tags, explorer } + +enum KeepScreenOn { never, videoPlayback, viewerOnly, always } + +enum MaxBrightness { never, viewerOnly, always } + +enum OverlayHistogramStyle { none, rgb, luminance } + +enum SlideshowVideoPlayback { skip, playMuted, playWithSound } + +enum SubtitlePosition { top, bottom } + +enum ThumbnailOverlayLocationIcon { located, unlocated, none } + +enum ThumbnailOverlayTagIcon { tagged, untagged, none } + +enum UnitSystem { metric, imperial } + +enum VideoAutoPlayMode { disabled, playMuted, playWithSound } + +enum VideoBackgroundMode { disabled, pip } + +enum VideoLoopMode { never, shortOnly, always } + +enum VideoResumptionMode { never, ask, always } + +enum ViewerTransition { slide, parallax, fade, zoomIn, none, random } + +enum WidgetDisplayedItem { random, mostRecent } + +enum WidgetOpenPage { home, collection, viewer, updateWidget } + +enum WidgetOutline { + none, + black, + white, + // system brightness dependent (low contrast): + // - white on light theme + // - black on dark theme + systemBlackAndWhite, + // system brightness dependent (high contrast): + // - black on light theme + // - white on dark theme + systemBlackAndWhiteHighContrast, + // system brightness dependent (low contrast): + // light dynamic colour on light theme + // dark dynamic colour on dark theme. + systemDynamicLowContrast, + // system brightness dependent (high contrast): + // dark dynamic colour on light theme + // light dynamic colour on dark theme. + systemDynamic, +} + +enum WidgetShape { rrect, circle, heart, concaveSquare, wavyCircle16, tearRectLeft, tearRectRight, bumpyRows, bumpyColumns } diff --git a/plugins/aves_model/lib/src/settings/event.dart b/plugins/aves_model/lib/src/settings/event.dart new file mode 100644 index 0000000..22b3bfa --- /dev/null +++ b/plugins/aves_model/lib/src/settings/event.dart @@ -0,0 +1,11 @@ +import 'package:meta/meta.dart'; + +@immutable +class SettingsChangedEvent { + final String key; + final dynamic oldValue; + final dynamic newValue; + + // old and new values as stored, e.g. `List<String>` for collections + const SettingsChangedEvent(this.key, this.oldValue, this.newValue); +} diff --git a/plugins/aves_model/lib/src/settings/keys.dart b/plugins/aves_model/lib/src/settings/keys.dart new file mode 100644 index 0000000..f85d21d --- /dev/null +++ b/plugins/aves_model/lib/src/settings/keys.dart @@ -0,0 +1,199 @@ +class SettingKeys { + static bool isInternalKey(String key) => _internalKeys.contains(key) || key.startsWith(_widgetKeyPrefix); + + static const Set<String> _internalKeys = { + hasAcceptedTermsKey, + catalogTimeZoneOffsetMillisKey, + searchHistoryKey, + platformAccelerometerRotationKey, + platformTransitionAnimationScaleKey, + topEntryIdsKey, + recentDestinationAlbumsKey, + recentTagsKey, + debugShowViewerTilesKey, + }; + + static const _widgetKeyPrefix = 'widget_'; + + // app + static const hasAcceptedTermsKey = 'has_accepted_terms'; + static const canUseAnalysisServiceKey = 'can_use_analysis_service'; + static const isInstalledAppAccessAllowedKey = 'is_installed_app_access_allowed'; + static const isErrorReportingAllowedKey = 'is_crashlytics_enabled'; + static const localeKey = 'locale'; + static const forceWesternArabicNumeralsKey = 'force_western_arabic_numerals'; + static const catalogTimeZoneOffsetMillisKey = 'catalog_time_zone_raw_offset_millis'; + static const tileExtentPrefixKey = 'tile_extent_'; + static const tileLayoutPrefixKey = 'tile_layout_'; + static const entryRenamingPatternKey = 'entry_renaming_pattern'; + static const topEntryIdsKey = 'top_entry_ids'; + static const recentDestinationAlbumsKey = 'recent_destination_albums'; + static const recentTagsKey = 'recent_tags'; + + // debug + static const debugShowViewerTilesKey = 'debug_show_viewer_tiles'; + + // display + static const displayRefreshRateModeKey = 'display_refresh_rate_mode'; + static const themeBrightnessKey = 'theme_brightness'; + static const themeColorModeKey = 'theme_color_mode'; + static const enableDynamicColorKey = 'dynamic_color'; + static const enableBlurEffectKey = 'enable_overlay_blur_effect'; + static const maxBrightnessKey = 'max_brightness'; + static const forceTvLayoutKey = 'force_tv_layout'; + + // navigation + static const mustBackTwiceToExitKey = 'must_back_twice_to_exit'; + static const keepScreenOnKey = 'keep_screen_on'; + static const homePageKey = 'home_page'; + static const homeCustomCollectionKey = 'home_custom_collection'; + static const homeCustomExplorerPathKey = 'home_custom_explorer_path'; + static const confirmCreateVaultKey = 'confirm_create_vault'; + static const confirmDeleteForeverKey = 'confirm_delete_forever'; + static const confirmMoveToBinKey = 'confirm_move_to_bin'; + static const confirmMoveUndatedItemsKey = 'confirm_move_undated_items'; + static const confirmAfterMoveToBinKey = 'confirm_after_move_to_bin'; + static const setMetadataDateBeforeFileOpKey = 'set_metadata_date_before_file_op'; + static const drawerTypeBookmarksKey = 'drawer_type_bookmarks'; + static const drawerAlbumBookmarksKey = 'drawer_album_bookmarks'; + static const drawerPageBookmarksKey = 'drawer_page_bookmarks'; + static const bottomNavigationActionsKey = 'bottom_navigation_actions'; + + // collection + static const collectionBurstPatternsKey = 'collection_burst_patterns'; + static const collectionGroupFactorKey = 'collection_group_factor'; + static const collectionSortFactorKey = 'collection_sort_factor'; + static const collectionSortReverseKey = 'collection_sort_reverse'; + static const collectionBrowsingQuickActionsKey = 'collection_browsing_quick_actions'; + static const collectionSelectionQuickActionsKey = 'collection_selection_quick_actions'; + static const showThumbnailFavouriteKey = 'show_thumbnail_favourite'; + static const showThumbnailHdrKey = 'show_thumbnail_hdr'; + static const thumbnailLocationIconKey = 'thumbnail_location_icon'; + static const thumbnailTagIconKey = 'thumbnail_tag_icon'; + static const showThumbnailMotionPhotoKey = 'show_thumbnail_motion_photo'; + static const showThumbnailRatingKey = 'show_thumbnail_rating'; + static const showThumbnailRawKey = 'show_thumbnail_raw'; + static const showThumbnailVideoDurationKey = 'show_thumbnail_video_duration'; + + // filter grids + static const albumSectionFactorKey = 'album_section_factor'; + static const albumSortFactorKey = 'album_sort_factor'; + static const countrySortFactorKey = 'country_sort_factor'; + static const stateSortFactorKey = 'state_sort_factor'; + static const placeSortFactorKey = 'place_sort_factor'; + static const tagSortFactorKey = 'tag_sort_factor'; + static const albumSortReverseKey = 'album_sort_reverse'; + static const countrySortReverseKey = 'country_sort_reverse'; + static const stateSortReverseKey = 'state_sort_reverse'; + static const placeSortReverseKey = 'place_sort_reverse'; + static const tagSortReverseKey = 'tag_sort_reverse'; + static const albumGroupsKey = 'album_groups'; + static const tagGroupsKey = 'tag_groups'; + static const pinnedFiltersKey = 'pinned_filters'; + static const hiddenFiltersKey = 'hidden_filters'; + static const deactivatedHiddenFiltersKey = 'deactivated_hidden_filters'; + static const showTitleQueryPrefixKey = 'show_title_query_'; + + // viewer + static const viewerQuickActionsKey = 'viewer_quick_actions'; + static const showOverlayOnOpeningKey = 'show_overlay_on_opening'; + static const showOverlayMinimapKey = 'show_overlay_minimap'; + static const showOverlayZoomLevelKey = 'show_overlay_zoom_level'; + static const overlayHistogramStyleKey = 'show_overlay_histogram'; + static const showOverlayInfoKey = 'show_overlay_info'; + static const showOverlayDescriptionKey = 'show_overlay_description'; + static const showOverlayRatingTagsKey = 'show_overlay_rating_tags'; + static const showOverlayShootingDetailsKey = 'show_overlay_shooting_details'; + static const showOverlayThumbnailPreviewKey = 'show_overlay_thumbnail_preview'; + static const viewerGestureSideTapNextKey = 'viewer_gesture_side_tap_next'; + static const viewerUseCutoutKey = 'viewer_use_cutout'; + static const enableMotionPhotoAutoPlayKey = 'motion_photo_auto_play'; + static const imageBackgroundKey = 'image_background'; + + // video + static const enableVideoHardwareAccelerationKey = 'video_hwaccel_mediacodec'; + static const videoBackgroundModeKey = 'video_background_mode'; + static const videoAutoPlayModeKey = 'video_auto_play_mode'; + static const videoLoopModeKey = 'video_loop'; + static const videoResumptionModeKey = 'video_resumption_mode'; + static const videoControlActionsKey = 'video_control_actions'; + static const videoGestureDoubleTapTogglePlayKey = 'video_gesture_double_tap_toggle_play'; + static const videoGestureSideDoubleTapSeekKey = 'video_gesture_side_double_tap_skip'; + static const videoGestureVerticalDragBrightnessVolumeKey = 'video_gesture_vertical_drag_brightness_volume'; + + // subtitles + static const subtitleFontSizeKey = 'subtitle_font_size'; + static const subtitleTextAlignmentKey = 'subtitle_text_alignment'; + static const subtitleTextPositionKey = 'subtitle_text_position'; + static const subtitleShowOutlineKey = 'subtitle_show_outline'; + static const subtitleTextColorKey = 'subtitle_text_color_string'; + static const subtitleBackgroundColorKey = 'subtitle_background_color_string'; + + // info + static const infoMapZoomKey = 'info_map_zoom'; + static const coordinateFormatKey = 'coordinates_format'; + static const unitSystemKey = 'unit_system'; + + // tag editor + + static const tagEditorCurrentFilterSectionExpandedKey = 'tag_editor_current_filter_section_expanded'; + static const tagEditorExpandedSectionKey = 'tag_editor_expanded_section'; + + // converter + + static const convertMimeTypeKey = 'convert_mime_type'; + static const convertQualityKey = 'convert_quality'; + static const convertWriteMetadataKey = 'convert_write_metadata'; + + // map + static const mapStyleKey = 'info_map_style'; + static const mapDefaultCenterKey = 'map_default_center'; + static const customMapStylesKey = 'custom_map_styles'; + + // search + static const saveSearchHistoryKey = 'save_search_history'; + static const searchHistoryKey = 'search_history'; + + // bin + static const enableBinKey = 'enable_bin'; + + // accessibility + static const showPinchGestureAlternativesKey = 'show_pinch_gesture_alternatives'; + static const accessibilityAnimationsKey = 'accessibility_animations'; + static const timeToTakeActionKey = 'time_to_take_action'; + + // screen saver + static const screenSaverFillScreenKey = 'screen_saver_fill_screen'; + static const screenSaverAnimatedZoomEffectKey = 'screen_saver_animated_zoom_effect'; + static const screenSaverTransitionKey = 'screen_saver_transition'; + static const screenSaverVideoPlaybackKey = 'screen_saver_video_playback'; + static const screenSaverIntervalKey = 'screen_saver_interval'; + static const screenSaverCollectionFiltersKey = 'screen_saver_collection_filters'; + + // slideshow + static const slideshowRepeatKey = 'slideshow_loop'; + static const slideshowShuffleKey = 'slideshow_shuffle'; + static const slideshowFillScreenKey = 'slideshow_fill_screen'; + static const slideshowAnimatedZoomEffectKey = 'slideshow_animated_zoom_effect'; + static const slideshowTransitionKey = 'slideshow_transition'; + static const slideshowVideoPlaybackKey = 'slideshow_video_playback'; + static const slideshowIntervalKey = 'slideshow_interval'; + + // widget + static const widgetOutlinePrefixKey = '${_widgetKeyPrefix}outline_'; + static const widgetShapePrefixKey = '${_widgetKeyPrefix}shape_'; + static const widgetCollectionFiltersPrefixKey = '${_widgetKeyPrefix}collection_filters_'; + static const widgetOpenPagePrefixKey = '${_widgetKeyPrefix}open_page_'; + static const widgetDisplayedItemPrefixKey = '${_widgetKeyPrefix}displayed_item_'; + static const widgetUriPrefixKey = '${_widgetKeyPrefix}uri_'; + + // platform settings + // cf Android `Settings.System.ACCELEROMETER_ROTATION` + static const platformAccelerometerRotationKey = 'accelerometer_rotation'; + + // cf Android `Settings.Global.TRANSITION_ANIMATION_SCALE` + static const platformTransitionAnimationScaleKey = 'transition_animation_scale'; + + // cf Android `Settings.Secure.LONG_PRESS_TIMEOUT` + static const platformLongPressTimeoutMillisKey = 'long_press_timeout'; +} diff --git a/plugins/aves_model/lib/src/settings/store.dart b/plugins/aves_model/lib/src/settings/store.dart new file mode 100644 index 0000000..84a7feb --- /dev/null +++ b/plugins/aves_model/lib/src/settings/store.dart @@ -0,0 +1,39 @@ +abstract class SettingsStore { + bool get initialized; + + Future<void> init(); + + Future<void> reload(); + + Future<bool> clear(); + + Future<bool> remove(String key); + + // get + + Set<String> getKeys(); + + Object? get(String key); + + bool? getBool(String key); + + int? getInt(String key); + + double? getDouble(String key); + + String? getString(String key); + + List<String>? getStringList(String key); + + // set + + Future<bool> setBool(String key, bool value); + + Future<bool> setInt(String key, int value); + + Future<bool> setDouble(String key, double value); + + Future<bool> setString(String key, String value); + + Future<bool> setStringList(String key, List<String> value); +} diff --git a/plugins/aves_model/lib/src/source/album.dart b/plugins/aves_model/lib/src/source/album.dart new file mode 100644 index 0000000..1520e8b --- /dev/null +++ b/plugins/aves_model/lib/src/source/album.dart @@ -0,0 +1,10 @@ +enum AlbumType { + regular, + vault, + app, + camera, + download, + screenRecordings, + screenshots, + videoCaptures, +} diff --git a/plugins/aves_model/lib/src/source/enums.dart b/plugins/aves_model/lib/src/source/enums.dart new file mode 100644 index 0000000..e029534 --- /dev/null +++ b/plugins/aves_model/lib/src/source/enums.dart @@ -0,0 +1,11 @@ +enum SourceState { loading, cataloguing, locatingCountries, locatingPlaces, ready } + +enum ChipSortFactor { date, name, count, size, path } + +enum AlbumChipSectionFactor { none, importance, mimeType, volume } + +enum EntrySortFactor { date, name, rating, size, duration, path } + +enum EntrySectionFactor { none, album, month, day } + +enum TileLayout { mosaic, grid, list } diff --git a/plugins/aves_model/lib/src/source/vault.dart b/plugins/aves_model/lib/src/source/vault.dart new file mode 100644 index 0000000..b560948 --- /dev/null +++ b/plugins/aves_model/lib/src/source/vault.dart @@ -0,0 +1 @@ +enum VaultLockType { system, pattern, pin, password } diff --git a/plugins/aves_model/lib/src/storage/relative_dir.dart b/plugins/aves_model/lib/src/storage/relative_dir.dart new file mode 100644 index 0000000..377318f --- /dev/null +++ b/plugins/aves_model/lib/src/storage/relative_dir.dart @@ -0,0 +1,44 @@ +import 'package:aves_model/aves_model.dart'; +import 'package:equatable/equatable.dart'; +import 'package:meta/meta.dart'; + +@immutable +class VolumeRelativeDirectory extends Equatable { + final String volumePath, relativeDir; + + @override + List<Object?> get props => [volumePath, relativeDir]; + + String get dirPath => '$volumePath$relativeDir'; + + const VolumeRelativeDirectory({ + required this.volumePath, + required this.relativeDir, + }); + + factory VolumeRelativeDirectory.volume(StorageVolume volume) { + return VolumeRelativeDirectory(volumePath: volume.path, relativeDir: ''); + } + + static VolumeRelativeDirectory fromMap(Map map) { + return VolumeRelativeDirectory( + volumePath: map['volumePath'] ?? '', + relativeDir: map['relativeDir'] ?? '', + ); + } + + Map<String, dynamic> toMap() => { + 'volumePath': volumePath, + 'relativeDir': relativeDir, + }; + + VolumeRelativeDirectory copyWith({ + String? volumePath, + String? relativeDir, + }) { + return VolumeRelativeDirectory( + volumePath: volumePath ?? this.volumePath, + relativeDir: relativeDir ?? this.relativeDir, + ); + } +} diff --git a/plugins/aves_model/lib/src/storage/volume.dart b/plugins/aves_model/lib/src/storage/volume.dart new file mode 100644 index 0000000..ff6df3d --- /dev/null +++ b/plugins/aves_model/lib/src/storage/volume.dart @@ -0,0 +1,31 @@ +import 'package:equatable/equatable.dart'; +import 'package:meta/meta.dart'; + +@immutable +class StorageVolume extends Equatable { + final String? description; + final String path, state; + final bool isPrimary, isRemovable; + + @override + List<Object?> get props => [description, path, state, isPrimary, isRemovable]; + + const StorageVolume({ + required this.description, + required this.isPrimary, + required this.isRemovable, + required this.path, + required this.state, + }); + + factory StorageVolume.fromMap(Map map) { + final isPrimary = map['isPrimary'] ?? false; + return StorageVolume( + description: map['description'], + isPrimary: isPrimary, + isRemovable: map['isRemovable'] ?? false, + path: map['path'] ?? '', + state: map['state'] ?? '', + ); + } +} diff --git a/plugins/aves_model/lib/src/video/keys.dart b/plugins/aves_model/lib/src/video/keys.dart new file mode 100644 index 0000000..c27f9b2 --- /dev/null +++ b/plugins/aves_model/lib/src/video/keys.dart @@ -0,0 +1,109 @@ +// keys returned by fijkplayer when getting media and streams info +// they originate from FFmpeg, fijkplayer, and other software +// that write additional metadata to media files +class Keys { + static const alpha = 'alpha'; + static const androidCaptureFramerate = 'com.android.capture.fps'; + static const androidManufacturer = 'com.android.manufacturer'; + static const androidModel = 'com.android.model'; + static const androidVersion = 'com.android.version'; + static const audioChannels = 'audio-channels'; + static const avgFrameRate = 'avg_frame_rate'; + static const bps = 'bps'; + static const bitrate = 'bitrate'; + static const bitsPerSample = 'bits_per_sample'; + static const byteCount = 'number_of_bytes'; + static const channelLayout = 'channel_layout'; + static const chapters = 'chapters'; + static const chromaLocation = 'chroma_location'; + static const closedCaptions = 'closed_captions'; + static const codecLevel = 'codec_level'; + static const codecLongName = 'codec_long_name'; + static const codecName = 'codec_name'; + static const codecPixelFormat = 'codec_pixel_format'; + static const codecProfileId = 'codec_profile_id'; + static const codecTag = 'codec_tag'; + static const codecTagString = 'codec_tag_string'; + static const codedHeight = 'coded_height'; + static const codedWidth = 'coded_width'; + static const colorLevels = 'color_levels'; + static const colorMatrix = 'color_matrix'; + static const colorPrimaries = 'color_primaries'; + static const colorRange = 'color_range'; + static const colorSpace = 'color_space'; + static const colorTransfer = 'color_transfer'; + static const compatibleBrands = 'compatible_brands'; + static const creationTime = 'creation_time'; + static const dar = 'display_aspect_ratio'; + static const date = 'date'; + static const decoderHeight = 'dh'; + static const decoderWidth = 'dw'; + static const disposition = 'disposition'; + static const duration = 'duration'; + static const durationMicros = 'duration_us'; + static const durationTs = 'duration_ts'; + static const encoder = 'encoder'; + static const extraDataSize = 'extradata_size'; + static const filename = 'filename'; + static const filmGrain = 'film_grain'; + static const fpsDen = 'fps_den'; + static const fpsNum = 'fps_num'; + static const fps = 'fps'; + static const frameCount = 'number_of_frames'; + static const gamma = 'gamma'; + static const hasBFrames = 'has_b_frames'; + static const hearingImpaired = 'hearing_impaired'; + static const hwPixelFormat = 'hw_pixel_format'; + static const index = 'index'; + static const isAvc = 'is_avc'; + static const language = 'language'; + static const light = 'light'; + static const location = 'location'; + static const majorBrand = 'major_brand'; + static const mediaFormat = 'format'; + static const minorVersion = 'minor_version'; + static const nalLengthSize = 'nal_length_size'; + static const par = 'pixel_aspect_ratio'; + static const probeScore = 'probe_score'; + static const programCount = 'nb_programs'; + static const quicktimeCreationDate = 'com.apple.quicktime.creationdate'; + static const quicktimeLocationAccuracyHorizontal = 'com.apple.quicktime.location.accuracy.horizontal'; + static const quicktimeLocationIso6709 = 'com.apple.quicktime.location.iso6709'; + static const quicktimeMake = 'com.apple.quicktime.make'; + static const quicktimeModel = 'com.apple.quicktime.model'; + static const quicktimeSoftware = 'com.apple.quicktime.software'; + static const refs = 'refs'; + static const rFrameRate = 'r_frame_rate'; + static const rotate = 'rotate'; + static const sampleFormat = 'sample_fmt'; + static const sampleRate = 'sample_rate'; + static const sar = 'sample_aspect_ratio'; + static const sarDen = 'sar_den'; + static const sarNum = 'sar_num'; + static const selectedAudioStream = 'audio'; + static const selectedTextStream = 'timedtext'; + static const selectedVideoStream = 'video'; + static const sourceOshash = 'source_oshash'; + static const startMicros = 'start_us'; + static const startPts = 'start_pts'; + static const startTime = 'start_time'; + static const statisticsTags = '_statistics_tags'; + static const statisticsWritingApp = '_statistics_writing_app'; + static const statisticsWritingDateUtc = '_statistics_writing_date_utc'; + static const stereo3dMode = 'stereo_3d_mode'; + static const streamCount = 'nb_streams'; + static const streams = 'streams'; + static const tbrDen = 'tbr_den'; + static const tbrNum = 'tbr_num'; + static const time = 'time'; + static const segmentCount = 'segment_count'; + static const streamType = 'type'; + static const title = 'title'; + static const timeBase = 'time_base'; + static const track = 'track'; + static const vendorId = 'vendor_id'; + static const videoHeight = 'height'; + static const videoWidth = 'width'; + static const visualImpaired = 'visual_impaired'; + static const xiaomiSlowMoment = 'com.xiaomi.slow_moment'; +} diff --git a/plugins/aves_model/lib/src/video/stream_types.dart b/plugins/aves_model/lib/src/video/stream_types.dart new file mode 100644 index 0000000..d2be820 --- /dev/null +++ b/plugins/aves_model/lib/src/video/stream_types.dart @@ -0,0 +1,9 @@ +class MediaStreamTypes { + static const attachment = 'attachment'; + static const audio = 'audio'; + static const metadata = 'metadata'; + static const subtitle = 'subtitle'; + static const timedText = 'timedtext'; + static const unknown = 'unknown'; + static const video = 'video'; +} diff --git a/plugins/aves_model/lib/src/wallpaper_target.dart b/plugins/aves_model/lib/src/wallpaper_target.dart new file mode 100644 index 0000000..210a363 --- /dev/null +++ b/plugins/aves_model/lib/src/wallpaper_target.dart @@ -0,0 +1 @@ +enum WallpaperTarget { home, lock, homeLock } |
