Support Qt 5.11 and fix image provider.

This commit is contained in:
Black Hat
2018-07-07 17:38:20 +08:00
parent a850224c98
commit 17fa7cc7da
24 changed files with 666 additions and 808 deletions

View File

@@ -1,76 +0,0 @@
import QtQuick 2.10
import QtQuick.Controls 2.3
Rectangle {
id: root
property Connection currentConnection: null
property var currentRoom: null
function setRoom(room) {
currentRoom = room
messageModel.changeRoom(room)
}
function setConnection(conn) {
currentConnection = conn
messageModel.setConnection(conn)
}
function sendLine(text) {
if(!currentRoom || !currentConnection) return
currentConnection.postMessage(currentRoom, "m.text", text)
}
ListView {
id: chatView
anchors.fill: parent
flickableDirection: Flickable.VerticalFlick
verticalLayoutDirection: ListView.BottomToTop
model: MessageEventModel { id: messageModel }
delegate: Row {
id: message
width: parent.width
spacing: 8
Label {
id: timelabel
text: time.toLocaleTimeString("hh:mm:ss")
color: "grey"
}
Label {
width: 64
elide: Text.ElideRight
text: eventType == "message" ? author : "***"
color: eventType == "message" ? "grey" : "lightgrey"
horizontalAlignment: Text.AlignRight
}
Label {
text: content
wrapMode: Text.Wrap
width: parent.width - (x - parent.x) - spacing
color: eventType == "message" ? "black" : "lightgrey"
}
}
section {
property: "date"
labelPositioning: ViewSection.CurrentLabelAtStart
delegate: Rectangle {
width: parent.width
height: childrenRect.height
Label {
width: parent.width
text: section.toLocaleString(Qt.locale())
color: "grey"
horizontalAlignment: Text.AlignRight
}
}
}
onAtYBeginningChanged: {
if(currentRoom && atYBeginning) currentRoom.getPreviousContent()
}
}
}

View File

@@ -1,30 +1,31 @@
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick 2.11
import QtQuick.Controls 2.4
import QtGraphicalEffects 1.0
Item {
property bool statusIndicator: false
property bool opaqueBackground: false
property alias source: avatar.source
id: item
Rectangle {
width: parent.width
height: parent.width
radius: parent.width / 2
width: item.width
height: item.width
radius: item.width / 2
color: "white"
visible: opaqueBackground
}
Image {
id: avatar
width: parent.width
height: parent.width
width: item.width
height: item.width
mipmap: true
layer.enabled: true
fillMode: Image.PreserveAspectCrop
sourceSize.width: parent.width
sourceSize.height: parent.width
sourceSize.width: item.width
sourceSize.height: item.width
layer.effect: OpacityMask {
maskSource: Item {
@@ -38,15 +39,5 @@ Item {
}
}
}
Rectangle {
width: parent.width
height: parent.width
radius: parent.width / 2
color: "transparent"
border.color: "#4caf50"
border.width: 4
visible: statusIndicator
}
}
}

View File

@@ -1,10 +1,11 @@
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import QtQuick.Controls.Material 2.3
Item {
property alias icon: iconText.text
property var color: "white"
property var color: Material.theme == Material.Light ? "black" : "white"
id: item

View File

@@ -3,15 +3,9 @@ import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import QtQuick.Controls.Material 2.3
Drawer {
property SwipeView swipeView
interactive: false
position: 1.0
visible: true
modal: false
background: Rectangle {
Item {
Rectangle {
anchors.fill: parent
color: Material.accent
}
}

View File

@@ -4,7 +4,7 @@ import QtQuick.Layouts 1.3
import QtQuick.Controls.Material 2.3
Item {
property Item page
property var page
property alias contentItem: buttonDelegate.contentItem
signal clicked