mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-03-22 15:09:22 +01:00
Move memories settings to a new page
This commit is contained in:
parent
92bbf70bfc
commit
3040cd123e
3 changed files with 120 additions and 30 deletions
|
@ -363,6 +363,14 @@
|
||||||
"@settingsServerAppSectionTitle": {
|
"@settingsServerAppSectionTitle": {
|
||||||
"description": "Enable/disable various server apps"
|
"description": "Enable/disable various server apps"
|
||||||
},
|
},
|
||||||
|
"settingsPhotosDescription": "Customize contents shown in the Photos tab",
|
||||||
|
"@settingsPhotosDescription": {
|
||||||
|
"description": "The 'Photos' here means the tab called 'Photos', not literally a photo. The title of this setting will also reuse the label of that tab"
|
||||||
|
},
|
||||||
|
"settingsPhotosPageTitle": "Photos settings",
|
||||||
|
"@settingsPhotosPageTitle": {
|
||||||
|
"description": "Dedicated page for settings related to the Photos tab"
|
||||||
|
},
|
||||||
"settingsViewerTitle": "Viewer",
|
"settingsViewerTitle": "Viewer",
|
||||||
"settingsViewerDescription": "Customize the image/video viewer",
|
"settingsViewerDescription": "Customize the image/video viewer",
|
||||||
"settingsViewerPageTitle": "Viewer settings",
|
"settingsViewerPageTitle": "Viewer settings",
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
"settingsShareFolderDialogDescription",
|
"settingsShareFolderDialogDescription",
|
||||||
"settingsShareFolderPickerDescription",
|
"settingsShareFolderPickerDescription",
|
||||||
"settingsServerAppSectionTitle",
|
"settingsServerAppSectionTitle",
|
||||||
|
"settingsPhotosDescription",
|
||||||
|
"settingsPhotosPageTitle",
|
||||||
"settingsMapProviderTitle",
|
"settingsMapProviderTitle",
|
||||||
"settingsAlbumTitle",
|
"settingsAlbumTitle",
|
||||||
"settingsAlbumDescription",
|
"settingsAlbumDescription",
|
||||||
|
@ -166,6 +168,8 @@
|
||||||
"settingsShareFolderDialogDescription",
|
"settingsShareFolderDialogDescription",
|
||||||
"settingsShareFolderPickerDescription",
|
"settingsShareFolderPickerDescription",
|
||||||
"settingsServerAppSectionTitle",
|
"settingsServerAppSectionTitle",
|
||||||
|
"settingsPhotosDescription",
|
||||||
|
"settingsPhotosPageTitle",
|
||||||
"settingsMapProviderTitle",
|
"settingsMapProviderTitle",
|
||||||
"settingsAlbumTitle",
|
"settingsAlbumTitle",
|
||||||
"settingsAlbumDescription",
|
"settingsAlbumDescription",
|
||||||
|
@ -321,6 +325,8 @@
|
||||||
"settingsExifWifiOnlyFalseSubtitle",
|
"settingsExifWifiOnlyFalseSubtitle",
|
||||||
"settingsAccountLabelTitle",
|
"settingsAccountLabelTitle",
|
||||||
"settingsAccountLabelDescription",
|
"settingsAccountLabelDescription",
|
||||||
|
"settingsPhotosDescription",
|
||||||
|
"settingsPhotosPageTitle",
|
||||||
"settingsDoubleTapExitTitle",
|
"settingsDoubleTapExitTitle",
|
||||||
"enhanceStyleTransferStyleDialogTitle",
|
"enhanceStyleTransferStyleDialogTitle",
|
||||||
"doubleTapExitNotification",
|
"doubleTapExitNotification",
|
||||||
|
@ -362,6 +368,8 @@
|
||||||
|
|
||||||
"es": [
|
"es": [
|
||||||
"settingsLanguageOptionSystemDefaultLabel",
|
"settingsLanguageOptionSystemDefaultLabel",
|
||||||
|
"settingsPhotosDescription",
|
||||||
|
"settingsPhotosPageTitle",
|
||||||
"rootPickerSkipConfirmationDialogContent2",
|
"rootPickerSkipConfirmationDialogContent2",
|
||||||
"showAllButtonLabel",
|
"showAllButtonLabel",
|
||||||
"gpsPlaceText",
|
"gpsPlaceText",
|
||||||
|
@ -371,6 +379,8 @@
|
||||||
],
|
],
|
||||||
|
|
||||||
"fi": [
|
"fi": [
|
||||||
|
"settingsPhotosDescription",
|
||||||
|
"settingsPhotosPageTitle",
|
||||||
"gpsPlaceText",
|
"gpsPlaceText",
|
||||||
"gpsPlaceAboutDialogTitle",
|
"gpsPlaceAboutDialogTitle",
|
||||||
"gpsPlaceAboutDialogContent",
|
"gpsPlaceAboutDialogContent",
|
||||||
|
@ -384,6 +394,8 @@
|
||||||
"settingsExifWifiOnlyFalseSubtitle",
|
"settingsExifWifiOnlyFalseSubtitle",
|
||||||
"settingsAccountLabelTitle",
|
"settingsAccountLabelTitle",
|
||||||
"settingsAccountLabelDescription",
|
"settingsAccountLabelDescription",
|
||||||
|
"settingsPhotosDescription",
|
||||||
|
"settingsPhotosPageTitle",
|
||||||
"settingsPhotoEnhancementTitle",
|
"settingsPhotoEnhancementTitle",
|
||||||
"settingsPhotoEnhancementPageTitle",
|
"settingsPhotoEnhancementPageTitle",
|
||||||
"settingsEnhanceMaxResolutionTitle",
|
"settingsEnhanceMaxResolutionTitle",
|
||||||
|
@ -453,6 +465,8 @@
|
||||||
"settingsExifWifiOnlyFalseSubtitle",
|
"settingsExifWifiOnlyFalseSubtitle",
|
||||||
"settingsAccountLabelTitle",
|
"settingsAccountLabelTitle",
|
||||||
"settingsAccountLabelDescription",
|
"settingsAccountLabelDescription",
|
||||||
|
"settingsPhotosDescription",
|
||||||
|
"settingsPhotosPageTitle",
|
||||||
"settingsPhotoEnhancementTitle",
|
"settingsPhotoEnhancementTitle",
|
||||||
"settingsPhotoEnhancementPageTitle",
|
"settingsPhotoEnhancementPageTitle",
|
||||||
"settingsEnhanceMaxResolutionTitle",
|
"settingsEnhanceMaxResolutionTitle",
|
||||||
|
@ -540,6 +554,8 @@
|
||||||
"settingsExifWifiOnlyFalseSubtitle",
|
"settingsExifWifiOnlyFalseSubtitle",
|
||||||
"settingsAccountLabelTitle",
|
"settingsAccountLabelTitle",
|
||||||
"settingsAccountLabelDescription",
|
"settingsAccountLabelDescription",
|
||||||
|
"settingsPhotosDescription",
|
||||||
|
"settingsPhotosPageTitle",
|
||||||
"settingsPhotoEnhancementTitle",
|
"settingsPhotoEnhancementTitle",
|
||||||
"settingsPhotoEnhancementPageTitle",
|
"settingsPhotoEnhancementPageTitle",
|
||||||
"settingsEnhanceMaxResolutionTitle",
|
"settingsEnhanceMaxResolutionTitle",
|
||||||
|
@ -606,6 +622,8 @@
|
||||||
"settingsExifWifiOnlyFalseSubtitle",
|
"settingsExifWifiOnlyFalseSubtitle",
|
||||||
"settingsAccountLabelTitle",
|
"settingsAccountLabelTitle",
|
||||||
"settingsAccountLabelDescription",
|
"settingsAccountLabelDescription",
|
||||||
|
"settingsPhotosDescription",
|
||||||
|
"settingsPhotosPageTitle",
|
||||||
"settingsPhotoEnhancementTitle",
|
"settingsPhotoEnhancementTitle",
|
||||||
"settingsPhotoEnhancementPageTitle",
|
"settingsPhotoEnhancementPageTitle",
|
||||||
"settingsEnhanceMaxResolutionTitle",
|
"settingsEnhanceMaxResolutionTitle",
|
||||||
|
@ -672,6 +690,8 @@
|
||||||
"settingsExifWifiOnlyFalseSubtitle",
|
"settingsExifWifiOnlyFalseSubtitle",
|
||||||
"settingsAccountLabelTitle",
|
"settingsAccountLabelTitle",
|
||||||
"settingsAccountLabelDescription",
|
"settingsAccountLabelDescription",
|
||||||
|
"settingsPhotosDescription",
|
||||||
|
"settingsPhotosPageTitle",
|
||||||
"settingsPhotoEnhancementTitle",
|
"settingsPhotoEnhancementTitle",
|
||||||
"settingsPhotoEnhancementPageTitle",
|
"settingsPhotoEnhancementPageTitle",
|
||||||
"settingsEnhanceMaxResolutionTitle",
|
"settingsEnhanceMaxResolutionTitle",
|
||||||
|
@ -738,6 +758,8 @@
|
||||||
"settingsExifWifiOnlyFalseSubtitle",
|
"settingsExifWifiOnlyFalseSubtitle",
|
||||||
"settingsAccountLabelTitle",
|
"settingsAccountLabelTitle",
|
||||||
"settingsAccountLabelDescription",
|
"settingsAccountLabelDescription",
|
||||||
|
"settingsPhotosDescription",
|
||||||
|
"settingsPhotosPageTitle",
|
||||||
"settingsPhotoEnhancementTitle",
|
"settingsPhotoEnhancementTitle",
|
||||||
"settingsPhotoEnhancementPageTitle",
|
"settingsPhotoEnhancementPageTitle",
|
||||||
"settingsEnhanceMaxResolutionTitle",
|
"settingsEnhanceMaxResolutionTitle",
|
||||||
|
|
|
@ -72,9 +72,6 @@ class _SettingsState extends State<Settings> {
|
||||||
_isEnableExif = Pref().isEnableExifOr();
|
_isEnableExif = Pref().isEnableExifOr();
|
||||||
_shouldProcessExifWifiOnly = Pref().shouldProcessExifWifiOnlyOr();
|
_shouldProcessExifWifiOnly = Pref().shouldProcessExifWifiOnlyOr();
|
||||||
|
|
||||||
final settings = AccountPref.of(widget.account);
|
|
||||||
_isEnableMemoryAlbum = settings.isEnableMemoryAlbumOr(true);
|
|
||||||
|
|
||||||
_prefUpdatedListener.begin();
|
_prefUpdatedListener.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,14 +131,6 @@ class _SettingsState extends State<Settings> {
|
||||||
value: _shouldProcessExifWifiOnly,
|
value: _shouldProcessExifWifiOnly,
|
||||||
onChanged: _isEnableExif ? _onExifWifiOnlyChanged : null,
|
onChanged: _isEnableExif ? _onExifWifiOnlyChanged : null,
|
||||||
),
|
),
|
||||||
SwitchListTile(
|
|
||||||
title: Text(L10n.global().settingsMemoriesTitle),
|
|
||||||
subtitle: Text(L10n.global().settingsMemoriesSubtitle),
|
|
||||||
value: _isEnableMemoryAlbum,
|
|
||||||
onChanged: Pref().isPhotosTabSortByNameOr()
|
|
||||||
? null
|
|
||||||
: _onEnableMemoryAlbumChanged,
|
|
||||||
),
|
|
||||||
_buildSubSettings(
|
_buildSubSettings(
|
||||||
context,
|
context,
|
||||||
leading: Icon(
|
leading: Icon(
|
||||||
|
@ -151,6 +140,16 @@ class _SettingsState extends State<Settings> {
|
||||||
label: L10n.global().settingsAccountTitle,
|
label: L10n.global().settingsAccountTitle,
|
||||||
builder: () => AccountSettingsWidget(account: widget.account),
|
builder: () => AccountSettingsWidget(account: widget.account),
|
||||||
),
|
),
|
||||||
|
_buildSubSettings(
|
||||||
|
context,
|
||||||
|
leading: Icon(
|
||||||
|
Icons.image_outlined,
|
||||||
|
color: AppTheme.getUnfocusedIconColor(context),
|
||||||
|
),
|
||||||
|
label: L10n.global().photosTabLabel,
|
||||||
|
description: L10n.global().settingsPhotosDescription,
|
||||||
|
builder: () => _PhotosSettings(account: widget.account),
|
||||||
|
),
|
||||||
_buildSubSettings(
|
_buildSubSettings(
|
||||||
context,
|
context,
|
||||||
leading: Icon(
|
leading: Icon(
|
||||||
|
@ -385,24 +384,6 @@ class _SettingsState extends State<Settings> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onEnableMemoryAlbumChanged(bool value) async {
|
|
||||||
_log.info("[_onEnableMemoryAlbumChanged] New value: $value");
|
|
||||||
final oldValue = _isEnableMemoryAlbum;
|
|
||||||
setState(() {
|
|
||||||
_isEnableMemoryAlbum = value;
|
|
||||||
});
|
|
||||||
if (!await AccountPref.of(widget.account).setEnableMemoryAlbum(value)) {
|
|
||||||
_log.severe("[_onEnableMemoryAlbumChanged] Failed writing pref");
|
|
||||||
SnackBarManager().showSnackBar(SnackBar(
|
|
||||||
content: Text(L10n.global().writePreferenceFailureNotification),
|
|
||||||
duration: k.snackBarDurationNormal,
|
|
||||||
));
|
|
||||||
setState(() {
|
|
||||||
_isEnableMemoryAlbum = oldValue;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _onCaptureLogChanged(BuildContext context, bool value) async {
|
Future<void> _onCaptureLogChanged(BuildContext context, bool value) async {
|
||||||
if (value) {
|
if (value) {
|
||||||
final result = await showDialog<bool>(
|
final result = await showDialog<bool>(
|
||||||
|
@ -472,7 +453,6 @@ class _SettingsState extends State<Settings> {
|
||||||
|
|
||||||
late bool _isEnableExif;
|
late bool _isEnableExif;
|
||||||
late bool _shouldProcessExifWifiOnly;
|
late bool _shouldProcessExifWifiOnly;
|
||||||
late bool _isEnableMemoryAlbum;
|
|
||||||
|
|
||||||
var _devSettingsUnlockCount = 3;
|
var _devSettingsUnlockCount = 3;
|
||||||
var _isShowDevSettings = false;
|
var _isShowDevSettings = false;
|
||||||
|
@ -818,6 +798,86 @@ class _ShareFolderDialogState extends State<_ShareFolderDialog> {
|
||||||
late String _path = widget.initialValue;
|
late String _path = widget.initialValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _PhotosSettings extends StatefulWidget {
|
||||||
|
const _PhotosSettings({
|
||||||
|
Key? key,
|
||||||
|
required this.account,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
createState() => _PhotosSettingsState();
|
||||||
|
|
||||||
|
final Account account;
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PhotosSettingsState extends State<_PhotosSettings> {
|
||||||
|
@override
|
||||||
|
initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
final settings = AccountPref.of(widget.account);
|
||||||
|
_isEnableMemoryAlbum = settings.isEnableMemoryAlbumOr(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
build(BuildContext context) {
|
||||||
|
return AppTheme(
|
||||||
|
child: Scaffold(
|
||||||
|
body: Builder(
|
||||||
|
builder: (context) => _buildContent(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildContent(BuildContext context) {
|
||||||
|
return CustomScrollView(
|
||||||
|
slivers: [
|
||||||
|
SliverAppBar(
|
||||||
|
pinned: true,
|
||||||
|
title: Text(L10n.global().settingsPhotosPageTitle),
|
||||||
|
),
|
||||||
|
SliverList(
|
||||||
|
delegate: SliverChildListDelegate(
|
||||||
|
[
|
||||||
|
SwitchListTile(
|
||||||
|
title: Text(L10n.global().settingsMemoriesTitle),
|
||||||
|
subtitle: Text(L10n.global().settingsMemoriesSubtitle),
|
||||||
|
value: _isEnableMemoryAlbum,
|
||||||
|
onChanged: Pref().isPhotosTabSortByNameOr()
|
||||||
|
? null
|
||||||
|
: _onEnableMemoryAlbumChanged,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onEnableMemoryAlbumChanged(bool value) async {
|
||||||
|
_log.info("[_onEnableMemoryAlbumChanged] New value: $value");
|
||||||
|
final oldValue = _isEnableMemoryAlbum;
|
||||||
|
setState(() {
|
||||||
|
_isEnableMemoryAlbum = value;
|
||||||
|
});
|
||||||
|
if (!await AccountPref.of(widget.account).setEnableMemoryAlbum(value)) {
|
||||||
|
_log.severe("[_onEnableMemoryAlbumChanged] Failed writing pref");
|
||||||
|
SnackBarManager().showSnackBar(SnackBar(
|
||||||
|
content: Text(L10n.global().writePreferenceFailureNotification),
|
||||||
|
duration: k.snackBarDurationNormal,
|
||||||
|
));
|
||||||
|
setState(() {
|
||||||
|
_isEnableMemoryAlbum = oldValue;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
late bool _isEnableMemoryAlbum;
|
||||||
|
|
||||||
|
static final _log = Logger("widget.settings._PhotosSettingsState");
|
||||||
|
}
|
||||||
|
|
||||||
class _ViewerSettings extends StatefulWidget {
|
class _ViewerSettings extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
createState() => _ViewerSettingsState();
|
createState() => _ViewerSettingsState();
|
||||||
|
|
Loading…
Reference in a new issue