Better nesting & indentation

This commit is contained in:
Veloman Yunkan 2024-05-02 17:51:04 +02:00 committed by Kelson
parent 9a754715f7
commit b7fa28b811

View File

@ -251,23 +251,21 @@ void ContentManagerDelegate::handleLastColumnClicked(const QModelIndex& index, Q
ContentManager& contentMgr = *KiwixApp::instance()->getContentManager(); ContentManager& contentMgr = *KiwixApp::instance()->getContentManager();
if (const auto downloadState = node->getDownloadState()) { if (const auto downloadState = node->getDownloadState()) {
if (downloadState->paused) { if ( !downloadState->paused ) {
if (clickX < (x + w/2)) {
contentMgr.cancelBook(id);
} else {
contentMgr.resumeBook(id, index);
}
} else {
contentMgr.pauseBook(id, index); contentMgr.pauseBook(id, index);
} else if (clickX < (x + w/2)) {
contentMgr.cancelBook(id);
} else {
contentMgr.resumeBook(id, index);
} }
} else { } else {
try { try {
const auto book = KiwixApp::instance()->getLibrary()->getBookById(id); const auto book = KiwixApp::instance()->getLibrary()->getBookById(id);
contentMgr.openBook(id); contentMgr.openBook(id);
} catch (std::out_of_range& e) { } catch (std::out_of_range& e) {
contentMgr.downloadBook(id, index); contentMgr.downloadBook(id, index);
} }
} }
} }
QSize ContentManagerDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const QSize ContentManagerDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const