Phase C (T2-1..T3-10): command palette, reader mode (real Readability.js, E2E), boost force-dark, screenshot, split view, vertical tabs, Glance (Alt+click), tab groups (6 colors), workspaces, speed dial, InPrivate tabs, quick find, source view, print, PiP, TTS (94 tests GREEN)
This commit is contained in:
parent
0caa1111e7
commit
406957088f
14 changed files with 3496 additions and 7 deletions
66
VideoDownloader.App/Browser/GlanceWindow.xaml.cs
Normal file
66
VideoDownloader.App/Browser/GlanceWindow.xaml.cs
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
using System.Windows.Controls;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using Microsoft.Web.WebView2.Core;
|
||||
using VideoDownloader.Core.Config;
|
||||
using Wv2 = Microsoft.Web.WebView2.Wpf;
|
||||
|
||||
namespace VideoDownloader.App.Browser;
|
||||
|
||||
/// <summary>T2-6 Glance: Alt+클릭 링크의 플로팅 미리보기(Zen Glance 패턴) — 닫기/탭으로 승격.</summary>
|
||||
public partial class GlanceWindow : Window
|
||||
{
|
||||
private readonly Wv2.WebView2 _web = new() { DefaultBackgroundColor = System.Drawing.Color.Black };
|
||||
private readonly CoreWebView2Environment _env;
|
||||
private readonly AppConfig _config;
|
||||
|
||||
public string Url { get; }
|
||||
public event Action<GlanceWindow>? ExpandRequested;
|
||||
|
||||
public GlanceWindow(CoreWebView2Environment env, AppConfig config, string url)
|
||||
{
|
||||
_env = env;
|
||||
_config = config;
|
||||
Url = url;
|
||||
|
||||
Width = 720; Height = 520;
|
||||
WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
||||
ResizeMode = ResizeMode.CanResize;
|
||||
|
||||
var bar = new Border
|
||||
{
|
||||
Background = System.Windows.Media.Brushes.Black,
|
||||
Padding = new Thickness(8, 6, 8, 6)
|
||||
};
|
||||
var dock = new DockPanel();
|
||||
var close = new Button { Content = "✕ 닫기", Padding = new Thickness(10, 3, 10, 3), Margin = new Thickness(4, 0, 4, 0), Background = System.Windows.Media.Brushes.Transparent, Foreground = System.Windows.Media.Brushes.White, BorderBrush = System.Windows.Media.Brushes.Gray };
|
||||
close.Click += (_, _) => Close();
|
||||
var expand = new Button { Content = "⤢ 탭으로 열기", Padding = new Thickness(10, 3, 10, 3), Background = System.Windows.Media.Brushes.Transparent, Foreground = System.Windows.Media.Brushes.White, BorderBrush = System.Windows.Media.Brushes.Gray };
|
||||
expand.Click += (_, _) => ExpandRequested?.Invoke(this);
|
||||
var title = new TextBlock { Text = url, Foreground = System.Windows.Media.Brushes.LightGray, FontSize = 11, VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis };
|
||||
DockPanel.SetDock(close, Dock.Right);
|
||||
DockPanel.SetDock(expand, Dock.Right);
|
||||
dock.Children.Add(close);
|
||||
dock.Children.Add(expand);
|
||||
dock.Children.Add(title);
|
||||
bar.Child = dock;
|
||||
|
||||
var grid = new Grid { RowDefinitions = { new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } } };
|
||||
Grid.SetRow(bar, 0); Grid.SetRow(_web, 1);
|
||||
grid.Children.Add(bar);
|
||||
grid.Children.Add(_web);
|
||||
Content = grid;
|
||||
|
||||
Loaded += async (_, _) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var options = _env.CreateCoreWebView2ControllerOptions();
|
||||
if (_config.PrivateMode) options.IsInPrivateModeEnabled = true;
|
||||
await _web.EnsureCoreWebView2Async(_env, options);
|
||||
_web.CoreWebView2!.Navigate(url);
|
||||
}
|
||||
catch { }
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue