4 Tiomáintí

Údar SHA1 Teachtaireacht Dáta
b4320f611b Release v0.8, minor README changes 2022-10-22 17:20:20 +02:00
1b1ab2387e gui: PreviewGeneratorPdf: Guard cache lookup with mutex
No guarantes the read-only lookup is thread-safe so better
just lock there too
2022-10-22 15:08:29 +02:00
49a1a14009 gui: previewgenerator: Use QHash and guard using mutexes 2022-10-22 15:07:46 +02:00
48ca25abe3 gui: mainwindow: Reorder members for readability 2022-10-19 11:56:21 +02:00
D'athraigh 5 comhad le 53 breiseanna agus 36 scriosta

Féach ar an gComhad

@ -1,4 +1,15 @@
# looqs: Release notes # looqs: Release notes
## 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 ## 2022-09-10 - v0.7
CHANGES: CHANGES:

Féach ar an gComhad

@ -28,11 +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. 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 ## Current status
Latest version: 2022-09-10, v0.7 Latest version: 2022-10-22, v0.8
Please keep in mind: looqs is still at an early stage and may exhibit some weirdness and contain bugs. 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. Please see [Changelog](CHANGELOG.md) for a human readable list of changes. For download instructions, see
further down this document.
## Goals and principles ## Goals and principles
@ -96,7 +97,7 @@ The GUI is located in `gui/looqs-gui`, the binary for the CLI is in `cli/looqs`
## Packages ## Packages
At this point, looqs is not in any official distro package repo, but I maintain some 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. Latest release can be installed using apt from the repo.
``` ```
# First, obtain key, assume it's trusted. # First, obtain key, assume it's trusted.

Féach ar an gComhad

