UI Tweaks and new application hotkeys
This commit is contained in:
parent
8d73f5cc7e
commit
756d387238
@ -65,10 +65,13 @@
|
|||||||
Binding="{Binding LibraryScan, Mode=TwoWay}"
|
Binding="{Binding LibraryScan, Mode=TwoWay}"
|
||||||
Header="Include in
library scan?"/>
|
Header="Include in
library scan?"/>
|
||||||
|
|
||||||
<DataGridTextColumn
|
<DataGridTemplateColumn Width="2*" Header="Audible
email/login">
|
||||||
Width="2*"
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
Binding="{Binding AccountId, Mode=TwoWay}"
|
<DataTemplate>
|
||||||
Header="Audible
email/login"/>
|
<TextBox Text="{Binding AccountId, Mode=TwoWay}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
|
||||||
<DataGridTemplateColumn Width="Auto" Header="Locale">
|
<DataGridTemplateColumn Width="Auto" Header="Locale">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
|||||||
@ -2,17 +2,17 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="120"
|
mc:Ignorable="d" d:DesignWidth="550" d:DesignHeight="130"
|
||||||
xmlns:controls="clr-namespace:LibationAvalonia.Controls"
|
xmlns:controls="clr-namespace:LibationAvalonia.Controls"
|
||||||
x:Class="LibationAvalonia.Dialogs.LiberatedStatusBatchAutoDialog"
|
x:Class="LibationAvalonia.Dialogs.LiberatedStatusBatchAutoDialog"
|
||||||
Title="Liberated status: Whether the book has been downloaded"
|
Title="Liberated status: Whether the book has been downloaded"
|
||||||
MinHeight="100" MaxHeight="165"
|
MinHeight="130" MaxHeight="130"
|
||||||
MinWidth="600" MaxWidth="800"
|
MinWidth="550" MaxWidth="550"
|
||||||
Width="600"
|
Width="550" Height="130"
|
||||||
WindowStartupLocation="CenterOwner"
|
WindowStartupLocation="CenterOwner"
|
||||||
Icon="/Assets/libation.ico">
|
Icon="/Assets/libation.ico">
|
||||||
|
|
||||||
<Grid RowDefinitions="Auto,Auto,Auto">
|
<Grid Margin="10" RowDefinitions="Auto,Auto,Auto">
|
||||||
|
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
@ -45,7 +45,6 @@
|
|||||||
<Button
|
<Button
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Padding="30,0,30,0"
|
Padding="30,0,30,0"
|
||||||
Margin="10,0,10,10"
|
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Height="25"
|
Height="25"
|
||||||
Content="Save"
|
Content="Save"
|
||||||
|
|||||||
@ -25,12 +25,18 @@ namespace LibationAvalonia.Dialogs
|
|||||||
DataContext = _viewModel = new();
|
DataContext = _viewModel = new();
|
||||||
|
|
||||||
this.Closing += (_, _) => this.SaveSizeAndLocation(Configuration.Instance);
|
this.Closing += (_, _) => this.SaveSizeAndLocation(Configuration.Instance);
|
||||||
|
this.KeyDown += TrashBinDialog_KeyDown;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void EmptyTrash_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
public async void EmptyTrash_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||||
=> await _viewModel.PermanentlyDeleteCheckedAsync();
|
=> await _viewModel.PermanentlyDeleteCheckedAsync();
|
||||||
public async void Restore_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
public async void Restore_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||||
=> await _viewModel.RestoreCheckedAsync();
|
=> await _viewModel.RestoreCheckedAsync();
|
||||||
|
private void TrashBinDialog_KeyDown(object sender, Avalonia.Input.KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Avalonia.Input.Key.Escape)
|
||||||
|
Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TrashBinViewModel : ViewModelBase, IDisposable
|
public class TrashBinViewModel : ViewModelBase, IDisposable
|
||||||
|
|||||||
@ -2,9 +2,11 @@
|
|||||||
using Avalonia.Collections;
|
using Avalonia.Collections;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Data;
|
using Avalonia.Data;
|
||||||
|
using Avalonia.Input;
|
||||||
using LibationFileManager;
|
using LibationFileManager;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace LibationAvalonia.ViewModels
|
namespace LibationAvalonia.ViewModels
|
||||||
@ -32,7 +34,6 @@ namespace LibationAvalonia.ViewModels
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void Configure_Filters()
|
private void Configure_Filters()
|
||||||
{
|
{
|
||||||
FirstFilterIsDefault = QuickFilters.UseDefault;
|
FirstFilterIsDefault = QuickFilters.UseDefault;
|
||||||
@ -88,7 +89,16 @@ namespace LibationAvalonia.ViewModels
|
|||||||
var quickFilterNativeMenu = (NativeMenuItem)NativeMenu.GetMenu(MainWindow).Items[3];
|
var quickFilterNativeMenu = (NativeMenuItem)NativeMenu.GetMenu(MainWindow).Items[3];
|
||||||
for (int i = quickFilterNativeMenu.Menu.Items.Count - 1; i >= 3; i--)
|
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);
|
quickFilterNativeMenu.Menu.Items.RemoveAt(i);
|
||||||
QuickFilterMenuItems.RemoveAt(i);
|
QuickFilterMenuItems.RemoveAt(i);
|
||||||
}
|
}
|
||||||
@ -99,10 +109,25 @@ namespace LibationAvalonia.ViewModels
|
|||||||
{
|
{
|
||||||
var command = ReactiveCommand.Create(async () => await PerformFilter(filter));
|
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)
|
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);
|
setQueueCollapseState(false);
|
||||||
ProcessQueue.AddConvertMp3(libraryBook);
|
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>
|
/// <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");
|
public string LiberateVisibleToolStripText_2 { get; private set; } = menufyText("Liberate: 0");
|
||||||
|
|
||||||
|
|
||||||
private void Configure_VisibleBooks()
|
private void Configure_VisibleBooks()
|
||||||
{
|
{
|
||||||
LibraryCommands.BookUserDefinedItemCommitted += setLiberatedVisibleMenuItemAsync;
|
LibraryCommands.BookUserDefinedItemCommitted += setLiberatedVisibleMenuItemAsync;
|
||||||
@ -37,6 +36,7 @@ namespace LibationAvalonia.ViewModels
|
|||||||
this.RaisePropertyChanged(nameof(VisibleCountText));
|
this.RaisePropertyChanged(nameof(VisibleCountText));
|
||||||
this.RaisePropertyChanged(nameof(VisibleCountMenuItemText));
|
this.RaisePropertyChanged(nameof(VisibleCountMenuItemText));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setVisibleNotLiberatedCount(int visibleNotLiberated)
|
private void setVisibleNotLiberatedCount(int visibleNotLiberated)
|
||||||
{
|
{
|
||||||
_visibleNotLiberated = visibleNotLiberated;
|
_visibleNotLiberated = visibleNotLiberated;
|
||||||
@ -85,6 +85,7 @@ namespace LibationAvalonia.ViewModels
|
|||||||
Serilog.Log.Logger.Error(ex, "An error occurred while backing up visible library books");
|
Serilog.Log.Logger.Error(ex, "An error occurred while backing up visible library books");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ReplaceTagsAsync()
|
public async Task ReplaceTagsAsync()
|
||||||
{
|
{
|
||||||
var dialog = new TagsBatchDialog();
|
var dialog = new TagsBatchDialog();
|
||||||
|
|||||||
@ -24,12 +24,12 @@ namespace LibationAvalonia.ViewModels
|
|||||||
|
|
||||||
Configure_NonUI();
|
Configure_NonUI();
|
||||||
Configure_BackupCounts();
|
Configure_BackupCounts();
|
||||||
|
Configure_Export();
|
||||||
Configure_Filters();
|
Configure_Filters();
|
||||||
Configure_Import();
|
Configure_Import();
|
||||||
Configure_Liberate();
|
Configure_Liberate();
|
||||||
Configure_ProcessQueue();
|
Configure_ProcessQueue();
|
||||||
Configure_ScanAuto();
|
Configure_ScanAuto();
|
||||||
Configure_Export();
|
|
||||||
Configure_Settings();
|
Configure_Settings();
|
||||||
Configure_VisibleBooks();
|
Configure_VisibleBooks();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -145,12 +145,12 @@
|
|||||||
<Setter Property="Height" Value="NaN"/>
|
<Setter Property="Height" Value="NaN"/>
|
||||||
</Style>
|
</Style>
|
||||||
</MenuItem.Styles>
|
</MenuItem.Styles>
|
||||||
<MenuItem IsEnabled="{CompiledBinding LibraryStats.HasBookResults}" Command="{CompiledBinding ExportLibraryAsync}" Header="E_xport Library" />
|
<MenuItem IsEnabled="{CompiledBinding LibraryStats.HasBookResults}" Command="{CompiledBinding ExportLibraryAsync}" Header="E_xport Library" InputGesture="ctrl+S" />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
|
||||||
<!-- Quick Filters Menu -->
|
<!-- Quick Filters Menu -->
|
||||||
|
|
||||||
<MenuItem Name="quickFiltersToolStripMenuItem" Header="Quick _Filters" ItemsSource="{CompiledBinding QuickFilterMenuItems}" KeyDown="QuickFiltersMenuItem_KeyDown">
|
<MenuItem Name="quickFiltersToolStripMenuItem" Header="Quick _Filters" ItemsSource="{CompiledBinding QuickFilterMenuItems}">
|
||||||
<!-- Remove height style property for menu item -->
|
<!-- Remove height style property for menu item -->
|
||||||
<MenuItem.Styles>
|
<MenuItem.Styles>
|
||||||
<Style Selector="ItemsPresenter#PART_ItemsPresenter">
|
<Style Selector="ItemsPresenter#PART_ItemsPresenter">
|
||||||
@ -185,8 +185,8 @@
|
|||||||
<Setter Property="Height" Value="NaN"/>
|
<Setter Property="Height" Value="NaN"/>
|
||||||
</Style>
|
</Style>
|
||||||
</MenuItem.Styles>
|
</MenuItem.Styles>
|
||||||
<MenuItem Name="accountsToolStripMenuItem" Command="{CompiledBinding ShowAccountsAsync}" Header="_Accounts..." />
|
<MenuItem Name="accountsToolStripMenuItem" Command="{CompiledBinding ShowAccountsAsync}" Header="_Accounts..." InputGesture="ctrl+shift+A"/>
|
||||||
<MenuItem Name="basicSettingsToolStripMenuItem" Command="{CompiledBinding ShowSettingsAsync}" Header="_Settings..." />
|
<MenuItem Name="basicSettingsToolStripMenuItem" Command="{CompiledBinding ShowSettingsAsync}" Header="_Settings..." InputGesture="ctrl+P" />
|
||||||
<Separator />
|
<Separator />
|
||||||
<MenuItem Command="{CompiledBinding ShowTrashBinAsync}" Header="Trash Bin" />
|
<MenuItem Command="{CompiledBinding ShowTrashBinAsync}" Header="Trash Bin" />
|
||||||
<MenuItem Command="{CompiledBinding LaunchHangover}" Header="Launch _Hangover" />
|
<MenuItem Command="{CompiledBinding LaunchHangover}" Header="Launch _Hangover" />
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.ReactiveUI;
|
using Avalonia.ReactiveUI;
|
||||||
using DataLayer;
|
using DataLayer;
|
||||||
using LibationAvalonia.ViewModels;
|
using LibationAvalonia.ViewModels;
|
||||||
using LibationFileManager;
|
using LibationFileManager;
|
||||||
using LibationUiBase.GridView;
|
using LibationUiBase.GridView;
|
||||||
|
using ReactiveUI;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -24,6 +24,15 @@ namespace LibationAvalonia.Views
|
|||||||
Loaded += MainWindow_Loaded;
|
Loaded += MainWindow_Loaded;
|
||||||
Closing += MainWindow_Closing;
|
Closing += MainWindow_Closing;
|
||||||
LibraryLoaded += MainWindow_LibraryLoaded;
|
LibraryLoaded += MainWindow_LibraryLoaded;
|
||||||
|
|
||||||
|
KeyBindings.Add(new KeyBinding { Command = ReactiveCommand.Create(selectAndFocusSearchBox), Gesture = new KeyGesture(Key.F, Configuration.IsMacOs ? KeyModifiers.Meta : KeyModifiers.Control) });
|
||||||
|
|
||||||
|
if (!Configuration.IsMacOs)
|
||||||
|
{
|
||||||
|
KeyBindings.Add(new KeyBinding { Command = ReactiveCommand.Create(ViewModel.ShowSettingsAsync), Gesture = new KeyGesture(Key.P, KeyModifiers.Control) });
|
||||||
|
KeyBindings.Add(new KeyBinding { Command = ReactiveCommand.Create(ViewModel.ShowAccountsAsync), Gesture = new KeyGesture(Key.A, KeyModifiers.Control | KeyModifiers.Shift) });
|
||||||
|
KeyBindings.Add(new KeyBinding { Command = ReactiveCommand.Create(ViewModel.ExportLibraryAsync), Gesture = new KeyGesture(Key.S, KeyModifiers.Control) });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void MainWindow_Loaded(object sender, EventArgs e)
|
private async void MainWindow_Loaded(object sender, EventArgs e)
|
||||||
@ -55,6 +64,12 @@ namespace LibationAvalonia.Views
|
|||||||
ViewModel.ProductsDisplay.BindToGrid(dbBooks);
|
ViewModel.ProductsDisplay.BindToGrid(dbBooks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void selectAndFocusSearchBox()
|
||||||
|
{
|
||||||
|
filterSearchTb.SelectAll();
|
||||||
|
filterSearchTb.Focus();
|
||||||
|
}
|
||||||
|
|
||||||
public void OnLibraryLoaded(List<LibraryBook> initialLibrary) => LibraryLoaded?.Invoke(this, initialLibrary);
|
public void OnLibraryLoaded(List<LibraryBook> initialLibrary) => LibraryLoaded?.Invoke(this, initialLibrary);
|
||||||
public void ProductsDisplay_LiberateClicked(object _, LibraryBook libraryBook) => ViewModel.LiberateClicked(libraryBook);
|
public void ProductsDisplay_LiberateClicked(object _, LibraryBook libraryBook) => ViewModel.LiberateClicked(libraryBook);
|
||||||
public void ProductsDisplay_LiberateSeriesClicked(object _, ISeriesEntry series) => ViewModel.LiberateSeriesClicked(series);
|
public void ProductsDisplay_LiberateSeriesClicked(object _, ISeriesEntry series) => ViewModel.LiberateSeriesClicked(series);
|
||||||
@ -71,19 +86,6 @@ namespace LibationAvalonia.Views
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void QuickFiltersMenuItem_KeyDown(object _, KeyEventArgs e)
|
|
||||||
{
|
|
||||||
int keyNum = (int)e.Key - 34;
|
|
||||||
|
|
||||||
if (keyNum <= 9 && keyNum >= 1)
|
|
||||||
{
|
|
||||||
ViewModel.QuickFilterMenuItems
|
|
||||||
.OfType<MenuItem>()
|
|
||||||
.FirstOrDefault(i => i.Header is string h && h.StartsWith($"_{keyNum}"))
|
|
||||||
?.Command
|
|
||||||
?.Execute(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void Configure_Upgrade()
|
private void Configure_Upgrade()
|
||||||
{
|
{
|
||||||
setProgressVisible(false);
|
setProgressVisible(false);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user