diff options
Diffstat (limited to 'popups')
| -rw-r--r-- | popups/launcher/Launcher.qml | 13 | ||||
| -rw-r--r-- | popups/launcher/components/App.qml | 6 | ||||
| -rw-r--r-- | popups/launcher/components/Calc.qml | 8 | ||||
| -rw-r--r-- | popups/launcher/components/Clip.qml | 1 | ||||
| -rw-r--r-- | popups/launcher/components/DuckDuckGo.qml | 6 | ||||
| -rw-r--r-- | popups/launcher/components/IComponent.qml | 36 | ||||
| -rw-r--r-- | popups/launcher/components/ISmartCalc.qml | 8 |
7 files changed, 50 insertions, 28 deletions
diff --git a/popups/launcher/Launcher.qml b/popups/launcher/Launcher.qml index 1e1eb89..bbbc6be 100644 --- a/popups/launcher/Launcher.qml +++ b/popups/launcher/Launcher.qml @@ -206,6 +206,9 @@ ILauncher { } } } + HoverHandler { + cursorShape: Qt.IBeamCursor + } onTextChanged: { if (launcher.state.input !== textInput.text) pendingUpdate = true; @@ -233,14 +236,14 @@ ILauncher { } } IRect { - opacity: launcher.state?.priorities[0]?.predictiveCompletion ? 1 : 0 + opacity: launcher.state?.priorities[launcher.state.selectedPriority]?.predictiveCompletion ? 1 : 0 Layout.fillHeight: true Layout.preferredWidth: text.width radius: Launcher.predictiveCompletionRadius color: Qt.rgba(Colors.background2.r, Colors.background2.g, Colors.background2.b, Launcher.widgetBgTransparency) IText { id: text - // animate: true // too jumpy + animate: false // too jumpy color: Colors.foreground3 renderType: Text.CurveRendering antialiasing: true @@ -250,7 +253,7 @@ ILauncher { family: Style.font.family.sans wordSpacing: 5 } - text: launcher.state?.priorities[0]?.predictiveCompletion || "" + text: launcher.state?.priorities[launcher.state.selectedPriority]?.predictiveCompletion || "" } Behavior on Layout.preferredWidth { ISpringAnimation {} @@ -269,8 +272,8 @@ ILauncher { Layout.fillWidth: true } Loader { - active: launcher.state?.priorities[0]?.priority || false // .priority should always be true if it's in priorities - sourceComponent: launcher.state?.priorities[0]?.preview + active: launcher.state?.priorities[launcher.state.selectedPriority]?.priority || false // .priority should always be true if it's in priorities + sourceComponent: launcher.state?.priorities[launcher.state.selectedPriority]?.preview } } } diff --git a/popups/launcher/components/App.qml b/popups/launcher/components/App.qml index 4ac1fbe..a744f21 100644 --- a/popups/launcher/components/App.qml +++ b/popups/launcher/components/App.qml @@ -146,7 +146,7 @@ IComponent { RowLayout { id: item - scale: isSelectedPriority() && index === selectedIndex ? 1.01 : 0.99 + scale: root.isSelectedPriority() && index === selectedIndex ? 1.01 : 0.99 anchors.left: parent.left anchors.top: parent.top anchors.margins: Launcher.innerMargin * 2 @@ -160,8 +160,8 @@ IComponent { IText { text: modelData ? modelData.name : "" renderType: Text.QtRendering - font.bold: isSelectedPriority() && index === selectedIndex - color: isSelectedPriority() && index === selectedIndex ? Colors.foreground1 : Colors.foreground2 + font.bold: root.isSelectedPriority() && index === selectedIndex + color: root.isSelectedPriority() && index === selectedIndex ? Colors.foreground1 : Colors.foreground2 Behavior on color { ColorAnimation { duration: General.animationDuration diff --git a/popups/launcher/components/Calc.qml b/popups/launcher/components/Calc.qml index dee1668..4daae66 100644 --- a/popups/launcher/components/Calc.qml +++ b/popups/launcher/components/Calc.qml @@ -9,6 +9,8 @@ import qs.config import core IComponent { + id: root + property int cursorPosition: SelectionState.cursorPosition name: "Calculator" @@ -103,7 +105,7 @@ IComponent { .replace(/\s*\*\s*/g, " × ").replace(/\s*\/\s*/g, " ÷ ").replace(/\s*-\s*/g, " − ").replace(/\s*\+\s*/g, " + ") font { pixelSize: Launcher.widgetFontSize - bold: isSelectedPriority() + bold: root.isSelectedPriority() } } } @@ -112,7 +114,7 @@ IComponent { visible: valid text: "→" font.pixelSize: Launcher.widgetFontSize - font.bold: isSelectedPriority() + font.bold: root.isSelectedPriority() } Item { @@ -126,7 +128,7 @@ IComponent { text: valid ? answer : '' font { pixelSize: Launcher.widgetFontSize - bold: isSelectedPriority() + bold: root.isSelectedPriority() } } } diff --git a/popups/launcher/components/Clip.qml b/popups/launcher/components/Clip.qml index a842a73..07311d4 100644 --- a/popups/launcher/components/Clip.qml +++ b/popups/launcher/components/Clip.qml @@ -74,6 +74,7 @@ IComponent { syncSelectionState: function () { Qt.callLater(() => { if (!isSelectedPriority()) { + // TODO: fix sometimes if (state.selected && state.selected === listView.itemAtIndex(selectedIndex)) state.selected = null; diff --git a/popups/launcher/components/DuckDuckGo.qml b/popups/launcher/components/DuckDuckGo.qml index 928ca05..026b240 100644 --- a/popups/launcher/components/DuckDuckGo.qml +++ b/popups/launcher/components/DuckDuckGo.qml @@ -9,6 +9,8 @@ import qs.config import core IComponent { + id: root + property int cursorPosition: SelectionState.cursorPosition property bool expand: false @@ -72,7 +74,7 @@ IComponent { id: image property real maxWidth: status === Image.Ready ? implicitWidth : 0 anchors.fill: parent - scale: isSelectedPriority() ? 1.01 : 0.99 + scale: root.isSelectedPriority() ? 1.01 : 0.99 fillMode: Image.PreserveAspectCrop @@ -117,7 +119,7 @@ IComponent { text: answer font { pixelSize: Launcher.widgetFontSize * 1.1 - bold: isSelectedPriority() + bold: root.isSelectedPriority() } } diff --git a/popups/launcher/components/IComponent.qml b/popups/launcher/components/IComponent.qml index c7b99b3..415d22d 100644 --- a/popups/launcher/components/IComponent.qml +++ b/popups/launcher/components/IComponent.qml @@ -87,6 +87,18 @@ IRect { state.selectedPriority = self; } + function syncPriority() { + Qt.callLater(() => { + if (!standalone) { + if (state.priorities.includes(root) && !priority) + state.priorities = state.priorities.filter(x => x !== root); + else if (priority) + state.priorities = [...new Set(state.priorities), root]; + } else + state.priorities = [root]; + }); + } + // this doesn't change launcher size but only hides the actual content but the outside still think the content is there visible: active opacity: valid ? 1 : 0 @@ -103,12 +115,7 @@ IRect { onPriorityChanged: { // sync with state.priorities - Qt.callLater(() => { - if (!standalone) - state.priorities = state.priorities.includes(root) ? state.priorities.filter(x => x !== root) : [...new Set(state.priorities), root]; - else - state.priorities = [root]; - }); + syncPriority(); } Behavior on y { @@ -127,10 +134,15 @@ IRect { } } - // causes all of them fighting for selection state - // Component.onCompleted: { - // Qt.callLater(() => { - // syncSelectionState(); - // }); - // } + Component.onCompleted: { + syncPriority(); + + // Qt.callLater(() => { + // syncSelectionState(); + // }); + } + + Component.onDestruction: { + state.priorities = state.priorities.filter(x => x !== root); + } } diff --git a/popups/launcher/components/ISmartCalc.qml b/popups/launcher/components/ISmartCalc.qml index ded3c72..679bd5f 100644 --- a/popups/launcher/components/ISmartCalc.qml +++ b/popups/launcher/components/ISmartCalc.qml @@ -9,6 +9,8 @@ import qs.config import core IComponent { + id: root + property string symbol required property bool category required property string predictiveText @@ -60,7 +62,7 @@ IComponent { text: input font { pixelSize: Launcher.widgetFontSize - bold: isSelectedPriority() + bold: root.isSelectedPriority() } } } @@ -69,7 +71,7 @@ IComponent { visible: valid text: "→" font.pixelSize: Launcher.widgetFontSize - font.bold: isSelectedPriority() + font.bold: root.isSelectedPriority() } Item { @@ -83,7 +85,7 @@ IComponent { text: valid ? answer : '' font { pixelSize: Launcher.widgetFontSize - bold: isSelectedPriority() + bold: root.isSelectedPriority() } } } |
