Merge branch 'ebf' of cwtch.im/ui into master

This commit is contained in:
Dan Ballard 2019-04-17 14:18:35 -07:00 committed by Gogs
commit fa8d2007ec
8 changed files with 48 additions and 32 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<manifest package="ca.openprivacy.cwtch.ui" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto"> <manifest package="ca.openprivacy.cwtch.ui" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="cwtch" android:icon="@drawable/ic_launcher"> <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="cwtch" android:icon="@drawable/ic_launcher">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="ca.openprivacy.cwtch.ui.CwtchActivity" android:label="cwtch" android:theme="@style/AppTheme" android:screenOrientation="unspecified" android:launchMode="singleTop"> <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="ca.openprivacy.cwtch.ui.CwtchActivity" android:label="cwtch" android:theme="@style/AppTheme" android:screenOrientation="unspecified" android:launchMode="singleTop" android:windowSoftInputMode="adjustResize">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER"/>

View File

@ -47,10 +47,10 @@ func IncomingListener(callback func(*gobjects.Message), groupErrorCallback func(
if ctc != nil { if ctc != nil {
name, exists = ctc.GetAttribute("nick") name, exists = ctc.GetAttribute("nick")
if !exists || name == "" { if !exists || name == "" {
name = e.Data[event.RemotePeer] + "..." name = e.Data[event.RemotePeer]
} }
} else { } else {
name = e.Data[event.RemotePeer] + "..." name = e.Data[event.RemotePeer]
} }
ts, _ := time.Parse(time.RFC3339Nano, e.Data[event.TimestampSent]) ts, _ := time.Parse(time.RFC3339Nano, e.Data[event.TimestampSent])

View File

@ -200,9 +200,12 @@ func (this *GrandCentralDispatcher) loadMessagesPaneHelper(handle string) {
if ctc != nil { if ctc != nil {
name, exists = ctc.GetAttribute("nick") name, exists = ctc.GetAttribute("nick")
if !exists || name == "" { if !exists || name == "" {
name = tl[i].PeerID[:16] + "..." name = tl[i].PeerID
} }
} else {
name = tl[i].PeerID
} }
this.PrependMessage( this.PrependMessage(
handle, handle,
tl[i].PeerID, tl[i].PeerID,

View File

@ -145,7 +145,7 @@ ApplicationWindow {
Layout.fillHeight: true Layout.fillHeight: true
Layout.minimumWidth: Layout.maximumWidth Layout.minimumWidth: Layout.maximumWidth
Layout.maximumWidth: theStack.pane == theStack.emptyPane ? parent.width : 450 Layout.maximumWidth: theStack.pane == theStack.emptyPane ? parent.width : 450
visible: (ratio <= 1.08 && windowItem.width >= 700) || theStack.pane == theStack.emptyPane visible: (ratio <= 1.08 && windowItem.width >= 700 && !Qt.inputMethod.visible) || theStack.pane == theStack.emptyPane
ContactList{ ContactList{
@ -202,7 +202,7 @@ ApplicationWindow {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: 20 anchors.topMargin: 20
width: lblPopup.width + 30 width: lblPopup.width + 30
height: lblPopup.height + 8 height: lblPopup.height + 8 * gcd.themeScale
color: "#000000" color: "#000000"
opacity: 0.5 opacity: 0.5
radius: 15 radius: 15
@ -213,7 +213,7 @@ ApplicationWindow {
id: lblPopup id: lblPopup
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
font.pixelSize: 18 font.pixelSize: 18 * gcd.themeScale
color: "#FFFFFF" color: "#FFFFFF"
} }
} }

View File

@ -25,6 +25,7 @@ ColumnLayout {
spacing: 6 spacing: 6
clip: true clip: true
ScrollBar.vertical: ScrollBar {} ScrollBar.vertical: ScrollBar {}
maximumFlickVelocity: 1250
delegate: Message { delegate: Message {
handle: _handle handle: _handle
@ -96,7 +97,7 @@ ColumnLayout {
"_handle": handle, "_handle": handle,
"_from": from, "_from": from,
"_displayName": displayName, "_displayName": displayName,
"_message":parse(msg.d, 12), "_message":parse(msg.d, 24),
"_rawMessage":msg.d, "_rawMessage":msg.d,
"_image": image, "_image": image,
"_mid": mid, "_mid": mid,
@ -140,7 +141,7 @@ ColumnLayout {
TextEdit { TextEdit {
id: txtMessage id: txtMessage
font.pixelSize: 10 font.pixelSize: 10 * gcd.themeScale
text: "" text: ""
padding: 6 padding: 6
wrapMode: TextEdit.Wrap wrapMode: TextEdit.Wrap
@ -268,7 +269,9 @@ ColumnLayout {
anchors.right: btnAttach.left anchors.right: btnAttach.left
anchors.rightMargin: 2 anchors.rightMargin: 2
onClicked: gcd.popup("emoji not yet implemented, sorry") onClicked: {
gcd.popup("emoji not yet implemented, sorry")
}
} }
SimpleButton { SimpleButton {

View File

@ -17,7 +17,8 @@ Item {
property bool isGroup property bool isGroup
property bool showStatus property bool showStatus
property bool highlight property bool highlight
property int baseWidth: 48 * gcd.themeScale property real logscale: 4 * Math.log10(gcd.themeScale + 1)
property int baseWidth: 48 * logscale
Rectangle { Rectangle {
id: mainImage id: mainImage
@ -59,22 +60,22 @@ Item {
Rectangle { // PRESENCE INDICATOR Rectangle { // PRESENCE INDICATOR
visible: showStatus visible: showStatus
color: "#FFFFFF" color: "#FFFFFF"
width: 8 * gcd.themeScale width: 8 * logscale
height: 8 * gcd.themeScale height: 8 * logscale
radius: 2 * gcd.themeScale radius: 2 * logscale
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.margins: 4 * gcd.themeScale anchors.margins: 4 * logscale
Rectangle { //-2:WtfCodeError,-1:Untrusted,0:Disconnected,1:Connecting,2:Connected,3:Authenticated,4:Failed,5:Killed Rectangle { //-2:WtfCodeError,-1:Untrusted,0:Disconnected,1:Connecting,2:Connected,3:Authenticated,4:Failed,5:Killed
color: status == 3 ? "green" : status == -1 ? "blue" : status == 1 ? "orange" : status == 2 ? "orange" : "red" color: status == 3 ? "green" : status == -1 ? "blue" : status == 1 ? "orange" : status == 2 ? "orange" : "red"
width: 5 * gcd.themeScale width: 5 * logscale
height: 5 * gcd.themeScale height: 5 * logscale
radius: 2 * gcd.themeScale radius: 2 * logscale
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.margins: 1.5 * gcd.themeScale anchors.margins: 1.5 * logscale
} }
} }

View File

@ -9,9 +9,10 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
visible: !deleted visible: !deleted
height: 48 * gcd.themeScale + 3 height: 48 * logscale + 3
implicitHeight: height implicitHeight: height
property real logscale: 4 * Math.log10(gcd.themeScale + 1)
property alias displayName: cn.text property alias displayName: cn.text
property alias image: imgProfile.source property alias image: imgProfile.source
property string handle property string handle
@ -29,7 +30,7 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
id: crRect id: crRect
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
height: 48 * gcd.themeScale + 3 height: 48 * logscale + 3
width: parent.width width: parent.width
color: background ? (isHover ? "#D2D2F3" : (isActive ? "#D2D2F3" : "#D2C0DD")) : windowItem.cwtch_background_color color: background ? (isHover ? "#D2D2F3" : (isActive ? "#D2D2F3" : "#D2C0DD")) : windowItem.cwtch_background_color

View File

@ -6,7 +6,7 @@ import QtQuick.Layouts 1.3
import "controls" as Awesome import "controls" as Awesome
RowLayout { Item {
id: root id: root
anchors.left: fromMe ? undefined : parent.left anchors.left: fromMe ? undefined : parent.left
@ -73,12 +73,8 @@ RowLayout {
Rectangle { // THIS IS JUST A PRETTY MESSAGE-HOLDING RECTANGLE Rectangle { // THIS IS JUST A PRETTY MESSAGE-HOLDING RECTANGLE
id: rectMessageBubble id: rectMessageBubble
height: lbl.height + ts.height + 8 height: colMessageBubble.height + 8
Layout.minimumHeight: height
Layout.maximumHeight: height
width: colMessageBubble.width + 6 width: colMessageBubble.width + 6
Layout.minimumWidth: width
Layout.maximumWidth: width
color: fromMe ? "#B09CBC" : "#4B3557" color: fromMe ? "#B09CBC" : "#4B3557"
radius: 5 radius: 5
@ -130,29 +126,41 @@ RowLayout {
Label { // TIMESTAMP Label { // TIMESTAMP
id: ts id: ts
color: "#FFFFFF" color: "#FFFFFF"
font.pixelSize: 10 font.pixelSize: 10 * gcd.themeScale
anchors.left: parent.left anchors.left: parent.left
leftPadding: 10 leftPadding: 10
} }
Label { // DISPLAY NAME FOR GROUPS Label { // DISPLAY NAME FOR GROUPS
color: "#FFFFFF" color: "#FFFFFF"
font.pixelSize: 10 font.pixelSize: 10 * gcd.themeScale
anchors.right: parent.right anchors.right: parent.right
text: displayName text: displayName.length > 12 ? displayName.substr(0,12) + "..." : displayName
visible: !fromMe visible: !fromMe
ToolTip.text: from
ToolTip.visible: ma2.containsMouse
ToolTip.delay: 200
MouseArea {
id: ma2
anchors.fill: parent
hoverEnabled: true
}
} }
Image { // ACKNOWLEDGEMENT ICON Image { // ACKNOWLEDGEMENT ICON
id: ack id: ack
anchors.right: parent.right anchors.right: parent.right
source: root.error != "" ? "qrc:/qml/images/fontawesome/regular/window-close.svg" : (root.ackd ? "qrc:/qml/images/fontawesome/regular/check-circle.svg" : "qrc:/qml/images/fontawesome/regular/hourglass.svg") source: root.error != "" ? "qrc:/qml/images/fontawesome/regular/window-close.svg" : (root.ackd ? "qrc:/qml/images/fontawesome/regular/check-circle.svg" : "qrc:/qml/images/fontawesome/regular/hourglass.svg")
height: 10 height: 10 * gcd.themeScale
sourceSize.height: 10 sourceSize.height: 10 * gcd.themeScale
visible: fromMe visible: fromMe
ToolTip.visible: ma.containsMouse ToolTip.visible: ma.containsMouse
ToolTip.delay: 200
//: Could not send this message //: Could not send this message
ToolTip.text: root.error != "" ? qsTr("could-not-send-msg-error") + ":" + root.error : (root.ackd ? qsTr("acknowledged-label") : qsTr("pending-label")) ToolTip.text: root.error != "" ? qsTr("could-not-send-msg-error") + ":" + root.error : (root.ackd ? qsTr("acknowledged-label") : qsTr("pending-label"))
MouseArea { MouseArea {
id: ma id: ma
anchors.fill: parent anchors.fill: parent