diff --git a/installers/WindowsInstallerScript.iss b/installers/WindowsInstallerScript.iss index 0a8154e..bfdc59a 100644 --- a/installers/WindowsInstallerScript.iss +++ b/installers/WindowsInstallerScript.iss @@ -3,7 +3,7 @@ ; Non-commercial use only #define MyAppName "MayShow" -#define MyAppVersion "1.4.2" +#define MyAppVersion "1.4.3" #define MyAppPublisher "Quickity Quack Productions" #define MyAppExeName "MayShow.exe" diff --git a/installers/build-linux.sh b/installers/build-linux.sh index 60d974a..fe1bfd4 100755 --- a/installers/build-linux.sh +++ b/installers/build-linux.sh @@ -1,6 +1,6 @@ #!/bin/bash -VERSION="1.4.2" +VERSION="1.4.3" SRC_DIR="src" # user ran script from main folder if [ ! -d "$SRC_DIR" ]; then SRC_DIR= "../src" # try diff --git a/src/Directory.Build.props b/src/Directory.Build.props index c67685f..30ed9cc 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,5 +1,5 @@ - 11.3.12 + 11.3.13 diff --git a/src/MayShow.Desktop/app.manifest b/src/MayShow.Desktop/app.manifest index abaa302..3bfcfcc 100644 --- a/src/MayShow.Desktop/app.manifest +++ b/src/MayShow.Desktop/app.manifest @@ -3,7 +3,7 @@ - + diff --git a/src/MayShow.Shared/Helpers/Constants.cs b/src/MayShow.Shared/Helpers/Constants.cs index 11d8f05..6f4c715 100644 --- a/src/MayShow.Shared/Helpers/Constants.cs +++ b/src/MayShow.Shared/Helpers/Constants.cs @@ -1,15 +1,34 @@ +using System.Collections.Generic; +using MayShow.Models; + namespace MayShow.Helpers; class Constants { - public static string AppVersion = "1.4.2"; + public static string AppVersion = "1.4.3"; public static string[] AllowedFileExtensionPatterns = [ "*.png", "*.jpg", "*.jpeg", "*.gif", "*.bmp", "*.webp", "*.pdf", "*.heic", ]; public static string[] AllowedFileExtensionsNoStar = [ "png", "jpg", "jpeg", "gif", "bmp", "webp", "pdf", "heic", ]; public static string ReportSavedDataFileName = "report_data.json"; + public static List GetDateDisplayFormats() + { + return [ + new DateDisplayFormat("Month/Day/Year", "4/5/2026", "M/d/yyyy"), + new DateDisplayFormat("Year-Month-Day", "2026-04-05", "yyyy-MM-dd"), + new DateDisplayFormat("Month Day, Year", "April 5, 2026", "MMMM d, yyyy"), + new DateDisplayFormat("DOW, Month Day, Year", "Sunday, April 5, 2026", "dddd, MMMM d, yyyy"), + new DateDisplayFormat("Abbreviated-Month Day, Year", "Apr 5, 2026", "MMM d, yyyy"), + new DateDisplayFormat("DOW, Abbreviated-Month Day, Year", "Sunday, Apr 5, 2026", "dddd, MMM d, yyyy"), + new DateDisplayFormat("Day Month, Year", "5 April 2026", "d MMMM yyyy"), + new DateDisplayFormat("Day Abbreviated-Month, Year", "5 Apr 2026", "d MMM yyyy"), + new DateDisplayFormat("Day Month, Year", "05 April 2026", "dd MMMM yyyy"), + new DateDisplayFormat("Day Abbreviated-Month, Year", "05 Apr 2026", "dd MMM yyyy"), + ]; + } + public static string[] GetQuotes() { // sources: diff --git a/src/MayShow.Shared/Helpers/DateFormatConverter.cs b/src/MayShow.Shared/Helpers/DateFormatConverter.cs new file mode 100644 index 0000000..0ab1085 --- /dev/null +++ b/src/MayShow.Shared/Helpers/DateFormatConverter.cs @@ -0,0 +1,35 @@ + +using System; +using System.Collections.Generic; +using System.Globalization; +using Avalonia.Data.Converters; + +namespace MayShow.Helpers; + +public class DateFormatConverter : IMultiValueConverter +{ + public object? Convert( + IList values, + Type targetType, + object? parameter, + CultureInfo culture) + { + if (values.Count >= 2 && values[0] is DateOnly date && values[1] is string format) + { + return date.ToString(format); + } + if (values.Count >= 2 && values[0] is string dateFormat && values[1] is DateOnly dateOnly) + { + return dateOnly.ToString(dateFormat); + } + if (values.Count >= 2 && values[0] is DateTime dateTime && values[1] is string format3) + { + return dateTime.ToString(format3); + } + if (values.Count >= 2 && values[0] is string format4 && values[1] is DateTime dateTime2) + { + return dateTime2.ToString(format4); + } + return ""; + } +} \ No newline at end of file diff --git a/src/MayShow.Shared/Helpers/ListExtensions.cs b/src/MayShow.Shared/Helpers/ListExtensions.cs index 9f9c074..b990064 100644 --- a/src/MayShow.Shared/Helpers/ListExtensions.cs +++ b/src/MayShow.Shared/Helpers/ListExtensions.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; using System.Threading; -namespace MayShows.Helpers; +namespace MayShow.Helpers; public static class ThreadSafeRandom { diff --git a/src/MayShow.Shared/Helpers/Utilities.cs b/src/MayShow.Shared/Helpers/Utilities.cs index 8add352..6fcf243 100644 --- a/src/MayShow.Shared/Helpers/Utilities.cs +++ b/src/MayShow.Shared/Helpers/Utilities.cs @@ -9,7 +9,7 @@ using System.Text.RegularExpressions; using MayShow.Models; using Tmds.DBus.Protocol; -namespace MayShows.Helpers; +namespace MayShow.Helpers; class Utilities { diff --git a/src/MayShow.Shared/MayShow.Shared.csproj b/src/MayShow.Shared/MayShow.Shared.csproj index 94f14ca..f206ef7 100644 --- a/src/MayShow.Shared/MayShow.Shared.csproj +++ b/src/MayShow.Shared/MayShow.Shared.csproj @@ -6,10 +6,8 @@ true true MayShow - 1.4.2 - - - true + 1.4.3 + MayShow-icon.ico @@ -60,7 +58,9 @@ All - + + + diff --git a/src/MayShow.Shared/Models/DateDisplayFormat.cs b/src/MayShow.Shared/Models/DateDisplayFormat.cs new file mode 100644 index 0000000..3054949 --- /dev/null +++ b/src/MayShow.Shared/Models/DateDisplayFormat.cs @@ -0,0 +1,35 @@ +using MayShow.Helpers; + +namespace MayShow.Models; + +class DateDisplayFormat : ChangeNotifier +{ + private string _title; + private string _example; + private string _value; + + public DateDisplayFormat(string title, string example, string value) + { + _title = title; + _example = example; + _value = value; + } + + public string Title + { + get => _title; + set { _title = value; NotifyPropertyChanged(); } + } + + public string Example + { + get => _example; + set { _example = value; NotifyPropertyChanged(); } + } + + public string Value + { + get => _value; + set { _value = value; NotifyPropertyChanged(); } + } +} \ No newline at end of file diff --git a/src/MayShow.Shared/Models/ReportFile.cs b/src/MayShow.Shared/Models/ReportFile.cs index 2fbbbd8..fd9d350 100644 --- a/src/MayShow.Shared/Models/ReportFile.cs +++ b/src/MayShow.Shared/Models/ReportFile.cs @@ -23,7 +23,7 @@ class ReportFile : ChangeNotifier public ReportFile(ReportFile other) { Title = _title = other.Title; - ReceiptDateTime = _receiptDateTime = other.ReceiptDateTime; + ReceiptDateTime = _receiptDateTime = other.ReceiptDateTime ?? DateTime.Now; Notes = _notes = other.Notes; FilePath = _filePath = other.FilePath; } @@ -34,12 +34,12 @@ class ReportFile : ChangeNotifier set { _title = value; NotifyPropertyChanged(); } } - public DateTime ReceiptDateTime + public DateTime? ReceiptDateTime { get => _receiptDateTime; set - { - _receiptDateTime = value; + { + _receiptDateTime = value ?? DateTime.Now; NotifyPropertyChanged(); NotifyPropertyChanged(nameof(ReceiptDate)); } diff --git a/src/MayShow.Shared/Models/Settings.cs b/src/MayShow.Shared/Models/Settings.cs index 23b23ab..6bb54e8 100644 --- a/src/MayShow.Shared/Models/Settings.cs +++ b/src/MayShow.Shared/Models/Settings.cs @@ -7,7 +7,6 @@ using System.Text.Json; using System.Text.Json.Serialization; using System.Threading.Tasks; using MayShow.Helpers; -using MayShows.Helpers; namespace MayShow.Models; @@ -21,6 +20,8 @@ class Settings : ChangeNotifier private bool _saveReportJsonDataInInternalDir; private Dictionary _workingFolderToInternalFolderName; // obsolete private List _allReportInfo; + public string _dataGridDateFormat; + public string _reportDateFormat; public int _settingsVersion; public Settings() : base() @@ -34,6 +35,8 @@ class Settings : ChangeNotifier _workingFolderToInternalFolderName = []; _allReportInfo = []; _settingsVersion = 2; + _dataGridDateFormat = "dd/MM/yyyy"; + _reportDateFormat = "yyyy-MM-dd"; } public Settings(Settings other) @@ -47,6 +50,8 @@ class Settings : ChangeNotifier _workingFolderToInternalFolderName = other.WorkingFolderToInternalFolderName; _settingsVersion = other.SettingsVersion; _allReportInfo = other.AllReportInfo; + _dataGridDateFormat = other.DataGridDateFormat; + _reportDateFormat = other.ReportDateFormat; } [JsonInclude] @@ -113,6 +118,20 @@ class Settings : ChangeNotifier set { _settingsVersion = value; NotifyPropertyChanged(); } } + [JsonInclude] + public string DataGridDateFormat + { + get => _dataGridDateFormat; + set { _dataGridDateFormat = value; NotifyPropertyChanged(); } + } + + [JsonInclude] + public string ReportDateFormat + { + get => _reportDateFormat; + set { _reportDateFormat = value; NotifyPropertyChanged(); } + } + public static string SettingsFileName = "settings.json"; public static string GetSettingsPath() diff --git a/src/MayShow.Shared/ViewModels/SettingsViewModel.cs b/src/MayShow.Shared/ViewModels/SettingsViewModel.cs index 7056320..516e10f 100644 --- a/src/MayShow.Shared/ViewModels/SettingsViewModel.cs +++ b/src/MayShow.Shared/ViewModels/SettingsViewModel.cs @@ -18,7 +18,7 @@ using PdfSharp.Snippets.Font; using MayShow.Interfaces; using MayShow.Models; using MayShow.Helpers; -using MayShows.Helpers; +using System.Collections.Generic; namespace MayShow.ViewModels; @@ -28,6 +28,9 @@ class SettingsViewModel: ChangeNotifier private Settings _settings; private string _errorMessage; private ITopLevelGrabber? _topLevelGrabber; + private List _dateFormats; + private int _gridDisplayDateFormatSelectedIndex; + private int _reportDisplayDateFormatSelectedIndex; public SettingsViewModel(Settings settingsToEdit, ITopLevelGrabber? topLevelGrabber): base() { @@ -35,6 +38,17 @@ class SettingsViewModel: ChangeNotifier _settings = new Settings(settingsToEdit); // clone it _errorMessage = ""; _topLevelGrabber = topLevelGrabber; + _dateFormats = Constants.GetDateDisplayFormats(); + _gridDisplayDateFormatSelectedIndex = _dateFormats.FindIndex(x => x.Value == _previousSettings.DataGridDateFormat); + if (_gridDisplayDateFormatSelectedIndex == -1) + { + _gridDisplayDateFormatSelectedIndex = 0; + } + _reportDisplayDateFormatSelectedIndex = _dateFormats.FindIndex(x => x.Value == _previousSettings.ReportDateFormat); + if (_reportDisplayDateFormatSelectedIndex == -1) + { + _reportDisplayDateFormatSelectedIndex = 0; + } } public bool UseDocnetPDFImageRendering @@ -109,6 +123,33 @@ class SettingsViewModel: ChangeNotifier } } + public List DateFormats + { + get => _dateFormats; + } + + public int DataGridDisplayDateFormatSelectedIndex + { + get => _gridDisplayDateFormatSelectedIndex; + set + { + _gridDisplayDateFormatSelectedIndex = value; + _settings.DataGridDateFormat = _dateFormats[value].Value; + NotifyPropertyChanged(); + } + } + + public int ReportDisplayDateFormatSelectedIndex + { + get => _reportDisplayDateFormatSelectedIndex; + set + { + _reportDisplayDateFormatSelectedIndex = value; + _settings.ReportDateFormat = _dateFormats[value].Value; + NotifyPropertyChanged(); + } + } + public async void ChooseOutputFolder() { var topLevel = _topLevelGrabber?.GetTopLevel(); diff --git a/src/MayShow.Shared/Views/AboutView.axaml b/src/MayShow.Shared/Views/AboutView.axaml index 90b7c28..e17283b 100644 --- a/src/MayShow.Shared/Views/AboutView.axaml +++ b/src/MayShow.Shared/Views/AboutView.axaml @@ -11,7 +11,7 @@ MaxWidth="450"> - + + + - -