diff --git a/resources/qml/Avatar.qml b/resources/qml/Avatar.qml
index 07e68e10..f53dfe3a 100644
--- a/resources/qml/Avatar.qml
+++ b/resources/qml/Avatar.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import "./ui"
diff --git a/resources/qml/Completer.qml b/resources/qml/Completer.qml
index 6170045c..3b79a50d 100644
--- a/resources/qml/Completer.qml
+++ b/resources/qml/Completer.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import "./ui"
@@ -62,18 +61,17 @@ Popup {
}
function finishCompletion() {
- if(popup.completerName == "room") {
- popup.completionSelected(listView.itemAtIndex(currentIndex).modelData.roomid)
- }
+ if (popup.completerName == "room")
+ popup.completionSelected(listView.itemAtIndex(currentIndex).modelData.roomid);
+
}
onCompleterNameChanged: {
if (completerName) {
- if (completerName == "user") {
+ if (completerName == "user")
completer = TimelineManager.completerFor(completerName, TimelineManager.timeline.roomId());
- } else {
+ else
completer = TimelineManager.completerFor(completerName);
- }
completer.setSearchString("");
} else {
completer = undefined;
@@ -99,10 +97,11 @@ Popup {
pixelAligned: true
delegate: Rectangle {
+ property variant modelData: model
+
color: model.index == popup.currentIndex ? colors.highlight : colors.base
height: chooser.childrenRect.height + 2 * popup.rowMargin
implicitWidth: fullWidth ? popup.width : chooser.childrenRect.width + 4
- property variant modelData: model
MouseArea {
id: mouseArea
@@ -111,10 +110,10 @@ Popup {
hoverEnabled: true
onPositionChanged: popup.currentIndex = model.index
onClicked: {
- popup.completionClicked(completer.completionAt(model.index))
- if(popup.completerName == "room") {
- popup.completionSelected(model.roomid)
- }
+ popup.completionClicked(completer.completionAt(model.index));
+ if (popup.completerName == "room")
+ popup.completionSelected(model.roomid);
+
}
Ripple {
@@ -200,8 +199,8 @@ Popup {
width: popup.avatarWidth
url: model.avatarUrl.replace("mxc://", "image://MxcImage/")
onClicked: {
- popup.completionClicked(completer.completionAt(model.index))
- popup.completionSelected(model.roomid)
+ popup.completionClicked(completer.completionAt(model.index));
+ popup.completionSelected(model.roomid);
}
}
diff --git a/resources/qml/EncryptionIndicator.qml b/resources/qml/EncryptionIndicator.qml
index 58805f48..5fcc0ada 100644
--- a/resources/qml/EncryptionIndicator.qml
+++ b/resources/qml/EncryptionIndicator.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.12
diff --git a/resources/qml/ImageButton.qml b/resources/qml/ImageButton.qml
index 76cc0b42..f25705f0 100644
--- a/resources/qml/ImageButton.qml
+++ b/resources/qml/ImageButton.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import "./ui"
diff --git a/resources/qml/MatrixText.qml b/resources/qml/MatrixText.qml
index dfe7122d..073956f4 100644
--- a/resources/qml/MatrixText.qml
+++ b/resources/qml/MatrixText.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.5
diff --git a/resources/qml/MatrixTextField.qml b/resources/qml/MatrixTextField.qml
index 9e8d286b..9762817c 100644
--- a/resources/qml/MatrixTextField.qml
+++ b/resources/qml/MatrixTextField.qml
@@ -1,56 +1,62 @@
import QtQuick 2.13
-import QtQuick.Layouts 1.13
import QtQuick.Controls 2.13
+import QtQuick.Layouts 1.13
TextField {
id: input
- palette: colors
- background: Rectangle {
- color: colors.base
- }
+ palette: colors
Rectangle {
id: blueBar
anchors.top: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
-
color: colors.highlight
height: 1
width: parent.width
-
+
Rectangle {
id: blackBar
anchors.verticalCenter: blueBar.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
-
- height: parent.height+1
+ height: parent.height + 1
width: 0
color: colors.text
-
+
states: State {
- name: "focused"; when: input.activeFocus == true
+ name: "focused"
+ when: input.activeFocus == true
+
PropertyChanges {
target: blackBar
width: blueBar.width
}
+
}
-
+
transitions: Transition {
from: ""
to: "focused"
reversible: true
- NumberAnimation {
+ NumberAnimation {
target: blackBar
properties: "width"
duration: 500
easing.type: Easing.InOutQuad
- alwaysRunToEnd: true
+ alwaysRunToEnd: true
}
+
}
+
}
+
}
-}
\ No newline at end of file
+
+ background: Rectangle {
+ color: colors.base
+ }
+
+}
diff --git a/resources/qml/MessageInput.qml b/resources/qml/MessageInput.qml
index faf0d442..29657c85 100644
--- a/resources/qml/MessageInput.qml
+++ b/resources/qml/MessageInput.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import "./voip"
diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml
index 1bc10b60..baf6b800 100644
--- a/resources/qml/MessageView.qml
+++ b/resources/qml/MessageView.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import "./delegates"
diff --git a/resources/qml/NhekoBusyIndicator.qml b/resources/qml/NhekoBusyIndicator.qml
index 917e11dc..e45d71ec 100644
--- a/resources/qml/NhekoBusyIndicator.qml
+++ b/resources/qml/NhekoBusyIndicator.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.9
diff --git a/resources/qml/PrivacyScreen.qml b/resources/qml/PrivacyScreen.qml
index ca73cfd7..bd146dac 100644
--- a/resources/qml/PrivacyScreen.qml
+++ b/resources/qml/PrivacyScreen.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtGraphicalEffects 1.0
diff --git a/resources/qml/QuickSwitcher.qml b/resources/qml/QuickSwitcher.qml
index 88903163..ac896c56 100644
--- a/resources/qml/QuickSwitcher.qml
+++ b/resources/qml/QuickSwitcher.qml
@@ -5,19 +5,31 @@ import im.nheko 1.0
Popup {
id: quickSwitcher
- property int textHeight: 32
- property int textMargin: 8
+ property int textHeight: Math.round(Qt.application.font.pixelSize * 2.4)
+ property int textMargin: Math.round(textHeight / 8)
- x: parent.width / 2 - width / 2
- y: parent.height / 4 - height / 2
- width: parent.width / 2
+ function delay(delayTime, cb) {
+ timer.interval = delayTime;
+ timer.repeat = false;
+ timer.triggered.connect(cb);
+ timer.start();
+ }
+
+ width: Math.round(parent.width / 2)
+ x: Math.round(parent.width / 2 - width / 2)
+ y: Math.round(parent.height / 4 - height / 2)
modal: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
parent: Overlay.overlay
palette: colors
-
- Overlay.modal: Rectangle {
- color: "#aa1E1E1E"
+ onOpened: {
+ completerPopup.open();
+ delay(200, function() {
+ roomTextInput.forceActiveFocus();
+ });
+ }
+ onClosed: {
+ completerPopup.close();
}
MatrixTextField {
@@ -27,11 +39,9 @@ Popup {
font.pixelSize: Math.ceil(quickSwitcher.textHeight * 0.6)
padding: textMargin
color: colors.text
-
onTextEdited: {
- completerPopup.completer.setSearchString(text)
+ completerPopup.completer.searchString = text;
}
-
Keys.onPressed: {
if (event.key == Qt.Key_Up && completerPopup.opened) {
event.accepted = true;
@@ -40,7 +50,7 @@ Popup {
event.accepted = true;
completerPopup.down();
} else if (event.matches(StandardKey.InsertParagraphSeparator)) {
- completerPopup.finishCompletion()
+ completerPopup.finishCompletion();
event.accepted = true;
}
}
@@ -50,36 +60,30 @@ Popup {
id: completerPopup
x: roomTextInput.x
- y: roomTextInput.y + roomTextInput.height + textMargin
+ y: roomTextInput.y + quickSwitcher.textHeight + quickSwitcher.textMargin
+ visible: roomTextInput.length > 0
width: parent.width
completerName: "room"
bottomToTop: false
fullWidth: true
- avatarHeight: textHeight
- avatarWidth: textHeight
+ avatarHeight: quickSwitcher.textHeight
+ avatarWidth: quickSwitcher.textHeight
centerRowContent: false
- rowMargin: 8
- rowSpacing: 6
-
+ rowMargin: Math.round(quickSwitcher.textMargin / 2)
+ rowSpacing: quickSwitcher.textMargin
closePolicy: Popup.NoAutoClose
}
- onOpened: {
- completerPopup.open()
- delay(200, function() {
- roomTextInput.forceActiveFocus()
- })
- }
-
- onClosed: {
- completerPopup.close()
- }
-
Connections {
onCompletionSelected: {
- TimelineManager.setHistoryView(id)
- TimelineManager.highlightRoom(id)
- quickSwitcher.close()
+ TimelineManager.setHistoryView(id);
+ TimelineManager.highlightRoom(id);
+ quickSwitcher.close();
+ }
+ onCountChanged: {
+ if (completerPopup.count > 0 && (completerPopup.currentIndex < 0 || completerPopup.currentIndex >= completerPopup.count))
+ completerPopup.currentIndex = 0;
+
}
target: completerPopup
}
@@ -88,10 +92,8 @@ Popup {
id: timer
}
- function delay(delayTime, cb) {
- timer.interval = delayTime;
- timer.repeat = false;
- timer.triggered.connect(cb);
- timer.start();
+ Overlay.modal: Rectangle {
+ color: "#aa1E1E1E"
}
+
}
diff --git a/resources/qml/Reactions.qml b/resources/qml/Reactions.qml
index f53c89ad..335d5b29 100644
--- a/resources/qml/Reactions.qml
+++ b/resources/qml/Reactions.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.6
diff --git a/resources/qml/ReplyPopup.qml b/resources/qml/ReplyPopup.qml
index 37b6f6cc..eb70585e 100644
--- a/resources/qml/ReplyPopup.qml
+++ b/resources/qml/ReplyPopup.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import "./delegates/"
diff --git a/resources/qml/RoomSettings.qml b/resources/qml/RoomSettings.qml
index 2117e513..ed1a5bd9 100644
--- a/resources/qml/RoomSettings.qml
+++ b/resources/qml/RoomSettings.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import Qt.labs.platform 1.1 as Platform
diff --git a/resources/qml/ScrollHelper.qml b/resources/qml/ScrollHelper.qml
index 2dd56f27..2d315a6d 100644
--- a/resources/qml/ScrollHelper.qml
+++ b/resources/qml/ScrollHelper.qml
@@ -1,9 +1,7 @@
// Copyright (C) 2016 Michael Bohlender, <michael.bohlender@kdemail.net>
// Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsystems.com>
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
-
/*
* Shamelessly stolen from:
* https://cgit.kde.org/kube.git/tree/framework/qml/ScrollHelper.qml
diff --git a/resources/qml/StatusIndicator.qml b/resources/qml/StatusIndicator.qml
index 3d2d8278..f2b6c12d 100644
--- a/resources/qml/StatusIndicator.qml
+++ b/resources/qml/StatusIndicator.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.5
diff --git a/resources/qml/TimelineRow.qml b/resources/qml/TimelineRow.qml
index 0f815f6f..8e479d58 100644
--- a/resources/qml/TimelineRow.qml
+++ b/resources/qml/TimelineRow.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import "./delegates"
diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index 20251bc0..49221014 100644
--- a/resources/qml/TimelineView.qml
+++ b/resources/qml/TimelineView.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import "./delegates"
@@ -77,13 +76,14 @@ Page {
QuickSwitcher {
}
+
}
Shortcut {
sequence: "Ctrl+K"
onActivated: {
var quickSwitch = quickSwitcherComponent.createObject(timelineRoot);
- TimelineManager.focusTimeline()
+ TimelineManager.focusTimeline();
quickSwitch.open();
}
}
diff --git a/resources/qml/ToggleButton.qml b/resources/qml/ToggleButton.qml
index bd82e4f9..3791a5b4 100644
--- a/resources/qml/ToggleButton.qml
+++ b/resources/qml/ToggleButton.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.5
diff --git a/resources/qml/TopBar.qml b/resources/qml/TopBar.qml
index 444a4572..e158a8ba 100644
--- a/resources/qml/TopBar.qml
+++ b/resources/qml/TopBar.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.9
diff --git a/resources/qml/TypingIndicator.qml b/resources/qml/TypingIndicator.qml
index ffe88fb6..2e36e8ad 100644
--- a/resources/qml/TypingIndicator.qml
+++ b/resources/qml/TypingIndicator.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.9
diff --git a/resources/qml/UserProfile.qml b/resources/qml/UserProfile.qml
index dbf13796..05d2a391 100644
--- a/resources/qml/UserProfile.qml
+++ b/resources/qml/UserProfile.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import "./device-verification"
diff --git a/resources/qml/delegates/FileMessage.qml b/resources/qml/delegates/FileMessage.qml
index 293b7a78..e73d6a50 100644
--- a/resources/qml/delegates/FileMessage.qml
+++ b/resources/qml/delegates/FileMessage.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.12
diff --git a/resources/qml/delegates/ImageMessage.qml b/resources/qml/delegates/ImageMessage.qml
index 0521258e..829d29ed 100644
--- a/resources/qml/delegates/ImageMessage.qml
+++ b/resources/qml/delegates/ImageMessage.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.12
diff --git a/resources/qml/delegates/MessageDelegate.qml b/resources/qml/delegates/MessageDelegate.qml
index 211e03a6..dcf6eb3b 100644
--- a/resources/qml/delegates/MessageDelegate.qml
+++ b/resources/qml/delegates/MessageDelegate.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.6
diff --git a/resources/qml/delegates/NoticeMessage.qml b/resources/qml/delegates/NoticeMessage.qml
index 4f8fbfd2..6c604c5e 100644
--- a/resources/qml/delegates/NoticeMessage.qml
+++ b/resources/qml/delegates/NoticeMessage.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
TextMessage {
diff --git a/resources/qml/delegates/Pill.qml b/resources/qml/delegates/Pill.qml
index a3fa0d9e..8efa491c 100644
--- a/resources/qml/delegates/Pill.qml
+++ b/resources/qml/delegates/Pill.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.5
diff --git a/resources/qml/delegates/Placeholder.qml b/resources/qml/delegates/Placeholder.qml
index addbc7e7..50486439 100644
--- a/resources/qml/delegates/Placeholder.qml
+++ b/resources/qml/delegates/Placeholder.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import ".."
diff --git a/resources/qml/delegates/PlayableMediaMessage.qml b/resources/qml/delegates/PlayableMediaMessage.qml
index f871e492..7d00de21 100644
--- a/resources/qml/delegates/PlayableMediaMessage.qml
+++ b/resources/qml/delegates/PlayableMediaMessage.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtMultimedia 5.6
diff --git a/resources/qml/delegates/Reply.qml b/resources/qml/delegates/Reply.qml
index 6763b71b..728e9739 100644
--- a/resources/qml/delegates/Reply.qml
+++ b/resources/qml/delegates/Reply.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.12
diff --git a/resources/qml/delegates/TextMessage.qml b/resources/qml/delegates/TextMessage.qml
index 1624d95c..ec0866ad 100644
--- a/resources/qml/delegates/TextMessage.qml
+++ b/resources/qml/delegates/TextMessage.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import ".."
diff --git a/resources/qml/device-verification/AwaitingVerificationConfirmation.qml b/resources/qml/device-verification/AwaitingVerificationConfirmation.qml
index ae62c334..8d57c8d6 100644
--- a/resources/qml/device-verification/AwaitingVerificationConfirmation.qml
+++ b/resources/qml/device-verification/AwaitingVerificationConfirmation.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.3
diff --git a/resources/qml/device-verification/DeviceVerification.qml b/resources/qml/device-verification/DeviceVerification.qml
index fee0284a..cb3cd8ab 100644
--- a/resources/qml/device-verification/DeviceVerification.qml
+++ b/resources/qml/device-verification/DeviceVerification.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.10
diff --git a/resources/qml/device-verification/DigitVerification.qml b/resources/qml/device-verification/DigitVerification.qml
index a387756d..cf5f75ed 100644
--- a/resources/qml/device-verification/DigitVerification.qml
+++ b/resources/qml/device-verification/DigitVerification.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.3
diff --git a/resources/qml/device-verification/EmojiElement.qml b/resources/qml/device-verification/EmojiElement.qml
index f5c87a56..1b1ecbcf 100644
--- a/resources/qml/device-verification/EmojiElement.qml
+++ b/resources/qml/device-verification/EmojiElement.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.3
diff --git a/resources/qml/device-verification/EmojiVerification.qml b/resources/qml/device-verification/EmojiVerification.qml
index be9e3938..e179b0ed 100644
--- a/resources/qml/device-verification/EmojiVerification.qml
+++ b/resources/qml/device-verification/EmojiVerification.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.3
diff --git a/resources/qml/device-verification/Failed.qml b/resources/qml/device-verification/Failed.qml
index 5c71b02e..bc7dd5fc 100644
--- a/resources/qml/device-verification/Failed.qml
+++ b/resources/qml/device-verification/Failed.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.3
diff --git a/resources/qml/device-verification/NewVerificationRequest.qml b/resources/qml/device-verification/NewVerificationRequest.qml
index e8589cf7..7af19b42 100644
--- a/resources/qml/device-verification/NewVerificationRequest.qml
+++ b/resources/qml/device-verification/NewVerificationRequest.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.3
diff --git a/resources/qml/device-verification/Success.qml b/resources/qml/device-verification/Success.qml
index f2657b12..a454d56e 100644
--- a/resources/qml/device-verification/Success.qml
+++ b/resources/qml/device-verification/Success.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.3
diff --git a/resources/qml/device-verification/Waiting.qml b/resources/qml/device-verification/Waiting.qml
index 3bfa153d..c8dc2a77 100644
--- a/resources/qml/device-verification/Waiting.qml
+++ b/resources/qml/device-verification/Waiting.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.3
diff --git a/resources/qml/emoji/EmojiButton.qml b/resources/qml/emoji/EmojiButton.qml
index cec51d75..71f8bc01 100644
--- a/resources/qml/emoji/EmojiButton.qml
+++ b/resources/qml/emoji/EmojiButton.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import "../"
diff --git a/resources/qml/emoji/EmojiPicker.qml b/resources/qml/emoji/EmojiPicker.qml
index 2db9dc07..ed8fdec4 100644
--- a/resources/qml/emoji/EmojiPicker.qml
+++ b/resources/qml/emoji/EmojiPicker.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import "../"
diff --git a/resources/qml/ui/Ripple.qml b/resources/qml/ui/Ripple.qml
index b240f421..7a8688f5 100644
--- a/resources/qml/ui/Ripple.qml
+++ b/resources/qml/ui/Ripple.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtGraphicalEffects 1.0
diff --git a/resources/qml/voip/ActiveCallBar.qml b/resources/qml/voip/ActiveCallBar.qml
index 68d3bc4a..c8bd6037 100644
--- a/resources/qml/voip/ActiveCallBar.qml
+++ b/resources/qml/voip/ActiveCallBar.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import "../"
diff --git a/resources/qml/voip/CallDevices.qml b/resources/qml/voip/CallDevices.qml
index 11644797..02340b4b 100644
--- a/resources/qml/voip/CallDevices.qml
+++ b/resources/qml/voip/CallDevices.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.9
diff --git a/resources/qml/voip/CallInvite.qml b/resources/qml/voip/CallInvite.qml
index 15d987e7..ed706f12 100644
--- a/resources/qml/voip/CallInvite.qml
+++ b/resources/qml/voip/CallInvite.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import "../"
diff --git a/resources/qml/voip/CallInviteBar.qml b/resources/qml/voip/CallInviteBar.qml
index fe3f791f..c8474264 100644
--- a/resources/qml/voip/CallInviteBar.qml
+++ b/resources/qml/voip/CallInviteBar.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import "../"
diff --git a/resources/qml/voip/DeviceError.qml b/resources/qml/voip/DeviceError.qml
index 05cfd409..a1ec7f12 100644
--- a/resources/qml/voip/DeviceError.qml
+++ b/resources/qml/voip/DeviceError.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.9
diff --git a/resources/qml/voip/PlaceCall.qml b/resources/qml/voip/PlaceCall.qml
index c9aa8ea1..f340bb4e 100644
--- a/resources/qml/voip/PlaceCall.qml
+++ b/resources/qml/voip/PlaceCall.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import "../"
diff --git a/resources/qml/voip/ScreenShare.qml b/resources/qml/voip/ScreenShare.qml
index af473c04..908500ee 100644
--- a/resources/qml/voip/ScreenShare.qml
+++ b/resources/qml/voip/ScreenShare.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import "../"
diff --git a/resources/qml/voip/VideoCall.qml b/resources/qml/voip/VideoCall.qml
index 23651033..8dd5fb90 100644
--- a/resources/qml/voip/VideoCall.qml
+++ b/resources/qml/voip/VideoCall.qml
@@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.9
diff --git a/src/CompletionProxyModel.cpp b/src/CompletionProxyModel.cpp
index a6759978..45b44fca 100644
--- a/src/CompletionProxyModel.cpp
+++ b/src/CompletionProxyModel.cpp
@@ -19,6 +19,7 @@ CompletionProxyModel::CompletionProxyModel(QAbstractItemModel *model,
setSourceModel(model);
QRegularExpression splitPoints("\\s+|-");
+ // insert all the full texts
for (int i = 0; i < sourceModel()->rowCount(); i++) {
if (i < 7)
mapping.push_back(i);
@@ -29,6 +30,19 @@ CompletionProxyModel::CompletionProxyModel(QAbstractItemModel *model,
.toLower();
trie_.insert(string1.toUcs4(), i);
+ auto string2 = sourceModel()
+ ->data(sourceModel()->index(i, 0), CompletionModel::SearchRole2)
+ .toString()
+ .toLower();
+ }
+
+ // insert the partial matches
+ for (int i = 0; i < sourceModel()->rowCount(); i++) {
+ auto string1 = sourceModel()
+ ->data(sourceModel()->index(i, 0), CompletionModel::SearchRole)
+ .toString()
+ .toLower();
+
for (const auto &e : string1.split(splitPoints)) {
if (!e.isEmpty()) // NOTE(Nico): Use Qt::SkipEmptyParts in Qt 5.14
trie_.insert(e.toUcs4(), i);
@@ -40,7 +54,6 @@ CompletionProxyModel::CompletionProxyModel(QAbstractItemModel *model,
.toLower();
if (!string2.isEmpty()) {
- trie_.insert(string2.toUcs4(), i);
for (const auto &e : string2.split(splitPoints)) {
if (!e.isEmpty()) // NOTE(Nico): Use Qt::SkipEmptyParts in Qt 5.14
trie_.insert(e.toUcs4(), i);
@@ -55,7 +68,7 @@ CompletionProxyModel::CompletionProxyModel(QAbstractItemModel *model,
[this](QString s) {
s.remove(":");
s.remove("@");
- searchString = s.toLower();
+ searchString_ = s.toLower();
invalidate();
},
Qt::QueuedConnection);
@@ -64,7 +77,7 @@ CompletionProxyModel::CompletionProxyModel(QAbstractItemModel *model,
void
CompletionProxyModel::invalidate()
{
- auto key = searchString.toUcs4();
+ auto key = searchString_.toUcs4();
beginResetModel();
mapping = trie_.search(key, 7, maxMistakes_);
endResetModel();
diff --git a/src/CompletionProxyModel.h b/src/CompletionProxyModel.h
index 214845b7..5d3ae152 100644
--- a/src/CompletionProxyModel.h
+++ b/src/CompletionProxyModel.h
@@ -135,7 +135,8 @@ struct trie
class CompletionProxyModel : public QAbstractProxyModel
{
Q_OBJECT
-
+ Q_PROPERTY(
+ QString searchString READ searchString WRITE setSearchString NOTIFY newSearchString)
public:
CompletionProxyModel(QAbstractItemModel *model,
int max_mistakes = 2,
@@ -159,12 +160,13 @@ public slots:
QVariant completionAt(int i) const;
void setSearchString(QString s);
+ QString searchString() const { return searchString_; }
signals:
void newSearchString(QString);
private:
- QString searchString;
+ QString searchString_;
trie<uint, int> trie_;
std::vector<int> mapping;
int maxMistakes_;
|