/* * Copyright (C) 2020 by Savoir-faire Linux * Author: Andreas Traczyk * * 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.15 import QtQuick.Controls 2.15 import QtGraphicalEffects 1.15 import net.jami.Constants 1.1 Popup { id: root // convient access to closePolicy property bool autoClose: true property alias backgroundColor: container.color onContentItemChanged: { if(root.contentItem !== null) root.contentItem.parent = container } parent: Overlay.overlay // center in parent x: Math.round((parent.width - width) / 2) y: Math.round((parent.height - height) / 2) modal: true // A popup is invisible until opened. visible: false closePolicy: autoClose ? (Popup.CloseOnEscape | Popup.CloseOnPressOutside) : Popup.NoAutoClose padding: 0 background: Rectangle { id: container radius: JamiTheme.modalPopupRadius width: root.width height: root.height } DropShadow { z: -1 width: root.width height: root.height horizontalOffset: 3.0 verticalOffset: 3.0 radius: container.radius * 4 samples: JamiTheme.modalPopupDropShadowSamples color: JamiTheme.shadowColor source: container } enter: Transition { NumberAnimation { properties: "opacity"; from: 0.0; to: 1.0 duration: JamiTheme.shortFadeDuration } } exit: Transition { NumberAnimation { properties: "opacity"; from: 1.0; to: 0.0 duration: JamiTheme.shortFadeDuration } } }