Skip to content

Commit f1cf9d2

Browse files
committed
Improvements to tooltips on PackagesPages (fix #3501)
1 parent b740f6c commit f1cf9d2

7 files changed

+40
-17
lines changed

src/UniGetUI/Controls/CustomNavViewItem.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,13 @@ public int IconSize
5454

5555
public string Text
5656
{
57-
set => _textBlock.Text = CoreTools.Translate(value);
57+
set
58+
{
59+
string text = CoreTools.Translate(value);
60+
_textBlock.Text = text;
61+
ToolTipService.SetToolTip(this, text);
62+
}
63+
5864
}
5965

6066
private readonly TextBlock _textBlock;

src/UniGetUI/Controls/PackageWrapper.cs

+9-9
Original file line numberDiff line numberDiff line change
@@ -132,17 +132,17 @@ public void WhenTagHasChanged()
132132

133133
ListedNameTooltip = Package.Tag switch
134134
{
135-
PackageTag.Default => Package.Name,
136-
PackageTag.AlreadyInstalled => CoreTools.Translate("This package is already installed"),
135+
PackageTag.Default => "",
136+
PackageTag.AlreadyInstalled => CoreTools.Translate("This package is already installed") + " - ",
137137
PackageTag.IsUpgradable => CoreTools.Translate("This package can be upgraded to version {0}",
138-
Package.GetUpgradablePackage()?.NewVersionString ?? "-1"),
139-
PackageTag.Pinned => CoreTools.Translate("Updates for this package are ignored"),
140-
PackageTag.OnQueue => CoreTools.Translate("This package is on the queue"),
141-
PackageTag.BeingProcessed => CoreTools.Translate("This package is being processed"),
142-
PackageTag.Failed => CoreTools.Translate("An error occurred while processing this package"),
143-
PackageTag.Unavailable => CoreTools.Translate("This package is not available"),
138+
Package.GetUpgradablePackage()?.NewVersionString ?? "-1") + " - ",
139+
PackageTag.Pinned => CoreTools.Translate("Updates for this package are ignored") + " - ",
140+
PackageTag.OnQueue => CoreTools.Translate("This package is on the queue" + " - "),
141+
PackageTag.BeingProcessed => CoreTools.Translate("This package is being processed") + " - ",
142+
PackageTag.Failed => CoreTools.Translate("An error occurred while processing this package") + " - ",
143+
PackageTag.Unavailable => CoreTools.Translate("This package is not available") + " - ",
144144
_ => throw new ArgumentException($"Unknown tag {Package.Tag}"),
145-
} + " - " + Package.Name;
145+
} + Package.Name;
146146

147147
ListedOpacity = Package.Tag switch
148148
{

src/UniGetUI/Pages/SoftwarePages/AbstractPackagesPage.xaml

+11-3
Original file line numberDiff line numberDiff line change
@@ -690,12 +690,14 @@
690690
FontSize="24"
691691
FontWeight="ExtraLight"
692692
Icon="Package"
693+
ToolTipService.ToolTip="{x:Bind ListedNameTooltip, Mode=OneWay}"
693694
Visibility="{x:Bind ShowDefaultPackageIcon, Mode=OneWay}" />
694695
<Image
695696
Grid.Row="0"
696697
Grid.Column="1"
697698
VerticalAlignment="Center"
698699
Source="{x:Bind MainIconSource, Mode=OneWay}"
700+
ToolTipService.ToolTip="{x:Bind ListedNameTooltip, Mode=OneWay}"
699701
Visibility="{x:Bind ShowCustomPackageIcon, Mode=OneWay}" />
700702

701703
<!-- Package tag icon -->
@@ -711,6 +713,7 @@
711713
FontWeight="ExtraLight"
712714
Foreground="{ThemeResource AccentAAFillColorTertiaryBrush}"
713715
Icon="{x:Bind AlternateIconId, Mode=OneWay}"
716+
ToolTipService.ToolTip="{x:Bind ListedNameTooltip, Mode=OneWay}"
714717
Visibility="{x:Bind AlternateIdIconVisible, Mode=OneWay}" />
715718
<widgets:LocalIcon
716719
Grid.Row="0"
@@ -723,6 +726,7 @@
723726
FontSize="20"
724727
FontWeight="ExtraLight"
725728
Icon="{x:Bind MainIconId, Mode=OneWay}"
729+
ToolTipService.ToolTip="{x:Bind ListedNameTooltip, Mode=OneWay}"
726730
Visibility="{x:Bind AlternateIdIconVisible, Mode=OneWay}" />
727731

728732
<TextBlock
@@ -739,7 +743,8 @@
739743
VerticalAlignment="Center"
740744
FontSize="24"
741745
FontWeight="ExtraLight"
742-
Icon="Id" />
746+
Icon="Id"
747+
ToolTipService.ToolTip="{x:Bind Package.Id}" />
743748
<TextBlock
744749
Grid.Row="0"
745750
Grid.Column="4"
@@ -754,7 +759,8 @@
754759
VerticalAlignment="Center"
755760
FontSize="24"
756761
FontWeight="ExtraLight"
757-
Icon="version" />
762+
Icon="version"
763+
ToolTipService.ToolTip="{x:Bind Package.VersionString}" />
758764
<TextBlock
759765
Grid.Row="0"
760766
Grid.Column="6"
@@ -770,6 +776,7 @@
770776
FontSize="24"
771777
FontWeight="ExtraLight"
772778
Icon="download"
779+
ToolTipService.ToolTip="{x:Bind Package.NewVersionString}"
773780
Visibility="{x:Bind Package.IsUpgradable}" />
774781
<TextBlock
775782
Grid.Row="0"
@@ -786,7 +793,8 @@
786793
VerticalAlignment="Center"
787794
FontSize="24"
788795
FontWeight="ExtraLight"
789-
Icon="{x:Bind Package.Source.IconId}" />
796+
Icon="{x:Bind Package.Source.IconId}"
797+
ToolTipService.ToolTip="{x:Bind Package.Source.AsString_DisplayName}" />
790798
<TextBlock
791799
Grid.Row="0"
792800
Grid.Column="10"

src/UniGetUI/Pages/SoftwarePages/DiscoverSoftwarePage.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ public override void GenerateToolBar()
186186
toolButton.LabelPosition = CommandBarLabelPosition.Collapsed;
187187
}
188188

189-
toolButton.Label = Labels[toolButton].Trim();
189+
string text = Labels[toolButton].Trim();
190+
toolButton.Label = text;
191+
ToolTipService.SetToolTip(toolButton, text);
190192
}
191193

192194
Dictionary<AppBarButton, IconType> Icons = new()

src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,9 @@ public override void GenerateToolBar()
228228
toolButton.LabelPosition = CommandBarLabelPosition.Collapsed;
229229
}
230230

231-
toolButton.Label = Labels[toolButton].Trim();
231+
string text = Labels[toolButton].Trim();
232+
toolButton.Label = text;
233+
ToolTipService.SetToolTip(toolButton, text);
232234
}
233235

234236
Dictionary<AppBarButton, IconType> Icons = new()

src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,10 @@ public override void GenerateToolBar()
220220
toolButton.IsCompact = Labels[toolButton][0] == ' ';
221221
if (toolButton.IsCompact)
222222
toolButton.LabelPosition = CommandBarLabelPosition.Collapsed;
223-
toolButton.Label = Labels[toolButton].Trim();
223+
224+
string text = Labels[toolButton].Trim();
225+
toolButton.Label = text;
226+
ToolTipService.SetToolTip(toolButton, text);
224227
}
225228

226229
Dictionary<AppBarButton, IconType> Icons = new()

src/UniGetUI/Pages/SoftwarePages/SoftwareUpdatesPage.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,9 @@ public override void GenerateToolBar()
275275
toolButton.LabelPosition = CommandBarLabelPosition.Collapsed;
276276
}
277277

278-
toolButton.Label = Labels[toolButton].Trim();
278+
string text = Labels[toolButton].Trim();
279+
toolButton.Label = text;
280+
ToolTipService.SetToolTip(toolButton, text);
279281
}
280282

281283
Dictionary<AppBarButton, IconType> Icons = new()

0 commit comments

Comments
 (0)