Seperating editors and making backgrounds work
This commit is contained in:
parent
bcdba4fea9
commit
c71356cac3
8 changed files with 414 additions and 302 deletions
|
@ -34,7 +34,11 @@ ColumnLayout {
|
|||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
onDropped: {
|
||||
serviceListModel.append({"name": dragSongTitle, "type": "song"});
|
||||
appendItem(dragItemTitle,
|
||||
dragItemType,
|
||||
dragItemText,
|
||||
dragItemBackgroundType,
|
||||
dragItemBackground);
|
||||
}
|
||||
keys: ["library"]
|
||||
|
||||
|
@ -106,7 +110,7 @@ ColumnLayout {
|
|||
onMoveRequested: serviceListModel.move(oldIndex, newIndex, 1)
|
||||
onClicked: {
|
||||
serviceItemList.currentIndex = index;
|
||||
showPassiveNotification(serviceItemList.currentIndex);
|
||||
/* showPassiveNotification(serviceItemList.currentIndex); */
|
||||
changeSlideBackground(background, backgroundType);
|
||||
changeSlideText(text);
|
||||
changeSlideType(type);
|
||||
|
@ -117,8 +121,12 @@ ColumnLayout {
|
|||
id: serviceDrop
|
||||
anchors.fill: parent
|
||||
onDropped: {
|
||||
serviceListModel.insert(index, {"name": dragSongTitle, "type": "song"});
|
||||
showPassiveNotification(index);
|
||||
addItem(index,
|
||||
dragItemTitle,
|
||||
dragItemType,
|
||||
dragItemText,
|
||||
dragItemBackgroundType,
|
||||
dragItemBackground);
|
||||
}
|
||||
keys: ["library"]
|
||||
}
|
||||
|
@ -161,33 +169,26 @@ ColumnLayout {
|
|||
backgroundType: "video"
|
||||
background: "file:/home/chris/nextcloud/tfc/openlp/videos/test.mp4"
|
||||
}
|
||||
ListElement {
|
||||
name: "facebook"
|
||||
type: "video"
|
||||
text: ""
|
||||
backgroundType: "video"
|
||||
background: "file:/home/chris/nextcloud/tfc/videos/facebook-ukraine-vid.mkv"
|
||||
}
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function addItem(index, name, type, text, backgroundType, background) {
|
||||
serviceListModel.insert(index, {
|
||||
"name": name,
|
||||
"type": type,
|
||||
"text": text,
|
||||
"backgroundType": backgroundType,
|
||||
"background": background})
|
||||
}
|
||||
|
||||
function appendItem(name, type, text, backgroundType, background) {
|
||||
serviceListModel.append({
|
||||
"name": name,
|
||||
"type": type,
|
||||
"text": text,
|
||||
"backgroundType": backgroundType,
|
||||
"background": background})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -164,36 +164,26 @@ Item {
|
|||
backgroundColor: {
|
||||
if (parent.ListView.isCurrentItem) {
|
||||
Kirigami.Theme.highlightColor;
|
||||
} else if (dragHandler.containsMouse){
|
||||
} else if (songDragHandler.containsMouse){
|
||||
Kirigami.Theme.highlightColor;
|
||||
} else {
|
||||
Kirigami.Theme.backgroundColor;
|
||||
}
|
||||
}
|
||||
textColor: {
|
||||
if (parent.ListView.isCurrentItem || dragHandler.containsMouse)
|
||||
if (parent.ListView.isCurrentItem || songDragHandler.containsMouse)
|
||||
activeTextColor;
|
||||
else
|
||||
Kirigami.Theme.textColor;
|
||||
}
|
||||
|
||||
/* onAdd: { */
|
||||
/* showPassiveNotification(title, 3000) */
|
||||
/* songLibraryList.currentIndex = index */
|
||||
/* song = index */
|
||||
/* songTitle = title */
|
||||
/* songLyrics = lyrics */
|
||||
/* songAuthor = author */
|
||||
/* songVorder = vorder */
|
||||
/* } */
|
||||
|
||||
Behavior on height {
|
||||
NumberAnimation {
|
||||
easing.type: Easing.OutCubic
|
||||
duration: 300
|
||||
}
|
||||
}
|
||||
Drag.active: dragHandler.drag.active
|
||||
Drag.active: songDragHandler.drag.active
|
||||
Drag.hotSpot.x: width / 2
|
||||
Drag.hotSpot.y: height / 2
|
||||
Drag.keys: [ "library" ]
|
||||
|
@ -211,15 +201,18 @@ Item {
|
|||
}
|
||||
|
||||
MouseArea {
|
||||
id: dragHandler
|
||||
id: songDragHandler
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
drag {
|
||||
target: songListItem
|
||||
onActiveChanged: {
|
||||
if (dragHandler.drag.active) {
|
||||
dragSongTitle = title
|
||||
showPassiveNotification(dragSongTitle)
|
||||
if (songDragHandler.drag.active) {
|
||||
dragItemTitle = title;
|
||||
dragItemType = "song";
|
||||
dragItemBackgroundType = "image";
|
||||
dragItemBackground = "";
|
||||
/* showPassiveNotification(dragSongTitle) */
|
||||
} else {
|
||||
songListItem.Drag.drop()
|
||||
}
|
||||
|
@ -228,7 +221,7 @@ Item {
|
|||
threshold: 10
|
||||
}
|
||||
MouseArea {
|
||||
id: clickHandler
|
||||
id: songClickHandler
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
onClicked: {
|
||||
|
@ -237,11 +230,10 @@ Item {
|
|||
else{
|
||||
showPassiveNotification(title, 3000)
|
||||
songLibraryList.currentIndex = index
|
||||
song = index
|
||||
songTitle = title
|
||||
songLyrics = lyrics
|
||||
songAuthor = author
|
||||
songVorder = vorder
|
||||
if (!editMode)
|
||||
editMode = true;
|
||||
editType = "song";
|
||||
editSwitch(index);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -249,8 +241,8 @@ Item {
|
|||
}
|
||||
Controls.Menu {
|
||||
id: rightClickSongMenu
|
||||
x: clickHandler.mouseX
|
||||
y: clickHandler.mouseY + 10
|
||||
x: songClickHandler.mouseX
|
||||
y: songClickHandler.mouseY + 10
|
||||
Kirigami.Action {
|
||||
text: "delete"
|
||||
onTriggered: songsqlmodel.deleteSong(index)
|
||||
|
@ -274,15 +266,11 @@ Item {
|
|||
|
||||
function newSong() {
|
||||
songsqlmodel.newSong();
|
||||
songLibraryList.currentIndex = songsqlmodel.rowCount();
|
||||
songLibraryList.currentIndex = songsqlmodel.rowCount() - 1;
|
||||
if (!editMode)
|
||||
toggleEditMode();
|
||||
song = songLibraryList.currentItem
|
||||
songTitle = songLibraryList.currentItem.title
|
||||
songLyrics = songLibraryList.currentItem.lyrics
|
||||
songAuthor = songLibraryList.currentItem.author
|
||||
songVorder = songLibraryList.currentItem.vorder
|
||||
showPassiveNotification("newest song index: " + songLibraryList.currentIndex)
|
||||
editMode = true;
|
||||
editType = "song";
|
||||
editSwitch(songLibraryList.currentIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -436,8 +424,11 @@ Item {
|
|||
target: videoListItem
|
||||
onActiveChanged: {
|
||||
if (videoDragHandler.drag.active) {
|
||||
dragVideoTitle = title
|
||||
showPassiveNotification(dragVideoTitle)
|
||||
dragItemTitle = title;
|
||||
dragItemType = "video";
|
||||
dragItemText = "";
|
||||
dragItemBackgroundType = "video";
|
||||
dragItemBackground = filePath;
|
||||
} else {
|
||||
videoListItem.Drag.drop()
|
||||
}
|
||||
|
@ -457,7 +448,8 @@ Item {
|
|||
const video = videosqlmodel.getVideo(videoLibraryList.currentIndex);
|
||||
if (!editMode)
|
||||
editMode = true;
|
||||
editSwitch("video", video);
|
||||
editType = "video";
|
||||
editSwitch(video);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -522,132 +514,132 @@ Item {
|
|||
}
|
||||
]
|
||||
|
||||
transitions: Transition {
|
||||
to: "*"
|
||||
NumberAnimation {
|
||||
target: imageLibraryList
|
||||
properties: "preferredHeight"
|
||||
easing.type: Easing.OutCubic
|
||||
duration: 300
|
||||
}
|
||||
transitions: Transition {
|
||||
to: "*"
|
||||
NumberAnimation {
|
||||
target: imageLibraryList
|
||||
properties: "preferredHeight"
|
||||
easing.type: Easing.OutCubic
|
||||
duration: 300
|
||||
}
|
||||
|
||||
}
|
||||
Rectangle {
|
||||
id: presentationLibraryPanel
|
||||
Layout.preferredHeight: 40
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignTop
|
||||
color: Kirigami.Theme.backgroundColor
|
||||
|
||||
Controls.Label {
|
||||
anchors.centerIn: parent
|
||||
text: "Presentations"
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if (selectedLibrary == "presentations")
|
||||
selectedLibrary = ""
|
||||
else
|
||||
selectedLibrary = "presentations"
|
||||
print(selectedLibrary)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: presentationLibraryList
|
||||
Layout.preferredHeight: parent.height - 200
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignTop
|
||||
state: "deselected"
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "deselected"
|
||||
when: (selectedLibrary !== "presentations")
|
||||
PropertyChanges { target: presentationLibraryList
|
||||
Layout.preferredHeight: 0
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "selected"
|
||||
when: (selectedLibrary == "presentations")
|
||||
PropertyChanges { target: presentationLibraryList }
|
||||
}
|
||||
]
|
||||
|
||||
transitions: Transition {
|
||||
to: "*"
|
||||
NumberAnimation {
|
||||
target: presentationLibraryList
|
||||
properties: "preferredHeight"
|
||||
easing.type: Easing.OutCubic
|
||||
duration: 300
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Rectangle {
|
||||
id: slideLibraryPanel
|
||||
Layout.preferredHeight: 40
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignTop
|
||||
color: Kirigami.Theme.backgroundColor
|
||||
|
||||
Controls.Label {
|
||||
anchors.centerIn: parent
|
||||
text: "Slides"
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if (selectedLibrary == "slides")
|
||||
selectedLibrary = ""
|
||||
else
|
||||
selectedLibrary = "slides"
|
||||
print(selectedLibrary)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: slideLibraryList
|
||||
Layout.preferredHeight: parent.height - 200
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignTop
|
||||
state: "deselected"
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "deselected"
|
||||
when: (selectedLibrary !== "slides")
|
||||
PropertyChanges { target: slideLibraryList
|
||||
Layout.preferredHeight: 0
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "selected"
|
||||
when: (selectedLibrary == "slides")
|
||||
PropertyChanges { target: slideLibraryList }
|
||||
}
|
||||
]
|
||||
|
||||
transitions: Transition {
|
||||
to: "*"
|
||||
NumberAnimation {
|
||||
target: slideLibraryList
|
||||
properties: "preferredHeight"
|
||||
easing.type: Easing.OutCubic
|
||||
duration: 300
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: presentationLibraryPanel
|
||||
Layout.preferredHeight: 40
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignTop
|
||||
color: Kirigami.Theme.backgroundColor
|
||||
|
||||
Controls.Label {
|
||||
anchors.centerIn: parent
|
||||
text: "Presentations"
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if (selectedLibrary == "presentations")
|
||||
selectedLibrary = ""
|
||||
else
|
||||
selectedLibrary = "presentations"
|
||||
print(selectedLibrary)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: presentationLibraryList
|
||||
Layout.preferredHeight: parent.height - 200
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignTop
|
||||
state: "deselected"
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "deselected"
|
||||
when: (selectedLibrary !== "presentations")
|
||||
PropertyChanges { target: presentationLibraryList
|
||||
Layout.preferredHeight: 0
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "selected"
|
||||
when: (selectedLibrary == "presentations")
|
||||
PropertyChanges { target: presentationLibraryList }
|
||||
}
|
||||
]
|
||||
|
||||
transitions: Transition {
|
||||
to: "*"
|
||||
NumberAnimation {
|
||||
target: presentationLibraryList
|
||||
properties: "preferredHeight"
|
||||
easing.type: Easing.OutCubic
|
||||
duration: 300
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: slideLibraryPanel
|
||||
Layout.preferredHeight: 40
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignTop
|
||||
color: Kirigami.Theme.backgroundColor
|
||||
|
||||
Controls.Label {
|
||||
anchors.centerIn: parent
|
||||
text: "Slides"
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if (selectedLibrary == "slides")
|
||||
selectedLibrary = ""
|
||||
else
|
||||
selectedLibrary = "slides"
|
||||
print(selectedLibrary)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: slideLibraryList
|
||||
Layout.preferredHeight: parent.height - 200
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignTop
|
||||
state: "deselected"
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "deselected"
|
||||
when: (selectedLibrary !== "slides")
|
||||
PropertyChanges { target: slideLibraryList
|
||||
Layout.preferredHeight: 0
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "selected"
|
||||
when: (selectedLibrary == "slides")
|
||||
PropertyChanges { target: slideLibraryList }
|
||||
}
|
||||
]
|
||||
|
||||
transitions: Transition {
|
||||
to: "*"
|
||||
NumberAnimation {
|
||||
target: slideLibraryList
|
||||
properties: "preferredHeight"
|
||||
easing.type: Easing.OutCubic
|
||||
duration: 300
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DropArea {
|
||||
id: fileDropArea
|
||||
anchors.fill: parent
|
||||
|
|
|
@ -14,15 +14,15 @@ Controls.Page {
|
|||
// properties passed around for the slides
|
||||
property url imageBackground: ""
|
||||
property url videoBackground: ""
|
||||
property string songTitle: ""
|
||||
property string songLyrics: ""
|
||||
property string songAuthor: ""
|
||||
property string songVorder: ""
|
||||
property int blurRadius: 0
|
||||
|
||||
/* property var video */
|
||||
|
||||
property string dragSongTitle: ""
|
||||
property string dragItemTitle: ""
|
||||
property string dragItemType: ""
|
||||
property string dragItemText: ""
|
||||
property string dragItemBackgroundType: ""
|
||||
property string dragItemBackground: ""
|
||||
|
||||
property bool editing: true
|
||||
|
||||
|
@ -30,7 +30,7 @@ Controls.Page {
|
|||
property var song
|
||||
property var draggedLibraryItem
|
||||
|
||||
property Item editStackItem
|
||||
property string editType
|
||||
|
||||
Item {
|
||||
id: mainItem
|
||||
|
@ -64,19 +64,19 @@ Controls.Page {
|
|||
Controls.SplitView.minimumWidth: 200
|
||||
|
||||
Presenter.Presentation {
|
||||
id: presentation
|
||||
anchors.fill: parent
|
||||
id: presentation
|
||||
anchors.fill: parent
|
||||
}
|
||||
Presenter.SongEditor {
|
||||
id: songEditor
|
||||
visible: false
|
||||
anchors.fill: parent
|
||||
id: songEditor
|
||||
visible: false
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
Presenter.VideoEditor {
|
||||
id: videoEditor
|
||||
visible: false
|
||||
anchors.fill: parent
|
||||
id: videoEditor
|
||||
visible: false
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,41 +124,6 @@ Controls.Page {
|
|||
}
|
||||
}
|
||||
|
||||
FileDialog {
|
||||
id: videoFileDialog
|
||||
title: "Please choose a background"
|
||||
folder: shortcuts.home
|
||||
selectMultiple: false
|
||||
nameFilters: ["Video files (*.mp4 *.mkv *.mov *.wmv *.avi *.MP4 *.MOV *.MKV)"]
|
||||
onAccepted: {
|
||||
imageBackground = ""
|
||||
videoBackground = videoFileDialog.fileUrls[0]
|
||||
print("video background = " + videoFileDialog.fileUrl)
|
||||
}
|
||||
onRejected: {
|
||||
print("Canceled")
|
||||
/* Qt.quit() */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FileDialog {
|
||||
id: imageFileDialog
|
||||
title: "Please choose a background"
|
||||
folder: shortcuts.home
|
||||
selectMultiple: false
|
||||
nameFilters: ["Image files (*.jpg *.jpeg *.png *.JPG *.JPEG *.PNG)"]
|
||||
onAccepted: {
|
||||
videoBackground = ""
|
||||
imageBackground = imageFileDialog.fileUrls[0]
|
||||
}
|
||||
onRejected: {
|
||||
print("Canceled")
|
||||
/* Qt.quit() */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SongSqlModel {
|
||||
id: songsqlmodel
|
||||
}
|
||||
|
@ -168,21 +133,15 @@ Controls.Page {
|
|||
}
|
||||
|
||||
function changeSlideType(type) {
|
||||
/* showPassiveNotification("used to be: " + presentation.text); */
|
||||
presentation.itemType = type;
|
||||
/* showPassiveNotification("next"); */
|
||||
if (slideItem)
|
||||
slideItem.itemType = type;
|
||||
/* showPassiveNotification("last"); */
|
||||
}
|
||||
|
||||
function changeSlideText(text) {
|
||||
/* showPassiveNotification("used to be: " + presentation.text); */
|
||||
presentation.text = text;
|
||||
/* showPassiveNotification("next"); */
|
||||
if (slideItem)
|
||||
slideItem.text = text;
|
||||
/* showPassiveNotification("last"); */
|
||||
}
|
||||
|
||||
function changeSlideBackground(background, type) {
|
||||
|
@ -217,31 +176,40 @@ Controls.Page {
|
|||
showPassiveNotification("previous slide please")
|
||||
}
|
||||
|
||||
function editSwitch(editType, item) {
|
||||
function editSwitch(item) {
|
||||
if (editMode) {
|
||||
switch (editType) {
|
||||
case "song" :
|
||||
presentation.visible = false;
|
||||
videoEditor.visible = false;
|
||||
videoEditor.stop();
|
||||
songEditor.visible = true;
|
||||
songEditor.changeSong(item);
|
||||
break;
|
||||
case "video" :
|
||||
presentation.visible = false;
|
||||
songEditor.visible = false;
|
||||
videoEditor.visible = true;
|
||||
videoEditor.changeVideo(item);
|
||||
break;
|
||||
case "image" :
|
||||
mainPageArea.pop(Controls.StackView.Immediate);
|
||||
mainPageArea.push(imageEditorComp, Controls.StackView.Immediate);
|
||||
videoEditor.stop();
|
||||
break;
|
||||
default:
|
||||
videoEditor
|
||||
videoEditor.visible = false;
|
||||
videoEditor.stop();
|
||||
songEditor.visible = false;
|
||||
presentation.visible = true;
|
||||
editMode = false;
|
||||
}
|
||||
} else {
|
||||
videoEditor.visible = false;
|
||||
songEditor.visible = false;
|
||||
presentation.visible = true;
|
||||
editMode = false;
|
||||
videoEditor.visible = false;
|
||||
videoEditor.stop();
|
||||
songEditor.visible = false;
|
||||
presentation.visible = true;
|
||||
editMode = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,28 +219,4 @@ videoEditor
|
|||
else
|
||||
presentationWindow.close();
|
||||
}
|
||||
|
||||
function updateLyrics(lyrics) {
|
||||
songsqlmodel.updateLyrics(song, lyrics);
|
||||
}
|
||||
|
||||
function updateTitle(title) {
|
||||
songsqlmodel.updateTitle(song, title)
|
||||
}
|
||||
|
||||
function updateAuthor(author) {
|
||||
songsqlmodel.updateAuthor(song, author)
|
||||
}
|
||||
|
||||
function updateAudio(audio) {
|
||||
songsqlmodel.updateAudio(song, audio)
|
||||
}
|
||||
|
||||
function updateCcli(ccli) {
|
||||
songsqlmodel.updateCcli(song, ccli)
|
||||
}
|
||||
|
||||
function updateVerseOrder(vorder) {
|
||||
songsqlmodel.updateVerseOrder(song, vorder)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,10 +11,15 @@ import "./" as Presenter
|
|||
Item {
|
||||
id: root
|
||||
|
||||
property string imageBackground
|
||||
property string videoBackground
|
||||
|
||||
Presenter.Slide {
|
||||
id: representation
|
||||
anchors.fill: parent
|
||||
textSize: width / 15
|
||||
editMode: true
|
||||
imageSource: imageBackground
|
||||
videoSource: videoBackground
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,16 @@ import "./" as Presenter
|
|||
Item {
|
||||
id: root
|
||||
|
||||
property int songIndex
|
||||
property string songTitle
|
||||
property string songLyrics
|
||||
property string songAuthor
|
||||
property string songCcli
|
||||
property string songAudio
|
||||
property string songVorder
|
||||
property string songBackground
|
||||
property string songBackgroundType
|
||||
|
||||
GridLayout {
|
||||
id: mainLayout
|
||||
anchors.fill: parent
|
||||
|
@ -66,11 +76,11 @@ Item {
|
|||
text: "Background"
|
||||
icon.name: "fileopen"
|
||||
hoverEnabled: true
|
||||
onClicked: backgroundType.open()
|
||||
onClicked: backgroundTypePopup.open()
|
||||
}
|
||||
|
||||
Controls.Popup {
|
||||
id: backgroundType
|
||||
id: backgroundTypePopup
|
||||
x: backgroundButton.x
|
||||
y: backgroundButton.y + backgroundButton.height + 20
|
||||
modal: true
|
||||
|
@ -83,7 +93,7 @@ Item {
|
|||
border.color: Kirigami.Theme.activeBackgroundColor
|
||||
border.width: 2
|
||||
}
|
||||
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
|
||||
closePolicy: Controls.Popup.CloseOnEscape | Controls.Popup.CloseOnPressOutsideParent
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
Controls.ToolButton {
|
||||
|
@ -91,14 +101,14 @@ Item {
|
|||
Layout.fillWidth: true
|
||||
text: "Video"
|
||||
icon.name: "emblem-videos-symbolic"
|
||||
onClicked: videoFileDialog.open() & backgroundType.close()
|
||||
onClicked: videoFileDialog.open() & backgroundTypePopup.close()
|
||||
}
|
||||
Controls.ToolButton {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
text: "Image"
|
||||
icon.name: "folder-pictures-symbolic"
|
||||
onClicked: imageFileDialog.open() & backgroundType.close()
|
||||
onClicked: imageFileDialog.open() & backgroundTypePopup.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -196,15 +206,15 @@ Item {
|
|||
Controls.SplitView.preferredWidth: 700
|
||||
Controls.SplitView.minimumWidth: 300
|
||||
|
||||
Rectangle {
|
||||
id: slideBar
|
||||
color: Kirigami.Theme.highlightColor
|
||||
/* Rectangle { */
|
||||
/* id: slideBar */
|
||||
/* color: Kirigami.Theme.highlightColor */
|
||||
|
||||
Layout.preferredWidth: 500
|
||||
Layout.preferredHeight: songTitleField.height
|
||||
Layout.rightMargin: 20
|
||||
Layout.leftMargin: 20
|
||||
}
|
||||
/* Layout.preferredWidth: 500 */
|
||||
/* Layout.preferredHeight: songTitleField.height */
|
||||
/* Layout.rightMargin: 20 */
|
||||
/* Layout.leftMargin: 20 */
|
||||
/* } */
|
||||
|
||||
Presenter.SlideEditor {
|
||||
id: slideEditor
|
||||
|
@ -215,16 +225,98 @@ Item {
|
|||
Layout.rightMargin: 20
|
||||
Layout.leftMargin: 20
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: editorTimer
|
||||
interval: 1000
|
||||
repeat: true
|
||||
running: false
|
||||
onTriggered: updateLyrics(lyricsEditor.text)
|
||||
}
|
||||
Timer {
|
||||
id: editorTimer
|
||||
interval: 1000
|
||||
repeat: true
|
||||
running: false
|
||||
onTriggered: updateLyrics(lyricsEditor.text)
|
||||
|
||||
FileDialog {
|
||||
id: videoFileDialog
|
||||
title: "Please choose a background"
|
||||
folder: shortcuts.home
|
||||
selectMultiple: false
|
||||
nameFilters: ["Video files (*.mp4 *.mkv *.mov *.wmv *.avi *.MP4 *.MOV *.MKV)"]
|
||||
onAccepted: {
|
||||
updateBackground(videoFileDialog.fileUrls[0], "video");
|
||||
print("video background = " + videoFileDialog.fileUrls[0]);
|
||||
}
|
||||
onRejected: {
|
||||
print("Canceled")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FileDialog {
|
||||
id: imageFileDialog
|
||||
title: "Please choose a background"
|
||||
folder: shortcuts.home
|
||||
selectMultiple: false
|
||||
nameFilters: ["Image files (*.jpg *.jpeg *.png *.JPG *.JPEG *.PNG)"]
|
||||
onAccepted: {
|
||||
updateBackground(imageFileDialog.fileUrls[0], "image");
|
||||
print("image background = " + imageFileDialog.fileUrls[0]);
|
||||
}
|
||||
onRejected: {
|
||||
print("Canceled")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function changeSong(index) {
|
||||
const song = songsqlmodel.getSong(index);
|
||||
songIndex = index;
|
||||
songTitle = song[0];
|
||||
songLyrics = song[1];
|
||||
songAuthor = song[2];
|
||||
songCcli = song[3];
|
||||
songAudio = song[4];
|
||||
songVorder = song[5];
|
||||
songBackground = song[6];
|
||||
songBackgroundType = song[7];
|
||||
if (songBackgroundType == "image") {
|
||||
slideEditor.videoBackground = "";
|
||||
slideEditor.imageBackground = songBackground;
|
||||
} else {
|
||||
slideEditor.imageBackground = "";
|
||||
slideEditor.videoBackground = songBackground;
|
||||
}
|
||||
print(song);
|
||||
}
|
||||
|
||||
function updateLyrics(lyrics) {
|
||||
songsqlmodel.updateLyrics(songIndex, lyrics);
|
||||
}
|
||||
|
||||
function updateTitle(title) {
|
||||
songsqlmodel.updateTitle(songIndex, title)
|
||||
}
|
||||
|
||||
function updateAuthor(author) {
|
||||
songsqlmodel.updateAuthor(songIndex, author)
|
||||
}
|
||||
|
||||
function updateAudio(audio) {
|
||||
songsqlmodel.updateAudio(songIndex, audio)
|
||||
}
|
||||
|
||||
function updateCcli(ccli) {
|
||||
songsqlmodel.updateCcli(songIndex, ccli)
|
||||
}
|
||||
|
||||
function updateVerseOrder(vorder) {
|
||||
songsqlmodel.updateVerseOrder(songIndex, vorder)
|
||||
}
|
||||
|
||||
function updateBackground(background, backgroundType) {
|
||||
songsqlmodel.updateBackground(songIndex, background);
|
||||
songsqlmodel.updateBackgroundType(songIndex, backgroundType);
|
||||
print("changed background");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -230,13 +230,9 @@ Item {
|
|||
mpvLoadingTimer.restart();
|
||||
}
|
||||
|
||||
function prePop() {
|
||||
function stop() {
|
||||
print("stopping video");
|
||||
videoSlider.to = 0;
|
||||
/* videoSlider.position = 0; */
|
||||
/* videoSlider.onMoved = null; */
|
||||
videoPreview.quit();
|
||||
videoPreview.pause();
|
||||
print("quit mpv");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,8 @@ static void createTable()
|
|||
" 'ccli' TEXT,"
|
||||
" 'audio' TEXT,"
|
||||
" 'vorder' TEXT,"
|
||||
" 'background' TEXT,"
|
||||
" 'backgroundType' TEXT,"
|
||||
" PRIMARY KEY(id))")) {
|
||||
qFatal("Failed to query database: %s",
|
||||
qPrintable(query.lastError().text()));
|
||||
|
@ -36,11 +38,11 @@ static void createTable()
|
|||
qDebug() << query.lastQuery();
|
||||
qDebug() << "inserting into songs";
|
||||
|
||||
query.exec("INSERT INTO songs (title, lyrics, author, ccli, audio, vorder) VALUES ('10,000 Reasons', '10,000 reasons for my heart to sing', 'Matt Redman', '13470183', '', '')");
|
||||
query.exec("INSERT INTO songs (title, lyrics, author, ccli, audio, vorder, background, backgroundType) VALUES ('10,000 Reasons', '10,000 reasons for my heart to sing', 'Matt Redman', '13470183', '', '', '', '')");
|
||||
qDebug() << query.lastQuery();
|
||||
query.exec("INSERT INTO songs (title, lyrics, author, ccli, audio, vorder) VALUES ('River', 'Im going down to the river', 'Jordan Feliz', '13470183', '', '')");
|
||||
query.exec("INSERT INTO songs (title, lyrics, author, ccli, audio, vorder) VALUES ('Marvelous Light', 'Into marvelous "
|
||||
"light Im running', 'Chris Tomlin', '13470183', '', '')");
|
||||
query.exec("INSERT INTO songs (title, lyrics, author, ccli, audio, vorder, background, backgroundType) VALUES ('River', 'Im going down to the river', 'Jordan Feliz', '13470183', '', '', '', '')");
|
||||
query.exec("INSERT INTO songs (title, lyrics, author, ccli, audio, vorder, background, backgroundType) VALUES ('Marvelous Light', 'Into marvelous "
|
||||
"light Im running', 'Chris Tomlin', '13470183', '', '', '', '')");
|
||||
|
||||
query.exec("select * from songs");
|
||||
qDebug() << query.lastQuery();
|
||||
|
@ -78,6 +80,8 @@ QHash<int, QByteArray> SongSqlModel::roleNames() const
|
|||
names[Qt::UserRole + 4] = "ccli";
|
||||
names[Qt::UserRole + 5] = "audio";
|
||||
names[Qt::UserRole + 6] = "vorder";
|
||||
names[Qt::UserRole + 7] = "background";
|
||||
names[Qt::UserRole + 8] = "backgroundType";
|
||||
return names;
|
||||
}
|
||||
|
||||
|
@ -106,6 +110,27 @@ void SongSqlModel::deleteSong(const int &row) {
|
|||
submitAll();
|
||||
}
|
||||
|
||||
QVariantList SongSqlModel::getSong(const int &row) {
|
||||
QSqlRecord recordData = record(row);
|
||||
if (recordData.isEmpty()) {
|
||||
qDebug() << "this is not a song";
|
||||
QVariantList empty;
|
||||
return empty;
|
||||
}
|
||||
|
||||
QVariantList song;
|
||||
song.append(recordData.value("title"));
|
||||
song.append(recordData.value("lyrics"));
|
||||
song.append(recordData.value("author"));
|
||||
song.append(recordData.value("ccli"));
|
||||
song.append(recordData.value("audio"));
|
||||
song.append(recordData.value("vorder"));
|
||||
song.append(recordData.value("background"));
|
||||
song.append(recordData.value("backgroundType"));
|
||||
|
||||
return song;
|
||||
}
|
||||
|
||||
int SongSqlModel::id() const {
|
||||
return m_id;
|
||||
}
|
||||
|
@ -253,3 +278,47 @@ void SongSqlModel::updateVerseOrder(const int &row, const QString &vorder) {
|
|||
submitAll();
|
||||
emit vorderChanged();
|
||||
}
|
||||
|
||||
QString SongSqlModel::background() const { return m_background; }
|
||||
|
||||
void SongSqlModel::setBackground(const QString &background) {
|
||||
if (background == m_background)
|
||||
return;
|
||||
|
||||
m_background = background;
|
||||
|
||||
select();
|
||||
emit backgroundChanged();
|
||||
}
|
||||
|
||||
// This function is for updating the lyrics from outside the delegate
|
||||
void SongSqlModel::updateBackground(const int &row, const QString &background) {
|
||||
qDebug() << "Row is " << row;
|
||||
QSqlRecord rowdata = record(row);
|
||||
rowdata.setValue("background", background);
|
||||
setRecord(row, rowdata);
|
||||
submitAll();
|
||||
emit backgroundChanged();
|
||||
}
|
||||
|
||||
QString SongSqlModel::backgroundType() const { return m_backgroundType; }
|
||||
|
||||
void SongSqlModel::setBackgroundType(const QString &backgroundType) {
|
||||
if (backgroundType == m_backgroundType)
|
||||
return;
|
||||
|
||||
m_backgroundType = backgroundType;
|
||||
|
||||
select();
|
||||
emit backgroundTypeChanged();
|
||||
}
|
||||
|
||||
// This function is for updating the lyrics from outside the delegate
|
||||
void SongSqlModel::updateBackgroundType(const int &row, const QString &backgroundType) {
|
||||
qDebug() << "Row is " << row;
|
||||
QSqlRecord rowdata = record(row);
|
||||
rowdata.setValue("backgroundType", backgroundType);
|
||||
setRecord(row, rowdata);
|
||||
submitAll();
|
||||
emit backgroundTypeChanged();
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@ class SongSqlModel : public QSqlTableModel
|
|||
Q_PROPERTY(QString ccli READ ccli WRITE setCcli NOTIFY ccliChanged)
|
||||
Q_PROPERTY(QString audio READ audio WRITE setAudio NOTIFY audioChanged)
|
||||
Q_PROPERTY(QString vorder READ vorder WRITE setVerseOrder NOTIFY vorderChanged)
|
||||
Q_PROPERTY(QString background READ background WRITE setBackground NOTIFY backgroundChanged)
|
||||
Q_PROPERTY(QString backgroundType READ backgroundType WRITE setBackgroundType NOTIFY backgroundTypeChanged)
|
||||
QML_ELEMENT
|
||||
|
||||
public:
|
||||
|
@ -28,6 +30,8 @@ public:
|
|||
QString ccli() const;
|
||||
QString audio() const;
|
||||
QString vorder() const;
|
||||
QString background() const;
|
||||
QString backgroundType() const;
|
||||
|
||||
void setTitle(const QString &title);
|
||||
void setLyrics(const QString &lyrics);
|
||||
|
@ -35,6 +39,8 @@ public:
|
|||
void setCcli(const QString &ccli);
|
||||
void setAudio(const QString &audio);
|
||||
void setVerseOrder(const QString &vorder);
|
||||
void setBackground(const QString &background);
|
||||
void setBackgroundType(const QString &backgroundType);
|
||||
|
||||
Q_INVOKABLE void updateTitle(const int &row, const QString &title);
|
||||
Q_INVOKABLE void updateLyrics(const int &row, const QString &lyrics);
|
||||
|
@ -42,9 +48,12 @@ public:
|
|||
Q_INVOKABLE void updateCcli(const int &row, const QString &ccli);
|
||||
Q_INVOKABLE void updateAudio(const int &row, const QString &audio);
|
||||
Q_INVOKABLE void updateVerseOrder(const int &row, const QString &vorder);
|
||||
Q_INVOKABLE void updateBackground(const int &row, const QString &background);
|
||||
Q_INVOKABLE void updateBackgroundType(const int &row, const QString &backgroundType);
|
||||
|
||||
Q_INVOKABLE void newSong();
|
||||
Q_INVOKABLE void deleteSong(const int &row);
|
||||
Q_INVOKABLE QVariantList getSong(const int &row);
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
|
@ -56,6 +65,8 @@ signals:
|
|||
void ccliChanged();
|
||||
void audioChanged();
|
||||
void vorderChanged();
|
||||
void backgroundChanged();
|
||||
void backgroundTypeChanged();
|
||||
|
||||
private:
|
||||
int m_id;
|
||||
|
@ -65,6 +76,8 @@ private:
|
|||
QString m_ccli;
|
||||
QString m_audio;
|
||||
QString m_vorder;
|
||||
QString m_background;
|
||||
QString m_backgroundType;
|
||||
};
|
||||
|
||||
#endif //SONGSQLMODEL_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue