Title for identifyable commands

This commit is contained in:
2023-07-29 15:38:50 +02:00
parent fd095df1bb
commit 604294fd2a
38 changed files with 122 additions and 110 deletions

View File

@@ -10,4 +10,6 @@ public sealed class CloseTabCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Close tab";
}

View File

@@ -1,6 +1,6 @@
namespace FileTime.App.Core.UserCommand;
public class CopyBase64Command : IIdentifiableUserCommand
public sealed class CopyBase64Command : IIdentifiableUserCommand
{
public const string CommandName = "copy_base64";
public static CopyBase64Command Instance { get; } = new();
@@ -10,4 +10,6 @@ public class CopyBase64Command : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Copy content as base64 text";
}

View File

@@ -10,4 +10,6 @@ public sealed class CopyCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Copy";
}

View File

@@ -1,6 +1,6 @@
namespace FileTime.App.Core.UserCommand;
public class CopyFilesToClipboardCommand : IIdentifiableUserCommand
public sealed class CopyFilesToClipboardCommand : IIdentifiableUserCommand
{
public const string CommandName = "copy_to_clipboard";
@@ -11,4 +11,6 @@ public class CopyFilesToClipboardCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Copy to clipbaord";
}

View File

@@ -1,6 +1,6 @@
namespace FileTime.App.Core.UserCommand;
public class CopyNativePathCommand : IIdentifiableUserCommand
public sealed class CopyNativePathCommand : IIdentifiableUserCommand
{
public const string CommandName = "copy_path";
public static CopyNativePathCommand Instance { get; } = new();
@@ -10,4 +10,6 @@ public class CopyNativePathCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Copy path";
}

View File

@@ -10,4 +10,6 @@ public sealed class CreateContainer : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Create container";
}

View File

@@ -10,4 +10,6 @@ public sealed class CreateElementCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Create element";
}

View File

@@ -1,19 +1,21 @@
namespace FileTime.App.Core.UserCommand;
public class DeleteCommand : IIdentifiableUserCommand
public sealed class DeleteCommand : IIdentifiableUserCommand
{
public const string SoftDeleteCommandName = "soft_delete";
public const string HardDeleteCommandName = "hard_delete";
public static DeleteCommand SoftDelete { get; } = new(SoftDeleteCommandName, false);
public static DeleteCommand HardDelete { get; } = new(HardDeleteCommandName, true);
public static DeleteCommand SoftDelete { get; } = new(SoftDeleteCommandName, false, "Delete (soft)");
public static DeleteCommand HardDelete { get; } = new(HardDeleteCommandName, true, "Delete (hard)");
private DeleteCommand(string commandName, bool hardDelete)
private DeleteCommand(string commandName, bool hardDelete, string title)
{
UserCommandID = commandName;
IsHardDelete = hardDelete;
Title = title;
}
public string UserCommandID { get; }
public bool IsHardDelete { get; }
public string Title { get; }
}

View File

@@ -10,4 +10,6 @@ public sealed class EnterRapidTravelCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Enter rapid travel mode";
}

View File

@@ -10,4 +10,6 @@ public sealed class ExitRapidTravelCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Exit rapid travel mode";
}

View File

@@ -1,6 +1,6 @@
namespace FileTime.App.Core.UserCommand;
public class GoByFrequencyCommand : IIdentifiableUserCommand
public sealed class GoByFrequencyCommand : IIdentifiableUserCommand
{
public const string CommandName = "go_by_frequency";
@@ -11,4 +11,6 @@ public class GoByFrequencyCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Go to frequent place";
}

View File

@@ -1,6 +1,6 @@
namespace FileTime.App.Core.UserCommand;
public class GoToHomeCommand : IIdentifiableUserCommand
public sealed class GoToHomeCommand : IIdentifiableUserCommand
{
public const string CommandName = "go_to_home";
public static GoToHomeCommand Instance { get; } = new();
@@ -10,4 +10,6 @@ public class GoToHomeCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Go home";
}

View File

@@ -1,6 +1,6 @@
namespace FileTime.App.Core.UserCommand;
public class GoToPathCommand : IIdentifiableUserCommand
public sealed class GoToPathCommand : IIdentifiableUserCommand
{
public const string CommandName = "go_to_path";
public static GoToPathCommand Instance { get; } = new();
@@ -10,4 +10,6 @@ public class GoToPathCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Go to path";
}

View File

@@ -1,6 +1,6 @@
namespace FileTime.App.Core.UserCommand;
public class GoToProviderCommand : IIdentifiableUserCommand
public sealed class GoToProviderCommand : IIdentifiableUserCommand
{
public const string CommandName = "go_to_provider";
public static GoToProviderCommand Instance { get; } = new();
@@ -10,4 +10,6 @@ public class GoToProviderCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Go to provider";
}

View File

@@ -1,6 +1,6 @@
namespace FileTime.App.Core.UserCommand;
public class GoToRootCommand : IIdentifiableUserCommand
public sealed class GoToRootCommand : IIdentifiableUserCommand
{
public const string CommandName = "go_to_root";
public static GoToRootCommand Instance { get; } = new();
@@ -10,4 +10,6 @@ public class GoToRootCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Go to root";
}

View File

@@ -10,4 +10,6 @@ public sealed class GoUpCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Go up";
}

View File

@@ -3,5 +3,5 @@ namespace FileTime.App.Core.UserCommand;
public interface IIdentifiableUserCommand : IUserCommand
{
string UserCommandID { get; }
//string Title { get; }
string Title { get; }
}

View File

@@ -4,68 +4,3 @@ public interface IUserCommand
{
}
/*public enum Command
{
None,
AutoRefresh,
ChangeTimelineMode,
CloseTab,
Compress,
Copy,
CopyHash,
CopyPath,
CreateContainer,
CreateElement,
Cut,
Edit,
EnterRapidTravel,
ExitRapidTravel,
FindByName,
FindByNameRegex,
GoToHome,
GoToPath,
GoToProvider,
GoToRoot,
GoUp,
HardDelete,
Mark,
MoveCursorDown,
MoveCursorDownPage,
MoveCursorUp,
MoveCursorUpPage,
MoveToFirst,
MoveToLast,
NextTimelineBlock,
NextTimelineCommand,
Open,
OpenInFileBrowser,
OpenOrRun,
PasteMerge,
PasteOverwrite,
PasteSkip,
PinFavorite,
PreviousTimelineBlock,
PreviousTimelineCommand,
Refresh,
Rename,
RunCommand,
ScanContainerSize,
ShowAllShortcut,
SoftDelete,
SwitchToLastTab,
SwitchToTab1,
SwitchToTab2,
SwitchToTab3,
SwitchToTab4,
SwitchToTab5,
SwitchToTab6,
SwitchToTab7,
SwitchToTab8,
TimelinePause,
TimelineRefresh,
TimelineStart,
ToggleAdvancedIcons,
ToggleHidden,
}*/

View File

@@ -10,4 +10,6 @@ public sealed class MarkCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Select item";
}

View File

@@ -10,4 +10,6 @@ public sealed class MoveCursorDownCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Move down";
}

View File

@@ -1,6 +1,6 @@
namespace FileTime.App.Core.UserCommand;
public class MoveCursorDownPageCommand : IIdentifiableUserCommand
public sealed class MoveCursorDownPageCommand : IIdentifiableUserCommand
{
public const string CommandName = "move_cursor_down_page";
public static MoveCursorDownPageCommand Instance { get; } = new();
@@ -10,4 +10,6 @@ public class MoveCursorDownPageCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Move down a page";
}

View File

@@ -1,6 +1,6 @@
namespace FileTime.App.Core.UserCommand;
public class MoveCursorToFirstCommand : IIdentifiableUserCommand
public sealed class MoveCursorToFirstCommand : IIdentifiableUserCommand
{
public const string CommandName = "move_cursor_to_first";
public static MoveCursorToFirstCommand Instance { get; } = new();
@@ -10,4 +10,6 @@ public class MoveCursorToFirstCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Move to first";
}

View File

@@ -1,6 +1,6 @@
namespace FileTime.App.Core.UserCommand;
public class MoveCursorToLastCommand : IIdentifiableUserCommand
public sealed class MoveCursorToLastCommand : IIdentifiableUserCommand
{
public const string CommandName = "move_cursor_to_last";
public static MoveCursorToLastCommand Instance { get; } = new();
@@ -10,4 +10,6 @@ public class MoveCursorToLastCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Move to last";
}

View File

@@ -10,4 +10,6 @@ public sealed class MoveCursorUpCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Move up";
}

View File

@@ -1,6 +1,6 @@
namespace FileTime.App.Core.UserCommand;
public class MoveCursorUpPageCommand : IIdentifiableUserCommand
public sealed class MoveCursorUpPageCommand : IIdentifiableUserCommand
{
public const string CommandName = "move_cursor_up_page";
public static MoveCursorUpPageCommand Instance { get; } = new();
@@ -10,4 +10,6 @@ public class MoveCursorUpPageCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Move up by page";
}

