From 1d8d11a06eecd56b9243fd1939498794077de340 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 23 Sep 2020 15:03:55 -0400 Subject: [PATCH] display channel suggestions in main channel list --- ui/app/AppLayouts/Chat/ContactsColumn.qml | 15 ++++---- .../Chat/ContactsColumn/ChannelList.qml | 36 ++++++++++++++++--- .../Chat/ContactsColumn/EmptyView.qml | 18 +++++----- 3 files changed, 51 insertions(+), 18 deletions(-) diff --git a/ui/app/AppLayouts/Chat/ContactsColumn.qml b/ui/app/AppLayouts/Chat/ContactsColumn.qml index 33201a4ca7..357acfbced 100644 --- a/ui/app/AppLayouts/Chat/ContactsColumn.qml +++ b/ui/app/AppLayouts/Chat/ContactsColumn.qml @@ -64,16 +64,19 @@ Item { anchors.topMargin: Style.current.padding function getCurrentIndex() { - return channelList.channelListCount > 0 ? 1 : 0 + // return channelList.channelListCount > 0 ? 1 : 0 + return 0 } currentIndex: getCurrentIndex() - EmptyView { - onCloseButtonPressed: function () { - contactsStackView.currentIndex = 2 - } - } + // ScrollView { + // clip: true + // EmptyView { + // onCloseButtonPressed: function () { + // contactsStackView.currentIndex = 2 + // } + // } ChannelList { id: channelList diff --git a/ui/app/AppLayouts/Chat/ContactsColumn/ChannelList.qml b/ui/app/AppLayouts/Chat/ContactsColumn/ChannelList.qml index c2622f8269..6bbe87115a 100644 --- a/ui/app/AppLayouts/Chat/ContactsColumn/ChannelList.qml +++ b/ui/app/AppLayouts/Chat/ContactsColumn/ChannelList.qml @@ -4,6 +4,7 @@ import QtQuick.Layouts 1.13 import "../../../../shared" import "../../../../imports" import "../components" +import "./" ScrollView { property alias channelListCount: chatGroupsListView.count @@ -12,16 +13,34 @@ ScrollView { Layout.fillHeight: true Layout.fillWidth: true ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + contentHeight: { + return itemId.height + } + clip: true - ListView { - id: chatGroupsListView +Item { + id: itemId + Layout.fillHeight: true anchors.top: parent.top - anchors.bottom: parent.bottom + // anchors.bottom: parent.bottom anchors.right: parent.right anchors.left: parent.left anchors.rightMargin: Style.current.padding anchors.leftMargin: Style.current.padding - clip: true + height: childrenRect.height + + ListView { + id: chatGroupsListView + anchors.top: parent.top + height: childrenRect.height + // anchors.bottom: parent.bottom + // anchors.bottom: chatGroupsListView2.top + anchors.right: parent.right + anchors.left: parent.left + anchors.rightMargin: Style.current.padding + anchors.leftMargin: Style.current.padding + interactive: false + // clip: true model: chatsModel.chats delegate: Channel { name: model.name @@ -52,6 +71,15 @@ ScrollView { } } + EmptyView { + width: parent.width + // height: 500 + anchors.top: chatGroupsListView.bottom + anchors.topMargin: 10 + } + +} + ProfilePopup { id: profilePopup height: 330 diff --git a/ui/app/AppLayouts/Chat/ContactsColumn/EmptyView.qml b/ui/app/AppLayouts/Chat/ContactsColumn/EmptyView.qml index 99556a893b..4417ba1073 100644 --- a/ui/app/AppLayouts/Chat/ContactsColumn/EmptyView.qml +++ b/ui/app/AppLayouts/Chat/ContactsColumn/EmptyView.qml @@ -7,9 +7,8 @@ import "../data/channelList.js" as ChannelJSON import "../../../../shared" import "../../../../imports" -//Item { - ScrollView { -// id: sview +Item { + // ScrollView { clip: true // anchors.top: suggestionsText.bottom @@ -18,17 +17,20 @@ import "../../../../imports" // anchors.right: parent.right // anchors.bottom: parent.bottom - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - ScrollBar.vertical.policy: ScrollBar.AlwaysOn + // ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + // ScrollBar.vertical.policy: ScrollBar.AlwaysOn // Layout.fillHeight: true // Layout.fillWidth: true + property var onCloseButtonPressed: function () {} id: emptyView Layout.fillHeight: true Layout.fillWidth: true - contentHeight: { + // contentHeight: { + height: { + if (!visible) return 0 var totalHeight = 0 for (let i = 0; i < sectionRepeater.count; i++) { totalHeight += sectionRepeater.itemAt(i).height + Style.current.padding @@ -52,7 +54,7 @@ import "../../../../imports" Item { id: inviteFriendsContainer - height: 190 + height: visible ? 190 : 0 anchors.top: parent.top anchors.topMargin: 0 anchors.right: parent.right @@ -88,7 +90,7 @@ import "../../../../imports" anchors.fill: closeImg cursorShape: Qt.PointingHandCursor onClicked: { - emptyView.onCloseButtonPressed() + emptyView.visible = false } }