summary refs log tree commit diff
path: root/resources/qml/dialogs/CreateDirect.qml
blob: bbb758e3862d0d809f0896dc13524ed32287766d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// SPDX-FileCopyrightText: 2021 Nheko Contributors
// SPDX-FileCopyrightText: 2022 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later

import ".."
import QtQuick 2.15
import QtQuick.Window 2.13
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.3
import im.nheko 1.0

ApplicationWindow {
    id: createDirectRoot
    title: qsTr("Create Direct Chat")
    property var profile: null
    minimumHeight: layout.implicitHeight+2*layout.anchors.margins+footer.height
    minimumWidth: footer.width
    ColumnLayout {
        id: layout
        anchors.fill: parent
        anchors.margins: Nheko.paddingSmall
        MatrixTextField {
            id: userID
            Layout.fillWidth: true
            focus: true
            placeholderText: qsTr("Name")
            /*onTextChanged: {
                if(isValidMxid(text))
                    profile = getProfile(text);
                else
                    profile = null;
            }*/
        }

        GridLayout {
            Layout.fillWidth: true
            rows: 2
            columns: 2
            rowSpacing: Nheko.paddingSmall
            columnSpacing: Nheko.paddingMedium
            anchors.centerIn: parent

            Avatar {
                Layout.rowSpan: 2
                Layout.preferredWidth: Nheko.avatarSize
                Layout.preferredHeight: Nheko.avatarSize
                Layout.alignment: Qt.AlignLeft
                userid: profile.mxid
                url: profile.avatarUrl.replace("mxc://", "image://MxcImage/")
                displayName: profile.displayName
                enabled: false
            }
            Label {
                Layout.fillWidth: true
                text: "John Smith" //profile.displayName
                color: TimelineManager.userColor(userID.text, Nheko.colors.window)
                font.pointSize: fontMetrics.font.pointSize
            }

            Label {
                Layout.fillWidth: true
                text: userID.text
                color: Nheko.colors.buttonText
                font.pointSize: fontMetrics.font.pointSize * 0.9
            }
        }
        RowLayout {
            Layout.fillWidth: true
            Label {
                Layout.fillWidth: true
                Layout.alignment: Qt.AlignLeft
                text: qsTr("Encryption")
                color: Nheko.colors.text
            }
            ToggleButton {
                Layout.alignment: Qt.AlignRight
                id: encryption
                checked: true
            }
        }
    }
    footer: DialogButtonBox {
        standardButtons: DialogButtonBox.Cancel
        Button {
            text: "Start Direct Chat"
            DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
        }
        onRejected: createDirectRoot.close();
        //onAccepted: createRoom(newRoomName.text, newRoomTopic.text, newRoomAlias.text, newRoomVisibility.index, newRoomPreset.index)
    }
}