a working multi delete in libraries

This commit is contained in:
Chris Cochrun 2023-03-05 06:51:47 -06:00
parent 8eeb3b5151
commit 6c33e52ea3
10 changed files with 51 additions and 14 deletions

View file

@ -235,3 +235,12 @@ void ImageProxyModel::deleteImage(const int &row) {
auto model = qobject_cast<ImageSqlModel *>(sourceModel());
model->deleteImage(row);
}
void ImageProxyModel::deleteImages(const QVector<int> &rows) {
auto model = qobject_cast<ImageSqlModel *>(sourceModel());
qDebug() << "DELETING!!!!!!!!!!!!!!!!!!!!!!!" << rows;
for (int i = rows.size() - 1; i >= 0; i--) {
qDebug() << "deleting" << rows.at(i);
model->deleteImage(rows.at(i));
}
}

View file

@ -62,6 +62,7 @@ public:
public slots:
Q_INVOKABLE QVariantMap getImage(const int &row);
Q_INVOKABLE void deleteImage(const int &row);
Q_INVOKABLE void deleteImages(const QVector<int> &rows);
private:
ImageSqlModel *m_imageModel;

View file

@ -270,3 +270,12 @@ void PresentationProxyModel::deletePresentation(const int &row) {
auto model = qobject_cast<PresentationSqlModel *>(sourceModel());
model->deletePresentation(row);
}
void PresentationProxyModel::deletePresentations(const QVector<int> &rows) {
auto model = qobject_cast<PresentationSqlModel *>(sourceModel());
qDebug() << "DELETING!!!!!!!!!!!!!!!!!!!!!!!" << rows;
for (int i = rows.size() - 1; i >= 0; i--) {
qDebug() << "deleting" << rows.at(i);
model->deletePresentation(rows.at(i));
}
}

View file

@ -69,6 +69,7 @@ public:
public slots:
Q_INVOKABLE QVariantMap getPresentation(const int &row);
Q_INVOKABLE void deletePresentation(const int &row);
Q_INVOKABLE void deletePresentations(const QVector<int> &row);
private:
PresentationSqlModel *m_presentationModel;

View file

@ -760,3 +760,13 @@ void SongProxyModel::deleteSong(const int &row) {
auto model = qobject_cast<SongSqlModel *>(sourceModel());
model->deleteSong(row);
}
void SongProxyModel::deleteSongs(const QVector<int> &rows) {
auto model = qobject_cast<SongSqlModel *>(sourceModel());
qDebug() << "DELETING!!!!!!!!!!!!!!!!!!!!!!!" << rows;
for (int i = rows.size() - 1; i >= 0; i--) {
qDebug() << "deleting" << rows.at(i);
model->deleteSong(rows.at(i));
}
}

View file

@ -131,6 +131,7 @@ public:
public slots:
Q_INVOKABLE QVariantMap getSong(const int &row);
Q_INVOKABLE void deleteSong(const int &row);
Q_INVOKABLE void deleteSongs(const QVector<int> &rows);
Q_INVOKABLE QStringList getLyricList(const int &row);
// Q_INVOKABLE void select(int row);
// Q_INVOKABLE void selectSongs(int row);

View file

@ -351,3 +351,12 @@ void VideoProxyModel::deleteVideo(const int &row) {
auto model = qobject_cast<VideoSqlModel *>(sourceModel());
model->deleteVideo(mapToSource(index(row,0)).row());
}
void VideoProxyModel::deleteVideos(const QVector<int> &rows) {
auto model = qobject_cast<VideoSqlModel *>(sourceModel());
qDebug() << "DELETING!!!!!!!!!!!!!!!!!!!!!!!" << rows;
for (int i = rows.size() - 1; i >= 0; i--) {
qDebug() << "deleting" << rows.at(i);
model->deleteVideo(rows.at(i));
}
}

View file

@ -80,6 +80,7 @@ public:
public slots:
Q_INVOKABLE QVariantMap getVideo(const int &row);
Q_INVOKABLE void deleteVideo(const int &row);
Q_INVOKABLE void deleteVideos(const QVector<int> &row);
private:
VideoSqlModel *m_videoModel;