1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-14 15:02:37 +01:00
ScreenPlay/qml/main.qml

182 lines
4.7 KiB
QML
Raw Normal View History

import QtQuick 2.6
import QtQuick.Window 2.2
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import Qt.labs.platform 1.0
import "Components"
2017-06-06 12:51:53 +02:00
ApplicationWindow {
2017-04-04 17:40:21 +02:00
id: window
color: "#eeeeee"
visible: true
width: 1400
2017-04-23 11:31:05 +02:00
minimumHeight: 768
minimumWidth: 1050
2017-11-02 18:54:32 +01:00
LinearGradient {
id: tabShadow
height: 5
z: 99
cached: true
2017-11-02 18:54:32 +01:00
anchors {
2017-11-02 18:54:32 +01:00
top: nav.bottom
right: parent.right
left: parent.left
}
start: Qt.point(0, 0)
end: Qt.point(0, 5)
2017-11-02 18:54:32 +01:00
gradient: Gradient {
GradientStop {
position: 0.0
color: "#22000000"
}
GradientStop {
position: 1.0
color: "#00000000"
}
2017-11-02 18:54:32 +01:00
}
}
SystemTrayIcon {
id: sti
visible: true
iconSource: "qrc:/assets/icons/favicon.ico"
menu: Menu {
MenuItem {
text: qsTr("Open ScreenPlay")
onTriggered: {
window.show()
}
}
MenuItem {
id: miMuteAll
property bool isMuted: false
text: qsTr("Mute all")
onTriggered: {
if (miMuteAll.isMuted) {
isMuted = false
miMuteAll.text = qsTr("Mute all")
screenPlaySettings.setMuteAll(false)
} else {
isMuted = true
miMuteAll.text = qsTr("Unmute all")
screenPlaySettings.setMuteAll(true)
}
}
}
MenuItem {
id: miStopAll
property bool isPlaying: false
text: qsTr("Stop all")
onTriggered: {
if (miStopAll.isPlaying) {
isPlaying = false
miStopAll.text = qsTr("Stop all")
screenPlaySettings.setPlayAll(true)
} else {
isPlaying = true
miStopAll.text = qsTr("Play all")
screenPlaySettings.setPlayAll(false)
}
}
}
MenuItem {
text: qsTr("Quit")
onTriggered: Qt.quit()
}
}
}
Component.onCompleted: {
setX(Screen.width / 2 - width / 2)
setY(Screen.height / 2 - height / 2)
}
2017-06-06 12:51:53 +02:00
Loader {
id: pageLoader
asynchronous: true
source: "qrc:/qml/Components/Installed.qml"
anchors {
top: nav.bottom
right: parent.right
bottom: parent.bottom
left: parent.left
}
2017-06-06 12:51:53 +02:00
Connections {
target: pageLoader.item
2017-04-03 19:58:47 +02:00
ignoreUnknownSignals: true
property bool ignoreWorkshopBanner: false
2017-04-04 17:40:21 +02:00
onSetSidebaractiveItem: {
if (sidebar.activeScreen == screenId
&& sidebar.state == "active") {
sidebar.state = "inactive"
2017-04-10 16:03:49 +02:00
} else {
sidebar.state = "active"
2017-04-10 16:03:49 +02:00
}
2017-04-04 17:40:21 +02:00
sidebar.activeScreen = screenId
}
onSetNavigationItem: {
if (pos === 0) {
nav.onPageChanged("Create")
} else {
nav.onPageChanged("Workshop")
}
2017-04-03 19:58:47 +02:00
}
onOpenCreate: {
if(!ignoreWorkshopBanner){
nav.onPageChanged("Create")
ignoreWorkshopBanner = true
}
}
2017-04-03 19:58:47 +02:00
}
}
Sidebar {
id: sidebar
width: 400
navHeight: nav.height
anchors {
top: parent.top
right: parent.right
bottom: parent.bottom
}
}
Navigation {
id: nav
anchors {
top: parent.top
right: parent.right
left: parent.left
}
onChangePage: {
if (name === "Create" || name === "Workshop" || name === "Settings" || name === "Community") {
pageLoader.setSource(
"qrc:/qml/Components/" + name + "/" + name + ".qml")
} else {
pageLoader.setSource("qrc:/qml/Components/" + name + ".qml")
}
sidebar.state = "inactive"
}
2017-04-13 08:24:11 +02:00
onToggleMonitors: {
monitors.state = monitors.state == "active" ? "inactive" : "active"
}
}
Monitors {
id: monitors
state: "inactive"
anchors.fill: pageLoader
z: 98
}
}