比较提交
23 次代码提交
v0.7
...
dbe4061c58
作者 | SHA1 | 提交日期 | |
---|---|---|---|
dbe4061c58 | |||
87e3cc3380 | |||
ffdaa4c0c6 | |||
fe8da94951 | |||
57f0afaf91 | |||
20a1f8b2cd | |||
a47af257f3 | |||
9686ef30c7 | |||
abce4cfcd9 | |||
d55187a71c | |||
9e1bc98f38 | |||
496aefaa09 | |||
b4320f611b | |||
1b1ab2387e | |||
49a1a14009 | |||
48ca25abe3 | |||
42e9ac5f41 | |||
7d3c24e6e1 | |||
c155d25a37 | |||
583d5babf3 | |||
45659cdc59 | |||
3022bbdfb5 | |||
b6ac652ade |
17
CHANGELOG.md
17
CHANGELOG.md
@ -1,4 +1,21 @@
|
||||
# looqs: Release notes
|
||||
|
||||
## 2022-11-19 - v0.8.1
|
||||
|
||||
CHANGES:
|
||||
- Fix regression causing previews in second (and higher) result page to not render
|
||||
- Minor improvements
|
||||
|
||||
## 2022-10-22 - v0.8
|
||||
|
||||
CHANGES:
|
||||
- For new, not previously indexed files, start creating an additional index using sqlite's experimental trigram tokenizer. Thanks to that, we can now match substrings >= 3 of an unicode sequence. Results of the usual index are prioritized.
|
||||
- GUI: Ensure order of previews matches ranking exactly. Previously, it depended simply on the time preview generators took, i. e. it was more or less a race.
|
||||
- Report progress more often during indexing, so users don't get the impression that it's stuck when processing dirs with large documents.
|
||||
- Fix a regression that caused phrase queries to be broken
|
||||
- Minor improvements
|
||||
- Add packages: Ubuntu 22.10.
|
||||
|
||||
## 2022-09-10 - v0.7
|
||||
|
||||
CHANGES:
|
||||
|
12
HACKING.md
12
HACKING.md
@ -1,12 +1,7 @@
|
||||
# looqs - Hacking
|
||||
|
||||
## Introduction
|
||||
Without elaborating here, I hacked looqs because I was not satisfied with the state of desktop search on Linux.
|
||||
|
||||
Originally a set of CLI python scripts, it is now written in C++ and offers a GUI made using Qt. While a "web app" would have been an option, I prefer a desktop application for something like looqs. I chose Qt because I am more familiar with it than with any other GUI framework. To my knowledge, potential alternatives like GTK do not include as many "batteries" as Qt anyway, so the job presumably would have been harder there,
|
||||
at least for me.
|
||||
|
||||
If you are interested in how to contribute, please see the file [CONTRIBUTING.md](CONTRIBUTING.md) which contains the instructions on how to submit patches etc.
|
||||
If you are interested on how to contribute, please see the file [CONTRIBUTING.md](CONTRIBUTING.md) which contains the instructions on how to submit patches etc.
|
||||
|
||||
## Security
|
||||
The architecture ensures that the parsing of documents and the preview generation is sandboxed by [exile.h](https://github.com/quitesimpleorg/exile.h). looqs uses a multi-process architecture to achieve this.
|
||||
@ -16,7 +11,8 @@ Qt code is considered trusted in this model. While one may critize this, it was
|
||||
Set the enviornment variable `LOOQS_DISABLE_SANDBOX=1` to disable sandboxing. It's intended for troublehshooting.
|
||||
|
||||
## Database
|
||||
The heart is sqlite, with the FTS5 extensions behind the full-text search. While FTS may not be sqlite's strong suit, I definitly did not want to run one of those oftenly recommended heavy (Java based) solutions. I explored other options like Postgresql, I've discard them due to some limitations back then.
|
||||
The heart is sqlite, with the FTS5 extensions behind the full-text search. While FTS may not be sqlite's strong suit, I definitely did not want to run one of those oftenly recommended heavy (Java based) solutions. I explored other options like Postgresql, I've discard them due to some limitations back then. It's also natural to use sqlite as it's
|
||||
used for metadata in general.
|
||||
|
||||
Down the road, alternatives will be explored of course if sqlite should not suffice anymore.
|
||||
|
||||
@ -27,7 +23,7 @@ looqs simply strips the tags and that seems to work fine so far. Naturally, this
|
||||
Naturally, looqs won't be able to index and render previews for everything. Such approach would create a huge bloated binary. In the future, there will be some plugin system of some sorts, either we will load .so objects or use subprocesses.
|
||||
|
||||
## Name
|
||||
looqs looks for files. You as the user can also look inside them. The 'k' in "looks" was replaced by a 'q'. Originally, I wanted my projects to have "qs" (for quitesimple) in their name. While abandoned now, this got us to looqs.
|
||||
looqs looks for files. You as the user can also look inside them. The 'k' in "looks" was replaced by a 'q'. Originally, I wanted my projects to have "qs" (for quitesimple) in their name. While that quirk is abandoned now, this got us to looqs.
|
||||
|
||||
|
||||
|
||||
|
@ -28,9 +28,12 @@ There is no need to write the long form of filters. There are also booleans avai
|
||||
The screenshots in this section may occasionally be slightly outdated, but they are usually recent enough to get an overall impression of the current state of the GUI.
|
||||
|
||||
## Current status
|
||||
Latest version: 2022-09-10, v0.7
|
||||
Latest version: 2022-11-19, v0.8.1
|
||||
|
||||
Please see [Changelog](CHANGELOG.md) for a human readable list of changes.
|
||||
Please keep in mind: looqs is still at an early stage and may exhibit some weirdness and contain bugs.
|
||||
|
||||
Please see [Changelog](CHANGELOG.md) for a human readable list of changes. For download instructions, see
|
||||
further down this document.
|
||||
|
||||
|
||||
## Goals and principles
|
||||
@ -94,7 +97,7 @@ The GUI is located in `gui/looqs-gui`, the binary for the CLI is in `cli/looqs`
|
||||
## Packages
|
||||
At this point, looqs is not in any official distro package repo, but I maintain some packages.
|
||||
|
||||
### Ubuntu 22.04
|
||||
### Ubuntu 22.04, 22.10
|
||||
Latest release can be installed using apt from the repo.
|
||||
```
|
||||
# First, obtain key, assume it's trusted.
|
||||
|
@ -34,6 +34,7 @@ SOURCES += \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
clicklabel.cpp \
|
||||
previewcoordinator.cpp \
|
||||
previewgenerator.cpp \
|
||||
previewgeneratormapfunctor.cpp \
|
||||
previewgeneratorodt.cpp \
|
||||
@ -54,6 +55,7 @@ HEADERS += \
|
||||
ipcserver.h \
|
||||
mainwindow.h \
|
||||
clicklabel.h \
|
||||
previewcoordinator.h \
|
||||
previewgenerator.h \
|
||||
previewgeneratormapfunctor.h \
|
||||
previewgeneratorodt.h \
|
||||
|
@ -28,7 +28,7 @@ void enableIpcSandbox()
|
||||
policy->namespace_options = EXILE_UNSHARE_USER | EXILE_UNSHARE_MOUNT | EXILE_UNSHARE_NETWORK;
|
||||
policy->no_new_privs = 1;
|
||||
policy->drop_caps = 1;
|
||||
policy->vow_promises = exile_vows_from_str("thread cpath rpath unix stdio proc error");
|
||||
policy->vow_promises = exile_vows_from_str("thread cpath rpath wpath unix stdio proc error");
|
||||
policy->mount_path_policies_to_chroot = 1;
|
||||
|
||||
QString ipcSocketPath = Common::ipcSocketPath();
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "../shared/sqlitesearch.h"
|
||||
#include "../shared/looqsgeneralexception.h"
|
||||
#include "../shared/common.h"
|
||||
#include "ipcpreviewclient.h"
|
||||
#include "previewgenerator.h"
|
||||
#include "aboutdialog.h"
|
||||
|
||||
@ -32,8 +31,7 @@ MainWindow::MainWindow(QWidget *parent, QString socketPath)
|
||||
this->progressDialog.cancel(); // because constructing it shows it, quite weird
|
||||
ui->setupUi(this);
|
||||
setWindowTitle(QCoreApplication::applicationName());
|
||||
this->ipcPreviewClient.moveToThread(&this->ipcClientThread);
|
||||
this->ipcPreviewClient.setSocketPath(socketPath);
|
||||
|
||||
QSettings settings;
|
||||
|
||||
this->dbFactory = new DatabaseFactory(Common::databasePath());
|
||||
@ -78,7 +76,7 @@ MainWindow::MainWindow(QWidget *parent, QString socketPath)
|
||||
ui->txtSearch->installEventFilter(this);
|
||||
ui->scrollArea->viewport()->installEventFilter(this);
|
||||
|
||||
this->ipcClientThread.start();
|
||||
this->previewCoordinator.setSocketPath(socketPath);
|
||||
}
|
||||
|
||||
void MainWindow::addPathToIndex()
|
||||
@ -208,9 +206,9 @@ void MainWindow::connectSignals()
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
connect(&ipcPreviewClient, &IPCPreviewClient::previewReceived, this, &MainWindow::previewReceived,
|
||||
connect(&previewCoordinator, &PreviewCoordinator::previewReady, this, &MainWindow::previewReceived,
|
||||
Qt::QueuedConnection);
|
||||
connect(&ipcPreviewClient, &IPCPreviewClient::finished, this,
|
||||
connect(&previewCoordinator, &PreviewCoordinator::completedGeneration, this,
|
||||
[&]
|
||||
{
|
||||
this->ui->previewProcessBar->setValue(this->ui->previewProcessBar->maximum());
|
||||
@ -218,17 +216,17 @@ void MainWindow::connectSignals()
|
||||
this->ui->comboPreviewFiles->setEnabled(true);
|
||||
ui->txtSearch->setEnabled(true);
|
||||
});
|
||||
connect(&ipcPreviewClient, &IPCPreviewClient::error, this,
|
||||
connect(&previewCoordinator, &PreviewCoordinator::error, this,
|
||||
[this](QString msg)
|
||||
{
|
||||
qCritical() << msg << Qt::endl;
|
||||
QMessageBox::critical(this, "IPC error", msg);
|
||||
});
|
||||
|
||||
connect(this, &MainWindow::startIpcPreviews, &ipcPreviewClient, &IPCPreviewClient::startGeneration,
|
||||
/*connect(this, &MainWindow::startIpcPreviews, &previewCoordinator, &IPCPreviewClient::startGeneration,
|
||||
Qt::QueuedConnection);
|
||||
connect(this, &MainWindow::stopIpcPreviews, &ipcPreviewClient, &IPCPreviewClient::stopGeneration,
|
||||
Qt::QueuedConnection);
|
||||
Qt::QueuedConnection); */
|
||||
}
|
||||
|
||||
void MainWindow::exportFailedPaths()
|
||||
@ -632,18 +630,21 @@ void MainWindow::saveSettings()
|
||||
qApp->quit();
|
||||
}
|
||||
|
||||
void MainWindow::previewReceived(QSharedPointer<PreviewResult> preview, unsigned int previewGeneration)
|
||||
void MainWindow::previewReceived()
|
||||
{
|
||||
if(previewGeneration < this->currentPreviewGeneration)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this->ui->previewProcessBar->setValue(this->ui->previewProcessBar->value() + 1);
|
||||
QBoxLayout *layout = static_cast<QBoxLayout *>(ui->scrollAreaWidgetContents->layout());
|
||||
int index = layout->count();
|
||||
if(index > 0)
|
||||
{
|
||||
--index;
|
||||
}
|
||||
QSharedPointer<PreviewResult> preview = this->previewCoordinator.resultAt(index);
|
||||
|
||||
if(!preview.isNull() && preview->hasPreview())
|
||||
{
|
||||
QString docPath = preview->getDocumentPath();
|
||||
auto previewPage = preview->getPage();
|
||||
|
||||
ClickLabel *headerLabel = new ClickLabel();
|
||||
headerLabel->setText(QString("Path: ") + preview->getDocumentPath());
|
||||
|
||||
@ -662,7 +663,7 @@ void MainWindow::previewReceived(QSharedPointer<PreviewResult> preview, unsigned
|
||||
{
|
||||
QFileInfo fileInfo{docPath};
|
||||
QMenu menu("labeRightClick", this);
|
||||
createSearchResutlMenu(menu, fileInfo);
|
||||
createSearchResultMenu(menu, fileInfo);
|
||||
menu.addAction("Copy page number",
|
||||
[previewPage] { QGuiApplication::clipboard()->setText(QString::number(previewPage)); });
|
||||
menu.exec(QCursor::pos());
|
||||
@ -685,7 +686,7 @@ void MainWindow::previewReceived(QSharedPointer<PreviewResult> preview, unsigned
|
||||
|
||||
previewWidget->setLayout(previewLayout);
|
||||
|
||||
ui->scrollAreaWidgetContents->layout()->addWidget(previewWidget);
|
||||
layout->insertWidget(index, previewWidget);
|
||||
}
|
||||
}
|
||||
|
||||
@ -802,7 +803,6 @@ void MainWindow::lineEditReturnPressed()
|
||||
|
||||
void MainWindow::handleSearchResults(const QVector<SearchResult> &results)
|
||||
{
|
||||
this->previewableSearchResults.clear();
|
||||
qDeleteAll(ui->scrollAreaWidgetContents->children());
|
||||
|
||||
ui->treeResultsList->clear();
|
||||
@ -811,6 +811,8 @@ void MainWindow::handleSearchResults(const QVector<SearchResult> &results)
|
||||
ui->comboPreviewFiles->setVisible(true);
|
||||
ui->lblTotalPreviewPagesCount->setText("");
|
||||
|
||||
this->previewCoordinator.init(results);
|
||||
|
||||
bool hasDeleted = false;
|
||||
QHash<QString, bool> seenMap;
|
||||
for(const SearchResult &result : results)
|
||||
@ -831,34 +833,29 @@ void MainWindow::handleSearchResults(const QVector<SearchResult> &results)
|
||||
item->setText(3, this->locale().formattedDataSize(result.fileData.size));
|
||||
}
|
||||
bool exists = pathInfo.exists();
|
||||
if(exists)
|
||||
{
|
||||
if(result.wasContentSearch)
|
||||
{
|
||||
if(!pathInfo.suffix().contains("htm")) // hack until we can preview them properly...
|
||||
{
|
||||
if(PreviewGenerator::get(pathInfo) != nullptr)
|
||||
{
|
||||
this->previewableSearchResults.append(result);
|
||||
if(!seenMap.contains(result.fileData.absPath))
|
||||
{
|
||||
ui->comboPreviewFiles->addItem(result.fileData.absPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if(!exists)
|
||||
{
|
||||
hasDeleted = true;
|
||||
}
|
||||
seenMap[absPath] = true;
|
||||
}
|
||||
|
||||
seenMap.clear();
|
||||
for(const SearchResult &result : this->previewCoordinator.getPreviewableSearchResults())
|
||||
{
|
||||
const QString &absPath = result.fileData.absPath;
|
||||
if(!seenMap.contains(absPath))
|
||||
{
|
||||
ui->comboPreviewFiles->addItem(absPath);
|
||||
}
|
||||
seenMap[absPath] = true;
|
||||
}
|
||||
|
||||
ui->treeResultsList->resizeColumnToContents(0);
|
||||
ui->treeResultsList->resizeColumnToContents(1);
|
||||
ui->treeResultsList->resizeColumnToContents(2);
|
||||
previewDirty = !this->previewableSearchResults.empty();
|
||||
|
||||
previewDirty = this->previewCoordinator.previewableCount() > 0;
|
||||
|
||||
ui->spinPreviewPage->setValue(1);
|
||||
|
||||
@ -868,7 +865,7 @@ void MainWindow::handleSearchResults(const QVector<SearchResult> &results)
|
||||
}
|
||||
|
||||
QString statusText = "Results: " + QString::number(results.size()) + " files";
|
||||
statusText += ", previewable: " + QString::number(this->previewableSearchResults.count());
|
||||
statusText += ", previewable: " + QString::number(this->previewCoordinator.previewableCount());
|
||||
if(hasDeleted)
|
||||
{
|
||||
statusText += " WARNING: Some files are inaccessible. No preview available for those. Index may be out of sync";
|
||||
@ -885,7 +882,7 @@ int MainWindow::currentSelectedScale()
|
||||
|
||||
void MainWindow::makePreviews(int page)
|
||||
{
|
||||
if(this->previewableSearchResults.empty())
|
||||
if(this->previewCoordinator.previewableCount() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -902,8 +899,7 @@ void MainWindow::makePreviews(int page)
|
||||
ui->scrollAreaWidgetContents->setLayout(new QVBoxLayout());
|
||||
ui->scrollAreaWidgetContents->layout()->setAlignment(Qt::AlignCenter);
|
||||
}
|
||||
ui->previewProcessBar->setMaximum(this->previewableSearchResults.size());
|
||||
processedPdfPreviews = 0;
|
||||
ui->previewProcessBar->setMaximum(this->previewCoordinator.previewableCount());
|
||||
|
||||
QVector<QString> wordsToHighlight;
|
||||
QRegularExpression extractor(R"#("([^"]*)"|([^\s]+))#");
|
||||
@ -924,12 +920,12 @@ void MainWindow::makePreviews(int page)
|
||||
}
|
||||
}
|
||||
}
|
||||
int end = previewsPerPage;
|
||||
int begin = page * previewsPerPage - previewsPerPage;
|
||||
if(begin < 0)
|
||||
int length = previewsPerPage;
|
||||
int beginOffset = page * previewsPerPage - previewsPerPage;
|
||||
if(beginOffset < 0)
|
||||
{
|
||||
// Should not happen actually
|
||||
begin = 0;
|
||||
beginOffset = 0;
|
||||
}
|
||||
|
||||
int currentScale = currentSelectedScale();
|
||||
@ -938,8 +934,9 @@ void MainWindow::makePreviews(int page)
|
||||
renderConfig.scaleY = QGuiApplication::primaryScreen()->physicalDotsPerInchY() * (currentScale / 100.);
|
||||
renderConfig.wordsToHighlight = wordsToHighlight;
|
||||
|
||||
int previewPos = 0;
|
||||
QVector<RenderTarget> targets;
|
||||
for(SearchResult &sr : this->previewableSearchResults)
|
||||
for(const SearchResult &sr : this->previewCoordinator.getPreviewableSearchResults())
|
||||
{
|
||||
if(ui->comboPreviewFiles->currentIndex() != 0)
|
||||
{
|
||||
@ -951,22 +948,23 @@ void MainWindow::makePreviews(int page)
|
||||
RenderTarget renderTarget;
|
||||
renderTarget.path = sr.fileData.absPath;
|
||||
renderTarget.page = (int)sr.page;
|
||||
|
||||
targets.append(renderTarget);
|
||||
}
|
||||
int numpages = ceil(static_cast<double>(targets.size()) / previewsPerPage);
|
||||
ui->spinPreviewPage->setMaximum(numpages);
|
||||
targets = targets.mid(begin, end);
|
||||
targets = targets.mid(beginOffset, length);
|
||||
|
||||
ui->lblTotalPreviewPagesCount->setText(QString::number(numpages));
|
||||
ui->previewProcessBar->setMaximum(targets.count());
|
||||
ui->previewProcessBar->setMinimum(0);
|
||||
ui->previewProcessBar->setValue(0);
|
||||
ui->previewProcessBar->setVisible(this->previewableSearchResults.size() > 0);
|
||||
++this->currentPreviewGeneration;
|
||||
ui->previewProcessBar->setVisible(this->previewCoordinator.previewableCount() > 0);
|
||||
this->ui->spinPreviewPage->setEnabled(false);
|
||||
this->ui->comboPreviewFiles->setEnabled(false);
|
||||
this->ui->txtSearch->setEnabled(false);
|
||||
emit startIpcPreviews(renderConfig, targets);
|
||||
|
||||
this->previewCoordinator.startGeneration(renderConfig, targets);
|
||||
}
|
||||
|
||||
void MainWindow::handleSearchError(QString error)
|
||||
@ -974,7 +972,7 @@ void MainWindow::handleSearchError(QString error)
|
||||
ui->lblSearchResults->setText("Error:" + error);
|
||||
}
|
||||
|
||||
void MainWindow::createSearchResutlMenu(QMenu &menu, const QFileInfo &fileInfo)
|
||||
void MainWindow::createSearchResultMenu(QMenu &menu, const QFileInfo &fileInfo)
|
||||
{
|
||||
menu.addAction("Copy filename to clipboard",
|
||||
[&fileInfo] { QGuiApplication::clipboard()->setText(fileInfo.fileName()); });
|
||||
@ -982,11 +980,12 @@ void MainWindow::createSearchResutlMenu(QMenu &menu, const QFileInfo &fileInfo)
|
||||
[&fileInfo] { QGuiApplication::clipboard()->setText(fileInfo.absoluteFilePath()); });
|
||||
menu.addAction("Open containing folder", [this, &fileInfo] { this->openFile(fileInfo.absolutePath()); });
|
||||
|
||||
auto previewables = this->previewCoordinator.getPreviewableSearchResults();
|
||||
auto result =
|
||||
std::find_if(this->previewableSearchResults.begin(), this->previewableSearchResults.end(),
|
||||
std::find_if(previewables.begin(), previewables.end(),
|
||||
[this, &fileInfo](SearchResult &a) { return fileInfo.absoluteFilePath() == a.fileData.absPath; });
|
||||
|
||||
if(result != this->previewableSearchResults.end())
|
||||
if(result != previewables.end())
|
||||
{
|
||||
menu.addAction("Show previews for this file",
|
||||
[this, &fileInfo]
|
||||
@ -1038,14 +1037,13 @@ void MainWindow::showSearchResultsContextMenu(const QPoint &point)
|
||||
}
|
||||
QFileInfo pathinfo(item->text(1));
|
||||
QMenu menu("SearchResults", this);
|
||||
createSearchResutlMenu(menu, pathinfo);
|
||||
createSearchResultMenu(menu, pathinfo);
|
||||
menu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
syncerThread.terminate();
|
||||
ipcClientThread.terminate();
|
||||
delete this->indexSyncer;
|
||||
delete this->dbService;
|
||||
delete this->dbFactory;
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <QProgressDialog>
|
||||
#include "../shared/looqsquery.h"
|
||||
#include "../shared/indexsyncer.h"
|
||||
#include "ipcpreviewclient.h"
|
||||
#include "previewcoordinator.h"
|
||||
#include "indexer.h"
|
||||
namespace Ui
|
||||
{
|
||||
@ -23,60 +23,48 @@ class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent, QString socketPath);
|
||||
~MainWindow();
|
||||
signals:
|
||||
void beginSearch(const QString &query);
|
||||
void startPdfPreviewGeneration(QVector<SearchResult> paths, double scalefactor);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
|
||||
private:
|
||||
DatabaseFactory *dbFactory;
|
||||
SqliteDbService *dbService;
|
||||
Ui::MainWindow *ui;
|
||||
IPCPreviewClient ipcPreviewClient;
|
||||
QThread ipcClientThread;
|
||||
|
||||
PreviewCoordinator previewCoordinator;
|
||||
|
||||
QThread syncerThread;
|
||||
Indexer *indexer;
|
||||
IndexSyncer *indexSyncer;
|
||||
QProgressDialog progressDialog;
|
||||
|
||||
Indexer *indexer;
|
||||
QFileIconProvider iconProvider;
|
||||
bool previewDirty;
|
||||
QSqlDatabase db;
|
||||
QFutureWatcher<QVector<SearchResult>> searchWatcher;
|
||||
void add(QString path, unsigned int page);
|
||||
QVector<SearchResult> previewableSearchResults;
|
||||
LooqsQuery contentSearchQuery;
|
||||
QVector<QString> searchHistory;
|
||||
int currentSearchHistoryIndex = 0;
|
||||
QString currentSavedSearchText;
|
||||
bool previewDirty = false;
|
||||
int previewsPerPage = 20;
|
||||
|
||||
void connectSignals();
|
||||
void makePreviews(int page);
|
||||
bool previewTabActive();
|
||||
bool indexerTabActive();
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
unsigned int processedPdfPreviews;
|
||||
void handleSearchResults(const QVector<SearchResult> &results);
|
||||
void handleSearchError(QString error);
|
||||
LooqsQuery contentSearchQuery;
|
||||
int previewsPerPage;
|
||||
void createSearchResutlMenu(QMenu &menu, const QFileInfo &fileInfo);
|
||||
void createSearchResultMenu(QMenu &menu, const QFileInfo &fileInfo);
|
||||
void openDocument(QString path, int num);
|
||||
void openFile(QString path);
|
||||
unsigned int currentPreviewGeneration = 1;
|
||||
void initSettingsTabs();
|
||||
int currentSelectedScale();
|
||||
void processShortcut(int key);
|
||||
bool eventFilter(QObject *object, QEvent *event);
|
||||
QVector<QString> searchHistory;
|
||||
int currentSearchHistoryIndex = 0;
|
||||
QString currentSavedSearchText;
|
||||
|
||||
private slots:
|
||||
void lineEditReturnPressed();
|
||||
void treeSearchItemActivated(QTreeWidgetItem *item, int i);
|
||||
void showSearchResultsContextMenu(const QPoint &point);
|
||||
void tabChanged();
|
||||
void previewReceived(QSharedPointer<PreviewResult> preview, unsigned int previewGeneration);
|
||||
void previewReceived();
|
||||
void comboScaleChanged(int i);
|
||||
void spinPreviewPageValueChanged(int val);
|
||||
void startIndexing();
|
||||
@ -90,6 +78,16 @@ class MainWindow : public QMainWindow
|
||||
void startIpcPreviews(RenderConfig config, const QVector<RenderTarget> &targets);
|
||||
void stopIpcPreviews();
|
||||
void beginIndexSync();
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent, QString socketPath);
|
||||
~MainWindow();
|
||||
signals:
|
||||
void beginSearch(const QString &query);
|
||||
void startPdfPreviewGeneration(QVector<SearchResult> paths, double scalefactor);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
97
gui/previewcoordinator.cpp
普通文件
97
gui/previewcoordinator.cpp
普通文件
@ -0,0 +1,97 @@
|
||||
#include "previewcoordinator.h"
|
||||
#include <QFileInfo>
|
||||
|
||||
PreviewCoordinator::PreviewCoordinator()
|
||||
{
|
||||
this->ipcPreviewClient.moveToThread(&this->ipcClientThread);
|
||||
|
||||
connect(&ipcPreviewClient, &IPCPreviewClient::previewReceived, this, &PreviewCoordinator::handleReceivedPreview,
|
||||
Qt::QueuedConnection);
|
||||
connect(&ipcPreviewClient, &IPCPreviewClient::finished, this, [&] { emit completedGeneration(); });
|
||||
connect(this, &PreviewCoordinator::ipcStartGeneration, &ipcPreviewClient, &IPCPreviewClient::startGeneration,
|
||||
Qt::QueuedConnection);
|
||||
|
||||
this->ipcClientThread.start();
|
||||
}
|
||||
|
||||
void PreviewCoordinator::init(const QVector<SearchResult> &searchResults)
|
||||
{
|
||||
this->previewableSearchResults.clear();
|
||||
for(const SearchResult &result : searchResults)
|
||||
{
|
||||
if(result.wasContentSearch)
|
||||
{
|
||||
QString path = result.fileData.absPath;
|
||||
// HACK until we can preview them properly
|
||||
if(path.endsWith(".html") || path.endsWith(".htm"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
QFileInfo info{path};
|
||||
if(info.exists())
|
||||
{
|
||||
this->previewableSearchResults.append(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewCoordinator::setSocketPath(QString socketPath)
|
||||
{
|
||||
this->socketPath = socketPath;
|
||||
this->ipcPreviewClient.setSocketPath(socketPath);
|
||||
}
|
||||
|
||||
int PreviewCoordinator::previewableCount() const
|
||||
{
|
||||
return this->previewableSearchResults.count();
|
||||
}
|
||||
|
||||
QSharedPointer<PreviewResult> PreviewCoordinator::resultAt(int index)
|
||||
{
|
||||
if(this->previewResults.size() > index)
|
||||
{
|
||||
return {this->previewResults[index]};
|
||||
}
|
||||
return {nullptr};
|
||||
}
|
||||
|
||||
const QVector<SearchResult> &PreviewCoordinator::getPreviewableSearchResults() const
|
||||
{
|
||||
return this->previewableSearchResults;
|
||||
}
|
||||
|
||||
void PreviewCoordinator::handleReceivedPreview(QSharedPointer<PreviewResult> preview, unsigned int previewGeneration)
|
||||
{
|
||||
if(previewGeneration < this->currentPreviewGeneration)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(!preview.isNull() && preview->hasPreview())
|
||||
{
|
||||
QString docPath = preview->getDocumentPath();
|
||||
auto previewPage = preview->getPage();
|
||||
int pos = previewOrder[docPath + QString::number(previewPage)];
|
||||
this->previewResults[pos] = preview;
|
||||
emit previewReady();
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewCoordinator::startGeneration(RenderConfig config, const QVector<RenderTarget> &targets)
|
||||
{
|
||||
++this->currentPreviewGeneration;
|
||||
|
||||
this->previewOrder.clear();
|
||||
this->previewResults.clear();
|
||||
|
||||
this->previewResults.resize(targets.size());
|
||||
this->previewResults.fill(nullptr);
|
||||
|
||||
int i = 0;
|
||||
for(const RenderTarget &target : targets)
|
||||
{
|
||||
this->previewOrder[target.path + QString::number(target.page)] = i++;
|
||||
}
|
||||
|
||||
emit ipcStartGeneration(config, targets);
|
||||
}
|
48
gui/previewcoordinator.h
普通文件
48
gui/previewcoordinator.h
普通文件
@ -0,0 +1,48 @@
|
||||
#ifndef PREVIEWCOORDINATOR_H
|
||||
#define PREVIEWCOORDINATOR_H
|
||||
#include <QVector>
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include "searchresult.h"
|
||||
#include "previewresult.h"
|
||||
#include "ipcpreviewclient.h"
|
||||
#include "rendertarget.h"
|
||||
class PreviewCoordinator : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
QThread ipcClientThread;
|
||||
IPCPreviewClient ipcPreviewClient;
|
||||
QString socketPath;
|
||||
|
||||
QVector<QSharedPointer<PreviewResult>> previewResults;
|
||||
QVector<SearchResult> previewableSearchResults;
|
||||
|
||||
unsigned int currentPreviewGeneration = 1;
|
||||
|
||||
/* Quick lookup table for the order a preview should have */
|
||||
QHash<QString, int> previewOrder;
|
||||
|
||||
public:
|
||||
PreviewCoordinator();
|
||||
|
||||
void init(const QVector<SearchResult> &searchResults);
|
||||
|
||||
int previewableCount() const;
|
||||
const QVector<SearchResult> &getPreviewableSearchResults() const;
|
||||
|
||||
QSharedPointer<PreviewResult> resultAt(int index);
|
||||
|
||||
void setSocketPath(QString socketPath);
|
||||
public slots:
|
||||
void startGeneration(RenderConfig config, const QVector<RenderTarget> &targets);
|
||||
void handleReceivedPreview(QSharedPointer<PreviewResult> preview, unsigned int previewGeneration);
|
||||
|
||||
signals:
|
||||
void previewReady();
|
||||
void completedGeneration();
|
||||
void error(QString);
|
||||
void ipcStartGeneration(RenderConfig config, const QVector<RenderTarget> &targets);
|
||||
};
|
||||
|
||||
#endif // PREVIEWCOORDINATOR_H
|
@ -1,20 +1,24 @@
|
||||
#include "../shared/common.h"
|
||||
#include "previewgenerator.h"
|
||||
#include <QMutexLocker>
|
||||
#include "previewgeneratorpdf.h"
|
||||
#include "previewgeneratorplaintext.h"
|
||||
#include "previewgeneratorodt.h"
|
||||
|
||||
static PreviewGenerator *plainTextGenerator = new PreviewGeneratorPlainText();
|
||||
|
||||
static QMap<QString, PreviewGenerator *> generators{
|
||||
static QHash<QString, PreviewGenerator *> generators{
|
||||
{"pdf", new PreviewGeneratorPdf()}, {"txt", plainTextGenerator}, {"md", plainTextGenerator},
|
||||
{"py", plainTextGenerator}, {"java", plainTextGenerator}, {"js", plainTextGenerator},
|
||||
{"cpp", plainTextGenerator}, {"c", plainTextGenerator}, {"sql", plainTextGenerator},
|
||||
{"odt", new PreviewGeneratorOdt()}};
|
||||
|
||||
static QMutex generatorsMutex;
|
||||
PreviewGenerator *PreviewGenerator::get(QFileInfo &info)
|
||||
{
|
||||
QMutexLocker locker(&generatorsMutex);
|
||||
PreviewGenerator *result = generators.value(info.suffix(), nullptr);
|
||||
locker.unlock();
|
||||
if(result == nullptr)
|
||||
{
|
||||
if(Common::isTextFile(info))
|
||||
|
@ -7,10 +7,12 @@ static QMutex cacheMutex;
|
||||
|
||||
Poppler::Document *PreviewGeneratorPdf::document(QString path)
|
||||
{
|
||||
QMutexLocker locker(&cacheMutex);
|
||||
if(documentcache.contains(path))
|
||||
{
|
||||
return documentcache.value(path);
|
||||
}
|
||||
locker.unlock();
|
||||
Poppler::Document *result = Poppler::Document::load(path);
|
||||
if(result == nullptr)
|
||||
{
|
||||
@ -18,8 +20,10 @@ Poppler::Document *PreviewGeneratorPdf::document(QString path)
|
||||
return nullptr;
|
||||
}
|
||||
result->setRenderHint(Poppler::Document::TextAntialiasing);
|
||||
result->setRenderHint(Poppler::Document::TextHinting);
|
||||
result->setRenderHint(Poppler::Document::TextSlightHinting);
|
||||
|
||||
QMutexLocker locker(&cacheMutex);
|
||||
locker.relock();
|
||||
documentcache.insert(path, result);
|
||||
locker.unlock();
|
||||
return result;
|
||||
|
@ -103,7 +103,7 @@ QString PreviewGeneratorPlainText::generateLineBasedPreviewText(QTextStream &in,
|
||||
int foundWordsCount = 0;
|
||||
for(QString &word : config.wordsToHighlight)
|
||||
{
|
||||
QRegularExpression searchRegex("\\b" + word + "\\b");
|
||||
QRegularExpression searchRegex("\\b" + QRegularExpression::escape(word) + "\\b");
|
||||
bool containsRegex = line.contains(searchRegex);
|
||||
bool contains = false;
|
||||
if(!containsRegex)
|
||||
|
@ -30,7 +30,7 @@ QByteArray PreviewResultPdf::serialize() const
|
||||
|
||||
QSharedPointer<PreviewResultPdf> PreviewResultPdf::deserialize(QByteArray &ba)
|
||||
{
|
||||
PreviewResultPdf *result = new PreviewResultPdf();
|
||||
QSharedPointer<PreviewResultPdf> result(new PreviewResultPdf());
|
||||
PreviewResultType type;
|
||||
|
||||
QDataStream stream{&ba, QIODevice::ReadOnly};
|
||||
@ -40,5 +40,5 @@ QSharedPointer<PreviewResultPdf> PreviewResultPdf::deserialize(QByteArray &ba)
|
||||
throw std::runtime_error("Invalid byte array: Not a pdf preview");
|
||||
}
|
||||
stream >> result->documentPath >> result->page >> result->previewImage;
|
||||
return QSharedPointer<PreviewResultPdf>(result);
|
||||
return result;
|
||||
}
|
||||
|
@ -40,7 +40,8 @@ QByteArray PreviewResultPlainText::serialize() const
|
||||
|
||||
QSharedPointer<PreviewResultPlainText> PreviewResultPlainText::deserialize(QByteArray &ba)
|
||||
{
|
||||
PreviewResultPlainText *result = new PreviewResultPlainText();
|
||||
QSharedPointer<PreviewResultPlainText> result(new PreviewResultPlainText());
|
||||
|
||||
PreviewResultType type;
|
||||
|
||||
QDataStream stream{&ba, QIODevice::ReadOnly};
|
||||
@ -50,5 +51,5 @@ QSharedPointer<PreviewResultPlainText> PreviewResultPlainText::deserialize(QByte
|
||||
throw std::runtime_error("Invalid byte array: Not a pdf preview");
|
||||
}
|
||||
stream >> result->documentPath >> result->page >> result->text;
|
||||
return QSharedPointer<PreviewResultPlainText>(result);
|
||||
return result;
|
||||
}
|
||||
|
@ -152,12 +152,14 @@ void Indexer::processFileScanResult(FileScanResult result)
|
||||
++this->currentIndexResult.erroredPaths;
|
||||
}
|
||||
|
||||
if(currentScanProcessedCount++ == progressReportThreshold)
|
||||
QTime currentTime = QTime::currentTime();
|
||||
if(currentScanProcessedCount++ == progressReportThreshold || this->lastProgressReportTime.secsTo(currentTime) >= 10)
|
||||
{
|
||||
emit indexProgress(this->currentIndexResult.total(), this->currentIndexResult.addedPaths,
|
||||
this->currentIndexResult.skippedPaths, this->currentIndexResult.erroredPaths,
|
||||
this->dirScanner->pathCount());
|
||||
currentScanProcessedCount = 0;
|
||||
this->lastProgressReportTime = currentTime;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,6 +72,8 @@ class Indexer : public QObject
|
||||
IndexResult currentIndexResult;
|
||||
void launchWorker(ConcurrentQueue<QString> &queue, int batchsize);
|
||||
|
||||
QTime lastProgressReportTime = QTime::currentTime();
|
||||
|
||||
public:
|
||||
bool isRunning();
|
||||
|
||||
|
3
shared/migrations/4.sql
普通文件
3
shared/migrations/4.sql
普通文件
@ -0,0 +1,3 @@
|
||||
CREATE VIRTUAL TABLE fts_trigram USING fts5(content, content='',tokenize="trigram");
|
||||
ALTER TABLE content ADD COLUMN fts_trigramid integer;
|
||||
CREATE INDEX content_fts_trigramid ON content (fts_trigramid);
|
@ -3,5 +3,6 @@
|
||||
<file>1.sql</file>
|
||||
<file>2.sql</file>
|
||||
<file>3.sql</file>
|
||||
<file>4.sql</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -110,6 +110,44 @@ unsigned int SqliteDbService::getFiles(QVector<FileData> &results, QString wildC
|
||||
return processedRows;
|
||||
}
|
||||
|
||||
bool SqliteDbService::insertToFTS(bool useTrigrams, QSqlDatabase &db, int fileid, QVector<PageData> &pageData)
|
||||
{
|
||||
QString ftsInsertStatement;
|
||||
QString contentInsertStatement;
|
||||
if(useTrigrams)
|
||||
{
|
||||
ftsInsertStatement = "INSERT INTO fts_trigram(content) VALUES(?)";
|
||||
contentInsertStatement = "INSERT INTO content(fileid, page, fts_trigramid) VALUES(?, ?, last_insert_rowid())";
|
||||
}
|
||||
else
|
||||
{
|
||||
ftsInsertStatement = "INSERT INTO fts(content) VALUES(?)";
|
||||
contentInsertStatement = "INSERT INTO content(fileid, page, ftsid) VALUES(?, ?, last_insert_rowid())";
|
||||
}
|
||||
|
||||
for(const PageData &data : pageData)
|
||||
{
|
||||
QSqlQuery ftsQuery(db);
|
||||
ftsQuery.prepare(ftsInsertStatement);
|
||||
ftsQuery.addBindValue(data.content);
|
||||
if(!ftsQuery.exec())
|
||||
{
|
||||
Logger::error() << "Failed fts insertion " << ftsQuery.lastError() << Qt::endl;
|
||||
return false;
|
||||
}
|
||||
QSqlQuery contentQuery(db);
|
||||
contentQuery.prepare(contentInsertStatement);
|
||||
contentQuery.addBindValue(fileid);
|
||||
contentQuery.addBindValue(data.pagenumber);
|
||||
if(!contentQuery.exec())
|
||||
{
|
||||
Logger::error() << "Failed content insertion " << contentQuery.lastError() << Qt::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
SaveFileResult SqliteDbService::saveFile(QFileInfo fileInfo, QVector<PageData> &pageData)
|
||||
{
|
||||
QString absPath = fileInfo.absoluteFilePath();
|
||||
@ -149,24 +187,18 @@ SaveFileResult SqliteDbService::saveFile(QFileInfo fileInfo, QVector<PageData> &
|
||||
}
|
||||
|
||||
int lastid = inserterQuery.lastInsertId().toInt();
|
||||
for(const PageData &data : pageData)
|
||||
if(!insertToFTS(false, db, lastid, pageData))
|
||||
{
|
||||
QSqlQuery ftsQuery(db);
|
||||
ftsQuery.prepare("INSERT INTO fts(content) VALUES(?)");
|
||||
ftsQuery.addBindValue(data.content);
|
||||
ftsQuery.exec();
|
||||
QSqlQuery contentQuery(db);
|
||||
contentQuery.prepare("INSERT INTO content(fileid, page, ftsid) VALUES(?, ?, last_insert_rowid())");
|
||||
contentQuery.addBindValue(lastid);
|
||||
contentQuery.addBindValue(data.pagenumber);
|
||||
if(!contentQuery.exec())
|
||||
{
|
||||
db.rollback();
|
||||
Logger::error() << "Failed content insertion " << contentQuery.lastError() << Qt::endl;
|
||||
return DBFAIL;
|
||||
}
|
||||
db.rollback();
|
||||
Logger::error() << "Failed to insert data to FTS index " << Qt::endl;
|
||||
return DBFAIL;
|
||||
}
|
||||
if(!insertToFTS(true, db, lastid, pageData))
|
||||
{
|
||||
db.rollback();
|
||||
Logger::error() << "Failed to insert data to FTS index " << Qt::endl;
|
||||
return DBFAIL;
|
||||
}
|
||||
|
||||
if(!db.commit())
|
||||
{
|
||||
db.rollback();
|
||||
|
@ -13,6 +13,7 @@ class SqliteDbService
|
||||
{
|
||||
private:
|
||||
DatabaseFactory *dbFactory = nullptr;
|
||||
bool insertToFTS(bool useTrigrams, QSqlDatabase &db, int fileid, QVector<PageData> &pageData);
|
||||
|
||||
public:
|
||||
SqliteDbService(DatabaseFactory &dbFactory);
|
||||
|
@ -82,11 +82,10 @@ QString SqliteSearch::escapeFtsArgument(QString ftsArg)
|
||||
{
|
||||
value = value.mid(0, value.size() - 1);
|
||||
}
|
||||
result += "\"" + value + "\"*";
|
||||
result += "\"" + value + "\"* ";
|
||||
}
|
||||
else
|
||||
{
|
||||
value = "\"\"" + value + "\"\"";
|
||||
result += "\"" + value + "\" ";
|
||||
}
|
||||
}
|
||||
@ -142,9 +141,7 @@ QPair<QString, QVector<QString>> SqliteSearch::createSql(const Token &token)
|
||||
}
|
||||
if(token.type == FILTER_CONTENT_CONTAINS)
|
||||
{
|
||||
return {" content.id IN (SELECT fts.ROWID FROM fts WHERE fts.content MATCH ? ORDER BY "
|
||||
"rank) ",
|
||||
{escapeFtsArgument(value)}};
|
||||
return {" fts MATCH ? ", {escapeFtsArgument(value)}};
|
||||
}
|
||||
throw LooqsGeneralException("Unknown token passed (should not happen)");
|
||||
}
|
||||
@ -160,30 +157,17 @@ QSqlQuery SqliteSearch::makeSqlQuery(const LooqsQuery &query)
|
||||
throw LooqsGeneralException("Nothing to search for supplied");
|
||||
}
|
||||
|
||||
bool ftsAlreadyJoined = false;
|
||||
auto tokens = query.getTokens();
|
||||
for(const Token &token : tokens)
|
||||
{
|
||||
if(token.type == FILTER_CONTENT_CONTAINS)
|
||||
{
|
||||
if(!ftsAlreadyJoined)
|
||||
{
|
||||
joinSql += " INNER JOIN fts ON content.ftsid = fts.ROWID ";
|
||||
ftsAlreadyJoined = true;
|
||||
}
|
||||
whereSql += " fts.content MATCH ? ";
|
||||
bindValues.append(escapeFtsArgument(token.value));
|
||||
}
|
||||
else
|
||||
{
|
||||
auto sql = createSql(token);
|
||||
whereSql += sql.first;
|
||||
bindValues.append(sql.second);
|
||||
}
|
||||
auto sql = createSql(token);
|
||||
whereSql += sql.first;
|
||||
bindValues.append(sql.second);
|
||||
}
|
||||
|
||||
QString prepSql;
|
||||
QString sortSql = createSortSql(query.getSortConditions());
|
||||
int bindIterations = 1;
|
||||
if(isContentSearch)
|
||||
{
|
||||
if(sortSql.isEmpty())
|
||||
@ -191,12 +175,24 @@ QSqlQuery SqliteSearch::makeSqlQuery(const LooqsQuery &query)
|
||||
if(std::find_if(tokens.begin(), tokens.end(),
|
||||
[](const Token &t) -> bool { return t.type == FILTER_CONTENT_CONTAINS; }) != tokens.end())
|
||||
{
|
||||
sortSql = "ORDER BY rank";
|
||||
sortSql = "ORDER BY prio, rank";
|
||||
}
|
||||
}
|
||||
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;
|
||||
QString whereSqlTrigram = whereSql;
|
||||
whereSqlTrigram.replace("fts MATCH", "fts_trigram MATCH"); // A bit dirty...
|
||||
prepSql =
|
||||
"SELECT DISTINCT path, page, mtime, size, filetype FROM ("
|
||||
"SELECT file.path AS path, content.page AS page, file.mtime AS mtime, file.size AS size, "
|
||||
"file.filetype AS filetype, 0 AS prio, fts.rank AS rank FROM file INNER JOIN content ON file.id = "
|
||||
"content.fileid "
|
||||
"INNER JOIN fts ON content.ftsid = fts.ROWID WHERE 1=1 AND " +
|
||||
whereSql +
|
||||
"UNION ALL SELECT file.path AS path, content.page AS page, file.mtime AS mtime, file.size AS size, "
|
||||
"file.filetype AS filetype, 1 as prio, fts_trigram.rank AS rank FROM file INNER JOIN content ON file.id = "
|
||||
"content.fileid " +
|
||||
"INNER JOIN fts_trigram ON content.fts_trigramid = fts_trigram.ROWID WHERE 1=1 AND " + whereSqlTrigram +
|
||||
" ) " + sortSql;
|
||||
++bindIterations;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -216,11 +212,14 @@ QSqlQuery SqliteSearch::makeSqlQuery(const LooqsQuery &query)
|
||||
|
||||
QSqlQuery dbquery(*db);
|
||||
dbquery.prepare(prepSql);
|
||||
for(const QString &value : bindValues)
|
||||
for(int i = 0; i < bindIterations; i++)
|
||||
{
|
||||
if(value != "")
|
||||
for(const QString &value : bindValues)
|
||||
{
|
||||
dbquery.addBindValue(value);
|
||||
if(value != "")
|
||||
{
|
||||
dbquery.addBindValue(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return dbquery;
|
||||
|
在新工单中引用
屏蔽一个用户