moment/src/gui/MainPane/TopBar.qml

145 lines
4.4 KiB
QML
Raw Normal View History

// Copyright Mirage authors & contributors <https://github.com/mirukana/mirage>
2020-05-13 07:37:39 -04:00
// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick 2.12
import QtQuick.Layouts 1.12
import ".."
2020-05-13 07:37:39 -04:00
import "../Base"
Rectangle {
clip: true
2020-05-13 08:03:50 -04:00
implicitHeight: theme.baseElementsHeight
color: theme.mainPane.topBar.background
2020-05-13 07:37:39 -04:00
HRowLayout {
anchors.fill: parent
HButton {
backgroundColor: "transparent"
icon.name: "settings"
toolTip.text: qsTr("Settings")
onClicked: settingsMenu.open()
2020-05-13 07:37:39 -04:00
Layout.fillHeight: true
HMenu {
id: settingsMenu
y: parent.height
HMenuItem {
icon.name: "more-settings"
text: qsTr("Open config folder")
onTriggered:
py.callCoro("get_config_dir", [], Qt.openUrlExternally)
}
HMenuItem {
icon.name: "theme"
text: qsTr("Open theme folder")
onTriggered:
py.callCoro("get_theme_dir", [], Qt.openUrlExternally)
}
HMenuItem {
icon.name: "reload-config-files"
text: qsTr("Reload config & theme")
onTriggered: mainUI.reloadSettings()
}
HMenuItem {
icon.name: "debug"
text: qsTr("Developer console")
onTriggered: mainUI.debugConsole.toggle()
}
}
2020-05-13 07:37:39 -04:00
}
HButton {
backgroundColor: "transparent"
text: qsTr("%1 %2")
.arg(Qt.application.displayName).arg(Qt.application.version)
label.color: theme.mainPane.topBar.nameVersionLabel
2020-05-13 07:37:39 -04:00
toolTip.text: qsTr("Open project repository")
onClicked:
Qt.openUrlExternally("https://github.com/mirukana/mirage")
Layout.fillWidth: true
Layout.fillHeight: true
}
HButton {
backgroundColor: "transparent"
icon.name:
window.notificationLevel === Window.NotificationLevel.All ?
"notifications-all" :
window.notificationLevel === Window.NotificationLevel.None ?
"notifications-none" :
"notifications-mentions-keywords"
icon.color:
window.notificationLevel === Window.NotificationLevel.All ?
theme.icons.colorize :
window.notificationLevel === Window.NotificationLevel.None ?
theme.colors.negativeBackground :
theme.colors.middleBackground
toolTip.text: qsTr("Control global notifications")
onClicked: notificationsMenu.open()
2020-05-13 07:37:39 -04:00
Layout.fillHeight: true
HMenu {
id: notificationsMenu
y: parent.height
HMenuItem {
icon.name: "notifications-all"
text: qsTr("Normal notifications")
onTriggered:
window.notificationLevel =
Window.NotificationLevel.All
}
HMenuItem {
icon.name: "notifications-mentions-keywords"
icon.color: theme.colors.middleBackground
text: qsTr("Mentions & keywords")
onTriggered:
window.notificationLevel =
Window.NotificationLevel.MentionsKeywords
}
HMenuItem {
icon.name: "notifications-none"
icon.color: theme.colors.negativeBackground
text: qsTr("Nothing")
onTriggered:
window.notificationLevel =
Window.NotificationLevel.None
}
}
2020-05-13 07:37:39 -04:00
}
HButton {
visible: Layout.preferredWidth > 0
backgroundColor: "transparent"
icon.name: "go-back-to-chat-from-main-pane"
toolTip.text: qsTr("Go back to room")
onClicked: mainPane.toggleFocus()
Layout.preferredWidth: mainPane.collapse ? implicitWidth : 0
Layout.fillHeight: true
Behavior on Layout.preferredWidth { HNumberAnimation {} }
}
}
}