Skip to content

Commit 222a1b5

Browse files
committed
Revert changes in toolbar layout, switch to a split button instead of all flyout (related to #3894)
1 parent c66b380 commit 222a1b5

7 files changed

Lines changed: 112 additions & 99 deletions

File tree

src/UniGetUI/AppOperationHelper.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ public static async Task Download(IEnumerable<IPackage> packages, TEL_InstallRef
138138
{
139139
try
140140
{
141+
if (!packages.Any()) return;
142+
141143
var hWnd = MainApp.Instance.MainWindow.GetWindowHandle();
142144
var a = new ExternalLibraries.Pickers.FolderPicker(hWnd);
143145
var outputPath = await Task.Run(a.Show);

src/UniGetUI/Pages/MainView.xaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
xmlns:operations="using:UniGetUI.PackageOperations"
1414
xmlns:pages="using:UniGetUI.Interface"
1515
xmlns:widgets="using:UniGetUI.Interface.Widgets"
16-
xmlns:winex="using:WinUIEx"
1716
MinWidth="200"
1817
MinHeight="200"
1918
mc:Ignorable="d">
@@ -71,7 +70,7 @@
7170
Click="RetryFailedOps_Click"
7271
IconName="Reload"
7372
Text="Retry failed operations" />
74-
<MenuFlyoutSeparator/>
73+
<MenuFlyoutSeparator />
7574
<widgets:BetterMenuItem
7675
Name="ClearSuccessful"
7776
Click="ClearSuccessfulOps_Click"
@@ -82,7 +81,7 @@
8281
Click="ClearAllFinished_OnClick"
8382
IconName="ClipboardList"
8483
Text="Clear finished operations" />
85-
<MenuFlyoutSeparator/>
84+
<MenuFlyoutSeparator />
8685
<widgets:BetterMenuItem
8786
Name="CancellAllOps"
8887
Click="CancellAllOps_Click"
@@ -258,6 +257,8 @@
258257
<NavigationView.Resources>
259258
<SolidColorBrush x:Key="NavigationViewContentBackground" Color="Transparent" />
260259
<Thickness x:Key="NavigationViewContentGridBorderThickness">0,0,0,0</Thickness>
260+
<Thickness x:Key="NavigationViewMinimalContentGridBorderThickness">0,0,0,0</Thickness>
261+
<Thickness x:Key="TopNavigationViewContentGridBorderThickness">0,0,0,0</Thickness>
261262
</NavigationView.Resources>
262263

263264
<NavigationView.MenuItems>
@@ -412,7 +413,10 @@
412413
SizeChanged="OperationScrollView_SizeChanged">
413414
<ItemsControl.ItemsPanel>
414415
<ItemsPanelTemplate>
415-
<StackPanel Orientation="Vertical" Spacing="8" Margin="-16,0,-12,0" />
416+
<StackPanel
417+
Margin="-16,0,-12,0"
418+
Orientation="Vertical"
419+
Spacing="8" />
416420
</ItemsPanelTemplate>
417421
</ItemsControl.ItemsPanel>
418422
<ListView.Resources>

src/UniGetUI/Pages/SoftwarePages/AbstractPackagesPage.xaml

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -601,12 +601,14 @@
601601
Grid.Column="0"
602602
Grid.ColumnSpan="3">
603603
<Grid.ColumnDefinitions>
604+
<ColumnDefinition Width="Auto" />
604605
<ColumnDefinition Width="Auto" />
605606
<ColumnDefinition Width="*" />
606607
</Grid.ColumnDefinitions>
607608

608609
<StackPanel
609610
x:Name="ToggleFiltersButtonWidth"
611+
Margin="0,0,13,0"
610612
Orientation="Horizontal">
611613
<ToggleButton
612614
x:Name="ToggleFiltersButton"
@@ -616,27 +618,73 @@
616618
Padding="8,4"
617619
x:FieldModifier="protected"
618620
Background="Transparent"
619-
BorderBrush="Transparent"
621+
BorderThickness="0"
620622
Click="ToggleFiltersButton_Click"
621-
CornerRadius="4">
623+
CornerRadius="4"
624+
Foreground="{ThemeResource TextFillColorPrimaryBrush}">
625+
<ToggleButton.Resources>
626+
<ResourceDictionary>
627+
<StaticResource x:Key="ToggleButtonBackgroundChecked" ResourceKey="ControlFillColorDefaultBrush" />
628+
<StaticResource x:Key="ToggleButtonBackgroundCheckedPointerOver" ResourceKey="ControlFillColorSecondaryBrush" />
629+
<StaticResource x:Key="ToggleButtonBackgroundCheckedPressed" ResourceKey="ControlFillColorTertiaryBrush" />
630+
</ResourceDictionary>
631+
</ToggleButton.Resources>
622632
<StackPanel Orientation="Horizontal" Spacing="8">
623-
<FontIcon FontSize="20" Glyph="&#xE71C;" />
633+
<FontIcon
634+
FontSize="20"
635+
Foreground="{ThemeResource TextFillColorPrimaryBrush}"
636+
Glyph="&#xE71C;" />
624637
<widgets:TranslatedTextBlock
625638
VerticalAlignment="Center"
626639
FontSize="12"
627-
FontWeight="SemiBold"
640+
FontWeight="Medium"
641+
Foreground="{ThemeResource TextFillColorPrimaryBrush}"
628642
Text="Filters" />
629643
</StackPanel>
630644
</ToggleButton>
631645
</StackPanel>
632646

647+
<StackPanel Grid.Column="1" Orientation="Horizontal">
648+
<Button
649+
x:Name="MainToolbarButton"
650+
Height="36"
651+
Margin="0,0,1,0"
652+
x:FieldModifier="protected"
653+
BorderThickness="0"
654+
CornerRadius="4,0,0,4">
655+
<StackPanel
656+
VerticalAlignment="Stretch"
657+
Orientation="Horizontal"
658+
Spacing="4">
659+
<widgets:LocalIcon
660+
x:Name="MainToolbarButtonIcon"
661+
VerticalAlignment="Center"
662+
x:FieldModifier="protected" />
663+
<TextBlock
664+
x:Name="MainToolbarButtonText"
665+
VerticalAlignment="Center"
666+
x:FieldModifier="protected"
667+
FontSize="12"
668+
FontWeight="SemiBold" />
669+
</StackPanel>
670+
</Button>
671+
<Button
672+
x:Name="MainToolbarButtonDropdown"
673+
Width="30"
674+
Height="36"
675+
Padding="4"
676+
x:FieldModifier="protected"
677+
BorderThickness="0"
678+
CornerRadius="0,4,4,0">
679+
<FontIcon FontSize="14" Glyph="&#xE70D;" />
680+
</Button>
681+
</StackPanel>
682+
633683
<CommandBar
634684
Name="ToolBar"
635685
Grid.Column="2"
636686
HorizontalAlignment="Left"
637687
x:FieldModifier="protected"
638-
BorderBrush="Red"
639-
BorderThickness="1"
640688
DefaultLabelPosition="Right" />
641689
</Grid>
642690
</Grid>

src/UniGetUI/Pages/SoftwarePages/DiscoverSoftwarePage.cs

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -143,30 +143,24 @@ public override BetterMenu GenerateContextMenu()
143143

144144
public override void GenerateToolBar()
145145
{
146-
BetterMenuItem InstallSelected = new();
147146
BetterMenuItem InstallAsAdmin = new();
148147
BetterMenuItem InstallSkipHash = new();
149148
BetterMenuItem InstallInteractive = new();
150149
BetterMenuItem DownloadInstallers = new();
151150

152-
AppBarButton InstallMenu = new()
151+
MainToolbarButtonDropdown.Flyout = new BetterMenu()
153152
{
154-
Flyout = new BetterMenu()
155-
{
156-
Items =
157-
{
158-
InstallSelected,
159-
new MenuFlyoutSeparator(),
160-
InstallAsAdmin,
161-
InstallSkipHash,
162-
InstallInteractive,
163-
new MenuFlyoutSeparator(),
164-
DownloadInstallers,
153+
Items = {
154+
InstallAsAdmin,
155+
InstallSkipHash,
156+
InstallInteractive,
157+
new MenuFlyoutSeparator(),
158+
DownloadInstallers,
165159
},
166-
Placement = FlyoutPlacementMode.Bottom
167-
},
168-
FontWeight = new FontWeight(600),
160+
Placement = FlyoutPlacementMode.Bottom
169161
};
162+
MainToolbarButtonIcon.Icon = IconType.Download;
163+
MainToolbarButtonText.Text = CoreTools.Translate("Install selection");
170164

171165
AppBarButton InstallationSettings = new();
172166

@@ -177,7 +171,6 @@ public override void GenerateToolBar()
177171

178172
AppBarButton HelpButton = new();
179173

180-
ToolBar.PrimaryCommands.Add(InstallMenu);
181174
ToolBar.PrimaryCommands.Add(new AppBarSeparator());
182175
ToolBar.PrimaryCommands.Add(InstallationSettings);
183176
ToolBar.PrimaryCommands.Add(new AppBarSeparator());
@@ -191,8 +184,6 @@ public override void GenerateToolBar()
191184
Dictionary<DependencyObject, string> Labels = new()
192185
{ // Entries with a trailing space are collapsed
193186
// Their texts will be used as the tooltip
194-
{ InstallMenu, CoreTools.Translate("Install and more") + "..." },
195-
{ InstallSelected, CoreTools.Translate("Install selected packages") },
196187
{ InstallAsAdmin, CoreTools.Translate("Install as administrator") },
197188
{ InstallSkipHash, CoreTools.Translate("Skip integrity checks") },
198189
{ InstallInteractive, CoreTools.Translate("Interactive installation") },
@@ -206,8 +197,6 @@ public override void GenerateToolBar()
206197

207198
Dictionary<DependencyObject, IconType> Icons = new()
208199
{
209-
{ InstallMenu, IconType.Download },
210-
{ InstallSelected, IconType.Download },
211200
{ InstallAsAdmin, IconType.UAC },
212201
{ InstallSkipHash, IconType.Checksum },
213202
{ InstallationSettings, IconType.Options },
@@ -226,7 +215,7 @@ public override void GenerateToolBar()
226215
HelpButton.Click += (_, _) => MainApp.Instance.MainWindow.NavigationPage.ShowHelp();
227216
InstallationSettings.Click += (_, _) => _ = ShowInstallationOptionsForPackage(SelectedItem);
228217

229-
InstallSelected.Click += (_, _) => MainApp.Operations.Install(FilteredPackages.GetCheckedPackages(), TEL_InstallReferral.DIRECT_SEARCH);
218+
MainToolbarButton.Click += (_, _) => MainApp.Operations.Install(FilteredPackages.GetCheckedPackages(), TEL_InstallReferral.DIRECT_SEARCH);
230219
InstallAsAdmin.Click += (_, _) => MainApp.Operations.Install(FilteredPackages.GetCheckedPackages(), TEL_InstallReferral.DIRECT_SEARCH, elevated: true);
231220
InstallSkipHash.Click += (_, _) => MainApp.Operations.Install(FilteredPackages.GetCheckedPackages(), TEL_InstallReferral.DIRECT_SEARCH, no_integrity: true);
232221
InstallInteractive.Click += (_, _) => MainApp.Operations.Install(FilteredPackages.GetCheckedPackages(), TEL_InstallReferral.DIRECT_SEARCH, interactive: true);

src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -179,28 +179,23 @@ public override BetterMenu GenerateContextMenu()
179179

180180
public override void GenerateToolBar()
181181
{
182-
BetterMenuItem UninstallSelected = new();
183182
BetterMenuItem UninstallAsAdmin = new();
184183
BetterMenuItem UninstallInteractive = new();
185184
BetterMenuItem DownloadInstallers = new();
186185

187-
AppBarButton UninstallMenu = new()
186+
MainToolbarButtonDropdown.Flyout = new BetterMenu()
188187
{
189-
Flyout = new BetterMenu()
188+
Items =
190189
{
191-
Items =
192-
{
193-
UninstallSelected,
194-
new MenuFlyoutSeparator(),
195-
UninstallAsAdmin,
196-
UninstallInteractive,
197-
new MenuFlyoutSeparator(),
198-
DownloadInstallers,
199-
},
200-
Placement = FlyoutPlacementMode.Bottom
190+
UninstallAsAdmin,
191+
UninstallInteractive,
192+
new MenuFlyoutSeparator(),
193+
DownloadInstallers,
201194
},
202-
FontWeight = new FontWeight(600),
195+
Placement = FlyoutPlacementMode.Bottom
203196
};
197+
MainToolbarButtonIcon.Icon = IconType.Delete;
198+
MainToolbarButtonText.Text = CoreTools.Translate("Uninstall selection");
204199

205200
AppBarButton InstallationSettings = new();
206201

@@ -213,7 +208,6 @@ public override void GenerateToolBar()
213208

214209
AppBarButton HelpButton = new();
215210

216-
ToolBar.PrimaryCommands.Add(UninstallMenu);
217211
ToolBar.PrimaryCommands.Add(new AppBarSeparator());
218212
ToolBar.PrimaryCommands.Add(InstallationSettings);
219213
ToolBar.PrimaryCommands.Add(new AppBarSeparator());
@@ -230,8 +224,6 @@ public override void GenerateToolBar()
230224
Dictionary<DependencyObject, string> Labels = new()
231225
{ // Entries with a trailing space are collapsed
232226
// Their texts will be used as the tooltip
233-
{ UninstallMenu, CoreTools.Translate("Uninstall and more") + "..." },
234-
{ UninstallSelected, CoreTools.Translate("Uninstall selected packages") },
235227
{ UninstallAsAdmin, CoreTools.Translate("Uninstall as administrator") },
236228
{ UninstallInteractive, CoreTools.Translate("Interactive uninstall") },
237229
{ DownloadInstallers, CoreTools.Translate("Download selected installers") },
@@ -246,8 +238,6 @@ public override void GenerateToolBar()
246238

247239
Dictionary<DependencyObject, IconType> Icons = new()
248240
{
249-
{ UninstallMenu, IconType.Delete },
250-
{ UninstallSelected, IconType.Delete },
251241
{ UninstallAsAdmin, IconType.UAC },
252242
{ UninstallInteractive, IconType.Interactive },
253243
{ DownloadInstallers, IconType.Download },
@@ -280,7 +270,7 @@ public override void GenerateToolBar()
280270
}
281271
};
282272

283-
UninstallSelected.Click += (_, _) => _ = MainApp.Operations.ConfirmAndUninstall(FilteredPackages.GetCheckedPackages());
273+
MainToolbarButton.Click += (_, _) => _ = MainApp.Operations.ConfirmAndUninstall(FilteredPackages.GetCheckedPackages());
284274
UninstallAsAdmin.Click += (_, _) => _ = MainApp.Operations.ConfirmAndUninstall(FilteredPackages.GetCheckedPackages(), elevated: true);
285275
UninstallInteractive.Click += (_, _) => _ = MainApp.Operations.ConfirmAndUninstall(FilteredPackages.GetCheckedPackages(), interactive: true);
286276
DownloadInstallers.Click += (_, _) => _ = MainApp.Operations.Download(FilteredPackages.GetCheckedPackages(), TEL_InstallReferral.ALREADY_INSTALLED);

src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -174,30 +174,25 @@ public override void GenerateToolBar()
174174
AppBarButton OpenBundle = new();
175175
AppBarButton NewBundle = new();
176176

177-
BetterMenuItem InstallSelected = new();
178177
BetterMenuItem InstallAsAdmin = new();
179178
BetterMenuItem InstallSkipHash = new();
180179
BetterMenuItem InstallInteractive = new();
181180
BetterMenuItem DownloadInstallers = new();
182181

183-
AppBarButton InstallMenu = new()
182+
MainToolbarButtonDropdown.Flyout = new BetterMenu()
184183
{
185-
Flyout = new BetterMenu()
184+
Items =
186185
{
187-
Items =
188-
{
189-
InstallSelected,
190-
new MenuFlyoutSeparator(),
191-
InstallAsAdmin,
192-
InstallSkipHash,
193-
InstallInteractive,
194-
new MenuFlyoutSeparator(),
195-
DownloadInstallers,
196-
},
197-
Placement = FlyoutPlacementMode.Bottom
186+
InstallAsAdmin,
187+
InstallSkipHash,
188+
InstallInteractive,
189+
new MenuFlyoutSeparator(),
190+
DownloadInstallers,
198191
},
199-
FontWeight = new FontWeight(600),
192+
Placement = FlyoutPlacementMode.Bottom
200193
};
194+
MainToolbarButtonIcon.Icon = IconType.Download;
195+
MainToolbarButtonText.Text = CoreTools.Translate("Install selected packages");
201196

202197
AppBarButton RemoveSelected = new();
203198
AppBarButton SaveBundle = new();
@@ -206,12 +201,11 @@ public override void GenerateToolBar()
206201
AppBarButton SharePackage = new();
207202
AppBarButton HelpButton = new();
208203

204+
ToolBar.PrimaryCommands.Add(new AppBarSeparator());
209205
ToolBar.PrimaryCommands.Add(NewBundle);
210206
ToolBar.PrimaryCommands.Add(OpenBundle);
211207
ToolBar.PrimaryCommands.Add(SaveBundle);
212208
ToolBar.PrimaryCommands.Add(new AppBarSeparator());
213-
ToolBar.PrimaryCommands.Add(InstallMenu);
214-
ToolBar.PrimaryCommands.Add(new AppBarSeparator());
215209
ToolBar.PrimaryCommands.Add(AddPackagesToBundle);
216210
ToolBar.PrimaryCommands.Add(RemoveSelected);
217211
ToolBar.PrimaryCommands.Add(new AppBarSeparator());
@@ -224,8 +218,6 @@ public override void GenerateToolBar()
224218
{ // Entries with a trailing space are collapsed
225219
// Their texts will be used as the tooltip
226220
{ NewBundle, CoreTools.Translate("New") },
227-
{ InstallMenu, CoreTools.Translate("Install and more") + "..." },
228-
{ InstallSelected, CoreTools.Translate("Install selected packages") },
229221
{ InstallAsAdmin, CoreTools.Translate("Install as administrator") },
230222
{ InstallInteractive, CoreTools.Translate("Interactive installation") },
231223
{ InstallSkipHash, CoreTools.Translate("Skip integrity checks") },
@@ -242,9 +234,8 @@ public override void GenerateToolBar()
242234
Dictionary<DependencyObject, IconType> Icons = new()
243235
{
244236
{ NewBundle, IconType.AddTo },
245-
{ InstallMenu, IconType.Download },
246-
{ InstallSelected, IconType.Download },
247-
{ InstallAsAdmin, IconType.UAC }, { InstallInteractive, IconType.Interactive },
237+
{ InstallAsAdmin, IconType.UAC },
238+
{ InstallInteractive, IconType.Interactive },
248239
{ InstallSkipHash, IconType.Checksum },
249240
{ DownloadInstallers, IconType.Download },
250241
{ OpenBundle, IconType.OpenFolder },
@@ -292,7 +283,7 @@ IReadOnlyList<IPackage> GetCheckedNonInstalledPackages()
292283
return FilteredPackages.GetCheckedPackages().Where(p => p.Tag is not PackageTag.AlreadyInstalled).ToList();
293284
}
294285

295-
InstallSelected.Click += async (_, _) => await ImportAndInstallPackage(GetCheckedNonInstalledPackages());
286+
MainToolbarButton.Click += async (_, _) => await ImportAndInstallPackage(GetCheckedNonInstalledPackages());
296287
InstallSkipHash.Click += async (_, _) => await ImportAndInstallPackage(GetCheckedNonInstalledPackages(), skiphash: true);
297288
InstallInteractive.Click += async (_, _) => await ImportAndInstallPackage(GetCheckedNonInstalledPackages(), interactive: true);
298289
InstallAsAdmin.Click += async (_, _) => await ImportAndInstallPackage(GetCheckedNonInstalledPackages(), elevated: true);

0 commit comments

Comments
 (0)