コミットを比較

..

共通のコミットはありません。 "10d61acbd07e837cbc25600ddbad5c0e7a0dc2f8" と "14730ed20819093edec4b2fe8dd30fd7ac5c12ce" の履歴はすべて異なっています。

4個のファイルの変更33行の追加43行の削除

ファイルの表示

@ -33,18 +33,11 @@ int CommandSearch::handle(QStringList arguments)
try try
{ {
QHash<QString, bool> seenMap;
auto results = dbService->search(query); auto results = dbService->search(query);
for(const SearchResult &result : results) for(SearchResult &result : results)
{ {
const QString &absPath = result.fileData.absPath; Logger::info() << result.fileData.absPath << Qt::endl;
if(!seenMap.contains(absPath))
{
seenMap[absPath] = true;
Logger::info() << absPath << Qt::endl;
}
} }
} }
catch(LooqsGeneralException &e) catch(LooqsGeneralException &e)

ファイルの表示

@ -198,14 +198,7 @@ void MainWindow::connectSignals()
connect(ui->btnSaveSettings, &QPushButton::clicked, this, &MainWindow::saveSettings); connect(ui->btnSaveSettings, &QPushButton::clicked, this, &MainWindow::saveSettings);
connect(ui->btnOpenFailed, &QPushButton::clicked, this, &MainWindow::exportFailedPaths); connect(ui->btnOpenFailed, &QPushButton::clicked, this, &MainWindow::exportFailedPaths);
connect( connect(
ui->comboPreviewFiles, qOverload<int>(&QComboBox::currentIndexChanged), this, ui->comboPreviewFiles, qOverload<int>(&QComboBox::currentIndexChanged), this, [&]() { makePreviews(1); },
[&]()
{
if(this->previewTabActive())
{
makePreviews(1);
}
},
Qt::QueuedConnection); Qt::QueuedConnection);
connect(&ipcPreviewClient, &IPCPreviewClient::previewReceived, this, &MainWindow::previewReceived, connect(&ipcPreviewClient, &IPCPreviewClient::previewReceived, this, &MainWindow::previewReceived,
Qt::QueuedConnection); Qt::QueuedConnection);
@ -215,7 +208,6 @@ void MainWindow::connectSignals()
this->ui->previewProcessBar->setValue(this->ui->previewProcessBar->maximum()); this->ui->previewProcessBar->setValue(this->ui->previewProcessBar->maximum());
this->ui->spinPreviewPage->setEnabled(true); this->ui->spinPreviewPage->setEnabled(true);
this->ui->comboPreviewFiles->setEnabled(true); this->ui->comboPreviewFiles->setEnabled(true);
ui->txtSearch->setEnabled(true);
}); });
connect(&ipcPreviewClient, &IPCPreviewClient::error, this, connect(&ipcPreviewClient, &IPCPreviewClient::error, this,
[this](QString msg) [this](QString msg)
@ -808,25 +800,19 @@ void MainWindow::handleSearchResults(const QVector<SearchResult> &results)
ui->comboPreviewFiles->setVisible(true); ui->comboPreviewFiles->setVisible(true);
bool hasDeleted = false; bool hasDeleted = false;
QHash<QString, bool> seenMap;
for(const SearchResult &result : results) for(const SearchResult &result : results)
{ {
const QString &absPath = result.fileData.absPath; QFileInfo pathInfo(result.fileData.absPath);
QFileInfo pathInfo(absPath);
if(!seenMap.contains(absPath)) QString fileName = pathInfo.fileName();
{ QTreeWidgetItem *item = new QTreeWidgetItem(ui->treeResultsList);
seenMap[absPath] = true;
QString fileName = pathInfo.fileName();
QTreeWidgetItem *item = new QTreeWidgetItem(ui->treeResultsList);
QDateTime dt = QDateTime::fromSecsSinceEpoch(result.fileData.mtime); QDateTime dt = QDateTime::fromSecsSinceEpoch(result.fileData.mtime);
item->setIcon(0, iconProvider.icon(pathInfo)); item->setIcon(0, iconProvider.icon(pathInfo));
item->setText(0, fileName); item->setText(0, fileName);
item->setText(1, absPath); item->setText(1, result.fileData.absPath);
item->setText(2, dt.toString(Qt::ISODate)); item->setText(2, dt.toString(Qt::ISODate));
item->setText(3, this->locale().formattedDataSize(result.fileData.size)); item->setText(3, this->locale().formattedDataSize(result.fileData.size));
}
bool exists = pathInfo.exists(); bool exists = pathInfo.exists();
if(exists) if(exists)
{ {
@ -849,7 +835,6 @@ void MainWindow::handleSearchResults(const QVector<SearchResult> &results)
hasDeleted = true; hasDeleted = true;
} }
} }
ui->treeResultsList->resizeColumnToContents(0); ui->treeResultsList->resizeColumnToContents(0);
ui->treeResultsList->resizeColumnToContents(1); ui->treeResultsList->resizeColumnToContents(1);
ui->treeResultsList->resizeColumnToContents(2); ui->treeResultsList->resizeColumnToContents(2);
@ -944,8 +929,12 @@ void MainWindow::makePreviews(int page)
} }
RenderTarget renderTarget; RenderTarget renderTarget;
renderTarget.path = sr.fileData.absPath; renderTarget.path = sr.fileData.absPath;
renderTarget.page = (int)sr.page;
targets.append(renderTarget); for(unsigned int pagenum : sr.pages)
{
renderTarget.page = (int)pagenum;
targets.append(renderTarget);
}
} }
int numpages = ceil(static_cast<double>(targets.size()) / previewsPerPage); int numpages = ceil(static_cast<double>(targets.size()) / previewsPerPage);
ui->spinPreviewPage->setMaximum(numpages); ui->spinPreviewPage->setMaximum(numpages);
@ -959,7 +948,6 @@ void MainWindow::makePreviews(int page)
++this->currentPreviewGeneration; ++this->currentPreviewGeneration;
this->ui->spinPreviewPage->setEnabled(false); this->ui->spinPreviewPage->setEnabled(false);
this->ui->comboPreviewFiles->setEnabled(false); this->ui->comboPreviewFiles->setEnabled(false);
this->ui->txtSearch->setEnabled(false);
emit startIpcPreviews(renderConfig, targets); emit startIpcPreviews(renderConfig, targets);
} }

ファイルの表示

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

ファイルの表示

@ -194,9 +194,10 @@ QSqlQuery SqliteSearch::makeSqlQuery(const LooqsQuery &query)
sortSql = "ORDER BY rank"; sortSql = "ORDER BY rank";
} }
} }
prepSql = "SELECT file.path AS path, content.page AS page, file.mtime AS mtime, file.size AS size, " prepSql =
"file.filetype AS filetype FROM file INNER JOIN content ON file.id = content.fileid " + "SELECT file.path AS path, group_concat(content.page) AS pages, file.mtime AS mtime, file.size AS size, "
joinSql + " WHERE 1=1 AND " + whereSql + " " + sortSql; "file.filetype AS filetype FROM file INNER JOIN content ON file.id = content.fileid " +
joinSql + " WHERE 1=1 AND " + whereSql + " GROUP BY file.path " + sortSql;
} }
else else
{ {
@ -204,7 +205,7 @@ QSqlQuery SqliteSearch::makeSqlQuery(const LooqsQuery &query)
{ {
sortSql = "ORDER BY file.mtime DESC"; sortSql = "ORDER BY file.mtime DESC";
} }
prepSql = "SELECT file.path AS path, '0' as page, file.mtime AS mtime, file.size AS size, file.filetype AS " prepSql = "SELECT file.path AS path, '0' as pages, file.mtime AS mtime, file.size AS size, file.filetype AS "
"filetype FROM file WHERE 1=1 AND " + "filetype FROM file WHERE 1=1 AND " +
whereSql + " " + sortSql; whereSql + " " + sortSql;
} }
@ -247,7 +248,15 @@ QVector<SearchResult> SqliteSearch::search(const LooqsQuery &query)
result.fileData.mtime = dbQuery.value("mtime").toUInt(); result.fileData.mtime = dbQuery.value("mtime").toUInt();
result.fileData.size = dbQuery.value("size").toUInt(); result.fileData.size = dbQuery.value("size").toUInt();
result.fileData.filetype = dbQuery.value("filetype").toChar(); result.fileData.filetype = dbQuery.value("filetype").toChar();
result.page = dbQuery.value("page").toUInt(); QString pages = dbQuery.value("pages").toString();
QStringList pagesList = pages.split(",");
for(QString &page : pagesList)
{
if(page != "")
{
result.pages.append(page.toUInt());
}
}
result.wasContentSearch = contentSearch; result.wasContentSearch = contentSearch;
results.append(result); results.append(result);
} }