diff --git a/.dir-locals.el b/.dir-locals.el index a0a09dd..e29a5f1 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -1,3 +1,8 @@ -;; ((nil . ((projectile-project-run-cmd . "cmake -B buld/ . && make --dir build/ && ./build/bin/presenter") -;; (compilation-read-command nil) -;; (projectile-project-compilation-cmd . "cmake -B buld/ . && make --dir build/")))) +;;; Directory Local Variables +;;; For more information see (info "(emacs) Directory Variables") + +((nil . ((projectile-project-run-cmd . "./build/bin/presenter") + (compilation-read-command . (nil)) + (projectile-project-compilation-cmd . "cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -B buld/ . && make --dir build/"))) + (qml-mode . ((completion-at-point-functions . (list + (cape-super-capf #'cape-dabbrev #'cape-dict)))))) diff --git a/src/qml/main.qml b/src/qml/main.qml index 0d2225e..d8a4d20 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -21,6 +21,10 @@ Kirigami.ApplicationWindow { width: 1800 height: 900 + Rectangle { + + } + Presenter.MainWindow { id: mainPage } diff --git a/src/qml/presenter/DragHandle.qml b/src/qml/presenter/DragHandle.qml index 693bb6d..f4f957d 100644 --- a/src/qml/presenter/DragHandle.qml +++ b/src/qml/presenter/DragHandle.qml @@ -35,6 +35,9 @@ Item { */ signal dropped() + // Emitted when clicking to activate underneath mousearea + signal activated() + MouseArea { id: mouseArea anchors.fill: parent @@ -43,6 +46,7 @@ Item { axis: Drag.YAxis minimumY: 0 maximumY: listView.height - listItem.height + filterChildren: true } /* cursorShape: pressed ? Qt.ClosedHandCursor : Qt.OpenHandCursor */ @@ -60,8 +64,9 @@ Item { } } - preventStealing: true + preventStealing: false onPressed: { + listView.interactive = false; mouseArea.originalParent = listItem.parent; listItem.parent = listView; listItem.y = mouseArea.originalParent.mapToItem(listItem.parent, listItem.x, listItem.y).y; @@ -81,6 +86,7 @@ Item { listItem.y > listView.height - mouseArea.autoScrollThreshold); } onReleased: { + listView.interactive = true; listItem.y = mouseArea.originalParent.mapFromItem(listItem, 0, 0).y; listItem.parent = mouseArea.originalParent; dropAnimation.running = true; @@ -116,5 +122,11 @@ Item { mouseArea.arrangeItem(); } } + + MouseArea { + id: clickArea + anchors.fill: parent + onClicked: root.activated() + } } } diff --git a/src/qml/presenter/LeftDock.qml b/src/qml/presenter/LeftDock.qml index ed58b5c..55d547a 100644 --- a/src/qml/presenter/LeftDock.qml +++ b/src/qml/presenter/LeftDock.qml @@ -29,90 +29,123 @@ ColumnLayout { } } - ListView { - id: serviceItemList - Layout.fillWidth: true + DropArea { + id: serviceDropEnd Layout.fillHeight: true - model: listModel - delegate: Kirigami.DelegateRecycler { - width: serviceItemList.width - sourceComponent: itemDelegate - } - clip: true - spacing: 2 - addDisplaced: Transition { - NumberAnimation {properties: "x, y"; duration: 100} - } - moveDisplaced: Transition { - NumberAnimation { properties: "x, y"; duration: 100 } - } - remove: Transition { - NumberAnimation { properties: "x, y"; duration: 100 } - NumberAnimation { properties: "opacity"; duration: 100 } + Layout.fillWidth: true + onDropped: { + serviceListModel.append({"name": dragSongTitle, "type": "song"}); } + keys: ["library"] - removeDisplaced: Transition { - NumberAnimation { properties: "x, y"; duration: 100 } - } - - displaced: Transition { - NumberAnimation {properties: "x, y"; duration: 100} - } - - Component { - id: itemDelegate - Kirigami.BasicListItem { - id: serviceItem + ListView { + id: serviceItemList + anchors.fill: parent + model: serviceListModel + delegate: Kirigami.DelegateRecycler { width: serviceItemList.width - height:50 - label: itemName - subtitle: type - hoverEnabled: true - backgroundColor: serviceDrop.containsDrag ? Kirigami.Theme.highlightColor : Kirigami.Theme.viewBackgroundColor - onClicked: serviceItemList.currentIndex = index + sourceComponent: itemDelegate + } + clip: true + spacing: 3 - Presenter.DragHandle { - listItem: serviceItem - listView: serviceItemList - onMoveRequested: listModel.move(oldIndex, newIndex, 1) - anchors.fill: parent + addDisplaced: Transition { + NumberAnimation {properties: "x, y"; duration: 100} + } + moveDisplaced: Transition { + NumberAnimation { properties: "x, y"; duration: 100 } + } + remove: Transition { + NumberAnimation { properties: "x, y"; duration: 100 } + NumberAnimation { properties: "opacity"; duration: 100 } + } + + removeDisplaced: Transition { + NumberAnimation { properties: "x, y"; duration: 100 } + } + + displaced: Transition { + NumberAnimation {properties: "x, y"; duration: 100} + } + + Component { + id: itemDelegate + Item { + implicitWidth: ListView.view.width + height: 50 + Kirigami.BasicListItem { + id: serviceItem + width: serviceItemList.width + height: 50 + label: name + subtitle: type + hoverEnabled: true + supportsMouseEvents: false + backgroundColor: { + if (serviceDrop.containsDrag | isCurrentItem) { + Kirigami.Theme.highlightColor + } else + Kirigami.Theme.viewBackgroundColor + } + /* onClicked: serviceItemList.currentIndex = index && showPassiveNotification(serviceItemList.currentIndex) */ + + } + Presenter.DragHandle { + width: serviceItemList.width + height: 50 + /* anchors.fill: parent */ + listItem: serviceItem + listView: serviceItemList + onMoveRequested: serviceListModel.move(oldIndex, newIndex, 1) + onActivated: serviceItemList.currentIndex = index && showPassiveNotification(serviceItemList.currentIndex) + } + DropArea { + id: serviceDrop + width: serviceItemList.width + height: 50 + onDropped: { + serviceListModel.insert(index, {"name": dragSongTitle, "type": "song"}); + showPassiveNotification(index); + } + keys: ["library"] + } } + } - DropArea { - id: serviceDrop - Layout.fillHeight: true - Layout.fillWidth: true - onEntered: showPassiveNotification(drag.source + " has entered") - onDropped: listModel.append(drag.source) + Kirigami.WheelHandler { + id: wheelHandler + target: serviceItemList + filterMouseEvents: true + keyNavigationEnabled: true + } + + Controls.ScrollBar.vertical: Controls.ScrollBar { + anchors.right: serviceItemList.right + anchors.leftMargin: 10 + active: hovered || pressed + } + ListModel { + id: serviceListModel + ListElement { + name: "10,000 Reason" + type: "song" + } + ListElement { + name: "Marvelous Light" + type: "song" + } + ListElement { + name: "10,000 Reason" + type: "song" + } + ListElement { + name: "Marvelous Light" + type: "song" } - } + } - Kirigami.WheelHandler { - id: wheelHandler - target: serviceItemList - filterMouseEvents: true - keyNavigationEnabled: true - } - - Controls.ScrollBar.vertical: Controls.ScrollBar { - anchors.right: serviceItemList.right - anchors.leftMargin: 10 - active: hovered || pressed - } - ListModel { - id: listModel - ListElement { - itemName: "10,000 Reason" - type: "song" - } - ListElement { - itemName: "Marvelous Light" - type: "song" - } - } } - } diff --git a/src/qml/presenter/Library.qml b/src/qml/presenter/Library.qml index 8bd66a9..7bc6609 100644 --- a/src/qml/presenter/Library.qml +++ b/src/qml/presenter/Library.qml @@ -189,6 +189,7 @@ Item { Drag.active: dragHandler.drag.active Drag.hotSpot.x: width / 2 Drag.hotSpot.y: height / 2 + Drag.keys: [ "library" ] states: State { name: "dragged" @@ -210,8 +211,10 @@ Item { target: songListItem onActiveChanged: { if (dragHandler.drag.active) { - draggedLibraryItem = songLibraryList.currentItem - showPassiveNotification(index) + dragSongTitle = title + showPassiveNotification(dragSongTitle) + } else { + songListItem.Drag.drop() } } filterChildren: true diff --git a/src/qml/presenter/MainWindow.qml b/src/qml/presenter/MainWindow.qml index f320b9c..a107a3f 100644 --- a/src/qml/presenter/MainWindow.qml +++ b/src/qml/presenter/MainWindow.qml @@ -20,6 +20,8 @@ Controls.Page { property string songVorder: "" property int blurRadius: 0 + property string dragSongTitle: "" + property Item slideItem property var song property var draggedLibraryItem @@ -42,7 +44,7 @@ Controls.Page { Rectangle { height: parent.height anchors.horizontalCenter: parent.horizontalCenter - implicitWidth: 1 + width: 1 color: Controls.SplitHandle.hovered ? Kirigami.Theme.hoverColor : Kirigami.Theme.backgroundColor } } diff --git a/src/qml/presenter/SongEditor.qml b/src/qml/presenter/SongEditor.qml index ef1fd5c..3dcea41 100644 --- a/src/qml/presenter/SongEditor.qml +++ b/src/qml/presenter/SongEditor.qml @@ -97,7 +97,16 @@ Item { Layout.fillHeight: true Layout.fillWidth: true Layout.columnSpan: 2 - + handle: Item{ + implicitWidth: 6 + Rectangle { + height: parent.height + anchors.horizontalCenter: parent.horizontalCenter + width: 1 + color: Controls.SplitHandle.hovered ? Kirigami.Theme.hoverColor : Kirigami.Theme.backgroundColor + } + } + ColumnLayout { Controls.SplitView.fillHeight: true Controls.SplitView.preferredWidth: 500