2019-12-03 19:25:11 +03:00
|
|
|
import QtQml 2.2
|
2019-10-27 17:19:20 +03:00
|
|
|
import QtQuick 2.9
|
|
|
|
import QtQuick.Window 2.2
|
|
|
|
import QtQuick.Controls 2.2
|
|
|
|
import QtQuick.Layouts 1.3
|
2019-10-30 01:25:00 +03:00
|
|
|
import QtGraphicalEffects 1.0
|
2019-10-27 17:19:20 +03:00
|
|
|
|
|
|
|
Window {
|
2019-12-03 00:45:14 +03:00
|
|
|
|
2019-10-27 17:19:20 +03:00
|
|
|
id: trayWindow
|
|
|
|
visible: true
|
2019-10-30 01:25:00 +03:00
|
|
|
width: 400
|
2019-10-27 17:19:20 +03:00
|
|
|
height: 500
|
|
|
|
color: "transparent"
|
|
|
|
flags: Qt.FramelessWindowHint
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
2019-12-03 19:25:11 +03:00
|
|
|
/* desktopAvailableWidth and Height doesn't include the system tray bar
|
2019-10-29 10:13:05 +03:00
|
|
|
but breaks application anyway on windows when using multi monitor setup,
|
|
|
|
will look for a better solution later, for now just get this thing complete */
|
2019-12-03 19:25:11 +03:00
|
|
|
//setX(Screen.desktopAvailableWidth - width);
|
|
|
|
//setY(Screen.desktopAvailableHeight + height);
|
2019-10-27 17:19:20 +03:00
|
|
|
}
|
|
|
|
|
2019-12-04 18:19:42 +03:00
|
|
|
Connections {
|
|
|
|
target: systrayBackend
|
|
|
|
onRefreshCurrentUserGui: {
|
|
|
|
currentAccountAvatar.source = systrayBackend.currentUserAvatar()
|
|
|
|
currentAccountUser.text = systrayBackend.currentUserName()
|
|
|
|
currentAccountServer.text = systrayBackend.currentUserServer()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-27 17:19:20 +03:00
|
|
|
Rectangle {
|
|
|
|
id: trayWindowBackground
|
|
|
|
anchors.fill: parent
|
|
|
|
radius: 10
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: trayWindowHeaderBackground
|
|
|
|
anchors.left: trayWindowBackground.left
|
|
|
|
anchors.top: trayWindowBackground.top
|
|
|
|
height: 60
|
|
|
|
width: parent.width
|
2019-10-30 01:25:00 +03:00
|
|
|
radius: 9
|
2019-10-27 17:19:20 +03:00
|
|
|
color: "#0082c9"
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
anchors.left: trayWindowHeaderBackground.left
|
|
|
|
anchors.bottom: trayWindowHeaderBackground.bottom
|
|
|
|
height: 30
|
|
|
|
width: parent.width
|
|
|
|
color: "#0082c9"
|
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
id: trayWindowHeaderLayout
|
2019-10-30 01:25:00 +03:00
|
|
|
spacing: 0
|
2019-10-27 17:19:20 +03:00
|
|
|
anchors.fill: parent
|
|
|
|
|
2019-10-30 01:25:00 +03:00
|
|
|
Button {
|
|
|
|
id: currentAccountButton
|
|
|
|
Layout.preferredWidth: 220
|
|
|
|
Layout.preferredHeight: (trayWindowHeaderBackground.height)
|
|
|
|
display: AbstractButton.IconOnly
|
|
|
|
flat: true
|
2019-10-27 17:19:20 +03:00
|
|
|
|
2019-10-30 01:25:00 +03:00
|
|
|
MouseArea {
|
|
|
|
id: accountBtnMouseArea
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: true
|
|
|
|
onClicked:
|
|
|
|
{
|
2019-12-03 19:25:11 +03:00
|
|
|
accountMenu.open()
|
2019-10-30 01:25:00 +03:00
|
|
|
}
|
2019-10-27 17:19:20 +03:00
|
|
|
|
2019-10-30 01:25:00 +03:00
|
|
|
Menu {
|
|
|
|
id: accountMenu
|
2019-12-03 19:25:11 +03:00
|
|
|
x: (currentAccountButton.x + 2)
|
|
|
|
y: (currentAccountButton.y + currentAccountButton.height + 2)
|
|
|
|
width: (currentAccountButton.width - 4)
|
|
|
|
|
|
|
|
background: Rectangle {
|
|
|
|
border.color: "#0082c9"
|
2019-12-04 16:19:23 +03:00
|
|
|
radius: 2
|
2019-12-03 19:25:11 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Instantiator {
|
|
|
|
model: systrayBackend
|
2019-12-03 20:50:34 +03:00
|
|
|
delegate: UserLine {}
|
2019-12-03 19:25:11 +03:00
|
|
|
onObjectAdded: accountMenu.insertItem(index, object)
|
|
|
|
onObjectRemoved: accountMenu.removeItem(object)
|
|
|
|
}
|
|
|
|
|
2019-12-04 00:15:25 +03:00
|
|
|
MenuSeparator { id: accountMenuSeparator }
|
2019-10-27 17:19:20 +03:00
|
|
|
|
2019-12-04 00:15:25 +03:00
|
|
|
MenuItem {
|
|
|
|
text: (systrayBackend.isCurrentUserConnected() ? "Logout" : "Login")
|
|
|
|
onClicked: (systrayBackend.isCurrentUserConnected()
|
|
|
|
? systrayBackend.logout()
|
|
|
|
: systrayBackend.login() )
|
|
|
|
}
|
2019-12-04 16:19:23 +03:00
|
|
|
MenuItem {
|
|
|
|
text: "Add Account"
|
|
|
|
onClicked: systrayBackend.addAccount()
|
|
|
|
}
|
|
|
|
MenuItem {
|
|
|
|
text: "Remove Account"
|
|
|
|
onClicked: systrayBackend.removeAccount()
|
|
|
|
}
|
2019-12-04 00:15:25 +03:00
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
if(systrayBackend.numUsers() === 0) {
|
|
|
|
accountMenuSeparator.height = 0
|
|
|
|
} else {
|
|
|
|
accountMenuSeparator.height = 13
|
|
|
|
}
|
|
|
|
}
|
2019-10-30 01:25:00 +03:00
|
|
|
}
|
|
|
|
}
|
2019-10-27 17:19:20 +03:00
|
|
|
|
2019-10-30 01:25:00 +03:00
|
|
|
background:
|
|
|
|
Item {
|
|
|
|
id: leftHoverContainer
|
|
|
|
height: currentAccountButton.height
|
|
|
|
width: currentAccountButton.width
|
2019-12-03 19:25:11 +03:00
|
|
|
Rectangle {
|
|
|
|
width: currentAccountButton.width / 2
|
|
|
|
height: currentAccountButton.height / 2
|
|
|
|
color: "transparent"
|
|
|
|
clip: true
|
2019-10-27 17:19:20 +03:00
|
|
|
Rectangle {
|
2019-12-03 19:25:11 +03:00
|
|
|
width: currentAccountButton.width
|
|
|
|
height: currentAccountButton.height
|
|
|
|
radius: 10
|
2019-10-30 01:25:00 +03:00
|
|
|
color: "white"
|
|
|
|
opacity: 0.2
|
|
|
|
visible: accountBtnMouseArea.containsMouse
|
|
|
|
}
|
|
|
|
}
|
2019-12-03 19:25:11 +03:00
|
|
|
Rectangle {
|
|
|
|
width: currentAccountButton.width / 2
|
|
|
|
height: currentAccountButton.height / 2
|
|
|
|
anchors.bottom: leftHoverContainer.bottom
|
|
|
|
color: "white"
|
|
|
|
opacity: 0.2
|
|
|
|
visible: accountBtnMouseArea.containsMouse
|
|
|
|
}
|
|
|
|
Rectangle {
|
|
|
|
width: currentAccountButton.width / 2
|
|
|
|
height: currentAccountButton.height / 2
|
|
|
|
anchors.right: leftHoverContainer.right
|
|
|
|
color: "white"
|
|
|
|
opacity: 0.2
|
|
|
|
visible: accountBtnMouseArea.containsMouse
|
|
|
|
}
|
|
|
|
Rectangle {
|
|
|
|
width: currentAccountButton.width / 2
|
|
|
|
height: currentAccountButton.height / 2
|
|
|
|
anchors.right: leftHoverContainer.right
|
|
|
|
anchors.bottom: leftHoverContainer.bottom
|
|
|
|
color: "white"
|
|
|
|
opacity: 0.2
|
|
|
|
visible: accountBtnMouseArea.containsMouse
|
|
|
|
}
|
|
|
|
}
|
2019-10-27 17:19:20 +03:00
|
|
|
|
2019-10-30 01:25:00 +03:00
|
|
|
RowLayout {
|
|
|
|
id: accountControlRowLayout
|
|
|
|
height: currentAccountButton.height
|
|
|
|
width: currentAccountButton.width
|
2019-10-30 22:47:21 +03:00
|
|
|
spacing: 0
|
2019-10-30 01:25:00 +03:00
|
|
|
Image {
|
|
|
|
id: currentAccountAvatar
|
2019-12-04 00:15:25 +03:00
|
|
|
Layout.leftMargin: 8
|
2019-10-30 01:25:00 +03:00
|
|
|
verticalAlignment: Qt.AlignCenter
|
2019-12-03 20:50:34 +03:00
|
|
|
source: systrayBackend.currentUserAvatar()
|
2019-12-04 00:15:25 +03:00
|
|
|
Layout.preferredHeight: (trayWindowHeaderBackground.height -16)
|
|
|
|
Layout.preferredWidth: (trayWindowHeaderBackground.height -16)
|
2019-10-30 01:25:00 +03:00
|
|
|
}
|
2019-10-27 17:19:20 +03:00
|
|
|
|
2019-10-30 01:25:00 +03:00
|
|
|
Column {
|
|
|
|
id: accountLabels
|
|
|
|
spacing: 4
|
|
|
|
Layout.alignment: Qt.AlignLeft
|
2019-10-30 22:47:21 +03:00
|
|
|
Layout.leftMargin: 6
|
2019-10-30 01:25:00 +03:00
|
|
|
Label {
|
2019-12-03 00:45:14 +03:00
|
|
|
id: currentAccountUser
|
2019-12-03 20:50:34 +03:00
|
|
|
text: systrayBackend.currentUserName()
|
2019-10-30 01:25:00 +03:00
|
|
|
color: "white"
|
|
|
|
font.pointSize: 9
|
|
|
|
font.bold: true
|
|
|
|
}
|
|
|
|
Label {
|
2019-12-03 00:45:14 +03:00
|
|
|
id: currentAccountServer
|
2019-12-03 20:50:34 +03:00
|
|
|
text: systrayBackend.currentUserServer()
|
2019-10-30 01:25:00 +03:00
|
|
|
color: "white"
|
|
|
|
font.pointSize: 8
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Image {
|
|
|
|
Layout.alignment: Qt.AlignLeft
|
|
|
|
verticalAlignment: Qt.AlignCenter
|
|
|
|
Layout.margins: 12
|
|
|
|
//source: "../../theme/white/caret-down.svg"
|
|
|
|
source: "qrc:///client/theme/white/caret-down.svg"
|
|
|
|
}
|
|
|
|
}
|
2019-10-27 17:19:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: trayWindowHeaderSpacer
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
|
|
|
id: openLocalFolderButton
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
display: AbstractButton.IconOnly
|
2019-10-30 01:25:00 +03:00
|
|
|
Layout.preferredWidth: (trayWindowHeaderBackground.height)
|
|
|
|
Layout.preferredHeight: (trayWindowHeaderBackground.height)
|
2019-10-27 17:19:20 +03:00
|
|
|
flat: true
|
|
|
|
|
2019-10-30 01:25:00 +03:00
|
|
|
//icon.source: "../../theme/white/folder.svg"
|
2019-10-29 10:13:05 +03:00
|
|
|
icon.source: "qrc:///client/theme/white/folder.svg"
|
2019-10-27 17:19:20 +03:00
|
|
|
icon.color: "transparent"
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
id: folderBtnMouseArea
|
|
|
|
anchors.fill: parent
|
2019-10-30 01:25:00 +03:00
|
|
|
hoverEnabled: true
|
2019-10-27 17:19:20 +03:00
|
|
|
onClicked:
|
|
|
|
{
|
|
|
|
}
|
2019-10-30 01:25:00 +03:00
|
|
|
}
|
2019-10-27 17:19:20 +03:00
|
|
|
|
2019-10-30 01:25:00 +03:00
|
|
|
background:
|
2019-12-03 19:25:11 +03:00
|
|
|
Rectangle {
|
2019-10-30 01:25:00 +03:00
|
|
|
color: folderBtnMouseArea.containsMouse ? "white" : "transparent"
|
|
|
|
opacity: 0.2
|
2019-12-03 19:25:11 +03:00
|
|
|
}
|
2019-10-27 17:19:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
|
|
|
id: trayWindowTalkButton
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
display: AbstractButton.IconOnly
|
2019-10-30 01:25:00 +03:00
|
|
|
Layout.preferredWidth: (trayWindowHeaderBackground.height)
|
|
|
|
Layout.preferredHeight: (trayWindowHeaderBackground.height)
|
2019-10-27 17:19:20 +03:00
|
|
|
flat: true
|
|
|
|
|
2019-10-30 01:25:00 +03:00
|
|
|
//icon.source: "../../theme/white/talk-app.svg"
|
2019-10-29 10:13:05 +03:00
|
|
|
icon.source: "qrc:///client/theme/white/talk-app.svg"
|
2019-10-27 17:19:20 +03:00
|
|
|
icon.color: "transparent"
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
id: talkBtnMouseArea
|
|
|
|
anchors.fill: parent
|
2019-10-30 01:25:00 +03:00
|
|
|
hoverEnabled: true
|
2019-10-27 17:19:20 +03:00
|
|
|
onClicked:
|
|
|
|
{
|
|
|
|
}
|
2019-12-03 19:25:11 +03:00
|
|
|
}
|
2019-10-27 17:19:20 +03:00
|
|
|
|
2019-12-03 19:25:11 +03:00
|
|
|
background:
|
2019-10-27 17:19:20 +03:00
|
|
|
Rectangle {
|
2019-12-03 19:25:11 +03:00
|
|
|
color: talkBtnMouseArea.containsMouse ? "white" : "transparent"
|
|
|
|
opacity: 0.2
|
|
|
|
}
|
2019-10-27 17:19:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
|
|
|
id: trayWindowAppsButton
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
display: AbstractButton.IconOnly
|
2019-10-30 01:25:00 +03:00
|
|
|
Layout.preferredWidth: (trayWindowHeaderBackground.height)
|
|
|
|
Layout.preferredHeight: (trayWindowHeaderBackground.height)
|
2019-10-27 17:19:20 +03:00
|
|
|
flat: true
|
|
|
|
|
2019-10-30 01:25:00 +03:00
|
|
|
//icon.source: "../../theme/white/more-apps.svg"
|
2019-10-29 10:13:05 +03:00
|
|
|
icon.source: "qrc:///client/theme/white/more-apps.svg"
|
2019-10-27 17:19:20 +03:00
|
|
|
icon.color: "transparent"
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
id: appsBtnMouseArea
|
|
|
|
anchors.fill: parent
|
2019-10-30 01:25:00 +03:00
|
|
|
hoverEnabled: true
|
2019-10-27 17:19:20 +03:00
|
|
|
onClicked:
|
|
|
|
{
|
|
|
|
}
|
2019-12-03 19:25:11 +03:00
|
|
|
}
|
2019-10-27 17:19:20 +03:00
|
|
|
|
2019-12-03 19:25:11 +03:00
|
|
|
background:
|
2019-10-30 01:25:00 +03:00
|
|
|
Item {
|
|
|
|
id: rightHoverContainer
|
|
|
|
height: trayWindowAppsButton.height
|
|
|
|
width: trayWindowAppsButton.width
|
|
|
|
Rectangle {
|
|
|
|
width: trayWindowAppsButton.width / 2
|
|
|
|
height: trayWindowAppsButton.height / 2
|
|
|
|
color: "white"
|
|
|
|
opacity: 0.2
|
|
|
|
visible: appsBtnMouseArea.containsMouse
|
|
|
|
}
|
|
|
|
Rectangle {
|
|
|
|
width: trayWindowAppsButton.width / 2
|
|
|
|
height: trayWindowAppsButton.height / 2
|
|
|
|
anchors.bottom: rightHoverContainer.bottom
|
|
|
|
color: "white"
|
|
|
|
opacity: 0.2
|
|
|
|
visible: appsBtnMouseArea.containsMouse
|
|
|
|
}
|
2019-10-27 17:19:20 +03:00
|
|
|
Rectangle {
|
2019-10-30 01:25:00 +03:00
|
|
|
width: trayWindowAppsButton.width / 2
|
|
|
|
height: trayWindowAppsButton.height / 2
|
|
|
|
anchors.bottom: rightHoverContainer.bottom
|
|
|
|
anchors.right: rightHoverContainer.right
|
|
|
|
color: "white"
|
|
|
|
opacity: 0.2
|
|
|
|
visible: appsBtnMouseArea.containsMouse
|
|
|
|
}
|
2019-12-03 19:25:11 +03:00
|
|
|
Rectangle {
|
|
|
|
id: rightHoverContainerClipper
|
|
|
|
anchors.right: rightHoverContainer.right
|
|
|
|
width: trayWindowAppsButton.width / 2
|
|
|
|
height: trayWindowAppsButton.height / 2
|
|
|
|
color: "transparent"
|
|
|
|
clip: true
|
2019-10-30 01:25:00 +03:00
|
|
|
Rectangle {
|
2019-12-03 19:25:11 +03:00
|
|
|
width: trayWindowAppsButton.width
|
|
|
|
height: trayWindowAppsButton.height
|
|
|
|
anchors.right: rightHoverContainerClipper.right
|
|
|
|
radius: 10
|
|
|
|
color: "white"
|
|
|
|
opacity: 0.2
|
|
|
|
visible: appsBtnMouseArea.containsMouse
|
2019-10-30 01:25:00 +03:00
|
|
|
}
|
2019-10-27 17:19:20 +03:00
|
|
|
}
|
2019-12-03 19:25:11 +03:00
|
|
|
}
|
2019-10-27 17:19:20 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} // Rectangle trayWindowHeaderBackground
|
|
|
|
|
2019-11-29 19:06:35 +03:00
|
|
|
ListModel {
|
|
|
|
id: activityListModel
|
|
|
|
}
|
|
|
|
|
2019-10-30 22:47:21 +03:00
|
|
|
ListView {
|
|
|
|
id: activityListView
|
2019-10-27 17:19:20 +03:00
|
|
|
anchors.top: trayWindowHeaderBackground.bottom
|
2019-10-30 22:47:21 +03:00
|
|
|
width: trayWindowBackground.width
|
|
|
|
height: trayWindowBackground.height - trayWindowHeaderBackground.height
|
|
|
|
clip: true
|
|
|
|
|
2019-11-29 19:06:35 +03:00
|
|
|
model: activityListModel
|
2019-10-30 22:47:21 +03:00
|
|
|
|
|
|
|
delegate: RowLayout {
|
|
|
|
id: activityItem
|
|
|
|
width: activityListView.width
|
|
|
|
height: trayWindowHeaderLayout.height
|
|
|
|
spacing: 0
|
|
|
|
Image {
|
|
|
|
id: activityIcon
|
|
|
|
Layout.leftMargin: 6
|
|
|
|
Layout.preferredWidth: 48
|
|
|
|
Layout.preferredHeight: 48
|
|
|
|
verticalAlignment: Qt.AlignCenter
|
|
|
|
source: "qrc:///client/theme/black/state-sync.svg"
|
|
|
|
sourceSize.height: 48
|
|
|
|
sourceSize.width: 48
|
|
|
|
}
|
|
|
|
Column {
|
|
|
|
Layout.leftMargin: 6
|
|
|
|
spacing: 4
|
|
|
|
Layout.alignment: Qt.AlignLeft
|
|
|
|
Text {
|
|
|
|
id: activityTextTitle
|
|
|
|
text: name
|
|
|
|
font.pointSize: 9
|
|
|
|
}
|
|
|
|
Text {
|
|
|
|
id: activityTextInfo
|
|
|
|
text: "Lorem ipsum dolor sit amet"
|
|
|
|
font.pointSize: 8
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Item {
|
|
|
|
id: activityItemFiller
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
Layout.preferredWidth: activityItem.height
|
|
|
|
Layout.preferredHeight: activityItem.height
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
flat: true
|
|
|
|
display: AbstractButton.IconOnly
|
|
|
|
icon.source: "qrc:///client/resources/files.svg"
|
|
|
|
icon.color: "transparent"
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
Layout.preferredWidth: activityItem.height
|
|
|
|
Layout.preferredHeight: activityItem.height
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
flat: true
|
|
|
|
display: AbstractButton.IconOnly
|
|
|
|
icon.source: "qrc:///client/resources/public.svg"
|
|
|
|
icon.color: "transparent"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
add: Transition {
|
2019-11-04 14:48:07 +03:00
|
|
|
NumberAnimation { properties: "y"; from: -60; duration: 100; easing.type: Easing.Linear }
|
|
|
|
}
|
|
|
|
|
|
|
|
remove: Transition {
|
|
|
|
NumberAnimation { property: "opacity"; from: 1.0; to: 0; duration: 100 }
|
|
|
|
}
|
|
|
|
|
|
|
|
removeDisplaced: Transition {
|
|
|
|
SequentialAnimation {
|
|
|
|
PauseAnimation { duration: 100}
|
|
|
|
NumberAnimation { properties: "y"; duration: 100; easing.type: Easing.Linear }
|
|
|
|
}
|
2019-10-30 22:47:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
displaced: Transition {
|
2019-11-04 14:48:07 +03:00
|
|
|
NumberAnimation { properties: "y"; duration: 100; easing.type: Easing.Linear }
|
2019-10-30 22:47:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
focus: true
|
2019-11-29 19:06:35 +03:00
|
|
|
|
|
|
|
// For interactive ListView/Animation testing only
|
|
|
|
//Keys.onSpacePressed: model.insert(0, { "name": "Item " + model.count })
|
|
|
|
//Keys.onTabPressed: model.remove(3)
|
2019-10-30 22:47:21 +03:00
|
|
|
}
|
2019-10-27 17:19:20 +03:00
|
|
|
|
|
|
|
} // Rectangle trayWindowBackground
|
|
|
|
}
|