#162 collection: allow rescan when browsing

This commit is contained in:
Thibault Deckers 2022-01-27 10:30:09 +09:00
parent b97c51e541
commit c75d4fe6d2
4 changed files with 19 additions and 16 deletions

View file

@ -6,9 +6,10 @@ All notable changes to this project will be documented in this file.
### Added ### Added
- Info: edit location of JPG/PNG/WEBP/DNG images via Exif - Collection / Info: edit location of JPG/PNG/WEBP/DNG images via Exif
- Viewer: resize option when exporting - Viewer: resize option when exporting
- Settings: export/import covers & favourites along with settings - Settings: export/import covers & favourites along with settings
- Collection: allow rescan when browsing
- Portuguese translation (thanks Jonatas De Almeida Barros) - Portuguese translation (thanks Jonatas De Almeida Barros)
### Removed ### Removed
@ -21,6 +22,7 @@ All notable changes to this project will be documented in this file.
- handling timestamps provided in 10^-8 s (18 digits) - handling timestamps provided in 10^-8 s (18 digits)
- Viewer: SVG export - Viewer: SVG export
- Viewer: sending to editing app on some environments - Viewer: sending to editing app on some environments
- Map: projected center anchoring
## <a id="v1.5.10"></a>[v1.5.10] - 2022-01-07 ## <a id="v1.5.10"></a>[v1.5.10] - 2022-01-07

View file

