UI Tweaks and new application hotkeys
This commit is contained in:
parent
8d73f5cc7e
commit
756d387238
9 changed files with 72 additions and 36 deletions
|
|
@ -2,9 +2,11 @@
|
|||
using Avalonia.Collections;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Data;
|
||||
using Avalonia.Input;
|
||||
using LibationFileManager;
|
||||
using ReactiveUI;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibationAvalonia.ViewModels
|
||||
|
|
@ -32,7 +34,6 @@ namespace LibationAvalonia.ViewModels
|
|||
}
|
||||
|
||||
|
||||
|
||||
private void Configure_Filters()
|
||||
{
|
||||
FirstFilterIsDefault = QuickFilters.UseDefault;
|
||||
|
|
@ -88,7 +89,16 @@ namespace LibationAvalonia.ViewModels
|
|||
var quickFilterNativeMenu = (NativeMenuItem)NativeMenu.GetMenu(MainWindow).Items[3];
|
||||
for (int i = quickFilterNativeMenu.Menu.Items.Count - 1; i >= 3; i--)
|
||||
{
|
||||
(((NativeMenuItem)quickFilterNativeMenu.Menu.Items[i]).Command as IDisposable).Dispose();
|
||||
var command = ((NativeMenuItem)quickFilterNativeMenu.Menu.Items[i]).Command as IDisposable;
|
||||
if (command != null)
|
||||
{
|
||||
var existingBinding = MainWindow.KeyBindings.FirstOrDefault(kb => kb.Command == command);
|
||||
if (existingBinding != null)
|
||||
MainWindow.KeyBindings.Remove(existingBinding);
|
||||
|
||||
command.Dispose();
|
||||
}
|
||||
|
||||
quickFilterNativeMenu.Menu.Items.RemoveAt(i);
|
||||
QuickFilterMenuItems.RemoveAt(i);
|
||||
}
|
||||
|
|
@ -99,10 +109,25 @@ namespace LibationAvalonia.ViewModels
|
|||
{
|
||||
var command = ReactiveCommand.Create(async () => await PerformFilter(filter));
|
||||
|
||||
quickFilterNativeMenu.Menu.Items.Add(new NativeMenuItem { Header = $"{++index}: {filter}", Command = command, Gesture = new Avalonia.Input.KeyGesture(Avalonia.Input.Key.D0 + index, Avalonia.Input.KeyModifiers.Meta) });
|
||||
var menuItem = new MenuItem { Header = $"{++index}: {filter}", Command = command };
|
||||
var nativeMenuItem = new NativeMenuItem { Header = $"{index}: {filter}", Command = command };
|
||||
|
||||
QuickFilterMenuItems.Add(new MenuItem { Header = $"_{index}: {filter}", Command = command });
|
||||
if (Configuration.IsMacOs && index <= 10)
|
||||
{
|
||||
//Register hotkeys Command + 1 - 0 for quick filters
|
||||
var key = index == 10 ? Key.D0 : Key.D0 + index;
|
||||
nativeMenuItem.Gesture = new KeyGesture(key, KeyModifiers.Meta);
|
||||
}
|
||||
else if (!Configuration.IsMacOs && index <= 12)
|
||||
{
|
||||
//Register hotkeys F1 - F12 for quick filters
|
||||
menuItem.InputGesture = new KeyGesture(Key.F1 + index - 1);
|
||||
MainWindow.KeyBindings.Add(new KeyBinding { Command = command, Gesture = menuItem.InputGesture });
|
||||
}
|
||||
|
||||
QuickFilterMenuItems.Add(menuItem);
|
||||
quickFilterNativeMenu.Menu.Items.Add(nativeMenuItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ namespace LibationAvalonia.ViewModels
|
|||
{
|
||||
if (libraryBook.Book.UserDefinedItem.BookStatus is LiberatedStatus.Liberated)
|
||||
{
|
||||
Serilog.Log.Logger.Information("Begin single pdf backup of {libraryBook}", libraryBook);
|
||||
Serilog.Log.Logger.Information("Begin convert to mp3 {libraryBook}", libraryBook);
|
||||
setQueueCollapseState(false);
|
||||
ProcessQueue.AddConvertMp3(libraryBook);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ namespace LibationAvalonia.ViewModels
|
|||
/// <summary> The "Liberate" menu item header text (submenu item of the "Visible Books" menu item) </summary>
|
||||
public string LiberateVisibleToolStripText_2 { get; private set; } = menufyText("Liberate: 0");
|
||||
|
||||
|
||||
private void Configure_VisibleBooks()
|
||||
{
|
||||
LibraryCommands.BookUserDefinedItemCommitted += setLiberatedVisibleMenuItemAsync;
|
||||
|
|
@ -37,6 +36,7 @@ namespace LibationAvalonia.ViewModels
|
|||
this.RaisePropertyChanged(nameof(VisibleCountText));
|
||||
this.RaisePropertyChanged(nameof(VisibleCountMenuItemText));
|
||||
}
|
||||
|
||||
private void setVisibleNotLiberatedCount(int visibleNotLiberated)
|
||||
{
|
||||
_visibleNotLiberated = visibleNotLiberated;
|
||||
|
|
@ -85,6 +85,7 @@ namespace LibationAvalonia.ViewModels
|
|||
Serilog.Log.Logger.Error(ex, "An error occurred while backing up visible library books");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task ReplaceTagsAsync()
|
||||
{
|
||||
var dialog = new TagsBatchDialog();
|
||||
|
|
|
|||
|
|
@ -24,12 +24,12 @@ namespace LibationAvalonia.ViewModels
|
|||
|
||||
Configure_NonUI();
|
||||
Configure_BackupCounts();
|
||||
Configure_Export();
|
||||
Configure_Filters();
|
||||
Configure_Import();
|
||||
Configure_Liberate();
|
||||
Configure_ProcessQueue();
|
||||
Configure_ScanAuto();
|
||||
Configure_Export();
|
||||
Configure_Settings();
|
||||
Configure_VisibleBooks();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue