Use AutoTextField.

Fix #81.
square-messages
Black Hat 2018-10-16 08:16:54 +08:00
parent bead3ed36b
commit a8b159b98a
15 changed files with 67 additions and 43 deletions

View File

@ -0,0 +1,6 @@
import QtQuick 2.9
import QtQuick.Controls 2.2
TextField {
selectByMouse: true
}

View File

@ -60,7 +60,7 @@ RowLayout {
spacing: 0
AutoLabel {
TimelineLabel {
id: authorLabel
visible: messageRow.avatarVisible
@ -71,6 +71,7 @@ RowLayout {
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: inputField.insert(inputField.cursorPosition, author.displayName)
}
}
@ -123,7 +124,7 @@ RowLayout {
spacing: 4
AutoLabel {
TimelineLabel {
visible: userMarker.length > 5
text: userMarker.length - 5 + "+"
coloredBackground: highlighted
@ -140,10 +141,21 @@ RowLayout {
hint: modelData.displayName
image: modelData.avatar
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
readMarkerDialog.listModel = userMarker
readMarkerDialog.open()
}
}
}
}
AutoLabel {
TimelineLabel {
id: timeLabel
visible: Math.abs(time - aboveTime) > 600000 || index == 0
@ -164,7 +176,7 @@ RowLayout {
id: downloadable
AutoImage {
TimelineImage {
z: -4
id: messageImage
@ -185,7 +197,7 @@ RowLayout {
Component {
id: fileComponent
AutoLabel {
TimelineLabel {
Layout.fillWidth: true
id: downloadDelegate
@ -207,7 +219,7 @@ RowLayout {
Component {
id: audioComponent
AutoLabel {
TimelineLabel {
id: downloadDelegate
text: content.info.duration / 1000 + '"'

View File

@ -11,7 +11,7 @@ Label {
wrapMode: Label.Wrap
linkColor: coloredBackground ? "white" : Material.accent
textFormat: MSettings.richText ? Text.RichText : Text.StyledText
textFormat: Text.RichText
onLinkActivated: Qt.openUrlExternally(link)
}

View File

@ -2,8 +2,6 @@ module Spectral.Component
AutoMouseArea 2.0 AutoMouseArea.qml
MaterialIcon 2.0 MaterialIcon.qml
SideNavButton 2.0 SideNavButton.qml
AutoImage 2.0 AutoImage.qml
AutoLabel 2.0 AutoLabel.qml
AutoTextArea 2.0 AutoTextArea.qml
ScrollHelper 2.0 ScrollHelper.qml
AutoListView 2.0 AutoListView.qml
AutoTextField 2.0 AutoTextField.qml

View File

@ -18,16 +18,6 @@ Menu {
sourceDialog.open()
}
}
MenuItem {
visible: model && model.userMarker.length > 0
height: visible ? undefined : 0
text: "View Receipts"
onTriggered: {
readMarkerDialog.listModel = model.userMarker
readMarkerDialog.open()
}
}
MenuItem {
visible: isFile
height: visible ? undefined : 0

View File

@ -71,7 +71,7 @@ Page {
id: mainCol
TextField {
AutoTextField {
Layout.fillWidth: true
id: serverField
@ -92,7 +92,7 @@ Page {
}
}
TextField {
AutoTextField {
Layout.fillWidth: true
id: usernameField
@ -112,7 +112,7 @@ Page {
}
}
TextField {
AutoTextField {
Layout.fillWidth: true
id: passwordField

View File

@ -2,4 +2,5 @@ import QtQuick 2.9
RoomForm {
roomListModel.onNewMessage: if (!window.active) spectralController.showMessage(roomName, content, icon)
roomListModel.onRoomAdded: if (room) room.getPreviousContent(5)
}

View File

@ -83,11 +83,10 @@ Column {
Label {
text: "Homeserver:"
}
TextField {
AutoTextField {
Layout.fillWidth: true
text: connection.homeserver
selectByMouse: true
readOnly: true
}
}
@ -100,11 +99,10 @@ Column {
Label {
text: "Device ID:"
}
TextField {
AutoTextField {
Layout.fillWidth: true
text: connection.deviceId
selectByMouse: true
readOnly: true
}
}
@ -117,11 +115,10 @@ Column {
Label {
text: "Access Token:"
}
TextField {
AutoTextField {
Layout.fillWidth: true
text: connection.accessToken
selectByMouse: true
readOnly: true
}
}

View File

@ -63,12 +63,11 @@ Drawer {
RowLayout {
Layout.fillWidth: true
TextField {
AutoTextField {
Layout.fillWidth: true
id: roomNameField
text: room && room.name ? room.name : ""
selectByMouse: true
}
ItemDelegate {
@ -84,13 +83,12 @@ Drawer {
RowLayout {
Layout.fillWidth: true
TextField {
AutoTextField {
Layout.fillWidth: true
id: roomTopicField
text: room && room.topic ? room.topic : ""
selectByMouse: true
}
ItemDelegate {
@ -196,7 +194,7 @@ Drawer {
modal: true
standardButtons: Dialog.Ok | Dialog.Cancel
contentItem: TextField {
contentItem: AutoTextField {
id: inviteUserDialogTextField
placeholderText: "@bot:matrix.org"
}

View File

@ -35,7 +35,7 @@ Rectangle {
anchors.fill: parent
spacing: 0
TextField {
AutoTextField {
Layout.fillWidth: true
Layout.preferredHeight: 40
Layout.margins: 12

View File

@ -312,7 +312,7 @@ Item {
clip: true
AutoTextArea {
RoomPanelInputField {
id: inputField
}
}

View File

@ -236,14 +236,14 @@ ApplicationWindow {
standardButtons: Dialog.Ok | Dialog.Cancel
contentItem: Column {
TextField {
AutoTextField {
width: parent.width
id: addRoomDialogNameTextField
placeholderText: "Name"
}
TextField {
AutoTextField {
width: parent.width
id: addRoomDialogTopicTextField
@ -274,7 +274,7 @@ ApplicationWindow {
modal: true
standardButtons: Dialog.Ok | Dialog.Cancel
contentItem: TextField {
contentItem: AutoTextField {
id: joinRoomDialogTextField
placeholderText: "#matrix:matrix.org"
}
@ -301,7 +301,7 @@ ApplicationWindow {
modal: true
standardButtons: Dialog.Ok | Dialog.Cancel
contentItem: TextField {
contentItem: AutoTextField {
id: directChatDialogTextField
placeholderText: "@bot:matrix.org"
}

28
res.qrc
View File

@ -48,10 +48,32 @@
<file>imports/Spectral/Panel/RoomPanelForm.ui.qml</file>
<file>imports/Spectral/Panel/RoomHeader.qml</file>
<file>imports/Spectral/Panel/RoomListDelegate.qml</file>
<file>imports/Spectral/Component/AutoImage.qml</file>
<file>imports/Spectral/Component/AutoLabel.qml</file>
<file>imports/Spectral/Component/AutoTextArea.qml</file>
<file>imports/Spectral/Component/ScrollHelper.qml</file>
<file>imports/Spectral/Component/AutoListView.qml</file>
<file>imports/Spectral/Component/Timeline/TimelineImage.qml</file>
<file>imports/Spectral/Component/Timeline/TimelineLabel.qml</file>
<file>imports/Spectral/Panel/RoomPanelInputField.qml</file>
<file>src/accountlistmodel.cpp</file>
<file>src/accountlistmodel.h</file>
<file>src/controller.cpp</file>
<file>src/controller.h</file>
<file>src/emojimodel.cpp</file>
<file>src/emojimodel.h</file>
<file>src/imageitem.cpp</file>
<file>src/imageitem.h</file>
<file>src/imageprovider.cpp</file>
<file>src/imageprovider.h</file>
<file>src/main.cpp</file>
<file>src/messageeventmodel.cpp</file>
<file>src/messageeventmodel.h</file>
<file>src/roomlistmodel.cpp</file>
<file>src/roomlistmodel.h</file>
<file>src/spectralroom.cpp</file>
<file>src/spectralroom.h</file>
<file>src/spectraluser.cpp</file>
<file>src/spectraluser.h</file>
<file>src/userlistmodel.cpp</file>
<file>src/userlistmodel.h</file>
<file>imports/Spectral/Component/AutoTextField.qml</file>
</qresource>
</RCC>