add image editing

This commit is contained in:
Oleksandr Bezdieniezhnykh
2024-08-07 13:22:17 +03:00
parent c72f7fc265
commit a81a6f881d
11 changed files with 146 additions and 57 deletions
+10 -2
View File
@@ -1,5 +1,4 @@
using System.IO;
using System.Reflection;
using System.Text;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
@@ -28,6 +27,9 @@ public class Config
public double RightPanelWidth { get; set; }
public bool ShowHelpOnStart { get; set; }
public List<string> VideoFormats { get; set; }
public List<string> ImageFormats { get; set; }
}
public interface IConfigRepository
@@ -49,6 +51,9 @@ public class FileConfigRepository(ILogger<FileConfigRepository> logger) : IConfi
private static readonly Size DefaultWindowSize = new(1280, 720);
private static readonly Point DefaultWindowLocation = new(100, 100);
private static readonly List<string> DefaultVideoFormats = ["mp4", "mov", "avi"];
private static readonly List<string> DefaultImageFormats = ["jpg", "jpeg", "png", "bmp"];
public Config Get()
{
var exePath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory)!;
@@ -65,7 +70,10 @@ public class FileConfigRepository(ILogger<FileConfigRepository> logger) : IConfi
WindowLocation = DefaultWindowLocation,
WindowSize = DefaultWindowSize,
ShowHelpOnStart = true
ShowHelpOnStart = true,
VideoFormats = DefaultVideoFormats,
ImageFormats = DefaultImageFormats
};
}
var str = File.ReadAllText(CONFIG_PATH);
+6 -5
View File
@@ -1,5 +1,4 @@
using System.Collections.ObjectModel;
using System.Globalization;
using System.IO;
using System.Windows;
@@ -8,14 +7,16 @@ namespace Azaion.Annotator.DTO;
public class FormState
{
public SelectionState SelectionState { get; set; } = SelectionState.None;
public string CurrentFile { get; set; } = null!;
public MediaFileInfo? CurrentMedia { get; set; }
public Size CurrentVideoSize { get; set; }
public string VideoName => Path.GetFileNameWithoutExtension(CurrentFile).Replace(" ", "");
public string VideoName => string.IsNullOrEmpty(CurrentMedia?.Name)
? ""
: Path.GetFileNameWithoutExtension(CurrentMedia.Name).Replace(" ", "");
public TimeSpan CurrentVideoLength { get; set; }
public int CurrentVolume { get; set; } = 100;
public ObservableCollection<AnnotationResult> AnnotationResults { get; set; } = [];
public string GetTimeName(TimeSpan ts) => $"{VideoName}_{ts:hmmssf}";
public TimeSpan? GetTime(string name)
+11
View File
@@ -0,0 +1,11 @@
namespace Azaion.Annotator.DTO;
public class MediaFileInfo
{
public string Name { get; set; } = null!;
public string Path { get; set; } = null!;
public TimeSpan Duration { get; set; }
public string DurationStr => $"{Duration:h\\:mm\\:ss}";
public bool HasAnnotations { get; set; }
public MediaTypes MediaType { get; set; }
}
+8
View File
@@ -0,0 +1,8 @@
namespace Azaion.Annotator.DTO;
public enum MediaTypes
{
None = 0,
Video = 1,
Image = 2
}
+3 -1
View File
@@ -12,5 +12,7 @@ public enum PlaybackControlEnum
RemoveSelectedAnns = 7,
RemoveAllAnns = 8,
TurnOffVolume = 9,
TurnOnVolume = 10
TurnOnVolume = 10,
Previous = 11,
Next = 12
}
-10
View File
@@ -1,10 +0,0 @@
namespace Azaion.Annotator.DTO;
public class VideoFileInfo
{
public string Name { get; set; } = null!;
public string Path { get; set; } = null!;
public TimeSpan Duration { get; set; }
public string DurationStr => $"{Duration:h\\:mm\\:ss}";
public bool HasAnnotations { get; set; }
}