making future proof refactor of image and video get system
This commit is contained in:
parent
8d07c7355d
commit
f1378cc1ff
8 changed files with 72 additions and 44 deletions
21
TODO.org
21
TODO.org
|
@ -4,8 +4,8 @@
|
||||||
:END:
|
:END:
|
||||||
|
|
||||||
* Inbox
|
* Inbox
|
||||||
** TODO images and videos need a better get system
|
** TODO Check for edge cases in inputing wrong vorder and lyrics
|
||||||
[[file:~/dev/church-presenter/src/videosqlmodel.cpp::QVariantList VideoSqlModel::getVideo(const int &row) {]]
|
[[file:~/dev/church-presenter/TODO.org::*Fix broken append when importing River song][Fix broken append when importing River song]]
|
||||||
|
|
||||||
** TODO Images stored in sql need to have aspect saved and applied dynamically here
|
** TODO Images stored in sql need to have aspect saved and applied dynamically here
|
||||||
[[file:~/dev/church-presenter/src/qml/presenter/Slide.qml::fillMode: Image.PreserveAspectCrop]]
|
[[file:~/dev/church-presenter/src/qml/presenter/Slide.qml::fillMode: Image.PreserveAspectCrop]]
|
||||||
|
@ -13,9 +13,13 @@
|
||||||
** TODO Build out a slide preview system so we can see each slide in the song or image slideshow
|
** 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 {]]
|
[[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Presenter.SlideEditor {]]
|
||||||
|
|
||||||
** TODO Fix possible bug in arrangingItems in draghandler
|
** TODO Fix possible bug in arrangingItems in draghandler [1/3] [33%]
|
||||||
[[file:~/dev/church-presenter/src/qml/presenter/DragHandle.qml::function arrangeItem() {]]
|
[[file:~/dev/church-presenter/src/qml/presenter/DragHandle.qml::function arrangeItem() {]]
|
||||||
|
|
||||||
|
- [X] Basic fixed dnd
|
||||||
|
- [ ] Allow for a less buggy interaction
|
||||||
|
- [ ] Need to check for edge cases
|
||||||
|
|
||||||
** TODO [#A] Make Presentation Window follow the presenter component
|
** TODO [#A] Make Presentation Window follow the presenter component
|
||||||
[[file:~/dev/church-presenter/src/qml/presenter/MainWindow.qml::Presenter.Slide {]]
|
[[file:~/dev/church-presenter/src/qml/presenter/MainWindow.qml::Presenter.Slide {]]
|
||||||
|
|
||||||
|
@ -30,9 +34,6 @@
|
||||||
** 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]]
|
||||||
|
|
||||||
** TODO Fix broken append when importing River song
|
|
||||||
[[file:~/dev/church-presenter/src/qml/presenter/LeftDock.qml::function appendItem(name, type, background, backgroundType, text, itemID) {]]
|
|
||||||
|
|
||||||
** TODO Create a nextslide function to be used after the end of the list of slides
|
** TODO Create a nextslide function to be used after the end of the list of slides
|
||||||
[[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::function nextSlide() {]]
|
[[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::function nextSlide() {]]
|
||||||
|
|
||||||
|
@ -46,6 +47,14 @@
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
|
** DONE images and videos need a better get system
|
||||||
|
[[file:~/dev/church-presenter/src/videosqlmodel.cpp::QVariantList VideoSqlModel::getVideo(const int &row) {]]
|
||||||
|
|
||||||
|
** DONE Fix broken append when importing River song
|
||||||
|
[[file:~/dev/church-presenter/src/qml/presenter/LeftDock.qml::function appendItem(name, type, background, backgroundType, text, itemID) {]]
|
||||||
|
|
||||||
|
This was due to the song not having a vorder. Need to protect from edge cases of the user inputing the formatted text that doesn't fit what's expected in code.
|
||||||
|
|
||||||
** DONE Need to make ListModel capable of bringing in a string list [2/2] [100%]
|
** DONE Need to make ListModel capable of bringing in a string list [2/2] [100%]
|
||||||
- [X] Create a Model
|
- [X] Create a Model
|
||||||
- [X] Create a class that we'll make a list of in the model
|
- [X] Create a class that we'll make a list of in the model
|
||||||
|
|
|
@ -157,13 +157,28 @@ void ImageSqlModel::updateFilePath(const int &row, const QUrl &filePath) {
|
||||||
emit filePathChanged();
|
emit filePathChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl ImageSqlModel::getImage(const int &row) {
|
QVariantMap ImageSqlModel::getImage(const int &row) {
|
||||||
qDebug() << "Row we are getting is " << row;
|
// qDebug() << "Row we are getting is " << row;
|
||||||
QUrl image;
|
// QUrl image;
|
||||||
QSqlRecord rec = record(row);
|
// QSqlRecord rec = record(row);
|
||||||
qDebug() << rec.value("filePath").toUrl();
|
// qDebug() << rec.value("filePath").toUrl();
|
||||||
// image.append(rec.value("title"));
|
// // image.append(rec.value("title"));
|
||||||
// image.append(rec.value("filePath"));
|
// // image.append(rec.value("filePath"));
|
||||||
image = rec.value("filePath").toUrl();
|
// image = rec.value("filePath").toUrl();
|
||||||
return image;
|
// return image;
|
||||||
|
|
||||||
|
QVariantMap data;
|
||||||
|
const QModelIndex idx = this->index(row,0);
|
||||||
|
// qDebug() << idx;
|
||||||
|
if( !idx.isValid() )
|
||||||
|
return data;
|
||||||
|
const QHash<int,QByteArray> rn = roleNames();
|
||||||
|
// qDebug() << rn;
|
||||||
|
QHashIterator<int,QByteArray> it(rn);
|
||||||
|
while (it.hasNext()) {
|
||||||
|
it.next();
|
||||||
|
qDebug() << it.key() << ":" << it.value();
|
||||||
|
data[it.value()] = idx.data(it.key());
|
||||||
|
}
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE void newImage(const QUrl &filePath);
|
Q_INVOKABLE void newImage(const QUrl &filePath);
|
||||||
Q_INVOKABLE void deleteImage(const int &row);
|
Q_INVOKABLE void deleteImage(const int &row);
|
||||||
Q_INVOKABLE QUrl getImage(const int &row);
|
Q_INVOKABLE QVariantMap getImage(const int &row);
|
||||||
|
|
||||||
QVariant data(const QModelIndex &index, int role) const override;
|
QVariant data(const QModelIndex &index, int role) const override;
|
||||||
QHash<int, QByteArray> roleNames() const override;
|
QHash<int, QByteArray> roleNames() const override;
|
||||||
|
|
|
@ -43,18 +43,6 @@ Item {
|
||||||
implicitWidth: 100
|
implicitWidth: 100
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
}
|
}
|
||||||
Controls.ToolButton {
|
|
||||||
text: "B"
|
|
||||||
hoverEnabled: true
|
|
||||||
}
|
|
||||||
Controls.ToolButton {
|
|
||||||
text: "I"
|
|
||||||
hoverEnabled: true
|
|
||||||
}
|
|
||||||
Controls.ToolButton {
|
|
||||||
text: "U"
|
|
||||||
hoverEnabled: true
|
|
||||||
}
|
|
||||||
Controls.ToolSeparator {}
|
Controls.ToolSeparator {}
|
||||||
Item { Layout.fillWidth: true }
|
Item { Layout.fillWidth: true }
|
||||||
Controls.ToolSeparator {}
|
Controls.ToolSeparator {}
|
||||||
|
@ -66,7 +54,7 @@ Item {
|
||||||
}
|
}
|
||||||
Controls.ToolButton {
|
Controls.ToolButton {
|
||||||
id: backgroundButton
|
id: backgroundButton
|
||||||
text: "Background"
|
text: "Select Image"
|
||||||
icon.name: "fileopen"
|
icon.name: "fileopen"
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onClicked: backgroundType.open()
|
onClicked: backgroundType.open()
|
||||||
|
@ -175,7 +163,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeImage(image) {
|
function changeImage(image) {
|
||||||
root.image = image;
|
root.image = image.filePath;
|
||||||
print(image.toString());
|
print(image.filePath.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -820,7 +820,7 @@ Item {
|
||||||
videoLibraryList.currentIndex = videosqlmodel.rowCount();
|
videoLibraryList.currentIndex = videosqlmodel.rowCount();
|
||||||
print(videosqlmodel.getVideo(videoLibraryList.currentIndex));
|
print(videosqlmodel.getVideo(videoLibraryList.currentIndex));
|
||||||
const video = videosqlmodel.getVideo(videoLibraryList.currentIndex);
|
const video = videosqlmodel.getVideo(videoLibraryList.currentIndex);
|
||||||
showPassiveNotification("newest video: " + video);
|
showPassiveNotification("newest video: " + video.title);
|
||||||
if (!editMode)
|
if (!editMode)
|
||||||
editMode = true;
|
editMode = true;
|
||||||
editSwitch("video", video);
|
editSwitch("video", video);
|
||||||
|
|
|
@ -138,7 +138,7 @@ Item {
|
||||||
Layout.rightMargin: 20
|
Layout.rightMargin: 20
|
||||||
|
|
||||||
placeholderText: "Song Title..."
|
placeholderText: "Song Title..."
|
||||||
text: video[0]
|
text: video.title
|
||||||
padding: 10
|
padding: 10
|
||||||
/* onEditingFinished: updateTitle(text); */
|
/* onEditingFinished: updateTitle(text); */
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ Item {
|
||||||
Component.onCompleted: mpvLoadingTimer.start()
|
Component.onCompleted: mpvLoadingTimer.start()
|
||||||
onPositionChanged: videoSlider.value = position
|
onPositionChanged: videoSlider.value = position
|
||||||
onFileLoaded: {
|
onFileLoaded: {
|
||||||
showPassiveNotification(video[0] + " has been loaded");
|
showPassiveNotification(video.title + " has been loaded");
|
||||||
videoPreview.pause();
|
videoPreview.pause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ Item {
|
||||||
id: mpvLoadingTimer
|
id: mpvLoadingTimer
|
||||||
interval: 100
|
interval: 100
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
videoPreview.loadFile(video[1].toString());
|
videoPreview.loadFile(video.filePath.toString());
|
||||||
/* showPassiveNotification(video[0]); */
|
/* showPassiveNotification(video[0]); */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,12 +156,28 @@ void VideoSqlModel::updateFilePath(const int &row, const QUrl &filePath) {
|
||||||
emit filePathChanged();
|
emit filePathChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantList VideoSqlModel::getVideo(const int &row) {
|
QVariantMap VideoSqlModel::getVideo(const int &row) {
|
||||||
qDebug() << "Row we are getting is " << row;
|
// qDebug() << "Row we are getting is " << row;
|
||||||
QVariantList video;
|
// QVariantList video;
|
||||||
QSqlRecord rec = record(row);
|
// QSqlRecord rec = record(row);
|
||||||
qDebug() << rec.value("title");
|
// qDebug() << rec.value("title");
|
||||||
video.append(rec.value("title"));
|
// video.append(rec.value("title"));
|
||||||
video.append(rec.value("filePath"));
|
// video.append(rec.value("filePath"));
|
||||||
return video;
|
// return video;
|
||||||
|
|
||||||
|
QVariantMap data;
|
||||||
|
const QModelIndex idx = this->index(row,0);
|
||||||
|
// qDebug() << idx;
|
||||||
|
if( !idx.isValid() )
|
||||||
|
return data;
|
||||||
|
const QHash<int,QByteArray> rn = roleNames();
|
||||||
|
// qDebug() << rn;
|
||||||
|
QHashIterator<int,QByteArray> it(rn);
|
||||||
|
while (it.hasNext()) {
|
||||||
|
it.next();
|
||||||
|
qDebug() << it.key() << ":" << it.value();
|
||||||
|
data[it.value()] = idx.data(it.key());
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE void newVideo(const QUrl &filePath);
|
Q_INVOKABLE void newVideo(const QUrl &filePath);
|
||||||
Q_INVOKABLE void deleteVideo(const int &row);
|
Q_INVOKABLE void deleteVideo(const int &row);
|
||||||
Q_INVOKABLE QVariantList getVideo(const int &row);
|
Q_INVOKABLE QVariantMap getVideo(const int &row);
|
||||||
|
|
||||||
QVariant data(const QModelIndex &index, int role) const override;
|
QVariant data(const QModelIndex &index, int role) const override;
|
||||||
QHash<int, QByteArray> roleNames() const override;
|
QHash<int, QByteArray> roleNames() const override;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue