Skip to content

Commit 5f37711

Browse files
committed
Improve UI: Refine Recycle Bin icon display #1610
1 parent 1903687 commit 5f37711

File tree

6 files changed

+334
-62
lines changed

6 files changed

+334
-62
lines changed

QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/CLSIDInfoPanel.xaml.cs

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// You should have received a copy of the GNU General Public License
1616
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

18+
using QuickLook.Common.Plugin;
1819
using System.Windows;
1920
using System.Windows.Controls;
2021

@@ -28,26 +29,18 @@ public CLSIDInfoPanel()
2829
InitializeComponent();
2930
}
3031

31-
public void DisplayInfo(string path)
32+
public void DisplayInfo(string path, ContextObject context)
3233
{
33-
switch (path.ToUpper())
34+
Content = path.ToUpper() switch
3435
{
35-
case CLSIDRegister.RecycleBin:
36-
Content = new RecycleBinPanel();
37-
break;
38-
39-
case CLSIDRegister.ThisPC:
40-
Content = new ThisPCPanel();
41-
break;
42-
43-
default:
44-
Content = new TextBlock()
45-
{
46-
Text = $"Unsupported for {path}",
47-
HorizontalAlignment = HorizontalAlignment.Center,
48-
VerticalAlignment = VerticalAlignment.Center,
49-
};
50-
break;
51-
}
36+
CLSIDRegister.RecycleBin => new RecycleBinPanel(context),
37+
CLSIDRegister.ThisPC => new ThisPCPanel(context),
38+
_ => new TextBlock()
39+
{
40+
Text = $"Unsupported for {path}",
41+
HorizontalAlignment = HorizontalAlignment.Center,
42+
VerticalAlignment = VerticalAlignment.Center,
43+
},
44+
};
5245
}
5346
}

QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/Plugin.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void Prepare(string path, ContextObject context)
4949
{
5050
context.PreferredSize = path switch
5151
{
52-
CLSIDRegister.RecycleBin => new Size { Width = 520, Height = 192 },
52+
CLSIDRegister.RecycleBin => new Size { Width = 400, Height = 150 },
5353
CLSIDRegister.ThisPC => new Size { Width = 900, Height = 800 },
5454
_ => new Size { Width = 520, Height = 192 },
5555
};
@@ -59,13 +59,11 @@ public void View(string path, ContextObject context)
5959
{
6060
_path = path;
6161
_ip = new CLSIDInfoPanel();
62-
63-
_ip.DisplayInfo(_path);
64-
_ip.Tag = context;
62+
_ip.DisplayInfo(path, context);
6563

6664
context.ViewerContent = _ip;
6765
context.Title = $"{CLSIDRegister.GetName(path) ?? path}";
68-
context.IsBusy = false;
66+
context.IsBusy = true;
6967
}
7068

7169
public void Cleanup()

QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/RecycleBinPanel.xaml

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,54 @@
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5-
xmlns:local="clr-namespace:QuickLook.Plugin.CLSIDViewer"
65
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
76
d:DesignHeight="450"
87
d:DesignWidth="800"
98
mc:Ignorable="d">
10-
<Grid>
11-
<TextBlock x:Name="EmptyRecycleBinText"
12-
HorizontalAlignment="Center"
13-
VerticalAlignment="Center"
14-
Text="Recycle Bin is empty" />
15-
<Grid>
16-
<Button x:Name="EmptyRecycleBinButton"
17-
Grid.Column="0"
18-
HorizontalAlignment="Center"
19-
VerticalAlignment="Center"
20-
Click="OnEmptyRecycleBinClick"
21-
Content="Empty Recycle Bin" />
9+
<Grid Margin="0,-50,0,0">
10+
<Grid.ColumnDefinitions>
11+
<ColumnDefinition Width="120" />
12+
<ColumnDefinition Width="*" />
13+
</Grid.ColumnDefinitions>
14+
<Image x:Name="image"
15+
Grid.Row="0"
16+
Grid.Column="0"
17+
Width="48"
18+
Height="48"
19+
Opacity="1"
20+
Stretch="Fill">
21+
<Image.Style>
22+
<Style TargetType="{x:Type Image}">
23+
<Style.Triggers>
24+
<DataTrigger Binding="{Binding Source, ElementName=image}" Value="{x:Null}">
25+
<DataTrigger.ExitActions>
26+
<BeginStoryboard>
27+
<Storyboard>
28+
<DoubleAnimation BeginTime="0:0:0"
29+
Storyboard.TargetProperty="Opacity"
30+
From="0"
31+
To="1"
32+
Duration="0:0:0.05" />
33+
</Storyboard>
34+
</BeginStoryboard>
35+
</DataTrigger.ExitActions>
36+
</DataTrigger>
37+
</Style.Triggers>
38+
</Style>
39+
</Image.Style>
40+
</Image>
41+
<Grid Grid.Column="1" VerticalAlignment="Center">
42+
<Grid.RowDefinitions>
43+
<RowDefinition Height="Auto" />
44+
<RowDefinition Height="Auto" />
45+
</Grid.RowDefinitions>
46+
<TextBlock x:Name="totalSizeAndCount"
47+
Grid.Row="0"
48+
Padding="3" />
49+
<Button x:Name="emptyButton"
50+
Grid.Row="1"
51+
Margin="0,5,0,0"
52+
Command="{Binding EmptyRecycleBinCommand}" />
2253
</Grid>
2354
</Grid>
2455
</UserControl>

0 commit comments

Comments
 (0)