This repository has been archived on 2021-06-24. You can view files and clone it, but cannot push or open issues or pull requests.
ui/qml/panes/OverlayPane.qml

158 lines
3.9 KiB
QML

import QtGraphicalEffects 1.0
import QtQuick 2.7
import QtQuick.Controls 2.4
import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.3
import "../opaque" as Opaque
import "../opaque/styles"
import "../overlays"
import "../opaque/fonts"
import "../opaque/theme"
ColumnLayout {
Layout.fillWidth: true
id: overlay
property string name
property bool accepted
property bool inGroup
// TODO: this isn't needed now right? the peer approval flow can be addapted for groups too?
/* RowLayout {
visible:!overlay.accepted && (gcd.selectedConversation.length == 32)
Text {
//: Do you want to accept the invitation to $GROUP
text: qsTr("accept-group-invite-label") + " " + overlay.name + "?"
}
Opaque.Button {
//: Accept group invite button
text: qsTr("accept-group-btn")
icon: "regular/heart"
onClicked: {
gcd.acceptGroup(gcd.selectedConversation)
gcd.requestGroupSettings(gcd.selectedConversation)
}
}
Opaque.Button {
//: Reject Group invite button
text: qsTr("reject-group-btn")
icon: "regular/trash-alt"
onClicked: {
gcd.leaveGroup(gcd.selectedConversation)
theStack.pane = theStack.emptyPane
}
}
}*/
RowLayout {
id: switcher
height: chatTab.height
implicitHeight: height
Layout.fillWidth: true
property string selectedTab: "chat"
Opaque.Tab {
id: chatTab
Layout.fillWidth: true
active: switcher.selectedTab == "chat"
text: qsTr("chat-btn")
onClicked: { switcher.selectedTab = "chat"; overlayStack.overlay = overlayStack.chatOverlay }
}
Rectangle {
width: 2
height: parent.height
color: Theme.dividerColor
}
Opaque.Tab {
Layout.fillWidth: true
active: switcher.selectedTab == "lists"
text: qsTr("lists-btn")
onClicked: { switcher.selectedTab = "lists"; overlayStack.overlay = overlayStack.listOverlay }
}
Rectangle {
width: 2
height: parent.height
color: Theme.dividerColor
}
Opaque.Tab {
Layout.fillWidth: true
active: switcher.selectedTab == "bullitin"
text: qsTr("bulletins-btn")
onClicked: { switcher.selectedTab = "bullitin"; overlayStack.overlay = overlayStack.bulletinOverlay }
}
}
StackLayout {
id: overlayStack
Layout.fillWidth: true
implicitHeight: height
currentIndex: 0
property alias overlay: overlayStack.currentIndex
readonly property int chatOverlay: 0
readonly property int listOverlay: 1
readonly property int bulletinOverlay: 2
readonly property int membershipOverlay: 3
ChatOverlay { //0
Layout.maximumHeight: overlayStack.height
Layout.maximumWidth: overlayStack.width
}
ListOverlay{ //1
Layout.maximumHeight: overlayStack.height
Layout.maximumWidth: overlayStack.width
}
BulletinOverlay{ //2
Layout.maximumHeight: overlayStack.height
Layout.maximumWidth: overlayStack.width
}
MembershipOverlay { //3
Layout.maximumHeight: overlayStack.height
Layout.maximumWidth: overlayStack.width
}
}
Connections {
target: gcd
onResetMessagePane: function() {
overlayStack.overlay = overlayStack.chatOverlay
overlay.inGroup = false
}
onSupplyGroupSettings: function(gid, name, server, invite, accepted, addrbooknames, addrbookaddrs) {
overlay.name = name
overlay.accepted = accepted
overlay.inGroup = true
}
onSupplyServerSettings: function(server) {
overlay.name = server
}
}
}