diff --git a/YACReaderLibrary/db/treemodel.cpp b/YACReaderLibrary/db/treemodel.cpp index a55009bb..d403eba8 100644 --- a/YACReaderLibrary/db/treemodel.cpp +++ b/YACReaderLibrary/db/treemodel.cpp @@ -255,7 +255,9 @@ void TreeModel::setupModelData(QSqlQuery &sqlquery, TreeItem *parent) item->id = record.value("id").toULongLong(); //la inserción de hijos se hace de forma ordenada - items.value(record.value("parentId").toULongLong())->appendChild(item); + TreeItem * parent = items.value(record.value("parentId").toULongLong()); + if(parent !=0) + parent->appendChild(item); //se añade el item al map, de forma que se pueda encontrar como padre en siguientes iteraciones items.insert(item->id,item); } diff --git a/YACReaderLibrary/library_creator.cpp b/YACReaderLibrary/library_creator.cpp index 76a563dd..8ee77109 100644 --- a/YACReaderLibrary/library_creator.cpp +++ b/YACReaderLibrary/library_creator.cpp @@ -427,6 +427,12 @@ ThumbnailCreator::ThumbnailCreator(QString fileSource, QString target="", int co void ThumbnailCreator::create() { QFileInfo fi(_fileSource); + if(!fi.exists()) //TODO: error file not found. + { + _cover.load(":/images/notCover.png"); + return; + } + if(fi.suffix().compare("pdf",Qt::CaseInsensitive) == 0) { Poppler::Document * pdfComic = Poppler::Document::load(_fileSource); diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index 5ecacd10..bd2ccda3 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -1229,6 +1229,12 @@ void LibraryWindow::removeLibrary() { deleteCurrentLibrary(); } + + if(libraries.size()==0) + { + disableAllActions(); + showNoLibrariesWidget(); + } } void LibraryWindow::renameLibrary() @@ -1478,17 +1484,20 @@ void LibraryWindow::closeEvent ( QCloseEvent * event ) void LibraryWindow::showNoLibrariesWidget() { + disableAllActions(); mainWidget->setCurrentIndex(1); } void LibraryWindow::showRootWidget() { + enableActions(); libraryToolBar->setDisabled(false); mainWidget->setCurrentIndex(0); } void LibraryWindow::showImportingWidget() { + disableAllActions(); importWidget->clear(); libraryToolBar->setDisabled(true); mainWidget->setCurrentIndex(2); diff --git a/images/notCover.png b/images/notCover.png index 669dca68..bbd7936b 100644 Binary files a/images/notCover.png and b/images/notCover.png differ