fixing empty files not loading the application

This commit is contained in:
Chris Cochrun 2023-02-20 11:21:04 -06:00
parent d97467ee63
commit 0086ed3d5a
5 changed files with 20 additions and 19 deletions

View file

@ -27,16 +27,6 @@
ServiceItemModel::ServiceItemModel(QObject *parent)
: QAbstractListModel(parent) {
addItem(new ServiceItem("10,000 Reasons", "song",
"file:/home/chris/nextcloud/tfc/openlp/CMG - Nature King 21.jpg",
"image", QStringList("Yip Yip"),
"file:/home/chris/nextcloud/tfc/openlp/music/Eden-Phil Wickham [lyrics].mp3"));
addItem(new ServiceItem("Marvelous Light", "song",
"file:/home/chris/nextcloud/tfc/openlp/Fire Embers_Loop.mp4",
"video", QStringList("Hallelujah!")));
addItem(new ServiceItem("BP Text", "video",
"file:/home/chris/nextcloud/tfc/openlp/videos/test.mp4",
"video", QStringList()));
}
int ServiceItemModel::rowCount(const QModelIndex &parent) const {
@ -718,7 +708,8 @@ bool ServiceItemModel::load(QUrl file) {
qDebug() << "File path is: " << file.toString();
qDebug() << "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";
if (file.isEmpty() || !file.isValid())
QFileInfo loadInfo = QFileInfo(file.toLocalFile());
if (!loadInfo.exists())
return false;
QString fileUrl = file.toString().right(file.toString().size() - 7);

View file

@ -493,10 +493,12 @@ bool SlideModel::select(int id) {
bool SlideModel::activate(int id) {
QModelIndex idx = index(id);
Slide *item = m_items[idx.row()];
qDebug() << item->type();
for (int i = 0; i < m_items.length(); i++) {
QModelIndex idx = index(i);
Slide *itm = m_items[idx.row()];
qDebug() << i << m_items.length() << item->active() << itm->active();
if (itm->active()) {
itm->setActive(false);
qDebug() << "################";
@ -539,7 +541,7 @@ int SlideModel::findSlideIdFromServItm(int index) {
return i;
}
}
return -1;
return 0;
}
void SlideModel::addItemFromService(const int &index, const ServiceItem &item) {

View file

@ -146,6 +146,8 @@ void SlideObject::changeSlide(QVariantMap item, int index)
setImageCount(item.value("imageCount").toInt());
setSlideIndex(item.value("slideIndex").toInt());
qDebug() << "THIS IS THE INDEX OF THE SLIDE!";
qDebug() << index;
emit slideChanged(index);
// m_slideSize = serviceItem.value("slideNumber").toInt();