From 423f3e8d02f1648b30b436e9fb599fc2544daca4 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Wed, 1 May 2024 18:51:53 +0200 Subject: [PATCH] Trivial nano-cleanup --- src/contentmanager.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/contentmanager.cpp b/src/contentmanager.cpp index d905002..047b6a8 100644 --- a/src/contentmanager.cpp +++ b/src/contentmanager.cpp @@ -157,8 +157,7 @@ void ContentManager::restoreDownloads() { for ( const auto& bookId : mp_library->getBookIds() ) { const kiwix::Book& book = mp_library->getBookById(bookId); - const QString downloadId = QString::fromStdString(book.getDownloadId()); - if ( ! downloadId.isEmpty() ) { + if ( ! book.getDownloadId().empty() ) { const auto newDownload = std::make_shared(); newDownload->paused = true; m_downloads.set(bookId, newDownload); @@ -195,7 +194,6 @@ void ContentManager::updateModel() const auto bookIds = getBookIds(); BookInfoList bookList; QStringList keys = {"title", "tags", "date", "id", "size", "description", "favicon"}; - QIcon bookIcon; for (auto bookId : bookIds) { auto mp = getBookInfos(bookId, keys); bookList.append(mp); @@ -418,9 +416,8 @@ ContentManager::BookInfo ContentManager::getBookInfos(QString id, const QStringL void ContentManager::openBookWithIndex(const QModelIndex &index) { try { - QString bookId; auto bookNode = static_cast(index.internalPointer()); - bookId = bookNode->getBookId(); + const QString bookId = bookNode->getBookId(); // throws std::out_of_range if the book isn't available in local library const kiwix::Book& book = mp_library->getBookById(bookId); if ( !book.getDownloadId().empty() ) @@ -444,7 +441,6 @@ void ContentManager::openBook(const QString &id) mp_library->removeBookFromLibraryById(id); tabBar->setCurrentIndex(0); emit(booksChanged()); - return; } }