~nicohman/signal-rs

ref: 65a31f5a1c4562d1f216e9fef2048f50bddb4fe3 signal-rs/qml/main.qml -rw-r--r-- 5.9 KiB
65a31f5a — nicohman More Krigami conversion and image overlay 6 months ago
                                                                                
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
import QtQuick 2.12
import QtQuick.Controls 2.5
import SignalUI 0.1
import QtQuick.Layouts 1.15
import QtQuick.Controls.Material 2.12
import org.kde.kirigami 2.13 as Kirigami
Kirigami.ApplicationWindow {
    id: window
    width: 640
    height: 470
    visible: true
    title: signal.name
    color: theme.background
    Theme {
        id: theme
    }
    SystemPalette {
        id: systemPalette
        colorGroup: SystemPalette.Active
    }
    SignalState {
        id: signalState
    }
    SignalUI {
        id: signal
        objectName: "signal"
        Component.onCompleted: {
            theme.setTheme("signal");
            signal.init_state();
        }
        name: "signal"
        onReady: {
            signalState.currentView = "chats";
            window.pageStack.replace(chatViewStack);
            //toolButton.enabled = true;
        }
    }
    pageStack.initialPage: Kirigami.Page {
    //anchors.fill: stackView
    objectName: "loadingpage"
    title: ""
    background:Rectangle {
        color: theme.background
    }
    BusyIndicator {
        running: true
        anchors.centerIn: parent
    }
}

    globalDrawer: Kirigami.GlobalDrawer {
        isMenu: true
        actions: [
            Kirigami.Action {
                text: "Create Contact"
                icon.name: "gtk-add"
                onTriggered: {
                    signalState.openView("createContact")
                }
            },
            Kirigami.Action {
                text: i18n("Quit")
                icon.name: "gtk-quit"
                shortcut: StandardKey.Quit
                onTriggered: Qt.quit()
            }
        ]
    }
    /*header: ToolBar {
        id: headerToolBar
        background: Rectangle {
            color: theme.background
        }
        contentHeight: toolButton.implicitHeight
        ToolButton {
            enabled: false
            id: toolButton
            text: stackView.depth > 1 ? "\u25C0" : "\u2630"
            font.pixelSize: Qt.application.font.pixelSize * 1.6
            onClicked: {
                if (stackView.depth > 1) {
                    stackView.pop()
                    signal.show_view(stackView.currentItem.objectName);
                    signalState.currentView = stackView.currentItem.objectName;
                } else {
                    drawer.open()
                }
            }
        }
        Label {
            text: stackView.currentItem.title
            anchors.centerIn: parent
            font.pixelSize: Qt.application.font.pixelSize * 1.3
            color: theme.text
        }
        Item {
            anchors.right: parent.right
            anchors.top: parent.top
            id: headerBarDynamic
            ToolButton {
                visible: signalState.currentView === "chatHistory"
                id: editContactButton
                text: "Edit"
                anchors.right: parent.right
                anchors.rightMargin: 5
                anchors.top: parent.top
                anchors.topMargin: 5
                font.pixelSize: Qt.application.font.pixelSize * 1.1
                onClicked: {
                    signalState.openView("editContact");
                }
            }
            ToolButton {
                visible: signalState.currentView === "chats" 
                id: createChatButton
                text: "Create Chat"
                anchors.right: parent.right
                anchors.rightMargin: 5
                font.pixelSize: Qt.application.font.pixelSize * 1.1
                anchors.top: parent.top
                anchors.topMargin: 5
                onClicked: {
                    signalState.openView("createChat");
                }
            }
        }
    }
    Drawer {
        id: drawer
        width: window.width * 0.66
        height: window.height
        background: Rectangle {
            color: theme.background
        }
        Column {
            anchors.fill: parent
            ItemDelegate {
                width: parent.width
                onClicked: {
                    signalState.openView("chats");
                    drawer.close()
                }
                contentItem: Text {
                    text: "Chats"
                    color: theme.text
                }
            }
            ItemDelegate {
                width: parent.width
                onClicked: {
                    signalState.openView("createContact");
                    drawer.close()
                }
                contentItem: Text {
                    text: "Create Contact"
                    color: theme.text
                }
            }
            ItemDelegate {
                width: parent.width
                onClicked: {
                    signalState.openView("settings");
                    drawer.close()
                }
                contentItem : Text {
                    text: "Settings"
                    color: theme.text
                }
            }
        }
    }
    Row {
        anchors.fill: parent
        StackView {
            id: stackView
            initialItem: "loading.qml"
            anchors.fill: signalState.desktopView ? parent : undefined
            x: 0
            width: signalState.desktopView ? window.width * 0.33 : window.width
            height: window.height - headerToolBar.height
        }
        Loader {
            x: window.width * 0.33
            id: msgDesktopViewLoader
            sourceComponent: signalState.desktopView ? messagesViewStack : undefined
            height:  signalState.desktopView ? window.height - headerToolBar.height : 0
            width:  signalState.desktopView ? window.width * 0.66 : 0
            enabled: signalState.desktopView
            active: signalState.desktopView
        }
    }*/
    Component {
        id: chatViewStack
        ChatList {}
    }
   Component {
        id: messagesViewStack
        ChatHistory {}
    }
    Component {
        id: msgimgover
        MessageImage {}
    }

}