2020-05-23 02:30:51 +03:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018-2020 QuasarApp.
|
|
|
|
* Distributed under the lgplv3 software license, see the accompanying
|
|
|
|
* Everyone is permitted to copy and distribute verbatim copies
|
|
|
|
* of this license document, but changing it is not allowed.
|
|
|
|
*/
|
|
|
|
|
2021-01-17 22:37:30 +03:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Controls.Material 2.15
|
2019-11-19 15:20:38 +03:00
|
|
|
import QtQuick.Layouts 1.3
|
2021-01-17 22:37:30 +03:00
|
|
|
import QtGraphicalEffects 1.15
|
2019-11-19 15:20:38 +03:00
|
|
|
|
|
|
|
Dialog {
|
|
|
|
id : basePopup
|
|
|
|
width: 200
|
|
|
|
height: 100
|
|
|
|
x: 0
|
|
|
|
y: 0
|
|
|
|
|
|
|
|
transformOrigin: Item.Center
|
|
|
|
|
|
|
|
property bool autoClose: true
|
|
|
|
property bool clickClose: true
|
|
|
|
|
|
|
|
property int closeInterval: 15000;
|
|
|
|
property int margin : 0
|
|
|
|
property color backgroundColor: Material.background
|
|
|
|
|
2021-01-17 22:37:30 +03:00
|
|
|
property alias autoClosePasused: progressAnimation.paused
|
|
|
|
|
2019-11-19 15:20:38 +03:00
|
|
|
background: Item {
|
|
|
|
id: bacground
|
|
|
|
|
|
|
|
Rectangle{
|
|
|
|
anchors.fill: parent
|
|
|
|
id: backCorner
|
|
|
|
color: backgroundColor
|
|
|
|
radius: metrix.mm
|
|
|
|
}
|
|
|
|
|
|
|
|
DropShadow {
|
|
|
|
anchors.fill: parent
|
|
|
|
source: backCorner
|
|
|
|
color: "#80000000"
|
|
|
|
verticalOffset: 10
|
|
|
|
samples: 30
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function _show() {
|
2021-01-17 22:37:30 +03:00
|
|
|
open();
|
2019-11-19 15:20:38 +03:00
|
|
|
|
|
|
|
if (autoClose) {
|
2021-01-17 22:37:30 +03:00
|
|
|
progressAnimation.from = 0;
|
|
|
|
progressAnimation.start();
|
2019-11-19 15:20:38 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-17 22:37:30 +03:00
|
|
|
function autoclosePause() {
|
2021-01-18 23:20:03 +03:00
|
|
|
if (autoClose)
|
|
|
|
progressAnimation.pause();
|
2021-01-17 22:37:30 +03:00
|
|
|
}
|
2019-11-19 15:20:38 +03:00
|
|
|
|
2021-01-17 22:37:30 +03:00
|
|
|
function autocloseResume() {
|
2019-11-19 15:20:38 +03:00
|
|
|
if (autoClose)
|
2021-01-18 23:20:03 +03:00
|
|
|
progressAnimation.resume();
|
2019-11-19 15:20:38 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
closePolicy: (!clickClose || autoClose)? Popup.NoAutoClose: Popup.CloseOnReleaseOutside
|
|
|
|
|
|
|
|
|
2021-01-17 22:37:30 +03:00
|
|
|
footer: ProgressBar {
|
|
|
|
id: progress;
|
|
|
|
from: 0
|
|
|
|
to: 100
|
|
|
|
visible: autoClose
|
|
|
|
value: 0;
|
|
|
|
|
|
|
|
NumberAnimation on value {
|
|
|
|
|
|
|
|
id: progressAnimation
|
|
|
|
duration: closeInterval
|
|
|
|
easing.type: Easing.Linear
|
|
|
|
running: false
|
|
|
|
to: 100
|
|
|
|
from: progress.value
|
|
|
|
|
|
|
|
onFinished: {
|
|
|
|
close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-11-19 15:20:38 +03:00
|
|
|
}
|