Skip to content

Commit

Permalink
Add '~' symbol when we are guessing the image count (issue #1280)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bionus committed Jun 9, 2018
1 parent da83815 commit 00163d5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gui/src/tabs/search-tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,8 +790,10 @@ void searchTab::setPageLabelText(QLabel *txt, Page *page, const QList<QSharedPoi
}
else
{
QString pageCountStr = pageCount > 0 ? (page->pagesCount(false) == -1 ? "~" : "") + QString::number(pageCount) : "?";
QString imageCountStr = imageCount > 0 ? (page->imagesCount(false) == -1 ? "~" : "") + QString::number(imageCount) : "?";
QString pageLabel = firstPage != lastPage ? QString("%1-%2").arg(firstPage).arg(lastPage) : QString::number(lastPage);
txt->setText("<a href=\""+page->url().toString().toHtmlEscaped()+"\">"+page->site()->name()+"</a> - "+tr("Page %1 of %2 (%3 of %4)").arg(pageLabel, pageCount > 0 ? QString::number(pageCount) : "?").arg(totalCount).arg(imageCount > 0 ? QString::number(imageCount) : "?"));
txt->setText("<a href=\""+page->url().toString().toHtmlEscaped()+"\">"+page->site()->name()+"</a> - "+tr("Page %1 of %2 (%3 of %4)").arg(pageLabel, pageCountStr).arg(totalCount).arg(imageCountStr));
}

/*if (page->search().join(" ") != m_search->toPlainText() && m_settings->value("showtagwarning", true).toBool())
Expand Down
6 changes: 6 additions & 0 deletions lib/src/models/page-api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ int PageApi::imagesCount(bool guess) const
if (m_imagesCount < 0 && guess && m_pagesCount >= 0)
return m_pagesCount * perPage;

if (!m_imagesCountSafe && !guess)
return -1;

return m_imagesCount;
}
bool PageApi::isPageCountSure() const { return m_pagesCountSafe; }
Expand All @@ -315,6 +318,9 @@ int PageApi::pagesCount(bool guess) const
if (m_pagesCount < 0 && guess && m_imagesCount >= 0)
return qCeil(static_cast<float>(m_imagesCount) / perPage);

if (!m_pagesCountSafe && !guess)
return -1;

return m_pagesCount;
}

Expand Down

0 comments on commit 00163d5

Please sign in to comment.