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"?>
<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">
<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>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>

View File

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

View File

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

View File

@ -145,7 +145,7 @@ ApplicationWindow {
Layout.fillHeight: true
Layout.minimumWidth: Layout.maximumWidth
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{
@ -202,7 +202,7 @@ ApplicationWindow {
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: 20
width: lblPopup.width + 30
height: lblPopup.height + 8
height: lblPopup.height + 8 * gcd.themeScale
color: "#000000"
opacity: 0.5
radius: 15
@ -213,7 +213,7 @@ ApplicationWindow {
id: lblPopup
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: 18
font.pixelSize: 18 * gcd.themeScale
color: "#FFFFFF"
}
}

View File

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

View File

@ -17,7 +17,8 @@ Item {
property bool isGroup
property bool showStatus
property bool highlight
property int baseWidth: 48 * gcd.themeScale
property real logscale: 4 * Math.log10(gcd.themeScale + 1)
property int baseWidth: 48 * logscale
Rectangle {
id: mainImage
@ -59,22 +60,22 @@ Item {
Rectangle { // PRESENCE INDICATOR
visible: showStatus
color: "#FFFFFF"
width: 8 * gcd.themeScale
height: 8 * gcd.themeScale
radius: 2 * gcd.themeScale
width: 8 * logscale
height: 8 * logscale
radius: 2 * logscale
anchors.right: parent.right
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
color: status == 3 ? "green" : status == -1 ? "blue" : status == 1 ? "orange" : status == 2 ? "orange" : "red"
width: 5 * gcd.themeScale
height: 5 * gcd.themeScale
radius: 2 * gcd.themeScale
width: 5 * logscale
height: 5 * logscale
radius: 2 * logscale
anchors.right: parent.right
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.right: parent.right
visible: !deleted
height: 48 * gcd.themeScale + 3
height: 48 * logscale + 3
implicitHeight: height
property real logscale: 4 * Math.log10(gcd.themeScale + 1)
property alias displayName: cn.text
property alias image: imgProfile.source
property string handle
@ -29,7 +30,7 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
id: crRect
anchors.left: parent.left
anchors.right: parent.right
height: 48 * gcd.themeScale + 3
height: 48 * logscale + 3
width: parent.width
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
RowLayout {
Item {
id: root
anchors.left: fromMe ? undefined : parent.left
@ -73,12 +73,8 @@ RowLayout {
Rectangle { // THIS IS JUST A PRETTY MESSAGE-HOLDING RECTANGLE
id: rectMessageBubble
height: lbl.height + ts.height + 8
Layout.minimumHeight: height
Layout.maximumHeight: height
height: colMessageBubble.height + 8
width: colMessageBubble.width + 6
Layout.minimumWidth: width
Layout.maximumWidth: width
color: fromMe ? "#B09CBC" : "#4B3557"
radius: 5
@ -130,29 +126,41 @@ RowLayout {
Label { // TIMESTAMP
id: ts
color: "#FFFFFF"
font.pixelSize: 10
font.pixelSize: 10 * gcd.themeScale
anchors.left: parent.left
leftPadding: 10
}
Label { // DISPLAY NAME FOR GROUPS
color: "#FFFFFF"
font.pixelSize: 10
font.pixelSize: 10 * gcd.themeScale
anchors.right: parent.right
text: displayName
text: displayName.length > 12 ? displayName.substr(0,12) + "..." : displayName
visible: !fromMe
ToolTip.text: from
ToolTip.visible: ma2.containsMouse
ToolTip.delay: 200
MouseArea {
id: ma2
anchors.fill: parent
hoverEnabled: true
}
}
Image { // ACKNOWLEDGEMENT ICON
id: ack
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")
height: 10
sourceSize.height: 10
height: 10 * gcd.themeScale
sourceSize.height: 10 * gcd.themeScale
visible: fromMe
ToolTip.visible: ma.containsMouse
ToolTip.delay: 200
//: 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"))
MouseArea {
id: ma
anchors.fill: parent