mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-07 19:59:14 -04:00
feat(Clipboard-Bar-Hist): Add search/filter to saved clipboard entries & animation states (#2464)
* Fix gaps and overlaps when filtering clipboard history * feat(Clipboard-Bar-Hist): Add search/filter to saved clipboard entries as well. Change title on toggle between recent/saved. * keep Pinned/Saved icon highlighted when selected * add back filter animations * Implement snap state for list views based on animation settings --------- Co-authored-by: purian23 <purian23@gmail.com>
This commit is contained in:
@@ -970,6 +970,7 @@ Singleton {
|
|||||||
|
|
||||||
readonly property int shorterDuration: (typeof SettingsData !== "undefined" && SettingsData.animationSpeed === SettingsData.AnimationSpeed.Custom) ? SettingsData.customAnimationDuration : currentDurations.shorter
|
readonly property int shorterDuration: (typeof SettingsData !== "undefined" && SettingsData.animationSpeed === SettingsData.AnimationSpeed.Custom) ? SettingsData.customAnimationDuration : currentDurations.shorter
|
||||||
readonly property int shortDuration: (typeof SettingsData !== "undefined" && SettingsData.animationSpeed === SettingsData.AnimationSpeed.Custom) ? SettingsData.customAnimationDuration : currentDurations.short
|
readonly property int shortDuration: (typeof SettingsData !== "undefined" && SettingsData.animationSpeed === SettingsData.AnimationSpeed.Custom) ? SettingsData.customAnimationDuration : currentDurations.short
|
||||||
|
readonly property bool snapListModelChanges: shortDuration <= 0
|
||||||
readonly property int mediumDuration: (typeof SettingsData !== "undefined" && SettingsData.animationSpeed === SettingsData.AnimationSpeed.Custom) ? SettingsData.customAnimationDuration : currentDurations.medium
|
readonly property int mediumDuration: (typeof SettingsData !== "undefined" && SettingsData.animationSpeed === SettingsData.AnimationSpeed.Custom) ? SettingsData.customAnimationDuration : currentDurations.medium
|
||||||
readonly property int longDuration: (typeof SettingsData !== "undefined" && SettingsData.animationSpeed === SettingsData.AnimationSpeed.Custom) ? SettingsData.customAnimationDuration : currentDurations.long
|
readonly property int longDuration: (typeof SettingsData !== "undefined" && SettingsData.animationSpeed === SettingsData.AnimationSpeed.Custom) ? SettingsData.customAnimationDuration : currentDurations.long
|
||||||
readonly property int extraLongDuration: (typeof SettingsData !== "undefined" && SettingsData.animationSpeed === SettingsData.AnimationSpeed.Custom) ? SettingsData.customAnimationDuration : currentDurations.extraLong
|
readonly property int extraLongDuration: (typeof SettingsData !== "undefined" && SettingsData.animationSpeed === SettingsData.AnimationSpeed.Custom) ? SettingsData.customAnimationDuration : currentDurations.extraLong
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ Item {
|
|||||||
ClipboardHeader {
|
ClipboardHeader {
|
||||||
id: header
|
id: header
|
||||||
width: parent.width
|
width: parent.width
|
||||||
totalCount: modal.totalCount
|
recentsCount: modal.unpinnedEntries.length
|
||||||
|
savedCount: modal.pinnedEntries.length
|
||||||
showKeyboardHints: modal.showKeyboardHints
|
showKeyboardHints: modal.showKeyboardHints
|
||||||
activeTab: modal.activeTab
|
activeTab: modal.activeTab
|
||||||
pinnedCount: modal.pinnedCount
|
pinnedCount: modal.pinnedCount
|
||||||
@@ -99,6 +100,20 @@ Item {
|
|||||||
pressDelay: 0
|
pressDelay: 0
|
||||||
flickableDirection: Flickable.VerticalFlick
|
flickableDirection: Flickable.VerticalFlick
|
||||||
|
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
name: "snap"
|
||||||
|
when: Theme.snapListModelChanges
|
||||||
|
PropertyChanges {
|
||||||
|
target: clipboardListView
|
||||||
|
add: null
|
||||||
|
remove: null
|
||||||
|
displaced: null
|
||||||
|
move: null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
function ensureVisible(index) {
|
function ensureVisible(index) {
|
||||||
if (index < 0 || index >= count) {
|
if (index < 0 || index >= count) {
|
||||||
return;
|
return;
|
||||||
@@ -159,6 +174,20 @@ Item {
|
|||||||
pressDelay: 0
|
pressDelay: 0
|
||||||
flickableDirection: Flickable.VerticalFlick
|
flickableDirection: Flickable.VerticalFlick
|
||||||
|
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
name: "snap"
|
||||||
|
when: Theme.snapListModelChanges
|
||||||
|
PropertyChanges {
|
||||||
|
target: savedListView
|
||||||
|
add: null
|
||||||
|
remove: null
|
||||||
|
displaced: null
|
||||||
|
move: null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
function ensureVisible(index) {
|
function ensureVisible(index) {
|
||||||
if (index < 0 || index >= count) {
|
if (index < 0 || index >= count) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ import qs.Modals.Clipboard
|
|||||||
Item {
|
Item {
|
||||||
id: header
|
id: header
|
||||||
|
|
||||||
property int totalCount: 0
|
property int recentsCount: 0
|
||||||
|
property int savedCount: 0
|
||||||
property bool showKeyboardHints: false
|
property bool showKeyboardHints: false
|
||||||
property string activeTab: "recents"
|
property string activeTab: "recents"
|
||||||
property int pinnedCount: 0
|
property int pinnedCount: 0
|
||||||
@@ -31,7 +32,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: I18n.tr("Clipboard History") + ` (${totalCount})`
|
text: (header.activeTab === "saved" ? I18n.tr("Clipboard Saved") : I18n.tr("Clipboard History")) + ` (${header.activeTab === "saved" ? header.savedCount : header.recentsCount})`
|
||||||
font.pixelSize: Theme.fontSizeLarge
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
@@ -48,6 +49,7 @@ Item {
|
|||||||
iconName: "push_pin"
|
iconName: "push_pin"
|
||||||
iconSize: Theme.iconSize - 4
|
iconSize: Theme.iconSize - 4
|
||||||
iconColor: header.activeTab === "saved" ? Theme.primary : Theme.surfaceText
|
iconColor: header.activeTab === "saved" ? Theme.primary : Theme.surfaceText
|
||||||
|
backgroundColor: header.activeTab === "saved" ? Theme.primarySelected : "transparent"
|
||||||
visible: header.pinnedCount > 0
|
visible: header.pinnedCount > 0
|
||||||
tooltipText: header.activeTab === "saved" ? I18n.tr("Recent") : I18n.tr("Saved")
|
tooltipText: header.activeTab === "saved" ? I18n.tr("Recent") : I18n.tr("Saved")
|
||||||
onClicked: tabChanged(header.activeTab === "saved" ? "recents" : "saved")
|
onClicked: tabChanged(header.activeTab === "saved" ? "recents" : "saved")
|
||||||
|
|||||||
@@ -301,10 +301,19 @@ Item {
|
|||||||
clip: true
|
clip: true
|
||||||
spacing: 2
|
spacing: 2
|
||||||
|
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
name: "snap"
|
||||||
|
when: Theme.snapListModelChanges
|
||||||
|
PropertyChanges {
|
||||||
|
target: processListView
|
||||||
add: null
|
add: null
|
||||||
remove: null
|
remove: null
|
||||||
displaced: null
|
displaced: null
|
||||||
move: null
|
move: null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
model: ScriptModel {
|
model: ScriptModel {
|
||||||
values: root.cachedProcesses
|
values: root.cachedProcesses
|
||||||
|
|||||||
@@ -68,15 +68,17 @@ Singleton {
|
|||||||
|
|
||||||
clipboardEntries = filtered;
|
clipboardEntries = filtered;
|
||||||
unpinnedEntries = filtered.filter(e => !e.pinned);
|
unpinnedEntries = filtered.filter(e => !e.pinned);
|
||||||
|
pinnedEntries = filtered.filter(e => e.pinned);
|
||||||
totalCount = clipboardEntries.length;
|
totalCount = clipboardEntries.length;
|
||||||
|
|
||||||
if (unpinnedEntries.length === 0) {
|
const activeCount = Math.max(unpinnedEntries.length, pinnedEntries.length);
|
||||||
|
if (activeCount === 0) {
|
||||||
keyboardNavigationActive = false;
|
keyboardNavigationActive = false;
|
||||||
selectedIndex = 0;
|
selectedIndex = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (selectedIndex >= unpinnedEntries.length) {
|
if (selectedIndex >= activeCount) {
|
||||||
selectedIndex = unpinnedEntries.length - 1;
|
selectedIndex = activeCount - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user