mirror of
https://github.com/QL-Win/QuickLook.git
synced 2026-01-30 01:03:02 +08:00
Fix #604: use an icon for "Open" to spare more space
This commit is contained in:
@@ -193,18 +193,16 @@ namespace QuickLook
|
||||
buttonShare.Visibility = ShareHelper.IsShareSupported(_path) ? Visibility.Visible : Visibility.Collapsed;
|
||||
|
||||
// open icon
|
||||
buttonOpenText.Inlines.Clear();
|
||||
|
||||
if (Directory.Exists(_path))
|
||||
{
|
||||
AddToInlines("MW_BrowseFolder", Path.GetFileName(_path));
|
||||
buttonOpen.ToolTip = string.Format(TranslationHelper.Get("MW_BrowseFolder"), Path.GetFileName(_path));
|
||||
return;
|
||||
}
|
||||
|
||||
var isExe = FileHelper.IsExecutable(_path, out var appFriendlyName);
|
||||
if (isExe)
|
||||
{
|
||||
AddToInlines("MW_Run", appFriendlyName);
|
||||
buttonOpen.ToolTip = string.Format(TranslationHelper.Get("MW_Run"), appFriendlyName);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -212,31 +210,12 @@ namespace QuickLook
|
||||
var found = FileHelper.GetAssocApplication(_path, out appFriendlyName);
|
||||
if (found)
|
||||
{
|
||||
AddToInlines("MW_OpenWith", appFriendlyName);
|
||||
buttonOpen.ToolTip = string.Format(TranslationHelper.Get("MW_OpenWith"), appFriendlyName);
|
||||
return;
|
||||
}
|
||||
|
||||
// assoc not found
|
||||
AddToInlines("MW_Open", Path.GetFileName(_path));
|
||||
|
||||
void AddToInlines(string str, string replaceWith)
|
||||
{
|
||||
// limit str length
|
||||
if (replaceWith.Length > 16)
|
||||
replaceWith = replaceWith.Substring(0, 8) + "…" + replaceWith.Substring(replaceWith.Length - 8);
|
||||
|
||||
str = TranslationHelper.Get(str);
|
||||
var elements = str.Split(new[] {"{0}"}, StringSplitOptions.None).ToList();
|
||||
while (elements.Count < 2)
|
||||
elements.Add(string.Empty);
|
||||
|
||||
buttonOpenText.Inlines.Add(
|
||||
new Run(elements[0]) {FontWeight = FontWeights.Normal}); // text beforehand
|
||||
buttonOpenText.Inlines.Add(
|
||||
new Run(replaceWith) {FontWeight = FontWeights.SemiBold}); // appFriendlyName
|
||||
buttonOpenText.Inlines.Add(
|
||||
new Run(elements[1]) {FontWeight = FontWeights.Normal}); // text afterward
|
||||
}
|
||||
buttonOpen.ToolTip = string.Format(TranslationHelper.Get("MW_Open"), Path.GetFileName(_path));
|
||||
}
|
||||
|
||||
internal void BeginHide()
|
||||
|
||||
@@ -102,14 +102,17 @@
|
||||
Content="" ToolTip="Share" />
|
||||
<Button DockPanel.Dock="Right" x:Name="buttonOpenWith" Style="{StaticResource CaptionButtonStyle}"
|
||||
Content="" ToolTip="Open With" />
|
||||
<Button x:Name="buttonOpen" DockPanel.Dock="Right"
|
||||
Style="{StaticResource CaptionTextButtonStyle}">
|
||||
<Button DockPanel.Dock="Right" x:Name="buttonOpen" Style="{StaticResource CaptionButtonStyle}"
|
||||
Content="" ToolTip="Open with XXX" />
|
||||
<!--<Button x:Name="buttonOpen" DockPanel.Dock="Right"
|
||||
Style="{StaticResource CaptionTextButtonStyle}"
|
||||
Visibility="{Binding ActualWidth, ElementName=windowCaptionContainer, Converter={StaticResource WidthToVisibilityCollapsedConverter}}">
|
||||
<Button.Content>
|
||||
<TextBlock x:Name="buttonOpenText" VerticalAlignment="Center">
|
||||
Open with <Bold>AppName</Bold>
|
||||
</TextBlock>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
</Button>-->
|
||||
<Button DockPanel.Dock="Left" x:Name="buttonTop" Tag="Auto" ToolTip="Stay on Top">
|
||||
<Button.Resources>
|
||||
<Grid x:Key="ContentTop">
|
||||
|
||||
Reference in New Issue
Block a user