linphone-desktop/Linphone/view/App/AppWindow.qml

60 lines
No EOL
1.5 KiB
QML

import QtQuick 2.15
import QtQuick.Layouts 1.3
import QtQuick.Controls
import Linphone
import UtilsCpp 1.0
import SettingsCpp 1.0
ApplicationWindow {
id: mainWindow
Component {
id: popupComp
InformationPopup{}
}
function removeFromPopupLayout(index) {
popupLayout.popupList.splice(index, 1)
}
function showInformationPopup(title, description, isSuccess) {
var infoPopup = popupComp.createObject(popupLayout, {"title": title, "description": description, "isSuccess": isSuccess})
infoPopup.index = popupLayout.popupList.length
popupLayout.popupList.push(infoPopup)
infoPopup.open()
infoPopup.closePopup.connect(removeFromPopupLayout)
}
function showLoadingPopup(text) {
loadingPopup.text = text
loadingPopup.open()
}
function closeLoadingPopup() {
loadingPopup.close()
}
ColumnLayout {
id: popupLayout
anchors.fill: parent
Layout.alignment: Qt.AlignBottom
property int nextY: mainWindow.height
property list<InformationPopup> popupList
property int popupCount: popupList.length
spacing: 15 * DefaultStyle.dp
onPopupCountChanged: {
nextY = mainWindow.height
for(var i = 0; i < popupCount; ++i) {
popupList[i].y = nextY - popupList[i].height
popupList[i].index = i
nextY = nextY - popupList[i].height - 15
}
}
}
LoadingPopup {
id: loadingPopup
modal: true
closePolicy: Popup.NoAutoClose
anchors.centerIn: parent
padding: 20 * DefaultStyle.dp
underlineColor: DefaultStyle.main1_500_main
radius: 15 * DefaultStyle.dp
}
}