Jämför commits

...

3 Incheckningar

Upphovsman SHA1 Meddelande Datum
8ba4ee5847 gui: Disable settingsTab while Indexer is running 2022-06-13 22:53:41 +02:00
451c79088a shared/gui: Don't consider non-content search results for previews
Not entirely ideal, since we may want to search for 'cake', and look at
a preview for 'cake.txt' even if there is no 'cake' inside.

But this will do for now
2022-06-13 22:46:14 +02:00
1a39118470 shared: LooqsQuery: has*Search(): Mark methods const 2022-06-13 22:43:23 +02:00
5 ändrade filer med 14 tillägg och 4 borttagningar

Visa fil

@ -249,6 +249,7 @@ void MainWindow::startIndexing()
ui->previewsTab->setEnabled(false);
ui->resultsTab->setEnabled(false);
ui->settingsTab->setEnabled(false);
ui->txtPathScanAdd->setEnabled(false);
ui->txtSearch->setEnabled(false);
ui->previewProcessBar->setValue(0);
@ -285,6 +286,7 @@ void MainWindow::finishIndexing()
ui->btnStartIndexing->setText("Start indexing");
ui->previewsTab->setEnabled(true);
ui->resultsTab->setEnabled(true);
ui->settingsTab->setEnabled(true);
ui->txtPathScanAdd->setEnabled(true);
ui->txtSearch->setEnabled(true);
}
@ -489,6 +491,11 @@ void MainWindow::handleSearchResults(const QVector<SearchResult> &results)
bool exists = pathInfo.exists();
if(exists)
{
if(!result.wasContentSearch)
{
continue;
}
if(!pathInfo.suffix().contains("htm")) // hack until we can preview them properly...
{
if(PreviewGenerator::get(pathInfo) != nullptr)

Visa fil

@ -23,12 +23,12 @@ QueryType LooqsQuery::getQueryType()
return static_cast<QueryType>(tokensMask & COMBINED);
}
bool LooqsQuery::hasContentSearch()
bool LooqsQuery::hasContentSearch() const
{
return (this->getTokensMask() & FILTER_CONTENT) == FILTER_CONTENT;
}
bool LooqsQuery::hasPathSearch()
bool LooqsQuery::hasPathSearch() const
{
return (this->getTokensMask() & FILTER_PATH) == FILTER_PATH;
}

Visa fil

@ -61,8 +61,8 @@ class LooqsQuery
{
this->limit = limit;
}
bool hasContentSearch();
bool hasPathSearch();
bool hasContentSearch() const;
bool hasPathSearch() const;
void addSortCondition(SortCondition sc);
static bool checkParanthesis(QString query);

Visa fil

@ -7,6 +7,7 @@ class SearchResult
public:
FileData fileData;
QVector<unsigned int> pages;
bool wasContentSearch = false;
};
#endif // SEARCHRESULT_H

Visa fil

@ -213,6 +213,7 @@ QVector<SearchResult> SqliteSearch::search(const LooqsQuery &query)
throw LooqsGeneralException("SQL Error: " + dbQuery.lastError().text());
}
bool contentSearch = query.hasContentSearch();
while(dbQuery.next())
{
SearchResult result;
@ -229,6 +230,7 @@ QVector<SearchResult> SqliteSearch::search(const LooqsQuery &query)
result.pages.append(page.toUInt());
}
}
result.wasContentSearch = contentSearch;
results.append(result);
}
return results;