Skip to content
Snippets Groups Projects
Select Git revision
  • 04a57dfdbb8177f1c9b382f711f8f00abf66f413
  • master default protected
  • stable/20250815.1
  • stable/20250815.0
  • nightly/20250815.0
  • nightly/20250806.0
  • nightly/20250805.0
  • beta/202508051403
  • beta/202508051107
  • nightly/20250722.0
  • beta/202507211539
  • stable/20250718.0
  • nightly/20250718.0
  • nightly/20250714.0
  • beta/202507141552
  • beta/202506161038
  • stable/20250613.0
  • nightly/20250613.0
  • beta/202506101658
  • stable/20250610.0
  • nightly/20250610.0
  • beta/202506091027
22 results

TimestampInfo.qml

Blame
  • cberthet's avatar
    Capucine Berthet authored and Sébastien Blin committed
    GitLab: #1325
    Change-Id: Ib52222f4adae911e0975f4d7e8bc60739fb63cfb
    04a57dfd
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    TimestampInfo.qml 3.13 KiB
    /*
     * Copyright (C) 2022-2023 Savoir-faire Linux Inc.
     * Author: Nicolas Vengeon <nicolas.vengeon@savoirfairelinux.com>
     *
     * 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 <https://www.gnu.org/licenses/>.
     */
    import "../mainview/components"
    import QtQuick
    import QtQuick.Controls
    import QtQuick.Layouts
    import net.jami.Models 1.1
    import net.jami.Adapters 1.1
    import net.jami.Constants 1.1
    
    ColumnLayout {
        id: root
    
        property bool showTime
        property bool showDay
        property string formattedTime
        property string formattedDay
        property real detailsOpacity: 0.6
        property color timeColor: JamiTheme.chatviewSecondaryInformationColor
        property alias timeLabel: formattedTimeLabel
    
        spacing: 0
    
        Connections {
            target: MessagesAdapter
            function onTimestampUpdated() {
                if ((showTime || showDay) && Timestamp !== undefined) {
                    formattedTime = MessagesAdapter.getFormattedTime(Timestamp);
                }
            }
        }
    
        Item {
            visible: showDay
            Layout.alignment: Qt.AlignHCenter
    
            Layout.preferredHeight: childrenRect.height
            Layout.fillWidth: true
            Layout.topMargin: 30
    
            Rectangle {
                id: line
    
                height: 1
                opacity: detailsOpacity
                color: JamiTheme.timestampColor
                width: parent.width - JamiTheme.timestampLinePadding
                anchors.centerIn: parent
            }
    
            Rectangle {
                id: dayRectangle
    
                width: formattedDayLabel.width + JamiTheme.dayTimestampVPadding
                height: formattedDayLabel.height + JamiTheme.dayTimestampHPadding
                radius: 5
                color: JamiTheme.chatviewBgColor
                Layout.fillHeight: true
                anchors.centerIn: parent
    
                border {
                    color: JamiTheme.timestampColor
                    width: 1
                }
    
                Text {
                    id: formattedDayLabel
    
                    color: JamiTheme.chatviewTextColor
                    anchors {
                        verticalCenter: parent.verticalCenter
                        horizontalCenter: parent.horizontalCenter
                    }
                    text: formattedDay
                    font.pointSize: JamiTheme.timestampFont
                }
            }
        }
    
        Label {
            id: formattedTimeLabel
    
            text: formattedTime
            Layout.topMargin: 30
            Layout.bottomMargin: 30
            Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
            color: root.timeColor
            visible: showTime
            Layout.preferredHeight: visible * implicitHeight
            font.pointSize: JamiTheme.smallFontSize
        }
    }