mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-02-07 15:08:24 +00:00
Reworked menu bar to use burger
This commit is contained in:
parent
48c0678b58
commit
f6c7ab202c
2 changed files with 76 additions and 157 deletions
|
|
@ -47,9 +47,9 @@ ApplicationWindow {
|
|||
// Menu bar.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
menuBar: MainWindowMenuBar {
|
||||
/*menuBar: MainWindowMenuBar {
|
||||
hide: mainLoader.item ? !mainLoader.item.collapse.isCollapsed : true
|
||||
}
|
||||
}*/
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -184,6 +184,20 @@ ApplicationWindow {
|
|||
visible: !smartSearchBar.isOpen
|
||||
}
|
||||
}
|
||||
|
||||
Icon {
|
||||
icon: 'burger_menu_normal'
|
||||
iconSize: 16
|
||||
|
||||
MainWindowMenuBar {
|
||||
id: mainmenu
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: mainmenu.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import QtQuick 2.7
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Controls 2.1
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
import QtQuick.Window 2.2
|
||||
import Qt.labs.platform 1.0
|
||||
|
||||
import Linphone 1.0
|
||||
|
||||
|
|
@ -9,175 +10,79 @@ import App.Styles 1.0
|
|||
|
||||
// =============================================================================
|
||||
|
||||
MenuBar {
|
||||
id: container
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
property bool hide: false
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Workaround to hide toolbar.
|
||||
// Use private properties of MenuBar.
|
||||
|
||||
__contentItem.height: hide
|
||||
? 0
|
||||
: MainWindowMenuBarStyle.height
|
||||
|
||||
__contentItem.transform: Scale {
|
||||
yScale: Number(!hide)
|
||||
Item {
|
||||
function open() {
|
||||
menu.open()
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
style: MenuBarStyle {
|
||||
background: Rectangle {
|
||||
color: MainWindowMenuBarStyle.color
|
||||
|
||||
Rectangle {
|
||||
anchors.bottom: parent.bottom
|
||||
color: MainWindowMenuBarStyle.separator.color
|
||||
height: MainWindowMenuBarStyle.separator.height
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
|
||||
menuStyle: MenuStyle {
|
||||
id: menuStyle
|
||||
|
||||
font.pointSize: MainWindowMenuBarStyle.subMenu.text.fontSize
|
||||
|
||||
frame: Item {}
|
||||
|
||||
itemDelegate {
|
||||
background: Rectangle {
|
||||
color: (styleData.selected || styleData.open)
|
||||
? MainWindowMenuBarStyle.subMenu.color.selected
|
||||
: MainWindowMenuBarStyle.subMenu.color.normal
|
||||
}
|
||||
|
||||
label: Label {
|
||||
color: styleData.selected
|
||||
? MainWindowMenuBarStyle.subMenu.text.color.selected
|
||||
: MainWindowMenuBarStyle.subMenu.text.color.normal
|
||||
font: menuStyle.font
|
||||
text: styleData.text
|
||||
}
|
||||
|
||||
shortcut: Label {
|
||||
color: styleData.selected
|
||||
? MainWindowMenuBarStyle.subMenu.text.color.selected
|
||||
: MainWindowMenuBarStyle.subMenu.text.color.normal
|
||||
font: menuStyle.font
|
||||
text: styleData.shortcut
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
itemDelegate: Item {
|
||||
implicitHeight: menuItem.height + MainWindowMenuBarStyle.separator.spacing
|
||||
implicitWidth: menuItem.width
|
||||
|
||||
Item {
|
||||
id: menuItem
|
||||
|
||||
implicitHeight: text.height + MainWindowMenuBarStyle.menu.text.verticalMargins * 2
|
||||
implicitWidth: text.width + MainWindowMenuBarStyle.menu.text.horizontalMargins * 2
|
||||
|
||||
Text {
|
||||
id: text
|
||||
|
||||
anchors.centerIn: parent
|
||||
color: styleData.open
|
||||
? MainWindowMenuBarStyle.menu.text.color.selected
|
||||
: MainWindowMenuBarStyle.menu.text.color.normal
|
||||
|
||||
font.pointSize: MainWindowMenuBarStyle.menu.text.fontSize
|
||||
text: formatMnemonic(styleData.text, styleData.underlineMnemonic)
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.bottom: parent.bottom
|
||||
color: MainWindowMenuBarStyle.menu.indicator.color
|
||||
visible: styleData.open
|
||||
|
||||
height: MainWindowMenuBarStyle.menu.indicator.height
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Options.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Menu {
|
||||
id: menu
|
||||
|
||||
title: qsTr('options')
|
||||
Menu {
|
||||
title: qsTr('options')
|
||||
|
||||
MenuItem {
|
||||
shortcut: 'Ctrl+P'
|
||||
text: qsTr('settings')
|
||||
MenuItem {
|
||||
shortcut: 'Ctrl+P'
|
||||
text: qsTr('settings')
|
||||
|
||||
onTriggered: {
|
||||
var window = App.getSettingsWindow()
|
||||
if (window.visibility === Window.Minimized) {
|
||||
window.visibility = Window.AutomaticVisibility
|
||||
} else {
|
||||
window.setVisible(true)
|
||||
onTriggered: {
|
||||
var window = App.getSettingsWindow()
|
||||
if (window.visibility === Window.Minimized) {
|
||||
window.visibility = Window.AutomaticVisibility
|
||||
} else {
|
||||
window.setVisible(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MenuSeparator {}
|
||||
MenuSeparator {}
|
||||
|
||||
MenuItem {
|
||||
shortcut: StandardKey.Quit
|
||||
text: qsTr('quit')
|
||||
MenuItem {
|
||||
shortcut: StandardKey.Quit
|
||||
text: qsTr('quit')
|
||||
|
||||
onTriggered: Qt.quit()
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Tools.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Menu {
|
||||
title: qsTr('tools')
|
||||
|
||||
MenuItem {
|
||||
text: qsTr('audioAssistant')
|
||||
|
||||
onTriggered: console.log('TODO')
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Help.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Menu {
|
||||
title: qsTr('help')
|
||||
|
||||
MenuItem {
|
||||
shortcut: StandardKey.HelpContents
|
||||
text: qsTr('about')
|
||||
|
||||
onTriggered: {
|
||||
window.detachVirtualWindow()
|
||||
window.attachVirtualWindow(Qt.resolvedUrl('About.qml'))
|
||||
onTriggered: Qt.quit()
|
||||
}
|
||||
}
|
||||
|
||||
MenuSeparator {}
|
||||
// ---------------------------------------------------------------------------
|
||||
// Tools.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
MenuItem {
|
||||
text: qsTr('checkForUpdates')
|
||||
Menu {
|
||||
title: qsTr('tools')
|
||||
|
||||
onTriggered: console.log('TODO')
|
||||
MenuItem {
|
||||
text: qsTr('audioAssistant')
|
||||
|
||||
onTriggered: console.log('TODO')
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Help.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Menu {
|
||||
title: qsTr('help')
|
||||
|
||||
MenuItem {
|
||||
shortcut: StandardKey.HelpContents
|
||||
text: qsTr('about')
|
||||
|
||||
onTriggered: {
|
||||
window.detachVirtualWindow()
|
||||
window.attachVirtualWindow(Qt.resolvedUrl('About.qml'))
|
||||
}
|
||||
}
|
||||
|
||||
MenuSeparator {}
|
||||
|
||||
MenuItem {
|
||||
text: qsTr('checkForUpdates')
|
||||
|
||||
onTriggered: console.log('TODO')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue