1
0

gui: mainwindow: Improve preview status reporting

Better represent the state of available previews.

Only add paths to ui->comboPreviewFiles once
Dieser Commit ist enthalten in:
Albert S. 2022-08-27 12:02:12 +02:00
Ursprung 47874b3706
Commit 11b070ed42

Datei anzeigen

@ -806,6 +806,7 @@ void MainWindow::handleSearchResults(const QVector<SearchResult> &results)
ui->comboPreviewFiles->clear(); ui->comboPreviewFiles->clear();
ui->comboPreviewFiles->addItem("All previews"); ui->comboPreviewFiles->addItem("All previews");
ui->comboPreviewFiles->setVisible(true); ui->comboPreviewFiles->setVisible(true);
ui->lblTotalPreviewPagesCount->setText("");
bool hasDeleted = false; bool hasDeleted = false;
QHash<QString, bool> seenMap; QHash<QString, bool> seenMap;
@ -816,7 +817,6 @@ void MainWindow::handleSearchResults(const QVector<SearchResult> &results)
if(!seenMap.contains(absPath)) if(!seenMap.contains(absPath))
{ {
seenMap[absPath] = true;
QString fileName = pathInfo.fileName(); QString fileName = pathInfo.fileName();
QTreeWidgetItem *item = new QTreeWidgetItem(ui->treeResultsList); QTreeWidgetItem *item = new QTreeWidgetItem(ui->treeResultsList);
@ -830,24 +830,26 @@ void MainWindow::handleSearchResults(const QVector<SearchResult> &results)
bool exists = pathInfo.exists(); bool exists = pathInfo.exists();
if(exists) if(exists)
{ {
if(!result.wasContentSearch) if(result.wasContentSearch)
{ {
continue;
}
if(!pathInfo.suffix().contains("htm")) // hack until we can preview them properly... if(!pathInfo.suffix().contains("htm")) // hack until we can preview them properly...
{ {
if(PreviewGenerator::get(pathInfo) != nullptr) if(PreviewGenerator::get(pathInfo) != nullptr)
{ {
this->previewableSearchResults.append(result); this->previewableSearchResults.append(result);
if(!seenMap.contains(result.fileData.absPath))
{
ui->comboPreviewFiles->addItem(result.fileData.absPath); ui->comboPreviewFiles->addItem(result.fileData.absPath);
} }
} }
} }
}
}
else else
{ {
hasDeleted = true; hasDeleted = true;
} }
seenMap[absPath] = true;
} }
ui->treeResultsList->resizeColumnToContents(0); ui->treeResultsList->resizeColumnToContents(0);
@ -863,6 +865,7 @@ void MainWindow::handleSearchResults(const QVector<SearchResult> &results)
} }
QString statusText = "Results: " + QString::number(results.size()) + " files"; QString statusText = "Results: " + QString::number(results.size()) + " files";
statusText += ", previewable: " + QString::number(this->previewableSearchResults.count());
if(hasDeleted) if(hasDeleted)
{ {
statusText += " WARNING: Some files are inaccessible. No preview available for those. Index may be out of sync"; statusText += " WARNING: Some files are inaccessible. No preview available for those. Index may be out of sync";