Debian Codegraph @

au4/src/projectscene/qml/Audacity/ProjectScene/trackspanel/TracksTitleBar.qml

raw
1 import QtQuick
2 import QtQuick.Controls
3 import QtQuick.Layouts
4
5 import Muse.Ui
6 import Muse.UiComponents
7
8 import "qrc:/kddockwidgets/private/quick/qml/" as KDDW
9
10 KDDW.TitleBarBase {
11 id: root
12
13 property var navigationPanel
14 property var navigationOrder
15 property var contextMenuModel
16
17 property int expectedHeight: 39
18
19 signal addRequested(type: int, quantity: int)
20
21 anchors.fill: parent
22 implicitHeight: gripButton.implicitHeight
23 heightWhenVisible: expectedHeight
24
25 RowLayout {
26 id: rowLayout
27 anchors.fill: parent
28 spacing: 0
29
30 FlatButton {
31 id: gripButton
32
33 Layout.preferredHeight: root.expectedHeight
34 Layout.preferredWidth: 28
35 backgroundRadius: 0
36
37 visible: true
38 normalColor: ui.theme.backgroundSecondaryColor
39 hoverHitColor: ui.theme.buttonColor
40
41 mouseArea.objectName: root.objectName + "_gripButton"
42 mouseArea.cursorShape: Qt.SizeAllCursor
43 // do not accept buttons as FlatButton's mouseArea will override
44 // DockTitleBar mouseArea and panel will not be draggable
45 mouseArea.acceptedButtons: Qt.NoButton
46
47 transparent: false
48 contentItem: StyledIconLabel {
49 iconCode: IconCode.TOOLBAR_GRIP
50 }
51
52 backgroundItem: TracksTitleBarBackground {
53 mouseArea: gripButton.mouseArea
54 color: gripButton.normalColor
55 baseColor: gripButton.normalColor
56 }
57 }
58
59 SeparatorLine { }
60
61 FlatButton {
62 id: addNewTrackBtn
63
64 width: root.verticalPanelDefaultWidth - gripButton.width
65 Layout.fillWidth: true
66 Layout.preferredHeight: root.expectedHeight
67
68 accessible.name: qsTrc("projectscene", "Add Track")
69 backgroundRadius: 0
70 normalColor: ui.theme.backgroundSecondaryColor
71 hoverHitColor: ui.theme.buttonColor
72
73 text: qsTrc("projectscene", "Add new track")
74
75 //! TODO AU4
76 enabled: true //root.isAddingAvailable
77
78 icon: IconCode.PLUS
79
80 orientation: Qt.Horizontal
81
82 backgroundItem: TracksTitleBarBackground {
83 mouseArea: addNewTrackBtn.mouseArea
84 color: addNewTrackBtn.normalColor
85 baseColor: addNewTrackBtn.normalColor
86 }
87
88 onClicked: {
89 if (addNewTrack.isOpened) {
90 addNewTrack.close()
91 } else {
92 addNewTrack.open()
93 }
94 }
95
96 AddNewTrackPopup {
97 id: addNewTrack
98
99 onCreateTracks: (type, quantity) => {
100 root.addRequested(type, quantity)
101 addNewTrack.close()
102 }
103 }
104 }
105 }
106
107 SeparatorLine {
108 anchors.top: rowLayout.bottom
109 }
110 }