sourcegit/src/ViewModels/Workspace.cs
Massimo f14a666091
feat: add workspace-specific default clone directory functionality (#1183)
* refactor: improve diff handling for EOL changes and enhance text diff display

- Updated `Diff.cs` to streamline whitespace handling in diff arguments.
- Enhanced `DiffContext.cs` to check for EOL changes when old and new hashes differ, creating a text diff if necessary.
- Added support for showing end-of-line symbols in `TextDiffView.axaml.cs` options.

* localization: update translations to include EOF handling in ignore whitespace messages

- Modified the ignore whitespace text in multiple language files to specify that EOF changes are also ignored.
- Ensured consistency across all localization files for the patch application feature.

* revert: Typo in DiffResult comment

* revert: update diff arguments to ignore CR at EOL in whitespace handling (like before changes)

* revert: update translations to remove EOF references in Text.Apply.IgnoreWS and fixed typo in Text.Diff.IgnoreWhitespace (EOF => EOL)

* feat: add workspace-specific default clone directory functionality

- Implemented logic in Clone.cs to set ParentFolder based on the active workspace's DefaultCloneDir if available, falling back to the global GitDefaultCloneDir.
- Added DefaultCloneDir property to Workspace.cs to store the default clone directory for each workspace.
- Updated ConfigureWorkspace.axaml to include a TextBox and Button for setting the DefaultCloneDir in the UI.
- Implemented folder selection functionality in ConfigureWorkspace.axaml.cs to allow users to choose a directory for cloning.
- This closes issue #1145

---------

Co-authored-by: mpagani <massimo.pagani@unitec-group.com>
2025-04-14 16:41:34 +08:00

66 lines
1.5 KiB
C#

using System.Collections.Generic;
using Avalonia.Media;
using CommunityToolkit.Mvvm.ComponentModel;
namespace SourceGit.ViewModels
{
public class Workspace : ObservableObject
{
public string Name
{
get => _name;
set => SetProperty(ref _name, value);
}
public uint Color
{
get => _color;
set
{
if (SetProperty(ref _color, value))
OnPropertyChanged(nameof(Brush));
}
}
public List<string> Repositories
{
get;
set;
} = new List<string>();
public int ActiveIdx
{
get;
set;
} = 0;
public bool IsActive
{
get => _isActive;
set => SetProperty(ref _isActive, value);
}
public bool RestoreOnStartup
{
get => _restoreOnStartup;
set => SetProperty(ref _restoreOnStartup, value);
}
public string DefaultCloneDir
{
get => _defaultCloneDir;
set => SetProperty(ref _defaultCloneDir, value);
}
public IBrush Brush
{
get => new SolidColorBrush(_color);
}
private string _name = string.Empty;
private uint _color = 4278221015;
private bool _isActive = false;
private bool _restoreOnStartup = true;
private string _defaultCloneDir = string.Empty;
}
}