mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-09 17:41:14 +10:00
Rework foss filtering (#4696)
* Replace FOSS highlight toggle with inline label Remove the separate "Highlight FOSS" toggle and its theming logic, and instead append an inline "- FOSS" label to FOSS app entries. Changes: remove WPFToggleFOSSHighlight from app navigation and related event handlers, delete FOSSColor resource updates in theme code and button handler, simplify checkbox setup in Invoke-WPFUIElements by removing the special-case toggle logic, and update Initialize-InstallAppEntry to build a horizontal panel containing the app name plus a small green "- FOSS" TextBlock for FOSS items. This consolidates FOSS indication into the item UI and cleans up toggle/theme handling. * Add inline FOSS label to app entries Replace the separate StackPanel/TextBlock used for the FOSS indicator with an inline System.Windows.Documents.Run appended to the app name. The run is styled (green RGB(76,175,80) and FontSize=10) and the checkbox content assignment was moved outside the conditional so the appName (with optional FOSS run) is always used. Cleaned up related comments to reflect the FOSS label change. * Add FOSS note type with green bullet Added FOSS notes in the UI and FOSS labels with a green bullet instead of the text '#FOSS' * Use larger circle glyph; remove italic text Replaced the FOSS and list bullet glyphs with a larger circle for better visual consistency and removed the italic styling * Update FOSS/bullet glyphs, colors and sizes Updated FOSS/list bullet styling by switching glyphs from U+2B24 to U+25CF, increasing size (10→11.5), and adjusting bullet/text colors for better visibility and consistency across.
This commit is contained in:
@@ -73,12 +73,11 @@
|
|||||||
"Order": "5",
|
"Order": "5",
|
||||||
"Description": "Show the selected applications"
|
"Description": "Show the selected applications"
|
||||||
},
|
},
|
||||||
"WPFToggleFOSSHighlight": {
|
"WPFInstallFOSSInfo": {
|
||||||
"Content": "Highlight FOSS",
|
"Content": "Free and Open Source Software",
|
||||||
"Category": "__Selection",
|
"Category": "__Selection",
|
||||||
"Type": "Toggle",
|
"Type": "Note",
|
||||||
"Checked": true,
|
"Order": "0",
|
||||||
"Order": "6",
|
"Description": "Information about the #FOSS label on application entries"
|
||||||
"Description": "Toggle the green highlight for FOSS applications"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,13 +63,14 @@ function Initialize-InstallAppEntry {
|
|||||||
$appName.Style = $sync.Form.Resources.AppEntryNameStyle
|
$appName.Style = $sync.Form.Resources.AppEntryNameStyle
|
||||||
$appName.Text = $Apps.$appKey.content
|
$appName.Text = $Apps.$appKey.content
|
||||||
|
|
||||||
# Change color to Green if FOSS
|
# Add FOSS label after the name if FOSS
|
||||||
if ($Apps.$appKey.foss -eq $true) {
|
if ($Apps.$appKey.foss -eq $true) {
|
||||||
$appName.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "FOSSColor")
|
$fossRun = [System.Windows.Documents.Run]::new(" $([char]0x25CF)")
|
||||||
$appName.FontWeight = "Bold"
|
$fossRun.Foreground = [Windows.Media.SolidColorBrush]::new([Windows.Media.Color]::FromRgb(110, 255, 114))
|
||||||
}
|
$fossRun.FontSize = 11.5
|
||||||
|
|
||||||
# Add the name to the Checkbox
|
[void]$appName.Inlines.Add($fossRun)
|
||||||
|
}
|
||||||
$checkBox.Content = $appName
|
$checkBox.Content = $appName
|
||||||
|
|
||||||
# Add accessibility properties to make the elements screen reader friendly
|
# Add accessibility properties to make the elements screen reader friendly
|
||||||
|
|||||||
@@ -150,18 +150,6 @@ function Invoke-WinutilThemeChange {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set FOSS Highlight Color
|
|
||||||
$fossEnabled = $true
|
|
||||||
if ($sync.WPFToggleFOSSHighlight) {
|
|
||||||
$fossEnabled = $sync.WPFToggleFOSSHighlight.IsChecked
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($fossEnabled) {
|
|
||||||
$sync.Form.Resources["FOSSColor"] = [Windows.Media.SolidColorBrush]::new([Windows.Media.Color]::FromRgb(76, 175, 80)) # #4CAF50
|
|
||||||
} else {
|
|
||||||
$sync.Form.Resources["FOSSColor"] = $sync.Form.Resources["MainForegroundColor"]
|
|
||||||
}
|
|
||||||
|
|
||||||
# Update the theme selector button with the appropriate icon
|
# Update the theme selector button with the appropriate icon
|
||||||
$ThemeButton = $sync.Form.FindName("ThemeButton")
|
$ThemeButton = $sync.Form.FindName("ThemeButton")
|
||||||
$ThemeButton.Content = [string]$themeButtonIcon
|
$ThemeButton.Content = [string]$themeButtonIcon
|
||||||
|
|||||||
@@ -68,12 +68,5 @@ function Invoke-WPFButton {
|
|||||||
"WPFCloseButton" {$sync.Form.Close(); Write-Host "Bye bye!"}
|
"WPFCloseButton" {$sync.Form.Close(); Write-Host "Bye bye!"}
|
||||||
"WPFMinimizeButton" {$sync.Form.WindowState = [Windows.WindowState]::Minimized}
|
"WPFMinimizeButton" {$sync.Form.WindowState = [Windows.WindowState]::Minimized}
|
||||||
"WPFselectedAppsButton" {$sync.selectedAppsPopup.IsOpen = -not $sync.selectedAppsPopup.IsOpen}
|
"WPFselectedAppsButton" {$sync.selectedAppsPopup.IsOpen = -not $sync.selectedAppsPopup.IsOpen}
|
||||||
"WPFToggleFOSSHighlight" {
|
|
||||||
if ($sync.WPFToggleFOSSHighlight.IsChecked) {
|
|
||||||
$sync.Form.Resources["FOSSColor"] = [Windows.Media.SolidColorBrush]::new([Windows.Media.Color]::FromRgb(76, 175, 80)) # #4CAF50
|
|
||||||
} else {
|
|
||||||
$sync.Form.Resources["FOSSColor"] = $sync.Form.Resources["MainForegroundColor"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -177,38 +177,25 @@ function Invoke-WPFUIElements {
|
|||||||
$itemsControl.Items.Add($dockPanel) | Out-Null
|
$itemsControl.Items.Add($dockPanel) | Out-Null
|
||||||
|
|
||||||
$sync[$entryInfo.Name] = $checkBox
|
$sync[$entryInfo.Name] = $checkBox
|
||||||
if ($entryInfo.Name -eq "WPFToggleFOSSHighlight") {
|
$sync[$entryInfo.Name].IsChecked = (Get-WinUtilToggleStatus $entryInfo.Name)
|
||||||
if ($entryInfo.Checked -eq $true) {
|
|
||||||
$sync[$entryInfo.Name].IsChecked = $true
|
|
||||||
}
|
|
||||||
|
|
||||||
$sync[$entryInfo.Name].Add_Checked({
|
$sync[$entryInfo.Name].Add_Checked({
|
||||||
Invoke-WPFButton -Button "WPFToggleFOSSHighlight"
|
[System.Object]$Sender = $args[0]
|
||||||
})
|
Invoke-WPFSelectedCheckboxesUpdate -type "Add" -checkboxName $Sender.name
|
||||||
$sync[$entryInfo.Name].Add_Unchecked({
|
# Skip applying tweaks while an import is restoring toggle states
|
||||||
Invoke-WPFButton -Button "WPFToggleFOSSHighlight"
|
if (-not $sync.ImportInProgress) {
|
||||||
})
|
Invoke-WinUtilTweaks $Sender.name
|
||||||
} else {
|
}
|
||||||
$sync[$entryInfo.Name].IsChecked = (Get-WinUtilToggleStatus $entryInfo.Name)
|
})
|
||||||
|
|
||||||
$sync[$entryInfo.Name].Add_Checked({
|
$sync[$entryInfo.Name].Add_Unchecked({
|
||||||
[System.Object]$Sender = $args[0]
|
[System.Object]$Sender = $args[0]
|
||||||
Invoke-WPFSelectedCheckboxesUpdate -type "Add" -checkboxName $Sender.name
|
Invoke-WPFSelectedCheckboxesUpdate -type "Remove" -checkboxName $Sender.name
|
||||||
# Skip applying tweaks while an import is restoring toggle states
|
# Skip undoing tweaks while an import is restoring toggle states
|
||||||
if (-not $sync.ImportInProgress) {
|
if (-not $sync.ImportInProgress) {
|
||||||
Invoke-WinUtilTweaks $Sender.name
|
Invoke-WinUtiltweaks $Sender.name -undo $true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
$sync[$entryInfo.Name].Add_Unchecked({
|
|
||||||
[System.Object]$Sender = $args[0]
|
|
||||||
Invoke-WPFSelectedCheckboxesUpdate -type "Remove" -checkboxName $Sender.name
|
|
||||||
# Skip undoing tweaks while an import is restoring toggle states
|
|
||||||
if (-not $sync.ImportInProgress) {
|
|
||||||
Invoke-WinUtiltweaks $Sender.name -undo $true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
"ToggleButton" {
|
"ToggleButton" {
|
||||||
@@ -346,6 +333,28 @@ function Invoke-WPFUIElements {
|
|||||||
$sync[$entryInfo.Name] = $radioButton
|
$sync[$entryInfo.Name] = $radioButton
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"Note" {
|
||||||
|
$textBlock = New-Object Windows.Controls.TextBlock
|
||||||
|
$textBlock.TextWrapping = "Wrap"
|
||||||
|
$textBlock.Margin = "5,5,5,5"
|
||||||
|
$textBlock.UseLayoutRounding = $true
|
||||||
|
|
||||||
|
$bulletRun = New-Object Windows.Documents.Run
|
||||||
|
$bulletRun.Text = [char]0x25CF
|
||||||
|
$bulletRun.Foreground = [Windows.Media.SolidColorBrush]::new([Windows.Media.Color]::FromRgb(110, 255, 114))
|
||||||
|
$bulletRun.FontSize = 11.5
|
||||||
|
|
||||||
|
$textRun = New-Object Windows.Documents.Run
|
||||||
|
$textRun.Text = " $($entryInfo.Content)"
|
||||||
|
$textRun.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "FontSize")
|
||||||
|
$textRun.Foreground = [Windows.Media.SolidColorBrush]::new([Windows.Media.Color]::FromRgb(19, 143, 83))
|
||||||
|
|
||||||
|
$textBlock.Inlines.Add($bulletRun)
|
||||||
|
$textBlock.Inlines.Add($textRun)
|
||||||
|
|
||||||
|
$itemsControl.Items.Add($textBlock) | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
default {
|
default {
|
||||||
$horizontalStackPanel = New-Object Windows.Controls.StackPanel
|
$horizontalStackPanel = New-Object Windows.Controls.StackPanel
|
||||||
$horizontalStackPanel.Orientation = "Horizontal"
|
$horizontalStackPanel.Orientation = "Horizontal"
|
||||||
|
|||||||
Reference in New Issue
Block a user