adding some more todos and refactoring getSong so it's more future proof
This commit is contained in:
parent
e52d44f937
commit
deb620a2eb
6 changed files with 89 additions and 55 deletions
|
@ -47,10 +47,12 @@ Item {
|
|||
enableAudio: !preview
|
||||
Component.onCompleted: mpvLoadingTimer.start()
|
||||
onFileLoaded: {
|
||||
showPassiveNotification(videoSource + " has been loaded");
|
||||
/* showPassiveNotification(videoSource + " has been loaded"); */
|
||||
if (itemType == "song")
|
||||
mpv.setProperty("loop", "inf");
|
||||
showPassiveNotification(mpv.getProperty("loop"));
|
||||
else
|
||||
mpv.setProperty("loop", "no");
|
||||
/* showPassiveNotification(mpv.getProperty("loop")); */
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
|
@ -148,4 +150,8 @@ Item {
|
|||
black.visible = true;
|
||||
showPassiveNotification("Black is: " + black.visible);
|
||||
}
|
||||
|
||||
function pauseVideo() {
|
||||
mpv.pause();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,11 @@ Item {
|
|||
|
||||
Component.onCompleted: updateHAlignment(textAlignment)
|
||||
|
||||
function loadVideo() {
|
||||
representation.loadVideo();
|
||||
representation.pause();
|
||||
}
|
||||
|
||||
function updateHAlignment(alignment) {
|
||||
switch (alignment) {
|
||||
case "left" :
|
||||
|
|
|
@ -277,21 +277,22 @@ Item {
|
|||
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];
|
||||
songHAlignment = song[8];
|
||||
songTitle = song.title;
|
||||
songLyrics = song.lyrics;
|
||||
songAuthor = song.author;
|
||||
songCcli = song.ccli;
|
||||
songAudio = song.audio;
|
||||
songVorder = song.vorder;
|
||||
songBackground = song.background;
|
||||
songBackgroundType = song.backgroundType;
|
||||
songHAlignment = song.textAlignment;
|
||||
if (songBackgroundType == "image") {
|
||||
slideEditor.videoBackground = "";
|
||||
slideEditor.imageBackground = songBackground;
|
||||
} else {
|
||||
slideEditor.imageBackground = "";
|
||||
slideEditor.videoBackground = songBackground;
|
||||
slideEditor.loadVideo();
|
||||
}
|
||||
print(song);
|
||||
}
|
||||
|
|
|
@ -122,26 +122,41 @@ 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;
|
||||
QVariantMap 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"));
|
||||
// song.append(recordData.value("textAlignment"));
|
||||
|
||||
// return song;
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
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"));
|
||||
song.append(recordData.value("textAlignment"));
|
||||
|
||||
return song;
|
||||
return data;
|
||||
}
|
||||
|
||||
QStringList SongSqlModel::getLyricList(const int &row) {
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
|
||||
Q_INVOKABLE void newSong();
|
||||
Q_INVOKABLE void deleteSong(const int &row);
|
||||
Q_INVOKABLE QVariantList getSong(const int &row);
|
||||
Q_INVOKABLE QVariantMap getSong(const int &row);
|
||||
Q_INVOKABLE QStringList getLyricList(const int &row);
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue