| 1 |
/* |
| 2 |
* Audacity: A Digital Audio Editor |
| 3 |
*/ |
| 4 |
import QtQuick |
| 5 |
import QtQuick.Layouts |
| 6 |
import QtQuick.Controls |
| 7 |
|
| 8 |
import Muse.Ui |
| 9 |
import Muse.UiComponents |
| 10 |
|
| 11 |
import Audacity.ProjectScene |
| 12 |
|
| 13 |
Item { |
| 14 |
id: root |
| 15 |
|
| 16 |
property NavigationSection navigationSection: null |
| 17 |
property NavigationPanel navigationPanel: view.count > 0 ? view.itemAtIndex(0).navigationPanel : null // first panel |
| 18 |
property alias tracksModel: tracksModel |
| 19 |
// property alias contextMenuModel: contextMenuModel |
| 20 |
|
| 21 |
TracksListModel { |
| 22 |
id: tracksModel |
| 23 |
} |
| 24 |
|
| 25 |
//! NOTE Sync with TracksClipsView |
| 26 |
TracksViewStateModel { |
| 27 |
id: tracksViewState |
| 28 |
onTracksVericalYChanged: { |
| 29 |
view.contentY = tracksViewState.tracksVericalY |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
Component.onCompleted: { |
| 34 |
tracksViewState.init() |
| 35 |
tracksModel.load() |
| 36 |
} |
| 37 |
|
| 38 |
QtObject { |
| 39 |
id: prv |
| 40 |
|
| 41 |
property string currentItemNavigationName: "" |
| 42 |
} |
| 43 |
|
| 44 |
ColumnLayout { |
| 45 |
id: contentColumn |
| 46 |
|
| 47 |
anchors.fill: parent |
| 48 |
|
| 49 |
readonly property int sideMargin: 12 |
| 50 |
spacing: sideMargin |
| 51 |
|
| 52 |
StyledListView { |
| 53 |
id: view |
| 54 |
Layout.topMargin: 1 |
| 55 |
Layout.fillWidth: true |
| 56 |
Layout.fillHeight: true |
| 57 |
|
| 58 |
spacing: 0 |
| 59 |
|
| 60 |
ScrollBar.vertical: null |
| 61 |
onContentYChanged: { |
| 62 |
tracksViewState.changeTracksVericalY(view.contentY) |
| 63 |
} |
| 64 |
|
| 65 |
interactive: true |
| 66 |
|
| 67 |
model: tracksModel |
| 68 |
|
| 69 |
navigation.section: root.navigationSection |
| 70 |
navigation.order: 1 |
| 71 |
|
| 72 |
delegate: TrackItem { |
| 73 |
item: itemData |
| 74 |
|
| 75 |
isSelected: Boolean(item) ? item.isSelected : false |
| 76 |
|
| 77 |
navigation.name: Boolean(item) ? item.title + item.index : "" |
| 78 |
navigation.panel: view.navigation |
| 79 |
navigation.row: model.index |
| 80 |
navigation.accessible.name: Boolean(item) ? item.title : "" |
| 81 |
navigation.onActiveChanged: { |
| 82 |
if (navigation.active) { |
| 83 |
prv.currentItemNavigationName = navigation.name |
| 84 |
view.positionViewAtIndex(index, ListView.Contain) |
| 85 |
} |
| 86 |
} |
| 87 |
|
| 88 |
onClicked: { |
| 89 |
tracksModel.selectRow(model.index) |
| 90 |
} |
| 91 |
|
| 92 |
onInteractionStarted: { |
| 93 |
view.interactive = false |
| 94 |
} |
| 95 |
|
| 96 |
onInteractionEnded: { |
| 97 |
view.interactive = true |
| 98 |
} |
| 99 |
|
| 100 |
onDuplicateRequested: { |
| 101 |
tracksModel.duplicateTrack(model.index) |
| 102 |
} |
| 103 |
|
| 104 |
onDeleteRequested: { |
| 105 |
tracksModel.deleteTrack(model.index) |
| 106 |
} |
| 107 |
|
| 108 |
onOpenEffectsRequested: { |
| 109 |
tracksModel.openEffectsForTrack(model.index) |
| 110 |
} |
| 111 |
} |
| 112 |
} |
| 113 |
} |
| 114 |
} |