コミットを比較
4 コミット
14730ed208
...
10d61acbd0
作成者 | SHA1 | 日付 | |
---|---|---|---|
10d61acbd0 | |||
eef0fae137 | |||
d8205a0da4 | |||
877224b6e1 |
@ -33,11 +33,18 @@ int CommandSearch::handle(QStringList arguments)
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
QHash<QString, bool> seenMap;
|
||||
auto results = dbService->search(query);
|
||||
|
||||
for(SearchResult &result : results)
|
||||
for(const SearchResult &result : results)
|
||||
{
|
||||
Logger::info() << result.fileData.absPath << Qt::endl;
|
||||
const QString &absPath = result.fileData.absPath;
|
||||
if(!seenMap.contains(absPath))
|
||||
{
|
||||
seenMap[absPath] = true;
|
||||
Logger::info() << absPath << Qt::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(LooqsGeneralException &e)
|
||||
|
@ -198,7 +198,14 @@ void MainWindow::connectSignals()
|
||||
connect(ui->btnSaveSettings, &QPushButton::clicked, this, &MainWindow::saveSettings);
|
||||
connect(ui->btnOpenFailed, &QPushButton::clicked, this, &MainWindow::exportFailedPaths);
|
||||
connect(
|
||||
ui->comboPreviewFiles, qOverload<int>(&QComboBox::currentIndexChanged), this, [&]() { makePreviews(1); },
|
||||
ui->comboPreviewFiles, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
[&]()
|
||||
{
|
||||
if(this->previewTabActive())
|
||||
{
|
||||
makePreviews(1);
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
connect(&ipcPreviewClient, &IPCPreviewClient::previewReceived, this, &MainWindow::previewReceived,
|
||||
Qt::QueuedConnection);
|
||||
@ -208,6 +215,7 @@ void MainWindow::connectSignals()
|
||||
this->ui->previewProcessBar->setValue(this->ui->previewProcessBar->maximum());
|
||||
this->ui->spinPreviewPage->setEnabled(true);
|
||||
this->ui->comboPreviewFiles->setEnabled(true);
|
||||
ui->txtSearch->setEnabled(true);
|
||||
});
|
||||
connect(&ipcPreviewClient, &IPCPreviewClient::error, this,
|
||||
[this](QString msg)
|
||||
@ -800,19 +808,25 @@ void MainWindow::handleSearchResults(const QVector<SearchResult> &results)
|
||||
ui->comboPreviewFiles->setVisible(true);
|
||||
|
||||
bool hasDeleted = false;
|
||||
QHash<QString, bool> seenMap;
|
||||
for(const SearchResult &result : results)
|
||||
{
|
||||
QFileInfo pathInfo(result.fileData.absPath);
|
||||
const QString &absPath = result.fileData.absPath;
|
||||
QFileInfo pathInfo(absPath);
|
||||
|
||||
QString fileName = pathInfo.fileName();
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem(ui->treeResultsList);
|
||||
if(!seenMap.contains(absPath))
|
||||
{
|
||||
seenMap[absPath] = true;
|
||||
QString fileName = pathInfo.fileName();
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem(ui->treeResultsList);
|
||||
|
||||
QDateTime dt = QDateTime::fromSecsSinceEpoch(result.fileData.mtime);
|
||||
item->setIcon(0, iconProvider.icon(pathInfo));
|
||||
item->setText(0, fileName);
|
||||
item->setText(1, result.fileData.absPath);
|
||||
item->setText(2, dt.toString(Qt::ISODate));
|
||||
item->setText(3, this->locale().formattedDataSize(result.fileData.size));
|
||||
QDateTime dt = QDateTime::fromSecsSinceEpoch(result.fileData.mtime);
|
||||
item->setIcon(0, iconProvider.icon(pathInfo));
|
||||
item->setText(0, fileName);
|
||||
item->setText(1, absPath);
|
||||
item->setText(2, dt.toString(Qt::ISODate));
|
||||
item->setText(3, this->locale().formattedDataSize(result.fileData.size));
|
||||
}
|
||||
bool exists = pathInfo.exists();
|
||||
if(exists)
|
||||
{
|
||||
@ -835,6 +849,7 @@ void MainWindow::handleSearchResults(const QVector<SearchResult> &results)
|
||||
hasDeleted = true;
|
||||
}
|
||||
}
|
||||
|
||||
ui->treeResultsList->resizeColumnToContents(0);
|
||||
ui->treeResultsList->resizeColumnToContents(1);
|
||||
ui->treeResultsList->resizeColumnToContents(2);
|
||||
@ -929,12 +944,8 @@ void MainWindow::makePreviews(int page)
|
||||
}
|
||||
RenderTarget renderTarget;
|
||||
renderTarget.path = sr.fileData.absPath;
|
||||
|
||||
for(unsigned int pagenum : sr.pages)
|
||||
{
|
||||
renderTarget.page = (int)pagenum;
|
||||
targets.append(renderTarget);
|
||||
}
|
||||
renderTarget.page = (int)sr.page;
|
||||
targets.append(renderTarget);
|
||||
}
|
||||
int numpages = ceil(static_cast<double>(targets.size()) / previewsPerPage);
|
||||
ui->spinPreviewPage->setMaximum(numpages);
|
||||
@ -948,6 +959,7 @@ void MainWindow::makePreviews(int page)
|
||||
++this->currentPreviewGeneration;
|
||||
this->ui->spinPreviewPage->setEnabled(false);
|
||||
this->ui->comboPreviewFiles->setEnabled(false);
|
||||
this->ui->txtSearch->setEnabled(false);
|
||||
emit startIpcPreviews(renderConfig, targets);
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ class SearchResult
|
||||
{
|
||||
public:
|
||||
FileData fileData;
|
||||
QVector<unsigned int> pages;
|
||||
unsigned int page;
|
||||
bool wasContentSearch = false;
|
||||
};
|
||||
|
||||
|
@ -194,10 +194,9 @@ QSqlQuery SqliteSearch::makeSqlQuery(const LooqsQuery &query)
|
||||
sortSql = "ORDER BY rank";
|
||||
}
|
||||
}
|
||||
prepSql =
|
||||
"SELECT file.path AS path, group_concat(content.page) AS pages, file.mtime AS mtime, file.size AS size, "
|
||||
"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;
|
||||
prepSql = "SELECT file.path AS path, content.page AS page, file.mtime AS mtime, file.size AS size, "
|
||||
"file.filetype AS filetype FROM file INNER JOIN content ON file.id = content.fileid " +
|
||||
joinSql + " WHERE 1=1 AND " + whereSql + " " + sortSql;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -205,7 +204,7 @@ QSqlQuery SqliteSearch::makeSqlQuery(const LooqsQuery &query)
|
||||
{
|
||||
sortSql = "ORDER BY file.mtime DESC";
|
||||
}
|
||||
prepSql = "SELECT file.path AS path, '0' as pages, file.mtime AS mtime, file.size AS size, file.filetype AS "
|
||||
prepSql = "SELECT file.path AS path, '0' as page, file.mtime AS mtime, file.size AS size, file.filetype AS "
|
||||
"filetype FROM file WHERE 1=1 AND " +
|
||||
whereSql + " " + sortSql;
|
||||
}
|
||||
@ -248,15 +247,7 @@ QVector<SearchResult> SqliteSearch::search(const LooqsQuery &query)
|
||||
result.fileData.mtime = dbQuery.value("mtime").toUInt();
|
||||
result.fileData.size = dbQuery.value("size").toUInt();
|
||||
result.fileData.filetype = dbQuery.value("filetype").toChar();
|
||||
QString pages = dbQuery.value("pages").toString();
|
||||
QStringList pagesList = pages.split(",");
|
||||
for(QString &page : pagesList)
|
||||
{
|
||||
if(page != "")
|
||||
{
|
||||
result.pages.append(page.toUInt());
|
||||
}
|
||||
}
|
||||
result.page = dbQuery.value("page").toUInt();
|
||||
result.wasContentSearch = contentSearch;
|
||||
results.append(result);
|
||||
}
|
||||
|
読み込み中…
新しいイシューから参照
ユーザーをブロックする