-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFilterSettings.go
More file actions
39 lines (31 loc) · 996 Bytes
/
FilterSettings.go
File metadata and controls
39 lines (31 loc) · 996 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (c) 2025 Neil Stephens. All rights reserved.
// Use of this source code is governed by an MIT license that can be
// found in the LICENSE file.
package main
import (
"strconv"
"strings"
)
func (hg *HashGenerator) filterSettings(filterText string) {
hg.updateFilteredKeys(filterText)
hg.settingsList.Refresh()
}
func (hg *HashGenerator) updateFilteredKeys(filterText string) {
allKeys := hg.getSettingsKeys()
hg.filteredKeys = []string{}
filterLower := strings.ToLower(filterText)
for _, key := range allKeys {
setting := hg.savedSettings[key]
// Check if we should hide hobbled settings
if hg.hideZeroIterBox.Checked {
iterations, err := strconv.Atoi(setting.Iterations)
if err == nil && iterations <= 0 {
continue // Skip this setting if it has 0 iterations and we're hiding them
}
}
// Apply text filter
if filterText == "" || strings.Contains(strings.ToLower(key), filterLower) {
hg.filteredKeys = append(hg.filteredKeys, key)
}
}
}