82 lines
1.7 KiB
QML
Raw Normal View History

2020-05-23 02:30:51 +03:00
/*
2022-12-31 11:28:53 +03:00
* Copyright (C) 2018-2023 QuasarApp.
2023-03-29 12:57:55 +02:00
* Distributed under the GPLv3 software license, see the accompanying
2020-05-23 02:30:51 +03:00
* 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
Dialog {
id : basePopup
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
}
}
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
}