@ -15,12 +15,12 @@ enum EntrySetAction {
// browsing or selecting // browsing or selecting
map, map,
stats, stats,
rescan,
// selecting // selecting
share, share,
delete, delete,
copy, copy,
move, move,
rescan,
toggleFavourite, toggleFavourite,
rotateCCW, rotateCCW,
rotateCW, rotateCW,
@ -46,6 +46,7 @@ class EntrySetActions {
EntrySetAction.addShortcut, EntrySetAction.addShortcut,
EntrySetAction.map, EntrySetAction.map,
EntrySetAction.stats, EntrySetAction.stats,
EntrySetAction.rescan,
]; ];
static const selection = [ static const selection = [
@ -54,9 +55,9 @@ class EntrySetActions {
EntrySetAction.copy, EntrySetAction.copy,
EntrySetAction.move, EntrySetAction.move,
EntrySetAction.toggleFavourite, EntrySetAction.toggleFavourite,
EntrySetAction.rescan,
EntrySetAction.map, EntrySetAction.map,
EntrySetAction.stats, EntrySetAction.stats,
EntrySetAction.rescan,
// editing actions are in their subsection // editing actions are in their subsection
]; ];
} }
@ -86,6 +87,8 @@ extension ExtraEntrySetAction on EntrySetAction {
return context.l10n.menuActionMap; return context.l10n.menuActionMap;
case EntrySetAction.stats: case EntrySetAction.stats:
return context.l10n.menuActionStats; return context.l10n.menuActionStats;
case EntrySetAction.rescan:
return context.l10n.collectionActionRescan;
// selecting // selecting
case EntrySetAction.share: case EntrySetAction.share:
return context.l10n.entryActionShare; return context.l10n.entryActionShare;
@ -95,8 +98,6 @@ extension ExtraEntrySetAction on EntrySetAction {
return context.l10n.collectionActionCopy; return context.l10n.collectionActionCopy;
case EntrySetAction.move: case EntrySetAction.move:
return context.l10n.collectionActionMove; return context.l10n.collectionActionMove;
case EntrySetAction.rescan:
return context.l10n.collectionActionRescan;
case EntrySetAction.toggleFavourite: case EntrySetAction.toggleFavourite:
// different data depending on toggle state // different data depending on toggle state
return context.l10n.entryActionAddFavourite; return context.l10n.entryActionAddFavourite;
@ -147,6 +148,8 @@ extension ExtraEntrySetAction on EntrySetAction {
return AIcons.map; return AIcons.map;
case EntrySetAction.stats: case EntrySetAction.stats:
return AIcons.stats; return AIcons.stats;
case EntrySetAction.rescan:
return AIcons.refresh;
// selecting // selecting
case EntrySetAction.share: case EntrySetAction.share:
return AIcons.share; return AIcons.share;
@ -156,8 +159,6 @@ extension ExtraEntrySetAction on EntrySetAction {
return AIcons.copy; return AIcons.copy;
case EntrySetAction.move: case EntrySetAction.move:
return AIcons.move; return AIcons.move;
case EntrySetAction.rescan:
return AIcons.refresh;
case EntrySetAction.toggleFavourite: case EntrySetAction.toggleFavourite:
// different data depending on toggle state // different data depending on toggle state
return AIcons.favourite; return AIcons.favourite;

View file

@ -429,12 +429,12 @@ class _CollectionAppBarState extends State<CollectionAppBar> with SingleTickerPr
// browsing or selecting // browsing or selecting
case EntrySetAction.map: case EntrySetAction.map:
case EntrySetAction.stats: case EntrySetAction.stats:
case EntrySetAction.rescan:
// selecting // selecting
case EntrySetAction.share: case EntrySetAction.share:
case EntrySetAction.delete: case EntrySetAction.delete:
case EntrySetAction.copy: case EntrySetAction.copy:
case EntrySetAction.move: case EntrySetAction.move:
case EntrySetAction.rescan:
case EntrySetAction.toggleFavourite: case EntrySetAction.toggleFavourite:
case EntrySetAction.rotateCCW: case EntrySetAction.rotateCCW:
case EntrySetAction.rotateCW: case EntrySetAction.rotateCW:

View file

@ -67,13 +67,13 @@ class EntrySetActionDelegate with EntryEditorMixin, FeedbackMixin, PermissionAwa
// browsing or selecting // browsing or selecting
case EntrySetAction.map: case EntrySetAction.map:
case EntrySetAction.stats: case EntrySetAction.stats:
case EntrySetAction.rescan:
return appMode == AppMode.main; return appMode == AppMode.main;
// selecting // selecting
case EntrySetAction.share: case EntrySetAction.share:
case EntrySetAction.delete: case EntrySetAction.delete:
case EntrySetAction.copy: case EntrySetAction.copy:
case EntrySetAction.move: case EntrySetAction.move:
case EntrySetAction.rescan:
case EntrySetAction.toggleFavourite: case EntrySetAction.toggleFavourite:
case EntrySetAction.rotateCCW: case EntrySetAction.rotateCCW:
case EntrySetAction.rotateCW: case EntrySetAction.rotateCW:
@ -111,13 +111,13 @@ class EntrySetActionDelegate with EntryEditorMixin, FeedbackMixin, PermissionAwa
return true; return true;
case EntrySetAction.map: case EntrySetAction.map:
case EntrySetAction.stats: case EntrySetAction.stats:
case EntrySetAction.rescan:
return (!isSelecting && hasItems) || (isSelecting && hasSelection); return (!isSelecting && hasItems) || (isSelecting && hasSelection);
// selecting // selecting
case EntrySetAction.share: case EntrySetAction.share:
case EntrySetAction.delete: case EntrySetAction.delete:
case EntrySetAction.copy: case EntrySetAction.copy:
case EntrySetAction.move: case EntrySetAction.move:
case EntrySetAction.rescan:
case EntrySetAction.toggleFavourite: case EntrySetAction.toggleFavourite:
case EntrySetAction.rotateCCW: case EntrySetAction.rotateCCW:
case EntrySetAction.rotateCW: case EntrySetAction.rotateCW:
@ -156,6 +156,9 @@ class EntrySetActionDelegate with EntryEditorMixin, FeedbackMixin, PermissionAwa
case EntrySetAction.stats: case EntrySetAction.stats:
_goToStats(context); _goToStats(context);
break; break;
case EntrySetAction.rescan:
_rescan(context);
break;
// selecting // selecting
case EntrySetAction.share: case EntrySetAction.share:
_share(context); _share(context);
@ -169,9 +172,6 @@ class EntrySetActionDelegate with EntryEditorMixin, FeedbackMixin, PermissionAwa
case EntrySetAction.move: case EntrySetAction.move:
_move(context, moveType: MoveType.move); _move(context, moveType: MoveType.move);
break; break;
case EntrySetAction.rescan:
_rescan(context);
break;
case EntrySetAction.toggleFavourite: case EntrySetAction.toggleFavourite:
_toggleFavourite(context); _toggleFavourite(context);
break; break;
@ -215,12 +215,12 @@ class EntrySetActionDelegate with EntryEditorMixin, FeedbackMixin, PermissionAwa
} }
void _rescan(BuildContext context) { void _rescan(BuildContext context) {
final source = context.read<CollectionSource>();
final selection = context.read<Selection<AvesEntry>>(); final selection = context.read<Selection<AvesEntry>>();
final selectedItems = _getExpandedSelectedItems(selection); final collection = context.read<CollectionLens>();
final entries = (selection.isSelecting ? _getExpandedSelectedItems(selection) : collection.sortedEntries.toSet());
final controller = AnalysisController(canStartService: true, force: true); final controller = AnalysisController(canStartService: true, force: true);
source.analyze(controller, entries: selectedItems); collection.source.analyze(controller, entries: entries);
selection.browse(); selection.browse();
} }