gave the slide a black to put in front of loading videos

This commit is contained in:
Chris Cochrun 2022-04-04 06:43:05 -05:00
parent 62e1b07ec1
commit e52d44f937
10 changed files with 136 additions and 12 deletions

View file

@ -1,7 +1,15 @@
#+TITLE: Todo List #+TITLE: Todo List
* Inbox * Inbox
** TODO Build out a slide preview system so we can see each slide in the song or image slideshow
[[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Presenter.SlideEditor {]]
** TODO Make sure the video gets changed in a proper manner to not have left over video showing from previous items ** TODO Make sure the video gets changed in a proper manner to not have left over video showing from previous items
[[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::currentServiceItem++;]] [[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::currentServiceItem++;]]
- [X] Build a basic system that changes to black first and then switches to the video
- [ ] Build out a loading system that will load the next video if it needs to and then the switch can be instant.
The second option is the best, but requires a lot more work. I have the first already working so I'll come back to this once I have more of an idea of how to do it.
** TODO Fix possible bug in arrangingItems in draghandler ** TODO Fix possible bug in arrangingItems in draghandler
[[file:~/dev/church-presenter/src/qml/presenter/DragHandle.qml::function arrangeItem() {]] [[file:~/dev/church-presenter/src/qml/presenter/DragHandle.qml::function arrangeItem() {]]
** TODO [#A] Make Presentation Window follow the presenter component ** TODO [#A] Make Presentation Window follow the presenter component
@ -10,9 +18,11 @@
** TODO Make toolbar functional for songeditor ** TODO Make toolbar functional for songeditor
[[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Controls.ToolBar {]] [[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Controls.ToolBar {]]
- [ ] Will likely need to modify the model to persist the effects stored to the songs
** TODO Finish toolbar ** TODO Finish toolbar
[[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::Controls.ToolBar {]] [[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::Controls.ToolBar {]]
** TODO Find a way to maths the textsize ** TODO Find a way to maths the textsize
[[file:~/dev/church-presenter/src/qml/presenter/Slide.qml::property real textSize: 50]] [[file:~/dev/church-presenter/src/qml/presenter/Slide.qml::property real textSize: 50]]

BIN
src/assets/black.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -109,7 +109,9 @@ Controls.Page {
function changeServiceItem(index) { function changeServiceItem(index) {
const item = serviceItemModel.getItem(index); const item = serviceItemModel.getItem(index);
presentation.stopVideo()
presentation.itemType = item.type; presentation.itemType = item.type;
print("Time to start changing");
if (item.backgroundType === "image") { if (item.backgroundType === "image") {
presentation.vidbackground = ""; presentation.vidbackground = "";

View file

@ -16,7 +16,7 @@ Item {
property url imagebackground property url imagebackground
property url vidbackground property url vidbackground
Component.onCompleted: nextSlideText() Component.onCompleted: nextSlideAction()
GridLayout { GridLayout {
anchors.fill: parent anchors.fill: parent
@ -122,6 +122,10 @@ Item {
previewSlide.loadVideo(); previewSlide.loadVideo();
} }
function stopVideo() {
previewSlide.stopVideo()
}
function nextSlideAction() { function nextSlideAction() {
if (itemType === "song") { if (itemType === "song") {
if (textIndex === 0) { if (textIndex === 0) {
@ -135,13 +139,17 @@ Item {
} else { } else {
print("Next slide time"); print("Next slide time");
textIndex = 0; textIndex = 0;
previewSlide.text = ""; clearText();
nextSlide(); nextSlide();
} }
} else if (itemType === "video") } else if (itemType === "video") {
clearText();
nextSlide(); nextSlide();
else if (itemType === "image") }
else if (itemType === "image") {
clearText();
nextSlide(); nextSlide();
}
} }
function nextSlide() { function nextSlide() {
@ -149,4 +157,8 @@ Item {
changeServiceItem(currentServiceItem); changeServiceItem(currentServiceItem);
print(slideItem); print(slideItem);
} }
function clearText() {
previewSlide.text = "";
}
} }

View file

@ -72,8 +72,26 @@ Item {
Timer { Timer {
id: mpvLoadingTimer id: mpvLoadingTimer
interval: 100 interval: 2
onTriggered: mpv.loadFile(videoSource.toString()) onTriggered: {
mpv.loadFile(videoSource.toString());
blackTimer.restart();
}
}
Timer {
id: blackTimer
interval: 400
onTriggered: {
black.visible = false;
}
}
Rectangle {
id: black
color: "Black"
anchors.fill: parent
visible: false
} }
Image { Image {
@ -89,7 +107,7 @@ Item {
FastBlur { FastBlur {
id: imageBlue id: imageBlue
anchors.fill: parent anchors.fill: parent
source: imageSource == "" ? mpv : backgroundImage source: imageSource === "" ? mpv : backgroundImage
radius: blurRadius radius: blurRadius
Controls.Label { Controls.Label {
@ -126,6 +144,8 @@ Item {
} }
function stopVideo() { function stopVideo() {
mpv.stop() mpv.stop();
black.visible = true;
showPassiveNotification("Black is: " + black.visible);
} }
} }

View file

@ -13,6 +13,7 @@ Item {
property string imageBackground property string imageBackground
property string videoBackground property string videoBackground
property string textAlignment
Presenter.Slide { Presenter.Slide {
id: representation id: representation
@ -23,4 +24,23 @@ Item {
videoSource: videoBackground videoSource: videoBackground
preview: true preview: true
} }
Component.onCompleted: updateHAlignment(textAlignment)
function updateHAlignment(alignment) {
switch (alignment) {
case "left" :
representation.horizontalAlignment = Text.AlignLeft;
break;
case "center" :
representation.horizontalAlignment = Text.AlignHCenter;
break;
case "right" :
representation.horizontalAlignment = Text.AlignRight;
break;
case "justify" :
representation.horizontalAlignment = Text.AlignJustify;
break;
}
}
} }

View file

@ -18,6 +18,7 @@ Item {
property string songVorder property string songVorder
property string songBackground property string songBackground
property string songBackgroundType property string songBackgroundType
property string songHAlignment
GridLayout { GridLayout {
id: mainLayout id: mainLayout
@ -50,18 +51,28 @@ Item {
model: ["Left", "Center", "Right", "Justify"] model: ["Left", "Center", "Right", "Justify"]
implicitWidth: 100 implicitWidth: 100
hoverEnabled: true hoverEnabled: true
onCurrentTextChanged: updateTextAlignment(currentText.toLowerCase());
}
Controls.ComboBox {
model: ["Top", "Center", "Bottom"]
implicitWidth: 100
hoverEnabled: true
onCurrentTextChanged: print(currentText.toLowerCase());
} }
Controls.ToolButton { Controls.ToolButton {
text: "B" text: "B"
hoverEnabled: true hoverEnabled: true
visible: false
} }
Controls.ToolButton { Controls.ToolButton {
text: "I" text: "I"
hoverEnabled: true hoverEnabled: true
visible: false
} }
Controls.ToolButton { Controls.ToolButton {
text: "U" text: "U"
hoverEnabled: true hoverEnabled: true
visible: false
} }
Controls.ToolSeparator {} Controls.ToolSeparator {}
Item { Layout.fillWidth: true } Item { Layout.fillWidth: true }
@ -215,6 +226,7 @@ Item {
Layout.bottomMargin: 30 Layout.bottomMargin: 30
Layout.rightMargin: 20 Layout.rightMargin: 20
Layout.leftMargin: 20 Layout.leftMargin: 20
textAlignment: songHAlignment
} }
} }
} }
@ -273,6 +285,7 @@ Item {
songVorder = song[5]; songVorder = song[5];
songBackground = song[6]; songBackground = song[6];
songBackgroundType = song[7]; songBackgroundType = song[7];
songHAlignment = song[8];
if (songBackgroundType == "image") { if (songBackgroundType == "image") {
slideEditor.videoBackground = ""; slideEditor.videoBackground = "";
slideEditor.imageBackground = songBackground; slideEditor.imageBackground = songBackground;
@ -313,4 +326,8 @@ Item {
songsqlmodel.updateBackgroundType(songIndex, backgroundType); songsqlmodel.updateBackgroundType(songIndex, backgroundType);
print("changed background"); print("changed background");
} }
function updateTextAlignment(textAlignment) {
songsqlmodel.updateTextAlignment(songIndex, textAlignment)
}
} }

View file

@ -17,5 +17,6 @@
<file>qml/presenter/Presentation.qml</file> <file>qml/presenter/Presentation.qml</file>
<file>qml/presenter/Settings.qml</file> <file>qml/presenter/Settings.qml</file>
<file>assets/parallel.jpg</file> <file>assets/parallel.jpg</file>
<file>assets/black.jpg</file>
</qresource> </qresource>
</RCC> </RCC>

View file

@ -34,6 +34,7 @@ static void createTable()
" 'vorder' TEXT," " 'vorder' TEXT,"
" 'background' TEXT," " 'background' TEXT,"
" 'backgroundType' TEXT," " 'backgroundType' TEXT,"
" 'textAlignment' TEXT,"
" PRIMARY KEY(id))")) { " PRIMARY KEY(id))")) {
qFatal("Failed to query database: %s", qFatal("Failed to query database: %s",
qPrintable(query.lastError().text())); qPrintable(query.lastError().text()));
@ -41,11 +42,18 @@ static void createTable()
qDebug() << query.lastQuery(); qDebug() << query.lastQuery();
qDebug() << "inserting into songs"; qDebug() << "inserting into songs";
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', '', '', '', '')"); 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', '', '', '', '', 'center')");
qDebug() << query.lastQuery(); qDebug() << query.lastQuery();
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, "
query.exec("INSERT INTO songs (title, lyrics, author, ccli, audio, vorder, background, backgroundType) VALUES ('Marvelous Light', 'Into marvelous " "background, backgroundType) VALUES ('River', 'Im going down to "
"light Im running', 'Chris Tomlin', '13470183', '', '', '', '')"); "the river', 'Jordan Feliz', '13470183', '', '', '', '', 'center')");
query.exec(
"INSERT INTO songs (title, lyrics, author, ccli, audio, vorder, "
"background, backgroundType) VALUES ('Marvelous Light', 'Into marvelous "
"light Im running', 'Chris Tomlin', '13470183', '', '', '', '', 'center')");
query.exec("select * from songs"); query.exec("select * from songs");
qDebug() << query.lastQuery(); qDebug() << query.lastQuery();
@ -85,6 +93,7 @@ QHash<int, QByteArray> SongSqlModel::roleNames() const
names[Qt::UserRole + 6] = "vorder"; names[Qt::UserRole + 6] = "vorder";
names[Qt::UserRole + 7] = "background"; names[Qt::UserRole + 7] = "background";
names[Qt::UserRole + 8] = "backgroundType"; names[Qt::UserRole + 8] = "backgroundType";
names[Qt::UserRole + 9] = "textAlignment";
return names; return names;
} }
@ -130,6 +139,7 @@ QVariantList SongSqlModel::getSong(const int &row) {
song.append(recordData.value("vorder")); song.append(recordData.value("vorder"));
song.append(recordData.value("background")); song.append(recordData.value("background"));
song.append(recordData.value("backgroundType")); song.append(recordData.value("backgroundType"));
song.append(recordData.value("textAlignment"));
return song; return song;
} }
@ -394,3 +404,29 @@ void SongSqlModel::updateBackgroundType(const int &row, const QString &backgroun
submitAll(); submitAll();
emit backgroundTypeChanged(); emit backgroundTypeChanged();
} }
QString SongSqlModel::textAlignment() const {
return m_textAlignment;
}
void SongSqlModel::setTextAlignment(const QString &textAlignment) {
if (textAlignment == m_textAlignment)
return;
m_textAlignment = textAlignment;
select();
emit textAlignmentChanged();
}
// This function is for updating the lyrics from outside the delegate
void SongSqlModel::updateTextAlignment(const int &row, const QString &textAlignment) {
qDebug() << "Row is " << row;
QSqlRecord rowdata = record(row);
qDebug() << rowdata;
rowdata.setValue("textAlignment", textAlignment);
setRecord(row, rowdata);
qDebug() << rowdata;
submitAll();
emit textAlignmentChanged();
}

View file

@ -18,6 +18,7 @@ class SongSqlModel : public QSqlTableModel
Q_PROPERTY(QString vorder READ vorder WRITE setVerseOrder NOTIFY vorderChanged) Q_PROPERTY(QString vorder READ vorder WRITE setVerseOrder NOTIFY vorderChanged)
Q_PROPERTY(QString background READ background WRITE setBackground NOTIFY backgroundChanged) Q_PROPERTY(QString background READ background WRITE setBackground NOTIFY backgroundChanged)
Q_PROPERTY(QString backgroundType READ backgroundType WRITE setBackgroundType NOTIFY backgroundTypeChanged) Q_PROPERTY(QString backgroundType READ backgroundType WRITE setBackgroundType NOTIFY backgroundTypeChanged)
Q_PROPERTY(QString textAlignment READ textAlignment WRITE setTextAlignment NOTIFY textAlignmentChanged)
QML_ELEMENT QML_ELEMENT
public: public:
@ -32,6 +33,7 @@ public:
QString vorder() const; QString vorder() const;
QString background() const; QString background() const;
QString backgroundType() const; QString backgroundType() const;
QString textAlignment() const;
void setTitle(const QString &title); void setTitle(const QString &title);
void setLyrics(const QString &lyrics); void setLyrics(const QString &lyrics);
@ -41,6 +43,7 @@ public:
void setVerseOrder(const QString &vorder); void setVerseOrder(const QString &vorder);
void setBackground(const QString &background); void setBackground(const QString &background);
void setBackgroundType(const QString &backgroundType); void setBackgroundType(const QString &backgroundType);
void setTextAlignment(const QString &background);
Q_INVOKABLE void updateTitle(const int &row, const QString &title); Q_INVOKABLE void updateTitle(const int &row, const QString &title);
Q_INVOKABLE void updateLyrics(const int &row, const QString &lyrics); Q_INVOKABLE void updateLyrics(const int &row, const QString &lyrics);
@ -50,6 +53,7 @@ public:
Q_INVOKABLE void updateVerseOrder(const int &row, const QString &vorder); Q_INVOKABLE void updateVerseOrder(const int &row, const QString &vorder);
Q_INVOKABLE void updateBackground(const int &row, const QString &background); Q_INVOKABLE void updateBackground(const int &row, const QString &background);
Q_INVOKABLE void updateBackgroundType(const int &row, const QString &backgroundType); Q_INVOKABLE void updateBackgroundType(const int &row, const QString &backgroundType);
Q_INVOKABLE void updateTextAlignment(const int &row, const QString &textAlignment);
Q_INVOKABLE void newSong(); Q_INVOKABLE void newSong();
Q_INVOKABLE void deleteSong(const int &row); Q_INVOKABLE void deleteSong(const int &row);
@ -68,6 +72,7 @@ signals:
void vorderChanged(); void vorderChanged();
void backgroundChanged(); void backgroundChanged();
void backgroundTypeChanged(); void backgroundTypeChanged();
void textAlignmentChanged();
private: private:
int m_id; int m_id;
@ -79,6 +84,7 @@ private:
QString m_vorder; QString m_vorder;
QString m_background; QString m_background;
QString m_backgroundType; QString m_backgroundType;
QString m_textAlignment;
}; };
#endif //SONGSQLMODEL_H #endif //SONGSQLMODEL_H