View File

@@ -1,6 +1,6 @@
namespace FileTime.App.Core.UserCommand;
public class OpenCommandPaletteCommand : IIdentifiableUserCommand
public sealed class OpenCommandPaletteCommand : IIdentifiableUserCommand
{
public const string CommandName = "open_command_palette";
public static OpenCommandPaletteCommand Instance { get; } = new ();
@@ -10,4 +10,6 @@ public class OpenCommandPaletteCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Open command palette";
}

View File

@@ -1,6 +1,6 @@
namespace FileTime.App.Core.UserCommand;
public class OpenInDefaultFileExplorerCommand : IIdentifiableUserCommand
public sealed class OpenInDefaultFileExplorerCommand : IIdentifiableUserCommand
{
public const string CommandName = "open_in_default_explorer";
public static OpenInDefaultFileExplorerCommand Instance { get; } = new();
@@ -10,4 +10,6 @@ public class OpenInDefaultFileExplorerCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Open in default file browser";
}

View File

@@ -10,4 +10,6 @@ public sealed class OpenSelectedCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Open";
}

View File

@@ -8,17 +8,19 @@ public sealed class PasteCommand : IIdentifiableUserCommand
public const string PasteOverwriteCommandName = "paste_overwrite";
public const string PasteSkipCommandName = "paste_skip";
public static readonly PasteCommand Merge = new(PasteMode.Merge, PasteMergeCommandName);
public static readonly PasteCommand Overwrite = new(PasteMode.Overwrite, PasteOverwriteCommandName);
public static readonly PasteCommand Skip = new(PasteMode.Skip, PasteSkipCommandName);
public static readonly PasteCommand Merge = new(PasteMode.Merge, PasteMergeCommandName, "Paste (merge)");
public static readonly PasteCommand Overwrite = new(PasteMode.Overwrite, PasteOverwriteCommandName, "Paste (overwrite)");
public static readonly PasteCommand Skip = new(PasteMode.Skip, PasteSkipCommandName, "Paste (skip)");
public PasteMode PasteMode { get; }
private PasteCommand(PasteMode pasteMode, string commandName)
private PasteCommand(PasteMode pasteMode, string commandName, string title)
{
PasteMode = pasteMode;
UserCommandID = commandName;
Title = title;
}
public string UserCommandID { get; }
public string Title { get; }
}

View File

@@ -2,22 +2,28 @@ using FileTime.App.Core.Models.Enums;
namespace FileTime.App.Core.UserCommand;
public class PasteFilesFromClipboardCommand : IIdentifiableUserCommand
public sealed class PasteFilesFromClipboardCommand : IIdentifiableUserCommand
{
public const string PasteMergeCommandName = "paste_clipboard_merge";
public const string PasteOverwriteCommandName = "paste_clipboard_overwrite";
public const string PasteSkipCommandName = "paste_clipboard_skip";
public static readonly PasteFilesFromClipboardCommand Merge = new(PasteMode.Merge, PasteMergeCommandName);
public static readonly PasteFilesFromClipboardCommand Overwrite = new(PasteMode.Overwrite, PasteOverwriteCommandName);
public static readonly PasteFilesFromClipboardCommand Skip = new(PasteMode.Skip, PasteSkipCommandName);
public static readonly PasteFilesFromClipboardCommand Merge
= new(PasteMode.Merge, PasteMergeCommandName, "Paste from clipboard (merge)");
public static readonly PasteFilesFromClipboardCommand Overwrite
= new(PasteMode.Overwrite, PasteOverwriteCommandName, "Paste from clipboard (overwrite)");
public static readonly PasteFilesFromClipboardCommand Skip
= new(PasteMode.Skip, PasteSkipCommandName, "Paste from clipboard (skip)");
public PasteMode PasteMode { get; }
private PasteFilesFromClipboardCommand(PasteMode pasteMode, string commandName)
private PasteFilesFromClipboardCommand(PasteMode pasteMode, string commandName, string title)
{
PasteMode = pasteMode;
UserCommandID = commandName;
Title = title;
}
public string UserCommandID { get; }
public string Title { get; }
}

View File

@@ -1,6 +1,6 @@
namespace FileTime.App.Core.UserCommand;
public class PauseCommandSchedulerCommand : IIdentifiableUserCommand
public sealed class PauseCommandSchedulerCommand : IIdentifiableUserCommand
{
public const string CommandName = "pause_command_scheduler";
public static PauseCommandSchedulerCommand Instance { get; } = new();
@@ -10,4 +10,6 @@ public class PauseCommandSchedulerCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Pause command scheduler";
}

View File

@@ -10,4 +10,6 @@ public sealed class RefreshCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Refresh";
}

View File

@@ -1,6 +1,6 @@
namespace FileTime.App.Core.UserCommand;
public class RenameCommand : IIdentifiableUserCommand
public sealed class RenameCommand : IIdentifiableUserCommand
{
public const string CommandName = "rename";
public static RenameCommand Instance { get; } = new();
@@ -10,4 +10,6 @@ public class RenameCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Rename";
}

View File

@@ -1,6 +1,6 @@
namespace FileTime.App.Core.UserCommand;
public class RunOrOpenCommand : IIdentifiableUserCommand
public sealed class RunOrOpenCommand : IIdentifiableUserCommand
{
public const string CommandName = "run_or_open";
public static RunOrOpenCommand Instance { get; } = new();
@@ -10,4 +10,6 @@ public class RunOrOpenCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Open or run";
}

View File

@@ -18,21 +18,24 @@ public class SearchCommand : IUserCommand
}
}
public class IdentifiableSearchCommand : SearchCommand, IIdentifiableUserCommand
public sealed class IdentifiableSearchCommand : SearchCommand, IIdentifiableUserCommand
{
public const string SearchByNameContainsCommandName = "search_name_contains";
public static readonly IdentifiableSearchCommand SearchByNameContains =
new(null, SearchType.NameContains, SearchByNameContainsCommandName);
new(null, SearchType.NameContains, SearchByNameContainsCommandName, "Search by name");
private IdentifiableSearchCommand(
string? searchText,
SearchType searchType,
string commandId)
string commandId,
string title)
: base(searchText, searchType)
{
UserCommandID = commandId;
Title = title;
}
public string UserCommandID { get; }
public string Title { get; }
}

View File

@@ -2,32 +2,33 @@
namespace FileTime.App.Core.UserCommand;
public class SortItemsCommand : IIdentifiableUserCommand
public sealed class SortItemsCommand : IIdentifiableUserCommand
{
public const string OrderByNameCommandName = "order_by_name";
public const string OrderByNameDescCommandName = "order_by_name_desc";
public const string OrderByDateCommandName = "order_by_date";
public const string OrderByDateDescCommandName = "order_by_date_desc";
public static readonly SortItemsCommand OrderByNameCommand =
new(OrderByNameCommandName, ItemOrdering.Name);
new(OrderByNameCommandName, ItemOrdering.Name, "Order by name");
public static readonly SortItemsCommand OrderByNameDescCommand =
new(OrderByNameDescCommandName, ItemOrdering.NameDesc);
new(OrderByNameDescCommandName, ItemOrdering.NameDesc, "Order by name (descending)");
public static readonly SortItemsCommand OrderByDateCommand =
new(OrderByDateCommandName, ItemOrdering.LastModifyDate);
new(OrderByDateCommandName, ItemOrdering.LastModifyDate, "Order by date");
public static readonly SortItemsCommand OrderByDateDescCommand =
new(OrderByDateDescCommandName, ItemOrdering.LastModifyDateDesc);
new(OrderByDateDescCommandName, ItemOrdering.LastModifyDateDesc, "Order by date (descending)");
private SortItemsCommand(string userCommandId, ItemOrdering ordering)
private SortItemsCommand(string userCommandId, ItemOrdering ordering, string title)
{
UserCommandID = userCommandId;
Ordering = ordering;
Title = title;
}
public string UserCommandID { get; }
public ItemOrdering Ordering { get; }
public string Title { get; }
}

View File

@@ -10,4 +10,5 @@ public sealed class StartCommandSchedulerCommand : IIdentifiableUserCommand
}
public string UserCommandID => CommandName;
public string Title => "Start command scheduler";
}

View File

@@ -27,8 +27,12 @@ public sealed class SwitchToTabCommand : IIdentifiableUserCommand
{
TabNumber = tabNumber;
UserCommandID = commandName;
Title = tabNumber == -1
? "Switch to last tab"
: $"Switch to tab {tabNumber}";
}
public string UserCommandID { get; }
public int TabNumber { get; }
public string Title { get; }
}