@ -23,16 +23,6 @@ class MainWindow : public QMainWindow
{ {
Q_OBJECT 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: private:
DatabaseFactory *dbFactory; DatabaseFactory *dbFactory;
SqliteDbService *dbService; SqliteDbService *dbService;
@ -40,40 +30,39 @@ class MainWindow : public QMainWindow
IPCPreviewClient ipcPreviewClient; IPCPreviewClient ipcPreviewClient;
QThread ipcClientThread; QThread ipcClientThread;
QThread syncerThread; QThread syncerThread;
Indexer *indexer;
IndexSyncer *indexSyncer; IndexSyncer *indexSyncer;
QProgressDialog progressDialog; QProgressDialog progressDialog;
Indexer *indexer;
QFileIconProvider iconProvider; QFileIconProvider iconProvider;
bool previewDirty;
QSqlDatabase db; QSqlDatabase db;
QFutureWatcher<QVector<SearchResult>> searchWatcher; QFutureWatcher<QVector<SearchResult>> searchWatcher;
void add(QString path, unsigned int page);
QVector<SearchResult> previewableSearchResults; QVector<SearchResult> previewableSearchResults;
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; LooqsQuery contentSearchQuery;
int previewsPerPage;
void createSearchResutlMenu(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; QVector<QString> searchHistory;
int currentSearchHistoryIndex = 0; int currentSearchHistoryIndex = 0;
QString currentSavedSearchText; QString currentSavedSearchText;
QHash<QString, int> previewOrder; /* Quick lookup for the order a preview should have */ QHash<QString, int> previewOrder; /* Quick lookup for the order a preview should have */
QMap<int, QWidget *> QMap<int, QWidget *>
previewWidgetOrderCache /* Saves those that arrived out of order to be inserted later at the correct pos */; previewWidgetOrderCache /* Saves those that arrived out of order to be inserted later at the correct pos */;
bool previewDirty;
int previewsPerPage;
unsigned int processedPdfPreviews;
unsigned int currentPreviewGeneration = 1;
void connectSignals();
void makePreviews(int page);
bool previewTabActive();
bool indexerTabActive();
void keyPressEvent(QKeyEvent *event) override;
void handleSearchResults(const QVector<SearchResult> &results);
void handleSearchError(QString error);
void createSearchResutlMenu(QMenu &menu, const QFileInfo &fileInfo);
void openDocument(QString path, int num);
void openFile(QString path);
void initSettingsTabs();
int currentSelectedScale();
void processShortcut(int key);
bool eventFilter(QObject *object, QEvent *event);
private slots: private slots:
void lineEditReturnPressed(); void lineEditReturnPressed();
@ -94,6 +83,16 @@ class MainWindow : public QMainWindow
void startIpcPreviews(RenderConfig config, const QVector<RenderTarget> &targets); void startIpcPreviews(RenderConfig config, const QVector<RenderTarget> &targets);
void stopIpcPreviews(); void stopIpcPreviews();
void beginIndexSync(); 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 #endif // MAINWINDOW_H

Féach ar an gComhad

@ -1,20 +1,24 @@
#include "../shared/common.h" #include "../shared/common.h"
#include "previewgenerator.h" #include "previewgenerator.h"
#include <QMutexLocker>
#include "previewgeneratorpdf.h" #include "previewgeneratorpdf.h"
#include "previewgeneratorplaintext.h" #include "previewgeneratorplaintext.h"
#include "previewgeneratorodt.h" #include "previewgeneratorodt.h"
static PreviewGenerator *plainTextGenerator = new PreviewGeneratorPlainText(); static PreviewGenerator *plainTextGenerator = new PreviewGeneratorPlainText();
static QMap<QString, PreviewGenerator *> generators{ static QHash<QString, PreviewGenerator *> generators{
{"pdf", new PreviewGeneratorPdf()}, {"txt", plainTextGenerator}, {"md", plainTextGenerator}, {"pdf", new PreviewGeneratorPdf()}, {"txt", plainTextGenerator}, {"md", plainTextGenerator},
{"py", plainTextGenerator}, {"java", plainTextGenerator}, {"js", plainTextGenerator}, {"py", plainTextGenerator}, {"java", plainTextGenerator}, {"js", plainTextGenerator},
{"cpp", plainTextGenerator}, {"c", plainTextGenerator}, {"sql", plainTextGenerator}, {"cpp", plainTextGenerator}, {"c", plainTextGenerator}, {"sql", plainTextGenerator},
{"odt", new PreviewGeneratorOdt()}}; {"odt", new PreviewGeneratorOdt()}};
static QMutex generatorsMutex;
PreviewGenerator *PreviewGenerator::get(QFileInfo &info) PreviewGenerator *PreviewGenerator::get(QFileInfo &info)
{ {
QMutexLocker locker(&generatorsMutex);
PreviewGenerator *result = generators.value(info.suffix(), nullptr); PreviewGenerator *result = generators.value(info.suffix(), nullptr);
locker.unlock();
if(result == nullptr) if(result == nullptr)
{ {
if(Common::isTextFile(info)) if(Common::isTextFile(info))

Féach ar an gComhad

@ -7,10 +7,12 @@ static QMutex cacheMutex;
Poppler::Document *PreviewGeneratorPdf::document(QString path) Poppler::Document *PreviewGeneratorPdf::document(QString path)
{ {
QMutexLocker locker(&cacheMutex);
if(documentcache.contains(path)) if(documentcache.contains(path))
{ {
return documentcache.value(path); return documentcache.value(path);
} }
locker.unlock();
Poppler::Document *result = Poppler::Document::load(path); Poppler::Document *result = Poppler::Document::load(path);
if(result == nullptr) if(result == nullptr)
{ {
@ -19,7 +21,7 @@ Poppler::Document *PreviewGeneratorPdf::document(QString path)
} }
result->setRenderHint(Poppler::Document::TextAntialiasing); result->setRenderHint(Poppler::Document::TextAntialiasing);
QMutexLocker locker(&cacheMutex); locker.relock();
documentcache.insert(path, result); documentcache.insert(path, result);
locker.unlock(); locker.unlock();
return result; return result;