fixing empty files not loading the application
This commit is contained in:
parent
d97467ee63
commit
0086ed3d5a
5 changed files with 20 additions and 19 deletions
|
@ -27,16 +27,6 @@
|
||||||
|
|
||||||
ServiceItemModel::ServiceItemModel(QObject *parent)
|
ServiceItemModel::ServiceItemModel(QObject *parent)
|
||||||
: QAbstractListModel(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 {
|
int ServiceItemModel::rowCount(const QModelIndex &parent) const {
|
||||||
|
@ -718,7 +708,8 @@ bool ServiceItemModel::load(QUrl file) {
|
||||||
qDebug() << "File path is: " << file.toString();
|
qDebug() << "File path is: " << file.toString();
|
||||||
qDebug() << "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";
|
qDebug() << "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";
|
||||||
|
|
||||||
if (file.isEmpty() || !file.isValid())
|
QFileInfo loadInfo = QFileInfo(file.toLocalFile());
|
||||||
|
if (!loadInfo.exists())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
QString fileUrl = file.toString().right(file.toString().size() - 7);
|
QString fileUrl = file.toString().right(file.toString().size() - 7);
|
||||||
|
|
|
@ -493,10 +493,12 @@ bool SlideModel::select(int id) {
|
||||||
bool SlideModel::activate(int id) {
|
bool SlideModel::activate(int id) {
|
||||||
QModelIndex idx = index(id);
|
QModelIndex idx = index(id);
|
||||||
Slide *item = m_items[idx.row()];
|
Slide *item = m_items[idx.row()];
|
||||||
|
qDebug() << item->type();
|
||||||
|
|
||||||
for (int i = 0; i < m_items.length(); i++) {
|
for (int i = 0; i < m_items.length(); i++) {
|
||||||
QModelIndex idx = index(i);
|
QModelIndex idx = index(i);
|
||||||
Slide *itm = m_items[idx.row()];
|
Slide *itm = m_items[idx.row()];
|
||||||
|
qDebug() << i << m_items.length() << item->active() << itm->active();
|
||||||
if (itm->active()) {
|
if (itm->active()) {
|
||||||
itm->setActive(false);
|
itm->setActive(false);
|
||||||
qDebug() << "################";
|
qDebug() << "################";
|
||||||
|
@ -539,7 +541,7 @@ int SlideModel::findSlideIdFromServItm(int index) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlideModel::addItemFromService(const int &index, const ServiceItem &item) {
|
void SlideModel::addItemFromService(const int &index, const ServiceItem &item) {
|
||||||
|
|
|
@ -146,6 +146,8 @@ void SlideObject::changeSlide(QVariantMap item, int index)
|
||||||
|
|
||||||
setImageCount(item.value("imageCount").toInt());
|
setImageCount(item.value("imageCount").toInt());
|
||||||
setSlideIndex(item.value("slideIndex").toInt());
|
setSlideIndex(item.value("slideIndex").toInt());
|
||||||
|
qDebug() << "THIS IS THE INDEX OF THE SLIDE!";
|
||||||
|
qDebug() << index;
|
||||||
emit slideChanged(index);
|
emit slideChanged(index);
|
||||||
// m_slideSize = serviceItem.value("slideNumber").toInt();
|
// m_slideSize = serviceItem.value("slideNumber").toInt();
|
||||||
|
|
||||||
|
|
16
src/main.cpp
16
src/main.cpp
|
@ -147,10 +147,6 @@ int main(int argc, char *argv[])
|
||||||
SIGNAL(itemAdded(const int&, const ServiceItem&)),
|
SIGNAL(itemAdded(const int&, const ServiceItem&)),
|
||||||
slideModel.get(),
|
slideModel.get(),
|
||||||
SLOT(addItemFromService(const int&, const ServiceItem&)));
|
SLOT(addItemFromService(const int&, const ServiceItem&)));
|
||||||
QObject::connect(slideobject.get(),
|
|
||||||
SIGNAL(slideChanged(int)),
|
|
||||||
slideModel.get(),
|
|
||||||
SLOT(activate(int)));
|
|
||||||
QObject::connect(serviceItemModel.get(),
|
QObject::connect(serviceItemModel.get(),
|
||||||
SIGNAL(rowMoved(const int&, const int&, const ServiceItem&)),
|
SIGNAL(rowMoved(const int&, const int&, const ServiceItem&)),
|
||||||
slideModel.get(),
|
slideModel.get(),
|
||||||
|
@ -163,8 +159,18 @@ int main(int argc, char *argv[])
|
||||||
SIGNAL(allRemoved()),
|
SIGNAL(allRemoved()),
|
||||||
slideModel.get(),
|
slideModel.get(),
|
||||||
SLOT(clearAll()));
|
SLOT(clearAll()));
|
||||||
|
QObject::connect(slideobject.get(),
|
||||||
|
SIGNAL(slideChanged(int)),
|
||||||
|
slideModel.get(),
|
||||||
|
SLOT(activate(int)));
|
||||||
|
|
||||||
bool loading = serviceItemModel.get()->loadLastSaved();
|
if (!serviceItemModel.get()->loadLastSaved()) {
|
||||||
|
qDebug() << "Last saved file is missing or there isn't a last saved file.";
|
||||||
|
serviceItemModel.get()->addItem("Black", "image",
|
||||||
|
"qrc:/assets/black.jpg",
|
||||||
|
"image", QStringList(""),
|
||||||
|
"", "", 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
// apparently mpv needs this class set
|
// apparently mpv needs this class set
|
||||||
// let's register mpv as well
|
// let's register mpv as well
|
||||||
|
|
|
@ -146,12 +146,12 @@ Controls.Page {
|
||||||
currentSlide = slideId;
|
currentSlide = slideId;
|
||||||
const slide = SlideModel.getItem(slideId);
|
const slide = SlideModel.getItem(slideId);
|
||||||
console.log("index grabbed: " + index);
|
console.log("index grabbed: " + index);
|
||||||
console.log(item);
|
console.log(slideId);
|
||||||
|
console.log("Time to start changing");
|
||||||
|
|
||||||
/* presentation.stopVideo(); */
|
/* presentation.stopVideo(); */
|
||||||
/* pWindow.stopVideo(); */
|
/* pWindow.stopVideo(); */
|
||||||
/* presentation.itemType = item.type; */
|
/* presentation.itemType = item.type; */
|
||||||
console.log("Time to start changing");
|
|
||||||
|
|
||||||
ServiceItemModel.activate(index);
|
ServiceItemModel.activate(index);
|
||||||
SlideObject.changeSlide(slide, slideId);
|
SlideObject.changeSlide(slide, slideId);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue