From a0bbfa77215dd43e795bbebeae673d78fe9c97d1 Mon Sep 17 00:00:00 2001 From: erinn Date: Mon, 23 Nov 2020 15:50:16 -0800 Subject: [PATCH 1/3] add tabbar --- qml/opaque | 2 +- qml/panes/AddPeerGroupPane.qml | 77 +++++----------------------------- qml/panes/OverlayPane.qml | 54 ++++-------------------- 3 files changed, 19 insertions(+), 114 deletions(-) diff --git a/qml/opaque b/qml/opaque index d6b56d02..d78fcdc8 160000 --- a/qml/opaque +++ b/qml/opaque @@ -1 +1 @@ -Subproject commit d6b56d02780c675a0acc36bd0f9ae65a42789077 +Subproject commit d78fcdc8e6b0f484e29e404810b6660677ab840d diff --git a/qml/panes/AddPeerGroupPane.qml b/qml/panes/AddPeerGroupPane.qml index 17708d6d..698040f2 100644 --- a/qml/panes/AddPeerGroupPane.qml +++ b/qml/panes/AddPeerGroupPane.qml @@ -18,7 +18,7 @@ Rectangle { color: Theme.backgroundPaneColor function reset() { - addStack.currentIndex = addStack.addPeer + tabBar.currentIndex = 0 peerAddr.text = "" peerName.text = "" @@ -74,63 +74,12 @@ Rectangle { color: root.color } - RowLayout { - id: switcher + Opaque.TabBar { + id: tabBar visible: gcd.experimentsEnabled && Utils.checkMap(gcd.experiments, "tapir-groups-experiment") - - height: addPeerTab.height - implicitHeight: height - anchors.left: parent.left - anchors.right: parent.right - - Opaque.Tab { - id: addPeerTab - Layout.fillWidth: true - active: addStack.currentIndex == addStack.addPeer - //: Add a peer - text: qsTr("add-peer-tab") - - size: Theme.chatMetaTextSize - - onClicked: { addStack.currentIndex = addStack.addPeer; } - } - - Rectangle { - width: 2 - height: parent.height - color: Theme.dividerColor - } - - Opaque.Tab { - Layout.fillWidth: true - active: addStack.currentIndex == addStack.createGroup - //: Create a group - text: qsTr("create-group-tab") - - size: Theme.chatMetaTextSize - - onClicked: { addStack.currentIndex = addStack.createGroup } - } - - Rectangle { - width: 2 - height: parent.height - color: Theme.dividerColor - } - - Opaque.Tab { - Layout.fillWidth: true - active: addStack.currentIndex == addStack.joinGroup - //: Join a group - text: qsTr("join-group-tab") - - size: Theme.chatMetaTextSize - - onClicked: { addStack.currentIndex = addStack.joinGroup} - } - - } - + width: parent.width - parent.leftPadding - parent.rightPadding + model: [qsTr("add-peer-tab"), qsTr("create-group-tab"), qsTr("join-group-tab")] + } StackLayout { id: addStack @@ -138,11 +87,7 @@ Rectangle { anchors.right: parent.right implicitHeight: height - currentIndex: addPeer - - readonly property int addPeer: 0 - readonly property int createGroup: 1 - readonly property int joinGroup: 2 + currentIndex: tabBar.currentIndex Column { // Add a peer Layout.fillWidth: true @@ -176,7 +121,7 @@ Rectangle { } } - Column { + Column { // Create a group Layout.fillWidth: true leftPadding: 20 * gcd.themeScale rightPadding: 20 * gcd.themeScale @@ -219,7 +164,7 @@ Rectangle { } } - Column { + Column { // Join a group Layout.fillWidth: true leftPadding: 20 * gcd.themeScale rightPadding: 20 * gcd.themeScale @@ -267,10 +212,10 @@ Rectangle { height: 40 * gcd.themeScale //: Add Peer | Create Group | Join Group - text: addStack.currentIndex == addStack.addPeer ? qsTr("add-peer") : addStack.currentIndex == addStack.createGroup ? qsTr("create-group") : qsTr("join-group") + text: tabBar.currentItem.text onClicked: { - if (addStack.currentIndex == addStack.addPeer) { + if (tabBar.currentIndex == 0) { gcd.addPeer(peerName.text, peerAddr.text) theStack.currentIndex = theStack.emptyPane } // Else Group stuff diff --git a/qml/panes/OverlayPane.qml b/qml/panes/OverlayPane.qml index 6d5c3881..cd40de69 100644 --- a/qml/panes/OverlayPane.qml +++ b/qml/panes/OverlayPane.qml @@ -19,53 +19,13 @@ ColumnLayout { property bool accepted property bool inGroup - RowLayout { - id: switcher + Opaque.TabBar { + id: tabBar + Layout.fillWidth: true - 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 } - } - - } + model: [qsTr("chat-btn"), qsTr("lists-btn"), qsTr("bulletins-btn")] + onCurrentIndexChanged: overlayStack.overlay = currentIndex + 1 + } StackLayout { id: overlayStack @@ -107,7 +67,7 @@ ColumnLayout { target: gcd onResetMessagePane: function() { - overlayStack.overlay = overlayStack.chatOverlay + tabBar.currentIndex = 0 overlay.inGroup = false } From 94381cb07619f5bcda4d59aefb99d77b889adcb8 Mon Sep 17 00:00:00 2001 From: erinn Date: Mon, 23 Nov 2020 16:33:14 -0800 Subject: [PATCH 2/3] adding to new opaque tabbar --- qml/opaque | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qml/opaque b/qml/opaque index d78fcdc8..a69fb3cf 160000 --- a/qml/opaque +++ b/qml/opaque @@ -1 +1 @@ -Subproject commit d78fcdc8e6b0f484e29e404810b6660677ab840d +Subproject commit a69fb3cff29a56fd2ea9c3b3d2b61f4ebe34e3c7 From a0081c9d4ea824af28d035ca9516c54325f003e3 Mon Sep 17 00:00:00 2001 From: erinn Date: Mon, 23 Nov 2020 16:36:50 -0800 Subject: [PATCH 3/3] fix indents --- qml/panes/AddPeerGroupPane.qml | 4 ++-- qml/panes/OverlayPane.qml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/qml/panes/AddPeerGroupPane.qml b/qml/panes/AddPeerGroupPane.qml index 698040f2..cc60c9e4 100644 --- a/qml/panes/AddPeerGroupPane.qml +++ b/qml/panes/AddPeerGroupPane.qml @@ -74,8 +74,8 @@ Rectangle { color: root.color } - Opaque.TabBar { - id: tabBar + Opaque.TabBar { + id: tabBar visible: gcd.experimentsEnabled && Utils.checkMap(gcd.experiments, "tapir-groups-experiment") width: parent.width - parent.leftPadding - parent.rightPadding model: [qsTr("add-peer-tab"), qsTr("create-group-tab"), qsTr("join-group-tab")] diff --git a/qml/panes/OverlayPane.qml b/qml/panes/OverlayPane.qml index cd40de69..b7c85101 100644 --- a/qml/panes/OverlayPane.qml +++ b/qml/panes/OverlayPane.qml @@ -19,9 +19,9 @@ ColumnLayout { property bool accepted property bool inGroup - Opaque.TabBar { - id: tabBar - Layout.fillWidth: true + Opaque.TabBar { + id: tabBar + Layout.fillWidth: true model: [qsTr("chat-btn"), qsTr("lists-btn"), qsTr("bulletins-btn")] onCurrentIndexChanged: overlayStack.overlay = currentIndex + 1 @@ -67,7 +67,7 @@ ColumnLayout { target: gcd onResetMessagePane: function() { - tabBar.currentIndex = 0 + tabBar.currentIndex = 0 overlay.inGroup = false }