diff --git a/iap/lib/src/providers/equipment_profile_provider.dart b/iap/lib/src/providers/equipment_profile_provider.dart index 92ba8a2..0a037a9 100644 --- a/iap/lib/src/providers/equipment_profile_provider.dart +++ b/iap/lib/src/providers/equipment_profile_provider.dart @@ -36,7 +36,7 @@ class EquipmentProfileProviderState extends State { void setProfile(EquipmentProfile data) {} - void addProfile(String name) {} + void addProfile(String name, [EquipmentProfile? copyFrom]) {} void updateProdile(EquipmentProfile data) {} diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 4e12ad8..259fd0c 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -96,5 +96,17 @@ "buyLightmeterPro": "Buy Lightmeter Pro", "lightmeterPro": "Lightmeter Pro", "lightmeterProDescription": "Unlocks extra features, such as equipment profiles containing filters for aperture, shutter speed, and more; and a list of films with compensation for what's known as reciprocity failure.\n\nThe source code of Lightmeter is available on GitHub. You are welcome to compile it yourself. However, if you want to support the development and receive new features and updates, consider purchasing Lightmeter Pro.", - "buy": "Buy" + "buy": "Buy", + "tooltipAdd": "Add", + "tooltipClose": "Close", + "tooltipExpand": "Expand", + "tooltipCollapse": "Collapse", + "tooltipCopy": "Copy", + "tooltipDelete": "Delete", + "tooltipSelectAll": "Select all", + "tooltipDesecelectAll": "Deselect all", + "tooltipResetToZero": "Reset to zero", + "tooltipUseLightSensor": "Use lightsensor", + "tooltipUseCamera": "Use camera", + "tooltipOpenSettings": "Open settings" } \ No newline at end of file diff --git a/lib/l10n/intl_fr.arb b/lib/l10n/intl_fr.arb index 5946d5b..2d6d889 100644 --- a/lib/l10n/intl_fr.arb +++ b/lib/l10n/intl_fr.arb @@ -96,5 +96,17 @@ "buyLightmeterPro": "Acheter Lightmeter Pro", "lightmeterPro": "Lightmeter Pro", "lightmeterProDescription": "Déverrouille des fonctionnalités supplémentaires, telles que des profils d'équipement contenant des filtres pour l'ouverture, la vitesse d'obturation et plus encore, ainsi qu'une liste de films avec une compensation pour ce que l'on appelle l'échec de réciprocité.\n\nLe code source du Lightmeter est disponible sur GitHub. Vous pouvez le compiler vous-même. Cependant, si vous souhaitez soutenir le développement et recevoir de nouvelles fonctionnalités et mises à jour, envisagez d'acheter Lightmeter Pro.", - "buy": "Acheter" + "buy": "Acheter", + "tooltipAdd": "Ajouter", + "tooltipClose": "Fermer", + "tooltipExpand": "Élargir", + "tooltipCollapse": "Effondrement", + "tooltipCopy": "Copie", + "tooltipDelete": "Supprimer", + "tooltipSelectAll": "Tout sélectionner", + "tooltipDesecelectAll": "Désélectionner tout", + "tooltipResetToZero": "Remise à zéro", + "tooltipUseLightSensor": "Utiliser un capteur de lumière", + "tooltipUseCamera": "Utiliser la caméra", + "tooltipOpenSettings": "Ouvrir les paramètres" } \ No newline at end of file diff --git a/lib/l10n/intl_ru.arb b/lib/l10n/intl_ru.arb index 9f428c4..72c42f1 100644 --- a/lib/l10n/intl_ru.arb +++ b/lib/l10n/intl_ru.arb @@ -96,5 +96,17 @@ "buyLightmeterPro": "Купить Lightmeter Pro", "lightmeterPro": "Lightmeter Pro", "lightmeterProDescription": "Даёт доступ к таким функциям как профили оборудования, содержащие фильтры для диафрагмы, выдержки и других значений, а также набору пленок с компенсацией эффекта Шварцшильда.\n\nИсходный код Lightmeter доступен на GitHub. Вы можете собрать его самостоятельно. Однако если вы хотите поддержать разработку и получать новые функции и обновления, то приобретите Lightmeter Pro.", - "buy": "Купить" + "buy": "Купить", + "tooltipAdd": "Добавить", + "tooltipClose": "Закрыть", + "tooltipExpand": "Развернуть", + "tooltipCollapse": "Свернуть", + "tooltipCopy": "Скопировать", + "tooltipDelete": "Удалить", + "tooltipSelectAll": "Выбрать все", + "tooltipDesecelectAll": "Отменить все", + "tooltipResetToZero": "Сбросить до 0", + "tooltipUseLightSensor": "Использовать датчик освещенности", + "tooltipUseCamera": "Использовать камеру", + "tooltipOpenSettings": "Открыть настройки" } \ No newline at end of file diff --git a/lib/l10n/intl_zh.arb b/lib/l10n/intl_zh.arb index 92f19ee..391e268 100644 --- a/lib/l10n/intl_zh.arb +++ b/lib/l10n/intl_zh.arb @@ -96,5 +96,17 @@ "buyLightmeterPro": "Buy Lightmeter Pro", "lightmeterPro": "Lightmeter Pro", "lightmeterProDescription": "Unlocks extra features, such as equipment profiles containing filters for aperture, shutter speed, and more; and a list of films with compensation for what's known as reciprocity failure.\n\nThe source code of Lightmeter is available on GitHub. You are welcome to compile it yourself. However, if you want to support the development and receive new features and updates, consider purchasing Lightmeter Pro.", - "buy": "Buy" + "buy": "Buy", + "tooltipAdd": "Add", + "tooltipClose": "Close", + "tooltipExpand": "Expand", + "tooltipCollapse": "Collapse", + "tooltipCopy": "Copy", + "tooltipDelete": "Delete", + "tooltipSelectAll": "Select all", + "tooltipDesecelectAll": "Deselect all", + "resetToZero": "Reset to zero", + "tooltipUseLightSensor": "Use lightsensor", + "tooltipUseCamera": "Use camera", + "tooltipOpenSettings": "Open settings" } \ No newline at end of file diff --git a/lib/screens/metering/components/bottom_controls/widget_bottom_controls.dart b/lib/screens/metering/components/bottom_controls/widget_bottom_controls.dart index 54ea810..31ecac4 100644 --- a/lib/screens/metering/components/bottom_controls/widget_bottom_controls.dart +++ b/lib/screens/metering/components/bottom_controls/widget_bottom_controls.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:lightmeter/data/models/ev_source_type.dart'; +import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/providers/user_preferences_provider.dart'; import 'package:lightmeter/res/dimens.dart'; import 'package:lightmeter/screens/metering/components/bottom_controls/components/measure_button/widget_button_measure.dart'; @@ -46,6 +47,10 @@ class MeteringBottomControls extends StatelessWidget { ? Icons.camera_rear : Icons.wb_incandescent, ), + tooltip: + UserPreferencesProvider.evSourceTypeOf(context) != EvSourceType.camera + ? S.of(context).tooltipUseCamera + : S.of(context).tooltipUseLightSensor, ), ), ) @@ -61,6 +66,7 @@ class MeteringBottomControls extends StatelessWidget { child: IconButton( onPressed: onSettings, icon: const Icon(Icons.settings), + tooltip: S.of(context).tooltipOpenSettings, ), ), ), diff --git a/lib/screens/metering/components/camera_container/components/camera_controls/components/exposure_offset_slider/widget_slider_exposure_offset.dart b/lib/screens/metering/components/camera_container/components/camera_controls/components/exposure_offset_slider/widget_slider_exposure_offset.dart index 87539ee..484ee4b 100644 --- a/lib/screens/metering/components/camera_container/components/camera_controls/components/exposure_offset_slider/widget_slider_exposure_offset.dart +++ b/lib/screens/metering/components/camera_container/components/camera_controls/components/exposure_offset_slider/widget_slider_exposure_offset.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/res/dimens.dart'; import 'package:lightmeter/screens/shared/centered_slider/widget_slider_centered.dart'; import 'package:lightmeter/utils/to_string_signed.dart'; @@ -22,6 +23,7 @@ class ExposureOffsetSlider extends StatelessWidget { IconButton( icon: const Icon(Icons.sync), onPressed: value != 0.0 ? () => onChanged(0.0) : null, + tooltip: S.of(context).tooltipResetToZero, ), Expanded( child: Row( diff --git a/lib/screens/settings/components/equipment/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/components/equipment_list_tiles/widget_list_tiles_equipments.dart b/lib/screens/settings/components/equipment/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/components/equipment_list_tiles/widget_list_tiles_equipments.dart index 482c370..bb3651d 100644 --- a/lib/screens/settings/components/equipment/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/components/equipment_list_tiles/widget_list_tiles_equipments.dart +++ b/lib/screens/settings/components/equipment/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/components/equipment_list_tiles/widget_list_tiles_equipments.dart @@ -36,9 +36,6 @@ class EquipmentListTiles extends StatelessWidget { title: S.of(context).isoValues, description: S.of(context).isoValuesFilterDescription, values: IsoValue.values, - valuesCount: selectedIsoValues.length == IsoValue.values.length - ? S.of(context).equipmentProfileAllValues - : selectedIsoValues.length.toString(), selectedValues: selectedIsoValues, rangeSelect: false, onChanged: onIsoValuesSelecred, @@ -48,9 +45,6 @@ class EquipmentListTiles extends StatelessWidget { title: S.of(context).ndFilters, description: S.of(context).ndFiltersFilterDescription, values: NdValue.values, - valuesCount: selectedNdValues.length == NdValue.values.length - ? S.of(context).equipmentProfileAllValues - : selectedNdValues.length.toString(), selectedValues: selectedNdValues, rangeSelect: false, onChanged: onNdValuesSelected, @@ -60,9 +54,6 @@ class EquipmentListTiles extends StatelessWidget { title: S.of(context).apertureValues, description: S.of(context).apertureValuesFilterDescription, values: ApertureValue.values, - valuesCount: selectedApertureValues.length == ApertureValue.values.length - ? S.of(context).equipmentProfileAllValues - : selectedApertureValues.length.toString(), selectedValues: selectedApertureValues, rangeSelect: true, onChanged: onApertureValuesSelected, @@ -72,9 +63,6 @@ class EquipmentListTiles extends StatelessWidget { title: S.of(context).shutterSpeedValues, description: S.of(context).shutterSpeedValuesFilterDescription, values: ShutterSpeedValue.values, - valuesCount: selectedShutterSpeedValues.length == ShutterSpeedValue.values.length - ? S.of(context).equipmentProfileAllValues - : selectedShutterSpeedValues.length.toString(), selectedValues: selectedShutterSpeedValues, rangeSelect: true, onChanged: onShutterSpeedValuesSelected, @@ -87,7 +75,6 @@ class EquipmentListTiles extends StatelessWidget { class _EquipmentListTile extends StatelessWidget { final IconData icon; final String title; - final String valuesCount; final String description; final List selectedValues; final List values; @@ -97,7 +84,6 @@ class _EquipmentListTile extends StatelessWidget { const _EquipmentListTile({ required this.icon, required this.title, - required this.valuesCount, required this.description, required this.selectedValues, required this.values, @@ -111,7 +97,13 @@ class _EquipmentListTile extends StatelessWidget { return ListTile( leading: Icon(icon), title: Text(title), - trailing: Text(valuesCount), + trailing: rangeSelect + ? Text("${selectedValues.first} - ${selectedValues.last}") + : Text( + values.length == selectedValues.length + ? S.of(context).equipmentProfileAllValues + : selectedValues.length.toString(), + ), onTap: () { showDialog>( context: context, diff --git a/lib/screens/settings/components/equipment/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/widget_container_equipment_profile.dart b/lib/screens/settings/components/equipment/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/widget_container_equipment_profile.dart index 244ddce..bca15d8 100644 --- a/lib/screens/settings/components/equipment/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/widget_container_equipment_profile.dart +++ b/lib/screens/settings/components/equipment/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/widget_container_equipment_profile.dart @@ -2,6 +2,7 @@ import 'dart:math'; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; +import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/res/dimens.dart'; import 'package:lightmeter/screens/settings/components/equipment/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/components/equipment_list_tiles/widget_list_tiles_equipments.dart'; import 'package:lightmeter/screens/settings/components/equipment/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_name_dialog/widget_dialog_equipment_profile_name.dart'; @@ -10,12 +11,14 @@ import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; class EquipmentProfileContainer extends StatefulWidget { final EquipmentProfile data; final ValueChanged onUpdate; + final VoidCallback onCopy; final VoidCallback onDelete; final VoidCallback onExpand; const EquipmentProfileContainer({ required this.data, required this.onUpdate, + required this.onCopy, required this.onDelete, required this.onExpand, super.key, @@ -85,19 +88,9 @@ class EquipmentProfileContainerState extends State ), ], ), - trailing: Row( - mainAxisAlignment: MainAxisAlignment.end, - mainAxisSize: MainAxisSize.min, - children: [ - _AnimatedArrowButton( - controller: _controller, - onPressed: () => _expanded ? collapse() : expand(), - ), - IconButton( - onPressed: widget.onDelete, - icon: const Icon(Icons.delete), - ), - ], + trailing: _AnimatedArrowButton( + controller: _controller, + onPressed: () => _expanded ? collapse() : expand(), ), onTap: () => _expanded ? _showNameDialog() : expand(), ), @@ -120,6 +113,8 @@ class EquipmentProfileContainerState extends State _equipmentData = _equipmentData.copyWith(shutterSpeedValues: value); widget.onUpdate(_equipmentData); }, + onCopy: widget.onCopy, + onDelete: widget.onDelete, ), ], ), @@ -194,6 +189,7 @@ class _AnimatedArrowButton extends AnimatedWidget { angle: _progress.value * pi, child: const Icon(Icons.keyboard_arrow_down), ), + tooltip: _progress.value == 0 ? S.of(context).tooltipExpand : S.of(context).tooltipCollapse, ); } } @@ -204,6 +200,8 @@ class _AnimatedEquipmentListTiles extends AnimatedWidget { final ValueChanged> onIsoValuesSelecred; final ValueChanged> onNdValuesSelected; final ValueChanged> onShutterSpeedValuesSelected; + final VoidCallback onCopy; + final VoidCallback onDelete; const _AnimatedEquipmentListTiles({ required AnimationController controller, @@ -212,6 +210,8 @@ class _AnimatedEquipmentListTiles extends AnimatedWidget { required this.onIsoValuesSelecred, required this.onNdValuesSelected, required this.onShutterSpeedValuesSelected, + required this.onCopy, + required this.onDelete, }) : super(listenable: controller); Animation get _progress => listenable as Animation; @@ -222,19 +222,43 @@ class _AnimatedEquipmentListTiles extends AnimatedWidget { alignment: Alignment.topCenter, size: Size( double.maxFinite, - _progress.value * Dimens.grid56 * 4, + _progress.value * Dimens.grid56 * 5, ), + // https://github.com/gskinnerTeam/flutter-folio/pull/62 child: Opacity( opacity: _progress.value, - child: EquipmentListTiles( - selectedApertureValues: equipmentData.apertureValues, - selectedIsoValues: equipmentData.isoValues, - selectedNdValues: equipmentData.ndValues, - selectedShutterSpeedValues: equipmentData.shutterSpeedValues, - onApertureValuesSelected: onApertureValuesSelected, - onIsoValuesSelecred: onIsoValuesSelecred, - onNdValuesSelected: onNdValuesSelected, - onShutterSpeedValuesSelected: onShutterSpeedValuesSelected, + child: Column( + children: [ + EquipmentListTiles( + selectedApertureValues: equipmentData.apertureValues, + selectedIsoValues: equipmentData.isoValues, + selectedNdValues: equipmentData.ndValues, + selectedShutterSpeedValues: equipmentData.shutterSpeedValues, + onApertureValuesSelected: onApertureValuesSelected, + onIsoValuesSelecred: onIsoValuesSelecred, + onNdValuesSelected: onNdValuesSelected, + onShutterSpeedValuesSelected: onShutterSpeedValuesSelected, + ), + ListTile( + contentPadding: const EdgeInsets.symmetric(horizontal: Dimens.paddingM), + trailing: Row( + mainAxisAlignment: MainAxisAlignment.end, + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + onPressed: onCopy, + icon: const Icon(Icons.copy), + tooltip: S.of(context).tooltipCopy, + ), + IconButton( + onPressed: onDelete, + icon: const Icon(Icons.delete), + tooltip: S.of(context).tooltipDelete, + ), + ], + ), + ), + ], ), ), ); diff --git a/lib/screens/settings/components/equipment/components/equipment_profiles/components/equipment_profile_screen/screen_equipment_profile.dart b/lib/screens/settings/components/equipment/components/equipment_profiles/components/equipment_profile_screen/screen_equipment_profile.dart index a5b0eca..abacf7c 100644 --- a/lib/screens/settings/components/equipment/components/equipment_profiles/components/equipment_profile_screen/screen_equipment_profile.dart +++ b/lib/screens/settings/components/equipment/components/equipment_profiles/components/equipment_profile_screen/screen_equipment_profile.dart @@ -34,10 +34,7 @@ class _EquipmentProfilesScreenState extends State { IconButton( onPressed: _addProfile, icon: const Icon(Icons.add), - ), - IconButton( - onPressed: Navigator.of(context).pop, - icon: const Icon(Icons.close), + tooltip: S.of(context).tooltipAdd, ), ], slivers: profilesCount == 1 @@ -69,6 +66,7 @@ class _EquipmentProfilesScreenState extends State { data: profile, onExpand: () => _keepExpandedAt(index), onUpdate: _updateProfileAt, + onCopy: () => _addProfile(profile), onDelete: () => _removeProfileAt(profile), ), ); @@ -81,13 +79,13 @@ class _EquipmentProfilesScreenState extends State { ); } - void _addProfile() { + void _addProfile([EquipmentProfile? copyFrom]) { showDialog( context: context, builder: (_) => const EquipmentProfileNameDialog(), - ).then((value) { - if (value != null) { - EquipmentProfileProvider.of(context).addProfile(value); + ).then((name) { + if (name != null) { + EquipmentProfileProvider.of(context).addProfile(name, copyFrom); } }); } diff --git a/lib/screens/settings/components/metering/components/calibration/components/calibration_dialog/widget_dialog_calibration.dart b/lib/screens/settings/components/metering/components/calibration/components/calibration_dialog/widget_dialog_calibration.dart index 69a4f00..56c4ed0 100644 --- a/lib/screens/settings/components/metering/components/calibration/components/calibration_dialog/widget_dialog_calibration.dart +++ b/lib/screens/settings/components/metering/components/calibration/components/calibration_dialog/widget_dialog_calibration.dart @@ -117,6 +117,7 @@ class _CalibrationUnit extends StatelessWidget { IconButton( onPressed: onReset, icon: const Icon(Icons.sync), + tooltip: S.of(context).tooltipResetToZero, ), ], ) diff --git a/lib/screens/settings/components/shared/dialog_filter/widget_dialog_filter.dart b/lib/screens/settings/components/shared/dialog_filter/widget_dialog_filter.dart index 8bafcae..af2b35d 100644 --- a/lib/screens/settings/components/shared/dialog_filter/widget_dialog_filter.dart +++ b/lib/screens/settings/components/shared/dialog_filter/widget_dialog_filter.dart @@ -85,6 +85,9 @@ class _DialogFilterState extends State> { padding: EdgeInsets.zero, icon: Icon(_hasAnyUnselected ? Icons.select_all : Icons.deselect), onPressed: _toggleAll, + tooltip: _hasAnyUnselected + ? S.of(context).tooltipSelectAll + : S.of(context).tooltipDesecelectAll, ), ), const Spacer(), diff --git a/lib/screens/settings/screen_settings.dart b/lib/screens/settings/screen_settings.dart index 3f1c0a6..4102282 100644 --- a/lib/screens/settings/screen_settings.dart +++ b/lib/screens/settings/screen_settings.dart @@ -35,12 +35,6 @@ class _SettingsScreenState extends State { return ScaffoldMessenger( child: SliverScreen( title: S.of(context).settings, - appBarActions: [ - IconButton( - onPressed: Navigator.of(context).pop, - icon: const Icon(Icons.close), - ), - ], slivers: [ SliverList( delegate: SliverChildListDelegate( diff --git a/lib/screens/shared/sliver_screen/screen_sliver.dart b/lib/screens/shared/sliver_screen/screen_sliver.dart index 20d2e66..97ed830 100644 --- a/lib/screens/shared/sliver_screen/screen_sliver.dart +++ b/lib/screens/shared/sliver_screen/screen_sliver.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/res/dimens.dart'; class SliverScreen extends StatelessWidget { @@ -8,7 +9,7 @@ class SliverScreen extends StatelessWidget { const SliverScreen({ required this.title, - required this.appBarActions, + this.appBarActions = const [], required this.slivers, super.key, }); @@ -36,7 +37,15 @@ class SliverScreen extends StatelessWidget { ), ), ), - actions: appBarActions, + actions: [ + ...appBarActions, + if (Navigator.of(context).canPop()) + IconButton( + onPressed: Navigator.of(context).pop, + icon: const Icon(Icons.close), + tooltip: S.of(context).tooltipClose, + ), + ], ), ...slivers, ],