making songs have a list of slides visible to assist in editing
This commit is contained in:
parent
ceefbebe23
commit
39fc19dff2
4 changed files with 78 additions and 26 deletions
|
@ -87,7 +87,7 @@ MpvRenderer::~MpvRenderer() {
|
||||||
if (mpv_gl)
|
if (mpv_gl)
|
||||||
mpv_render_context_free(mpv_gl);
|
mpv_render_context_free(mpv_gl);
|
||||||
|
|
||||||
mpv_terminate_destroy(obj->mpv);
|
// mpv_destroy(obj->mpv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MpvRenderer::render() {
|
void MpvRenderer::render() {
|
||||||
|
@ -242,7 +242,7 @@ MpvObject::MpvObject(QQuickItem *parent)
|
||||||
|
|
||||||
MpvObject::~MpvObject()
|
MpvObject::~MpvObject()
|
||||||
{
|
{
|
||||||
|
// quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
QQuickFramebufferObject::Renderer *MpvObject::createRenderer() const
|
QQuickFramebufferObject::Renderer *MpvObject::createRenderer() const
|
||||||
|
@ -340,6 +340,10 @@ void MpvObject::handle_mpv_event(mpv_event *event)
|
||||||
// See: https://github.com/mpv-player/mpv/blob/master/player/lua.c#L471
|
// See: https://github.com/mpv-player/mpv/blob/master/player/lua.c#L471
|
||||||
|
|
||||||
switch (event->event_id) {
|
switch (event->event_id) {
|
||||||
|
case MPV_EVENT_SHUTDOWN: {
|
||||||
|
mpv_destroy(mpv);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case MPV_EVENT_LOG_MESSAGE: {
|
case MPV_EVENT_LOG_MESSAGE: {
|
||||||
mpv_event_log_message *logData = (mpv_event_log_message *)event->data;
|
mpv_event_log_message *logData = (mpv_event_log_message *)event->data;
|
||||||
Q_EMIT logMessage(
|
Q_EMIT logMessage(
|
||||||
|
@ -487,7 +491,7 @@ void MpvObject::pause()
|
||||||
{
|
{
|
||||||
// qDebug() << "pause";
|
// qDebug() << "pause";
|
||||||
if (isPlaying()) {
|
if (isPlaying()) {
|
||||||
// qDebug() << "!isPlaying";
|
qDebug() << "!isPlaying";
|
||||||
set_paused(true);
|
set_paused(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,9 @@ Item {
|
||||||
property string itemType
|
property string itemType
|
||||||
property bool preview: false
|
property bool preview: false
|
||||||
|
|
||||||
|
implicitWidth: 1920
|
||||||
|
implicitHeight: 1080
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: basePrColor
|
id: basePrColor
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -59,12 +62,12 @@ Item {
|
||||||
id: playArea
|
id: playArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
enabled: editMode
|
enabled: editMode
|
||||||
onPressed: mpv.loadFile(videoSource.toString());
|
onPressed: mpv.playPause();
|
||||||
cursorShape: preview ? Qt.ArrowCursor : Qt.BlankCursor
|
cursorShape: preview ? Qt.ArrowCursor : Qt.BlankCursor
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.ProgressBar {
|
Controls.ProgressBar {
|
||||||
anchors.centerIn: parent
|
anchors.top: parent.bottom
|
||||||
visible: editMode
|
visible: editMode
|
||||||
width: parent.width - 400
|
width: parent.width - 400
|
||||||
value: mpv.position
|
value: mpv.position
|
||||||
|
@ -74,13 +77,24 @@ Item {
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: mpvLoadingTimer
|
id: mpvLoadingTimer
|
||||||
interval: 2
|
interval: 100
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
|
/* showPassiveNotification("YIPPEEE!") */
|
||||||
mpv.loadFile(videoSource.toString());
|
mpv.loadFile(videoSource.toString());
|
||||||
|
if (preview) {
|
||||||
|
print("WHY AREN'T YOU PASUING!");
|
||||||
|
pauseTimer.restart();
|
||||||
|
}
|
||||||
blackTimer.restart();
|
blackTimer.restart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: pauseTimer
|
||||||
|
interval: 200
|
||||||
|
onTriggered: mpv.pause()
|
||||||
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: blackTimer
|
id: blackTimer
|
||||||
interval: 400
|
interval: 400
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import QtQuick 2.13
|
import QtQuick 2.15
|
||||||
import QtQuick.Dialogs 1.0
|
import QtQuick.Dialogs 1.0
|
||||||
import QtQuick.Controls 2.15 as Controls
|
import QtQuick.Controls 2.15 as Controls
|
||||||
import QtQuick.Window 2.13
|
import QtQuick.Window 2.13
|
||||||
|
@ -18,40 +18,65 @@ Item {
|
||||||
property string font
|
property string font
|
||||||
property real fontSize
|
property real fontSize
|
||||||
|
|
||||||
Presenter.Slide {
|
property ListModel songs: songModel
|
||||||
id: representation
|
|
||||||
|
ListView {
|
||||||
|
id: slideList
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
editMode: true
|
model: songModel
|
||||||
imageSource: imageBackground
|
clip: true
|
||||||
videoSource: videoBackground
|
cacheBuffer: 900
|
||||||
hTextAlignment: root.hTextAlignment
|
reuseItems: true
|
||||||
vTextAlignment: root.vTextAlignment
|
spacing: Kirigami.Units.gridUnit
|
||||||
chosenFont: font
|
flickDeceleration: 4000
|
||||||
textSize: fontSize
|
/* boundsMovement: Flickable.StopAtBounds */
|
||||||
preview: true
|
synchronousDrag: true
|
||||||
|
delegate: Presenter.Slide {
|
||||||
|
id: representation
|
||||||
|
editMode: true
|
||||||
|
imageSource: root.imageBackground
|
||||||
|
videoSource: root.videoBackground
|
||||||
|
hTextAlignment: root.hTextAlignment
|
||||||
|
vTextAlignment: root.vTextAlignment
|
||||||
|
chosenFont: root.font
|
||||||
|
textSize: root.fontSize
|
||||||
|
preview: true
|
||||||
|
text: verse
|
||||||
|
implicitWidth: slideList.width
|
||||||
|
implicitHeight: width * 9 / 16
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadVideo() {
|
ListModel {
|
||||||
representation.loadVideo();
|
id: songModel
|
||||||
representation.pauseVideo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function appendVerse(verse) {
|
||||||
|
print(verse);
|
||||||
|
songModel.append({"verse": verse})
|
||||||
|
}
|
||||||
|
|
||||||
|
/* function loadVideo() { */
|
||||||
|
/* representation.loadVideo(); */
|
||||||
|
/* } */
|
||||||
|
|
||||||
function updateHAlignment(alignment) {
|
function updateHAlignment(alignment) {
|
||||||
switch (alignment) {
|
switch (alignment) {
|
||||||
case "left" :
|
case "left" :
|
||||||
representation.horizontalAlignment = Text.AlignLeft;
|
root.hTextAlignment = Text.AlignLeft;
|
||||||
break;
|
break;
|
||||||
case "center" :
|
case "center" :
|
||||||
representation.horizontalAlignment = Text.AlignHCenter;
|
root.hTextAlignment = Text.AlignHCenter;
|
||||||
break;
|
break;
|
||||||
case "right" :
|
case "right" :
|
||||||
representation.horizontalAlignment = Text.AlignRight;
|
root.hTextAlignment = Text.AlignRight;
|
||||||
break;
|
break;
|
||||||
case "justify" :
|
case "justify" :
|
||||||
representation.horizontalAlignment = Text.AlignJustify;
|
root.hTextAlignment = Text.AlignJustify;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,8 +222,9 @@ Item {
|
||||||
id: slideEditor
|
id: slideEditor
|
||||||
Layout.preferredWidth: 500
|
Layout.preferredWidth: 500
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: slideEditor.width / 16 * 9
|
Layout.fillHeight: true
|
||||||
Layout.bottomMargin: 30
|
Layout.bottomMargin: 30
|
||||||
|
Layout.topMargin: 30
|
||||||
Layout.rightMargin: 20
|
Layout.rightMargin: 20
|
||||||
Layout.leftMargin: 20
|
Layout.leftMargin: 20
|
||||||
}
|
}
|
||||||
|
@ -284,13 +285,14 @@ Item {
|
||||||
} else {
|
} else {
|
||||||
slideEditor.imageBackground = "";
|
slideEditor.imageBackground = "";
|
||||||
slideEditor.videoBackground = song.background;
|
slideEditor.videoBackground = song.background;
|
||||||
slideEditor.loadVideo();
|
/* slideEditor.loadVideo(); */
|
||||||
}
|
}
|
||||||
|
|
||||||
changeSlideHAlignment(song.horizontalTextAlignment);
|
changeSlideHAlignment(song.horizontalTextAlignment);
|
||||||
changeSlideVAlignment(song.verticalTextAlignment);
|
changeSlideVAlignment(song.verticalTextAlignment);
|
||||||
changeSlideFont(song.font, true);
|
changeSlideFont(song.font, true);
|
||||||
changeSlideFontSize(song.fontSize, true)
|
changeSlideFontSize(song.fontSize, true)
|
||||||
|
changeSlideText(songIndex);
|
||||||
print(s.title);
|
print(s.title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,4 +398,11 @@ Item {
|
||||||
fontSizeBox.value = fontSize;
|
fontSizeBox.value = fontSize;
|
||||||
slideEditor.fontSize = fontSize;
|
slideEditor.fontSize = fontSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changeSlideText(id) {
|
||||||
|
const verses = songsqlmodel.getLyricList(id);
|
||||||
|
print("Here are the verses: " + verses);
|
||||||
|
slideEditor.songs.clear()
|
||||||
|
verses.forEach(slideEditor.appendVerse);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue