added basic video looping backend
This commit is contained in:
parent
b75eb449c0
commit
0d483979cc
3 changed files with 43 additions and 35 deletions
|
@ -45,7 +45,8 @@ Item {
|
||||||
|
|
||||||
text: "Repeat"
|
text: "Repeat"
|
||||||
padding: 10
|
padding: 10
|
||||||
onToggled: showPassiveNotification("BOOM!")
|
checked: video.loop
|
||||||
|
onToggled: updateLoop(!video.loop)
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.ToolSeparator {}
|
Controls.ToolSeparator {}
|
||||||
|
@ -247,6 +248,13 @@ Item {
|
||||||
showPassiveNotification(video.title);
|
showPassiveNotification(video.title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateLoop(value) {
|
||||||
|
/* changeStartTime(value, false); */
|
||||||
|
videosqlmodel.updateLoop(video.id, value);
|
||||||
|
video.loop = value;
|
||||||
|
showPassiveNotification("Loop changed to: " + video.loop);
|
||||||
|
}
|
||||||
|
|
||||||
function changeTitle(text, updateBox) {
|
function changeTitle(text, updateBox) {
|
||||||
if (updateBox)
|
if (updateBox)
|
||||||
videoTitleField.text = text;
|
videoTitleField.text = text;
|
||||||
|
|
|
@ -247,39 +247,39 @@ void VideoSqlModel::updateEndTime(const int &row, const int &endTime) {
|
||||||
emit endTimeChanged();
|
emit endTimeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
// bool VideoSqlModel::loop() const {
|
bool VideoSqlModel::loop() const {
|
||||||
// return m_loop;
|
return m_loop;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// void VideoSqlModel::setloop(const bool &loop) {
|
void VideoSqlModel::setLoop(const bool &loop) {
|
||||||
// if (loop == m_loop)
|
if (loop == m_loop)
|
||||||
// return;
|
return;
|
||||||
|
|
||||||
// m_loop = loop;
|
m_loop = loop;
|
||||||
|
|
||||||
// select();
|
select();
|
||||||
// emit loopChanged();
|
emit loopChanged();
|
||||||
// }
|
}
|
||||||
|
|
||||||
// // This function is for updating looping from outside the delegate
|
// This function is for updating looping from outside the delegate
|
||||||
// void VideoSqlModel::updateloop(const int &row, const bool &loop) {
|
void VideoSqlModel::updateLoop(const int &row, const bool &loop) {
|
||||||
// qDebug() << "Row is " << row;
|
qDebug() << "Row is " << row;
|
||||||
// QSqlQuery query("select id from videos");
|
QSqlQuery query("select id from videos");
|
||||||
// QList<int> ids;
|
QList<int> ids;
|
||||||
// while (query.next()) {
|
while (query.next()) {
|
||||||
// ids.append(query.value(0).toInt());
|
ids.append(query.value(0).toInt());
|
||||||
// // qDebug() << ids;
|
// qDebug() << ids;
|
||||||
// }
|
}
|
||||||
// int id = ids.indexOf(row,0);
|
int id = ids.indexOf(row,0);
|
||||||
|
|
||||||
// QSqlRecord rowdata = record(id);
|
QSqlRecord rowdata = record(id);
|
||||||
// qDebug() << rowdata;
|
qDebug() << rowdata;
|
||||||
// rowdata.setValue("loop", loop);
|
rowdata.setValue("loop", loop);
|
||||||
// setRecord(id, rowdata);
|
setRecord(id, rowdata);
|
||||||
// qDebug() << rowdata;
|
qDebug() << rowdata;
|
||||||
// submitAll();
|
submitAll();
|
||||||
// emit loopChanged();
|
emit loopChanged();
|
||||||
// }
|
}
|
||||||
|
|
||||||
QVariantMap 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;
|
||||||
|
|
|
@ -16,7 +16,7 @@ class VideoSqlModel : public QSqlTableModel
|
||||||
Q_PROPERTY(QUrl filePath READ filePath WRITE setFilePath NOTIFY filePathChanged)
|
Q_PROPERTY(QUrl filePath READ filePath WRITE setFilePath NOTIFY filePathChanged)
|
||||||
Q_PROPERTY(int startTime READ startTime WRITE setStartTime NOTIFY startTimeChanged)
|
Q_PROPERTY(int startTime READ startTime WRITE setStartTime NOTIFY startTimeChanged)
|
||||||
Q_PROPERTY(int endTime READ endTime WRITE setEndTime NOTIFY endTimeChanged)
|
Q_PROPERTY(int endTime READ endTime WRITE setEndTime NOTIFY endTimeChanged)
|
||||||
// Q_PROPERTY(bool loop READ loop WRITE setLoop NOTIFY loopChanged)
|
Q_PROPERTY(bool loop READ loop WRITE setLoop NOTIFY loopChanged)
|
||||||
QML_ELEMENT
|
QML_ELEMENT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -27,19 +27,19 @@ public:
|
||||||
QUrl filePath() const;
|
QUrl filePath() const;
|
||||||
int startTime() const;
|
int startTime() const;
|
||||||
int endTime() const;
|
int endTime() const;
|
||||||
// bool loop() const;
|
bool loop() const;
|
||||||
|
|
||||||
void setTitle(const QString &title);
|
void setTitle(const QString &title);
|
||||||
void setFilePath(const QUrl &filePath);
|
void setFilePath(const QUrl &filePath);
|
||||||
void setStartTime(const int &startTime);
|
void setStartTime(const int &startTime);
|
||||||
void setEndTime(const int &endTime);
|
void setEndTime(const int &endTime);
|
||||||
// void setLoop(const bool &loop);
|
void setLoop(const bool &loop);
|
||||||
|
|
||||||
Q_INVOKABLE void updateTitle(const int &row, const QString &title);
|
Q_INVOKABLE void updateTitle(const int &row, const QString &title);
|
||||||
Q_INVOKABLE void updateFilePath(const int &row, const QUrl &filePath);
|
Q_INVOKABLE void updateFilePath(const int &row, const QUrl &filePath);
|
||||||
Q_INVOKABLE void updateStartTime(const int &row, const int &startTime);
|
Q_INVOKABLE void updateStartTime(const int &row, const int &startTime);
|
||||||
Q_INVOKABLE void updateEndTime(const int &row, const int &endTime);
|
Q_INVOKABLE void updateEndTime(const int &row, const int &endTime);
|
||||||
// Q_INVOKABLE void updateLoop(const int &row, const bool &loop);
|
Q_INVOKABLE void updateLoop(const int &row, const bool &loop);
|
||||||
|
|
||||||
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);
|
||||||
|
@ -51,7 +51,7 @@ public:
|
||||||
signals:
|
signals:
|
||||||
void titleChanged();
|
void titleChanged();
|
||||||
void filePathChanged();
|
void filePathChanged();
|
||||||
// void loopChanged();
|
void loopChanged();
|
||||||
void startTimeChanged();
|
void startTimeChanged();
|
||||||
void endTimeChanged();
|
void endTimeChanged();
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ private:
|
||||||
QUrl m_filePath;
|
QUrl m_filePath;
|
||||||
int m_startTime;
|
int m_startTime;
|
||||||
int m_endTime;
|
int m_endTime;
|
||||||
// bool m_loop;
|
bool m_loop;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //VIDEOSQLMODEL_H
|
#endif //VIDEOSQLMODEL_H
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue