2020-09-16 15:53:50 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2020 by Savoir-faire Linux
|
|
|
|
* Author: Andreas Traczyk <andreas.traczyk@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/>.
|
|
|
|
*/
|
|
|
|
|
2020-10-06 13:58:44 +02:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
import QtGraphicalEffects 1.14
|
2021-03-17 14:23:21 -04:00
|
|
|
|
2021-08-23 13:24:08 -04:00
|
|
|
import net.jami.Constants 1.1
|
2020-09-16 15:53:50 -04:00
|
|
|
|
|
|
|
Popup {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
// convient access to closePolicy
|
|
|
|
property bool autoClose: true
|
2021-06-30 09:53:06 -04:00
|
|
|
property alias backgroundColor: container.color
|
2020-09-16 15:53:50 -04:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2021-06-30 09:53:06 -04:00
|
|
|
radius: JamiTheme.modalPopupRadius
|
2020-09-16 15:53:50 -04:00
|
|
|
width: root.width
|
|
|
|
height: root.height
|
|
|
|
}
|
|
|
|
|
|
|
|
DropShadow {
|
|
|
|
z: -1
|
|
|
|
width: root.width
|
|
|
|
height: root.height
|
|
|
|
horizontalOffset: 3.0
|
|
|
|
verticalOffset: 3.0
|
2021-04-15 23:17:58 -04:00
|
|
|
radius: container.radius * 4
|
2021-06-30 09:53:06 -04:00
|
|
|
samples: JamiTheme.modalPopupDropShadowSamples
|
2020-11-28 16:14:25 -05:00
|
|
|
color: JamiTheme.shadowColor
|
2020-09-16 15:53:50 -04:00
|
|
|
source: container
|
|
|
|
}
|
|
|
|
|
|
|
|
enter: Transition {
|
|
|
|
NumberAnimation {
|
|
|
|
properties: "opacity"; from: 0.0; to: 1.0
|
2021-05-20 00:33:43 -04:00
|
|
|
duration: JamiTheme.shortFadeDuration
|
2020-09-16 15:53:50 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
exit: Transition {
|
|
|
|
NumberAnimation {
|
|
|
|
properties: "opacity"; from: 1.0; to: 0.0
|
2021-05-20 00:33:43 -04:00
|
|
|
duration: JamiTheme.shortFadeDuration
|
2020-09-16 15:53:50 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|