diff --git a/src/jamihistoryview/plugin.cpp b/src/jamihistoryview/plugin.cpp index e3e09523..596b0c8b 100644 --- a/src/jamihistoryview/plugin.cpp +++ b/src/jamihistoryview/plugin.cpp @@ -1,41 +1,41 @@ /************************************************************************************ * Copyright (C) 2018 by BlueSystems GmbH * * Author : Emmanuel Lepage Vallee * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public * * License as published by the Free Software Foundation; either * * version 2.1 of the License, or (at your option) any later version. * * * * This library 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 * * Lesser General Public License for more details. * * * * You should have received a copy of the GNU Lesser General Public * * License along with this library; if not, write to the Free Software * * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ***********************************************************************************/ #include "plugin.h" // Qt #include #include // QRC #include void JamiHistoryView::registerTypes(const char *uri) { Q_ASSERT(uri == QByteArray("org.kde.ringkde.jamihistoryview")); - qmlRegisterType(QStringLiteral("qrc:/jamihistoryview/qml/callhistory.qml") , uri, 1, 0, "CallHistory"); - qmlRegisterType(QStringLiteral("qrc:/jamihistoryview/qml/historytimeline.qml") , uri, 1, 0, "HistoryTimeline"); - qmlRegisterType(QStringLiteral("qrc:/jamihistoryview/qml/recordinghistory.qml") , uri, 1, 0, "RecordingHistory"); + qmlRegisterType(QStringLiteral("qrc:/jamihistoryview/qml/callhistory.qml") , uri, 1, 0, "CallHistory"); + qmlRegisterType(QStringLiteral("qrc:/jamihistoryview/qml/historytimeline.qml") , uri, 1, 0, "HistoryTimeline"); + qmlRegisterType(QStringLiteral("qrc:/jamihistoryview/qml/recordinghistory.qml"), uri, 1, 0, "RecordingHistory"); } void JamiHistoryView::initializeEngine(QQmlEngine *engine, const char *uri) { Q_UNUSED(engine) Q_UNUSED(uri) } diff --git a/src/jamihistoryview/qml/recordinghistory.qml b/src/jamihistoryview/qml/recordinghistory.qml index 0a204b29..96fa8e8f 100644 --- a/src/jamihistoryview/qml/recordinghistory.qml +++ b/src/jamihistoryview/qml/recordinghistory.qml @@ -1,431 +1,386 @@ /*************************************************************************** * Copyright (C) 2017 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.playground.kquickitemviews 1.0 as KQuickItemViews import net.lvindustries.ringqtquick 1.0 as RingQtQuick import net.lvindustries.ringqtquick.models 1.0 as RingQtModels import org.kde.ringkde.jamitimeline 1.0 as JamiTimeline import org.kde.ringkde.jamitimelinebase 1.0 as JamiTimelineBase import org.kde.ringkde.jamiaudioplayer 1.0 as JamiAudioPlayer import org.kde.ringkde.genericutils 1.0 as GenericUtils import org.kde.kirigami 2.2 as Kirigami KQuickItemViews.TreeView { id: chatView - clip: true - property var treeHelper: _treeHelper + property QtObject individual: null - GenericUtils.TreeHelper { - id: _treeHelper + model: RingQtQuick.TimelineFilter { + individual: chatView.individual + showMessages: false + showCalls: false + showEmptyGroups: true } + clip: true + // Display something when the chat is empty Text { color: Kirigami.Theme.textColor text: i18n("There is nothing yet, enter a message below or place a call using the buttons\nfound in the header") anchors.centerIn: parent visible: chatView.empty horizontalAlignment: Text.AlignHCenter } Component { id: messageDelegate Loader { id: chatLoader property bool showDetailed: false // Create a delegate for each type Component { id: sectionDelegate Item { height: content.implicitHeight + 10 width: parent.width Rectangle { width: 1 color: Kirigami.Theme.textColor height: parent.height x: 10 } Rectangle { radius: 99 color: Kirigami.Theme.backgroundColor border.width: 1 border.color: Kirigami.Theme.textColor width: 16 height: 16 y: 10 x: 3 // (16 - 10) / 2 Rectangle { id: demandsAttention radius: 99 color: Kirigami.Theme.textColor anchors.centerIn: parent height: 8 width: 8 } } Rectangle { border.color: Kirigami.Theme.textColor border.width: 1 anchors.fill: parent anchors.topMargin: 5 anchors.bottomMargin: 5 anchors.leftMargin: 30 - anchors.rightMargin: 40 + anchors.rightMargin: 5 color: "transparent" radius: 10 ColumnLayout { id: content anchors.fill: parent Row { - Layout.preferredHeight: 2*fontMetrics.height - Image { + Layout.preferredHeight: 2*Kirigami.Units.fontMetrics.height + Kirigami.Icon { height: parent.height width: parent.height - asynchronous: true anchors.margins: 6 - source: "image://icon/dialog-messages" + source: "dialog-messages" + color: Kirigami.Theme.textColor } Text { height: parent.height text: formattedDate leftPadding: 10 verticalAlignment: Text.AlignVCenter - color: ListView.isCurrentItem ? - Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor + color: Kirigami.Theme.textColor } } Rectangle { color: Kirigami.Theme.textColor - height:1 Layout.preferredHeight: 1 Layout.fillWidth: true } Text { Layout.fillWidth: true text: incomingEntryCount + i18n(" incoming messages") - Layout.preferredHeight: 2*fontMetrics.height + Layout.preferredHeight: 2*Kirigami.Units.fontMetrics.height leftPadding: 10 verticalAlignment: Text.AlignVCenter - color: ListView.isCurrentItem ? - Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor + color: Kirigami.Theme.textColor } Text { Layout.fillWidth: true text: outgoingEntryCount + i18n(" outgoing messages") - Layout.preferredHeight: 2*fontMetrics.height + Layout.preferredHeight: 2*Kirigami.Units.fontMetrics.height leftPadding: 10 verticalAlignment: Text.AlignVCenter - color: ListView.isCurrentItem ? - Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor + color: Kirigami.Theme.textColor } Item { Layout.fillHeight: true } } } - - MouseArea { - anchors.fill: parent - onClicked: { - treeView.currentIndex = index - } - } } } Component { id: callDelegate Item { - height: content.implicitHeight + 10 + height: content5555.implicitHeight + 10 width: parent.width Behavior on height { NumberAnimation {duration: 200; easing.type: Easing.OutQuad} } Rectangle { width: 1 color: Kirigami.Theme.textColor height: parent.height x: 10 } Rectangle { radius: 99 color: Kirigami.Theme.backgroundColor border.width: 1 border.color: Kirigami.Theme.textColor width: 16 height: 16 y: 10 x: 3 // (16 - 10) / 2 Rectangle { id: demandsAttention radius: 99 color: Kirigami.Theme.textColor anchors.centerIn: parent height: 8 width: 8 } } Rectangle { border.color: Kirigami.Theme.textColor border.width: 1 anchors.fill: parent anchors.topMargin: 5 anchors.bottomMargin: 5 anchors.leftMargin: 30 - anchors.rightMargin: 40 + anchors.rightMargin: 5 color: "transparent" radius: 10 ColumnLayout { - id: content + id: content5555 anchors.fill: parent Row { - Layout.preferredHeight: 2*fontMetrics.height - Image { + Layout.preferredHeight: 2*Kirigami.Units.fontMetrics.height + Kirigami.Icon { height: parent.height width: parent.height - asynchronous: true anchors.margins: 6 - source: "image://icon/call-start" + source: "call-start" + color: Kirigami.Theme.textColor } Text { height: parent.height text: formattedDate + color: Kirigami.Theme.textColor leftPadding: 10 verticalAlignment: Text.AlignVCenter - color: ListView.isCurrentItem ? - Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor } } Rectangle { color: Kirigami.Theme.textColor height:1 Layout.preferredHeight: 1 Layout.fillWidth: true } JamiTimelineBase.MultiCall { width: chatView.width - 90 modelIndex: rootIndex count: callCount - - MouseArea { - anchors.fill: parent - onClicked: { - chatLoader.showDetailed = true - chatView.reloadChildren(rootIndex) - } - } } } } } } Component { id: categoryDelegate Item { height: rect.height JamiTimeline.PeersTimelineCategories { id: rect - property var section: display - property var recentDate: formattedDate - } - } - } - - Component { - id: singleCallDelegate - - RowLayout { - width: parent.width - - Text { - text: formattedDate - color: Kirigami.Theme.textColor - Layout.fillWidth: true - } - - Item { - height: 1 - Layout.fillWidth: true - } - - Text { - text: length - color: Kirigami.Theme.textColor + compact: true + section: display + recentDate: formattedDate } } } Component { id: recordingDelegate Item { - height: content.implicitHeight + 10 - width: parent.width + height: content4444.implicitHeight + 10 + width: chatView.width Rectangle { width: 1 color: Kirigami.Theme.textColor height: parent.height x: 10 } Rectangle { radius: 99 color: Kirigami.Theme.backgroundColor border.width: 1 border.color: Kirigami.Theme.textColor width: 16 height: 16 y: 10 x: 3 // (16 - 10) / 2 Rectangle { id: demandsAttention radius: 99 color: Kirigami.Theme.textColor anchors.centerIn: parent height: 8 width: 8 } } Rectangle { id: box border.color: Kirigami.Theme.textColor border.width: 1 anchors.fill: parent anchors.topMargin: 5 anchors.bottomMargin: 5 anchors.leftMargin: 30 - anchors.rightMargin: 40 + anchors.rightMargin: 5 color: "transparent" radius: 10 ColumnLayout { - id: content + id: content4444 anchors.fill: parent Row { - Layout.preferredHeight: 2*fontMetrics.height - Image { + Layout.minimumHeight: 2*Kirigami.Units.fontMetrics.height + Kirigami.Icon { height: parent.height width: parent.height - asynchronous: true anchors.margins: 6 - source: "image://icon/media-record" + source: "media-record" + color: Kirigami.Theme.textColor } Text { height: parent.height text: formattedDate + color: Kirigami.Theme.textColor leftPadding: 10 verticalAlignment: Text.AlignVCenter - color: ListView.isCurrentItem ? - Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor } } Rectangle { color: Kirigami.Theme.textColor height:1 Layout.preferredHeight: 1 Layout.fillWidth: true } JamiAudioPlayer.AudioPlayer { id: rect Layout.minimumWidth: box.width - 10 } Item { Layout.fillHeight: true } } } } } // Some elements don't have delegates because they are handled // by their parent delegates function selectDelegate() { if (nodeType == RingQtModels.IndividualTimelineModel.TIME_CATEGORY) return categoryDelegate - if (nodeType == RingQtModels.IndividualTimelineModel.SECTION_DELIMITER) + if (nodeType == RingQtModels.IndividualTimelineModel.SECTION_DELIMITER) { return sectionDelegate + } - if (nodeType == RingQtModels.IndividualTimelineModel.CALL_GROUP) + if (nodeType == RingQtModels.IndividualTimelineModel.CALL_GROUP) { return callDelegate + } if (nodeType == RingQtModels.IndividualTimelineModel.RECORDINGS) return recordingDelegate - - if (nodeType == RingQtModels.IndividualTimelineModel.CALL_GROUP) - return callDelegate - - if (nodeType == RingQtModels.IndividualTimelineModel.CALL - && chatView.parentTreeItem(rootIndex).showDetailed) - return singleCallDelegate } sourceComponent: selectDelegate() } } delegate: messageDelegate } diff --git a/src/jamitimeline/qml/peerstimelinecategories.qml b/src/jamitimeline/qml/peerstimelinecategories.qml index 93483cd5..54707500 100644 --- a/src/jamitimeline/qml/peerstimelinecategories.qml +++ b/src/jamitimeline/qml/peerstimelinecategories.qml @@ -1,48 +1,52 @@ /*************************************************************************** * Copyright (C) 2017 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 org.kde.kirigami 2.2 as Kirigami Text { + property bool compact: false + property string section: display + property string recentDate: formattedDate + anchors.margins:10 text: section + (section == i18n("Never") ? "" :", " + (recentDate ? recentDate.toLocaleString(Qt.locale(), "d MMM") : "")+ "") leftPadding: 10 rightPadding: 10 - height: 3*fontMetrics.height + height: (compact ? 1.5 : 3) *Kirigami.Units.fontMetrics.height verticalAlignment: Text.AlignVCenter color: Kirigami.Theme.textColor x: 10 Rectangle { height: 30 width: 100 border.width: 1 border.color: Kirigami.Theme.textColor color: "transparent" radius: 1 z: -10 anchors.fill: parent } Rectangle { width: 2 height: parent.height color: "#993558" } }