Archived
1
Fork 0
This repository has been archived on 2025-04-12. You can view files and clone it, but cannot push or open issues or pull requests.
trinity/qml/main.qml

86 lines
2.1 KiB
QML
Raw Permalink Normal View History

2021-07-21 16:08:15 -04:00
import QtQuick 2.10
import QtQuick.Window 2.10
import QtQuick.Controls 2.3
import trinity.matrix 1.0
ApplicationWindow {
id: window
visible: true
width: 640
height: 480
title: "Trinity " + matrix.profileName
SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
2021-07-21 16:08:15 -04:00
property var showDialog: function(title, description, buttons) {
var popup = Qt.createComponent("qrc:/Dialog.qml")
var popupContainer = popup.createObject(window, {"parent": window, "title": title, "description": description, "buttons": buttons})
popupContainer.open()
}
property var showImage: function(url) {
var popup = Qt.createComponent("qrc:/ImageViewer.qml")
var popupContainer = popup.createObject(window, {"parent": window, "url": url})
}
Component.onCompleted: {
connect.onAccountChange()
}
Connections {
id: connect
target: app
function onAccountChange() {
if(matrix.settingsValid()) {
desktop.showTrayIcon(false)
stack.replace("qrc:/Client.qml")
} else {
desktop.showTrayIcon(true)
stack.replace("qrc:/Login.qml")
}
2021-07-21 16:08:15 -04:00
}
}
StackView {
id: stack
anchors.fill: parent
pushEnter: Transition {
PropertyAnimation {
property: "opacity"
from: 0
to:1
duration: 200
}
}
pushExit: Transition {
PropertyAnimation {
property: "opacity"
from: 1
to:0
duration: 200
}
}
popEnter: Transition {
PropertyAnimation {
property: "opacity"
from: 0
to:1
duration: 200
}
}
popExit: Transition {
PropertyAnimation {
property: "opacity"
from: 1
to:0
duration: 200
}
}
2021-07-21 16:08:15 -04:00
}
}