diff --git a/src/accountview/qml/presenceselector.qml b/src/accountview/qml/presenceselector.qml index 97127235..55bf8814 100644 --- a/src/accountview/qml/presenceselector.qml +++ b/src/accountview/qml/presenceselector.qml @@ -1,51 +1,57 @@ /*************************************************************************** * Copyright (C) 2018 by Bluesystems * * Author : Emmanuel Lepage Vallee * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 3 of the License, 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 General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see . * **************************************************************************/ import QtQuick 2.7 import QtQuick.Layouts 1.0 import QtQuick.Controls 2.2 import org.kde.ringkde.jamicontactview 1.0 as JamiContactView import org.kde.kirigami 2.2 as Kirigami Dialog { id: dialog parent: applicationWindow().contentItem x: applicationWindow().contentItem.width / 2 - width/2 y: applicationWindow().contentItem.height / 2 - height/2 - width: applicationWindow().contentItem.width * 0.66 - height: applicationWindow().contentItem.height * 0.66 + + width: applicationWindow().contentItem.width * ( + Kirigami.Settings.isMobile ? 0.9 : 0.66 + ) + + height: applicationWindow().contentItem.height * ( + Kirigami.Settings.isMobile ? 0.9 : 0.75 + ) property QtObject individual: null JamiContactView.ContactInfo { id: contactInfo anchors.fill: parent showStat: false showImage: true showSave: false forcedState: "profile" individual: dialog.individual } onAccepted: { if (individual) contactInfo.save() } standardButtons: Dialog.Close | Dialog.Save } diff --git a/src/contactview/qml/vcardform.qml b/src/contactview/qml/vcardform.qml index ffd72798..26e28327 100644 --- a/src/contactview/qml/vcardform.qml +++ b/src/contactview/qml/vcardform.qml @@ -1,163 +1,167 @@ /*************************************************************************** * Copyright (C) 2017-2018 by Bluesystems * * Author : Emmanuel Lepage Vallee * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 3 of the License, 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 General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see . * **************************************************************************/ import QtQuick 2.7 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.0 import org.kde.kirigami 2.2 as Kirigami import net.lvindustries.ringqtquick 1.0 as RingQtQuick GridLayout { id: mainInfo property var currentContactMethod: null property var currentPerson: null property bool editing: true property real preferredHeight: implicitHeight property var individual: null property bool hasTarget: individual || currentContactMethod || currentPerson property alias name: formattedName.text signal changed() columns: 2 rowSpacing: 10 columnSpacing: 10 function syncDetails(person) { if ((!currentContactMethod) && (!currentPerson)) return // Changing the CM will flush the content, preserve it var old_formattedName = formattedName.text var old_firstName = firstName.text var old_secondName = lastName.text var old_preferredEmail = email.text // var old_organization = organization.text // Create a real contact method in case this is a temporary one if (currentContactMethod && currentContactMethod.type == RingQtQuick.ContactMethod.TEMPORARY) currentContactMethod = RingSession.individualDirectory.getNumber( currentContactMethod.uri, null, currentContactMethod.account ) person.formattedName = old_formattedName person.firstName = old_firstName person.secondName = old_secondName person.preferredEmail = old_preferredEmail // person.organization = old_organization currentPerson = person } onCurrentContactMethodChanged: { if (!currentContactMethod) return currentPerson = currentContactMethod.person } onCurrentPersonChanged: { formattedName.text = currentPerson ? currentPerson.formattedName : "" firstName.text = currentPerson ? currentPerson.firstName : "" lastName.text = currentPerson ? currentPerson.secondName : "" email.text = currentPerson ? currentPerson.preferredEmail : "" // organization.text = currentPerson ? // currentPerson.organization : "" } onIndividualChanged: { if (formattedName.text == "" && individual) formattedName.text = individual.bestName } Component.onCompleted: { if (formattedName.text == "" && individual) formattedName.text = individual.bestName } Label { id: label text: i18n("Formatted name:") color: labelColor ? labelColor : Kirigami.Theme.textColor } TextField { id: formattedName readOnly: hasTarget && !mainInfo.editing + Layout.fillWidth: true onTextChanged: { mainInfo.changed() } } Label { text: i18n("Primary name:") color: labelColor ? labelColor : Kirigami.Theme.textColor } TextField { id: firstName readOnly: hasTarget && !mainInfo.editing + Layout.fillWidth: true onTextChanged: { mainInfo.changed() } } Label { text: i18n("Last name:") color: labelColor ? labelColor : Kirigami.Theme.textColor } TextField { id: lastName readOnly: hasTarget && !mainInfo.editing + Layout.fillWidth: true onTextChanged: { mainInfo.changed() } } Label { text: i18n("Email:") color: labelColor ? labelColor : Kirigami.Theme.textColor } TextField { id: email readOnly: hasTarget && !mainInfo.editing + Layout.fillWidth: true onTextChanged: { mainInfo.changed() } } // OutlineButton { // id: addButton // height: 54 // sideMargin: 2 // Layout.columnSpan: 2 // width: formattedName.width + label.width + 30 // label: i18n("Add a field") // topPadding: 2 // visible: mainInfo.editing // } } diff --git a/views/basic/qml/callpage.qml b/views/basic/qml/callpage.qml index c308abe4..38646844 100644 --- a/views/basic/qml/callpage.qml +++ b/views/basic/qml/callpage.qml @@ -1,146 +1,146 @@ /* * 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 import org.kde.ringkde.jamicallview 1.0 as JamiCallView import net.lvindustries.ringqtquick 1.0 as RingQtQuick import net.lvindustries.ringqtquick.media 1.0 as RingQtMedia Kirigami.Page { spacing: 0 leftPadding: 0 rightPadding: 0 topPadding: 0 bottomPadding: 0 padding: 0 Kirigami.Theme.colorSet: Kirigami.Theme.View function getCall(cm) { return mainPage.call && mainPage.call.lifeCycleState != Call.FINISHED ? mainPage.call : RingSession.callModel.dialingCall(cm) } function getDefaultCm() { if (mainPage.currentContactMethod) return mainPage.currentContactMethod if (mainPage.currentIndividual) return mainPage.currentIndividual.mainContactMethod return null } function audioCall() { var cm = getDefaultCm() if (cm.hasInitCall) { mainPage.showCall(cm.firstActiveCall) return } var call = getCall(cm) call.performAction(RingQtQuick.Call.ACCEPT) } function videoCall() { var cm = getDefaultCm() if (cm.hasInitCall) { mainPage.showCall(cm.firstActiveCall) return } var call = getCall(cm) call.performAction(RingQtQuick.Call.ACCEPT) } function screencast() { var cm = getDefaultCm() if (cm.hasInitCall) { mainPage.showCall(cm.firstActiveCall) return } var call = getCall(cm) call.performAction(RingQtQuick.Call.ACCEPT) } JamiCallView.CallView { id: callview anchors.fill: parent mode: "CONVERSATION" call: mainPage.call Connections { target: mainPage onCallChanged: { callview.call = mainPage.call } } onCallWithAudio: { var cm = getDefaultCm() if (!cm) return audioCall() } onCallWithVideo: { var cm = getDefaultCm() if (!cm) return videoCall() } onCallWithScreen: { var cm = getDefaultCm() if (!cm) return screencast() } } actions { main : actionCollection.chatAction } - - contextualActions: [ + // Not worth it on mobile + contextualActions: Kirigami.Settings.isMobile ? [] : [ ActionCollection.holdAction , ActionCollection.recordAction , ActionCollection.muteCaptureAction , ActionCollection.mutePlaybackAction, ActionCollection.hangupAction , ActionCollection.transferAction , ActionCollection.acceptAction , ActionCollection.newCallAction ] } diff --git a/views/basic/qml/chatpage.qml b/views/basic/qml/chatpage.qml index adcf690d..aaab8305 100644 --- a/views/basic/qml/chatpage.qml +++ b/views/basic/qml/chatpage.qml @@ -1,127 +1,128 @@ /* * 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 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: actionCollection.shareScreenAction } - contextualActions: [ + // 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 8d2336d9..b6647d1e 100644 --- a/views/basic/qml/desktopheader.qml +++ b/views/basic/qml/desktopheader.qml @@ -1,138 +1,138 @@ /* * 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 MouseArea { - property var textColor: undefined + 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 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 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" 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 } } hoverEnabled: !Kirigami.Settings.isMobile onContainsMouseChanged: { favorite.opacity = containsMouse edit.opacity = containsMouse } }