Allow cover loading for metadata dialog from the tableview

This commit is contained in:
BasioMeusPuga
2018-03-04 21:38:29 +05:30
parent f91ae8d863
commit 4d40972026
2 changed files with 12 additions and 2 deletions

3
TODO
View File

@@ -25,7 +25,7 @@ TODO
✓ Information dialog widget
Allow editing of database data through the UI + for Bookmarks
Set focus to newly added file
Change selection rectangle position
Change focus rectangle dimensions
Reading:
✓ Drop down for TOC
✓ Override the keypress event of the textedit
@@ -50,7 +50,6 @@ TODO
✓ Deletion
Set context menu for definitions and the like
Search document using QTextCursor?
Cache multiple images
Comic view keyboard shortcuts
Comic view modes
Continuous paging

View File

@@ -993,6 +993,17 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
edit_book = selected_indexes[0]
metadata = self.lib_ref.view_model.data(
edit_book, QtCore.Qt.UserRole + 3)
is_cover_loaded = self.lib_ref.view_model.data(
edit_book, QtCore.Qt.UserRole + 8)
# Loads a cover in case culling is enabled and the table view is visible
if not is_cover_loaded:
book_hash = self.lib_ref.view_model.data(
edit_book, QtCore.Qt.UserRole + 6)
book_item = self.lib_ref.view_model.item(edit_book.row())
book_cover = database.DatabaseFunctions(
self.database_path).fetch_covers_only([book_hash])[0][1]
self.cover_loader(book_item, book_cover)
cover = self.lib_ref.view_model.item(edit_book.row()).icon()
title = metadata['title']