diff --git a/views/basic/qml/chatpage.qml b/views/basic/qml/chatpage.qml index eb29400d..80ff63a6 100644 --- a/views/basic/qml/chatpage.qml +++ b/views/basic/qml/chatpage.qml @@ -1,129 +1,130 @@ /* * Copyright 2018 Fabian Riethmayer * Copyright 2019 Emmanuel Lepage * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 3, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.2 import QtQuick.Layouts 1.4 import QtQuick.Controls 2.2 as Controls import org.kde.kirigami 2.6 as Kirigami import org.kde.ringkde.basicview 1.0 as BasicView import org.kde.ringkde.jamichatview 1.0 as JamiChatView Kirigami.Page { property var model; property var currentIndividual: null property alias showContactDetails: detail.active property alias editContact: form.active property bool _fits: false Kirigami.Theme.colorSet: Kirigami.Theme.View id: chatPage spacing: 0 leftPadding: 0 rightPadding: 0 topPadding: 0 bottomPadding: 0 padding: 0 titleDelegate: BasicView.DesktopHeader { id: dheader visible: fits + Layout.fillWidth: true Component.onCompleted: _fits = fits onFitsChanged: _fits = fits } header: Controls.ToolBar { visible: (!_fits) height: visible ? Kirigami.Units.gridUnit * 2.5 : 0 Layout.fillWidth: true Layout.preferredHeight: visible ? Kirigami.Units.gridUnit * 5 : 0 Layout.margins: 0 BasicView.DesktopHeader { anchors.fill: parent } } RowLayout { anchors.fill: parent spacing: 0 JamiChatView.ChatPage { id: chatView Layout.fillWidth: true Layout.fillHeight: true Layout.bottomMargin: 0 currentIndividual: mainPage.currentIndividual timelineModel: mainPage.timelineModel } Loader { id: sidebarLoader // 750 is the 600pt maximum width of the chat + width of the sidebar active: pageStack.wideMode && (!Kirigami.Settings.isMobile) && parent.width > 750 Layout.preferredWidth: active ? 250 : 0 Layout.fillHeight: true sourceComponent: BasicView.SideBar { anchors.fill: sidebarLoader } } } Loader { active: false id: detail sourceComponent: BasicView.DetailPage { model: chatPage.model onSheetOpenChanged: detail.active = sheetOpen Component.onCompleted: sheetOpen = true } } Loader { active: false id: form sourceComponent: BasicView.FormPage { onSheetOpenChanged: form.active = sheetOpen Component.onCompleted: {sheetOpen = true} } } actions { left : actionCollection.videoCallAction main : actionCollection.audioCallAction right: Kirigami.Settings.isMobile ? undefined : actionCollection.shareScreenAction } // Not worth it on mobile contextualActions: Kirigami.Settings.isMobile ? [] : [ actionCollection.bookmarkAction, actionCollection.shareAction, actionCollection.editAction, actionCollection.photoAction, actionCollection.banAction, actionCollection.deleteAction, actionCollection.learAction, ] } diff --git a/views/basic/qml/desktopheader.qml b/views/basic/qml/desktopheader.qml index cbf10178..705ec6bf 100644 --- a/views/basic/qml/desktopheader.qml +++ b/views/basic/qml/desktopheader.qml @@ -1,140 +1,151 @@ /* * Copyright 2018 Fabian Riethmayer * Copyright 2019 Emmanuel Lepage * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 3, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.2 import QtQuick.Layouts 1.4 import QtQuick.Controls 2.2 as Controls import org.kde.kirigami 2.6 as Kirigami import org.kde.ringkde.jamicontactview 1.0 as JamiContactView +import org.kde.ringkde.jamitroubleshooting 1.0 as JamiTroubleshooting MouseArea { property var textColor: Kirigami.Theme.highlightedTextColor property real photoSize: Kirigami.Units.largeSpacing // The `currentIndividual` is to force it to be reloaded property bool fits: mainPage.currentIndividual == mainPage.currentIndividual && pageStack.wideMode && grid.implicitWidth < parent.width implicitHeight: parent.parent.height - 2*photoSize GridLayout { id: grid rows: 2 columns: 5 rowSpacing: 0 flow: GridLayout.TopToBottom columnSpacing: Kirigami.Units.smallSpacing + anchors.fill: parent JamiContactView.ContactPhoto { Layout.preferredWidth: parent.parent.height Layout.preferredHeight: parent.parent.height Layout.rowSpan: 2 individual: mainPage.currentIndividual defaultColor: Kirigami.Theme.highlightedTextColor drawEmptyOutline: false MouseArea { onClicked: chatPage.showContactDetails = true anchors.fill: parent } } Kirigami.Heading { id: mainHeading level: 3 text: mainPage.currentIndividual ? mainPage.currentIndividual.bestName : "" color: textColor Layout.preferredWidth: implicitWidth elide: Text.ElideRight //show only when at least half of the string has been painted: use //opacity as using visible it won't correctly recalculate the width opacity: width > implicitWidth/2 Layout.columnSpan: 1 MouseArea { onClicked: chatPage.showContactDetails = true anchors.fill: parent } } Controls.Label { text: "Online" elide: Text.ElideRight color: textColor opacity: width > implicitWidth/2 // color: Qt.Tint( // mainHeading.color, // Kirigami.Theme.positiveTextColor // ) Layout.columnSpan: 2 MouseArea { onClicked: chatPage.showContactDetails = true anchors.fill: parent } } Kirigami.Icon { id: edit opacity: Kirigami.Settings.isMobile color: textColor source: "document-edit" Layout.preferredWidth: Kirigami.Units.iconSizes.smallMedium Layout.preferredHeight: Kirigami.Units.iconSizes.smallMedium MouseArea { onClicked: chatPage.editContact = true anchors.fill: parent } Behavior on opacity { NumberAnimation {duration: 200} } Layout.rowSpan: 2 } Kirigami.Icon { id: favorite source: "favorite" color: textColor opacity: Kirigami.Settings.isMobile Layout.rowSpan: 2 Layout.preferredWidth: Kirigami.Units.iconSizes.smallMedium Layout.preferredHeight: Kirigami.Units.iconSizes.smallMedium Behavior on opacity { NumberAnimation {duration: 200} } } Item { Layout.fillWidth: true Layout.rowSpan: 2 + Layout.fillHeight: true + + // Display reasons why the media buttons are not present + JamiTroubleshooting.MediaAvailability { + width: parent.width + defaultSize: parent.height < 48 ? parent.height : 48 + currentIndividual: mainPage.currentIndividual + anchors.verticalCenter: parent.verticalCenter + } } } hoverEnabled: !Kirigami.Settings.isMobile onContainsMouseChanged: { favorite.opacity = containsMouse edit.opacity = containsMouse } }