1
0

Commits vergleichen

..

Keine gemeinsamen Commits. "5f1932867942957b0bc3f147b584791e89144857" und "759d2a792440aa53403fbe4c8c42726dfe34fafb" haben vollständig unterschiedliche Historien.

25 geänderte Dateien mit 106 neuen und 1616 gelöschten Zeilen

Datei anzeigen

@ -1,19 +1,5 @@
# looqs: Release notes # looqs: Release notes
## 2022-06-29 - v0.4
This release makes several minor improvements and begins prebuilt binaries of looqs that (should) run
on any recent Linux distribution.
- General: Begin new, experimental distro-agnostic tarball containing prebuilt binaries and libs. See the README for more information.
- GUI: In the "Previews" tab, allow filtering by file, to only show previews for a specific file.
- GUI: Add "Show previews" context menu option to files in result (if available)
- General: Fix build with libquazip 1.X
- General: Properly report access errors as a failure during indexing
- GUI: Add button to export a list of all paths that failed
- General: Improve dir scan threading
- CLI: Improve helptext
- General: Add voidlinux build instructions
## 2022-06-14 - v0.3 ## 2022-06-14 - v0.3
CHANGES: CHANGES:
- GUI: Add settings tab to configure various settings - GUI: Add settings tab to configure various settings

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -3,6 +3,8 @@ looqs is a tool that creates a full-text search index for your files. It allows
search terms have been found, as shown in the screenshots below. search terms have been found, as shown in the screenshots below.
## Screenshots ## Screenshots
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.
### Preview ### Preview
looqs allow you to look inside files. It marks what you have searched for. looqs allow you to look inside files. It marks what you have searched for.
@ -26,10 +28,9 @@ There is no need to write the long form of filters. There are also booleans avai
![Screenshot looqs results](https://garage.quitesimple.org/assets/looqs/looqs_beatles_marley.png) ![Screenshot looqs results](https://garage.quitesimple.org/assets/looqs/looqs_beatles_marley.png)
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-06-29, v0.4 Last version: 2022-06-14, v0.3
Please see [Changelog](CHANGELOG.md) for a human readable list of changes. Please see [Changelog](CHANGELOG.md) for a human readable list of changes.
@ -57,8 +58,6 @@ Linux (on amd64) is currently the main focus. Currently, I don't plan on support
### Licence ### Licence
GPLv3. GPLv3.
For the dependencies/third-party libraries, see: LICENSE-3RD-PARTY
### Contributing ### Contributing
Please see the [Contribution guidelines](CONTRIBUTING.md) file. Please see the [Contribution guidelines](CONTRIBUTING.md) file.
@ -107,35 +106,7 @@ sudo apt-get update
sudo apt-get install looqs sudo apt-get install looqs
``` ```
### Prebuilt tarball (distro-agnostic) (EXPERIMENTAL)
looqs is also distributed as a tarball containing prebuilt binaries and its library dependencies. The tarball is
built using the Gentoo Hardened toolchain and the Qt version is smaller than what distributions usually
include. It does not include libraries that should mess with fontrendering or the graphics stack. The binaries should run on any recent Linux distribution (requires glibc 2.34 or newer at least) and expects
dependencies such as libGL to be provided by your distribution already (should be the case).
It's considered experimental for two reasons. Firstly, looqs has no updater (yet). You will have to manually check for updates. Secondly, I can't guarantee that I'll be quick with updates of the tarball specifically if the library versions become outdated between looqs updates.
You are therefore encouraged to use distro-native packages or to build it yourself if possible.
The tarball can be obtained here: https://repo.quitesimple.org/tarball/looqs
Quick start:
```
# Verify sig, see the end of this document: gpg --verify looqs-v0.4.tar.xz.sig
tar xf looqs-v0.4.tar.xz # Replace with the actual version you have obtained
cd looqs-v0.4
./looqs-gui # or ./looqs for the CLI
```
An AppImage may accompany the tarball in the future.
### Other distros ### Other distros
I'll probably add a package for voidlinux at some point and maybe will provide a Gentoo ebuild. However, I would appreciate help for others distros. If you create a package, let me know! I'll probably add a package for voidlinux at some point and maybe will provide a Gentoo ebuild. However, I would appreciate help for others distros. If you create a package, let me know!
As for distro-agnostic packages, I will also take a look into appimage / flatpak etc. and/or maybe just provide a self-contained archive.
### Signature verification
Release tags can be verified with [my PGP public key](https://quitesimple.org/share/pubkey). For what little it's worth, its fingerprint is: `C342 CA02 D2EC 2E14 F3C3 D5FF 7F7B 4C08 02CD 02F2`
Packages can be verified with the [repo-specific public key](https://repo.quitesimple.org/repo.quitesimple.org.asc). For what little it's worth, its fingerprint is: `1B49 45B3 16B2 468A 3DAC C1E0 75EF 3FE8 D753 C8F9`

Datei anzeigen

@ -47,8 +47,7 @@ int CommandAdd::handle(QStringList arguments)
{{"t", "threads"}, "Number of threads to use.", "threads"}}); {{"t", "threads"}, "Number of threads to use.", "threads"}});
parser.addHelpOption(); parser.addHelpOption();
parser.addPositionalArgument("add", "Add paths to the index", parser.addPositionalArgument("add", "Add paths to the index", "add [paths...]");
"add [paths...]. If no path is given, read from stdin, one path per line.");
parser.process(arguments); parser.process(arguments);
this->keepGoing = parser.isSet("continue"); this->keepGoing = parser.isSet("continue");

Datei anzeigen

@ -30,7 +30,6 @@
void printUsage(QString argv0) void printUsage(QString argv0)
{ {
qInfo() << "Usage:" << argv0 << "command"; qInfo() << "Usage:" << argv0 << "command";
qInfo() << "Valid commands: add, update, delete, search, list. Each command has a --help option.";
} }
Command *commandFromName(QString name, SqliteDbService &dbService) Command *commandFromName(QString name, SqliteDbService &dbService)
@ -98,7 +97,7 @@ int main(int argc, char *argv[])
QString file = args.at(1); QString file = args.at(1);
SandboxedProcessor processor(file); SandboxedProcessor processor(file);
return static_cast<int>(processor.process()); return processor.process();
} }
Command *cmd = commandFromName(commandName, dbService); Command *cmd = commandFromName(commandName, dbService);
if(cmd != nullptr) if(cmd != nullptr)
@ -117,7 +116,7 @@ int main(int argc, char *argv[])
} }
else else
{ {
printUsage(argv0); Logger::error() << "Unknown command:" << commandName << Qt::endl;
return 1; return 1;
} }

Datei anzeigen

@ -1,74 +0,0 @@
#include <QTabWidget>
#include <QVBoxLayout>
#include <QLabel>
#include <QTextBrowser>
#include <QPushButton>
#include "aboutdialog.h"
#include "common.h"
AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent)
{
QVBoxLayout *layout = new QVBoxLayout(this);
QTabWidget *tabWidget = new QTabWidget(this);
this->setWindowTitle("About looqs");
QHBoxLayout *closeLayout = new QHBoxLayout();
QPushButton *closeButton = new QPushButton(this);
closeButton->setText("Close");
closeButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
connect(closeButton, &QPushButton::clicked, this, &QDialog::close);
closeLayout->setMargin(10);
closeLayout->addStretch(10);
closeLayout->addWidget(closeButton);
layout->addWidget(tabWidget);
layout->addLayout(closeLayout);
QFrame *frame = new QFrame(this);
QVBoxLayout *aboutLayout = new QVBoxLayout(frame);
frame->setLayout(aboutLayout);
QLabel *aboutLooqs = new QLabel(this);
QString html = "<h2>looqs</h2>";
html += "Full-text search with previews for your files<br><br>";
html += "Copyright (c) 2018-2022: Albert Schwarzkopf<br><br>";
html += QString("Version: %1<br><br>").arg(Common::versionText());
html += "Contact: looqs at quitesimple dot org<br><br>";
html += "Website: <a href=\"https://quitesimple.org\">https://quitesimple.org</a><br><br>";
html += "Source code: <a "
"href=\"https://github.com/quitesimpleorg/looqs\">https://github.com/quitesimpleorg/looqs</a><br><br>";
html += "License: GPLv3<br><br>";
html += "looqs is open source and free of charge in the hope it will be useful. The author(s) do not "
"give any warranty. In the unlikely event of any damage, the author(s) cannot be held responsible. "
"You are using looqs at your own risk<br><br>";
html += "looqs uses third-party libraries, please see the corresponding tab.";
aboutLooqs->setText(html);
aboutLooqs->setTextFormat(Qt::RichText);
QLabel *logo = new QLabel(this);
QImage image(QString(":/looqs.svg"));
logo->setPixmap(QPixmap::fromImage(image));
aboutLayout->addWidget(logo);
aboutLayout->addWidget(aboutLooqs);
tabWidget->addTab(frame, "About");
QFile license(QString(":/LICENSE"));
license.open(QIODevice::ReadOnly);
QString licenseText = license.readAll();
QFile thirdPartyLicense(QString(":./LICENSE-3RD-PARTY"));
thirdPartyLicense.open(QIODevice::ReadOnly);
QString thirdPartyLicenseInfo = thirdPartyLicense.readAll();
QTextBrowser *licenseTextBrowser = new QTextBrowser(this);
licenseTextBrowser->setText(licenseText);
QTextBrowser *thirdPartyLicenceTextBrowser = new QTextBrowser(this);
thirdPartyLicenceTextBrowser->setText(thirdPartyLicenseInfo);
tabWidget->addTab(licenseTextBrowser, "License");
tabWidget->addTab(thirdPartyLicenceTextBrowser, "Third-party libraries");
}

Datei anzeigen

@ -1,12 +0,0 @@
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H
#include <QDialog>
class AboutDialog : public QDialog
{
Q_OBJECT
public:
AboutDialog(QWidget *parent = nullptr);
};
#endif // ABOUTDIALOG_H

Datei anzeigen

@ -27,7 +27,6 @@ DEFINES += QT_DEPRECATED_WARNINGS
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \ SOURCES += \
aboutdialog.cpp \
ipcpreviewclient.cpp \ ipcpreviewclient.cpp \
ipcpreviewworker.cpp \ ipcpreviewworker.cpp \
ipcserver.cpp \ ipcserver.cpp \
@ -45,7 +44,6 @@ SOURCES += \
rendertarget.cpp rendertarget.cpp
HEADERS += \ HEADERS += \
aboutdialog.h \
ipc.h \ ipc.h \
ipcpreviewclient.h \ ipcpreviewclient.h \
ipcpreviewworker.h \ ipcpreviewworker.h \

Datei anzeigen

@ -114,7 +114,7 @@ int main(int argc, char *argv[])
QString file = args.at(2); QString file = args.at(2);
SandboxedProcessor processor(file); SandboxedProcessor processor(file);
return static_cast<int>(processor.process()); return processor.process();
} }
} }
QString ipcSocketPath = Common::ipcSocketPath(); QString ipcSocketPath = Common::ipcSocketPath();

Datei anzeigen

@ -23,7 +23,6 @@
#include "../shared/common.h" #include "../shared/common.h"
#include "ipcpreviewclient.h" #include "ipcpreviewclient.h"
#include "previewgenerator.h" #include "previewgenerator.h"
#include "aboutdialog.h"
MainWindow::MainWindow(QWidget *parent, QString socketPath) MainWindow::MainWindow(QWidget *parent, QString socketPath)
: QMainWindow(parent), ui(new Ui::MainWindow), progressDialog(this) : QMainWindow(parent), ui(new Ui::MainWindow), progressDialog(this)
@ -41,7 +40,6 @@ MainWindow::MainWindow(QWidget *parent, QString socketPath)
{ {
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);
}); });
connect(&ipcPreviewClient, &IPCPreviewClient::error, this, connect(&ipcPreviewClient, &IPCPreviewClient::error, this,
[this](QString msg) [this](QString msg)
@ -84,13 +82,6 @@ MainWindow::MainWindow(QWidget *parent, QString socketPath)
ui->spinPreviewPage->setValue(1); ui->spinPreviewPage->setValue(1);
ui->spinPreviewPage->setMinimum(1); ui->spinPreviewPage->setMinimum(1);
ui->btnOpenFailed->setVisible(false);
ui->comboPreviewFiles->setVisible(false);
auto policy = ui->btnOpenFailed->sizePolicy();
policy.setRetainSizeWhenHidden(true);
ui->btnOpenFailed->setSizePolicy(policy);
} }
void MainWindow::addPathToIndex() void MainWindow::addPathToIndex()
@ -181,12 +172,25 @@ void MainWindow::connectSignals()
} }
} }
}); });
connect(ui->menuAboutAction, &QAction::triggered, this, connect(
ui->menuAboutAction, &QAction::triggered, this,
[this](bool checked) [this](bool checked)
{ {
AboutDialog aboutDialog(this); QString html = "<h2>looqs</h2>";
html += "Full-text search with previews for your files<br><br>";
html += "Copyright (c) 2018-2022: Albert Schwarzkopf<br><br>";
html += QString("Version: %1<br><br>").arg(Common::versionText());
html += "Contact: looqs at quitesimple dot org<br><br>";
html += "Website: <a href=\"https://quitesimple.org\">https://quitesimple.org</a><br><br>";
html +=
"Source code: <a "
"href=\"https://github.com/quitesimpleorg/looqs\">https://github.com/quitesimpleorg/looqs</a><br><br>";
html += "License: GPLv3<br><br><br>";
html += "looqs is open source and free of charge in the hope it will be useful. The author(s) do not "
"give any warranty. In the unlikely event of any damage, the author(s) cannot be held responsible. "
"You are using looqs at your own risk";
aboutDialog.exec(); QMessageBox::about(this, "About looqs", html);
}); });
connect(ui->menuAboutQtAction, &QAction::triggered, this, connect(ui->menuAboutQtAction, &QAction::triggered, this,
[this](bool checked) { QMessageBox::aboutQt(this, "About Qt"); }); [this](bool checked) { QMessageBox::aboutQt(this, "About Qt"); });
@ -206,35 +210,6 @@ void MainWindow::connectSignals()
connect(this, &MainWindow::beginIndexSync, indexSyncer, &IndexSyncer::sync); connect(this, &MainWindow::beginIndexSync, indexSyncer, &IndexSyncer::sync);
connect(&this->progressDialog, &QProgressDialog::canceled, indexSyncer, &IndexSyncer::cancel); connect(&this->progressDialog, &QProgressDialog::canceled, indexSyncer, &IndexSyncer::cancel);
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->comboPreviewFiles, qOverload<int>(&QComboBox::currentIndexChanged), this, [&]() { makePreviews(1); },
Qt::QueuedConnection);
}
void MainWindow::exportFailedPaths()
{
QString filename =
QString("/tmp/looqs_indexresult_failed_%1").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd_hhmmss"));
QFile outFile(filename);
if(!outFile.open(QIODevice::WriteOnly | QIODevice::Text))
{
QMessageBox::critical(this, "Failed to write log file", "An error occured while trying to create log file");
return;
}
QTextStream stream(&outFile);
IndexResult result = this->indexer->getResult();
stream << "Failed to index the following paths:\n";
for(FileScanResult &fsr : result.failedResults())
{
stream << fsr.first << " " << SaveFileResultToString(fsr.second) << '\n';
}
QDesktopServices::openUrl(filename);
} }
void MainWindow::startIndexSync() void MainWindow::startIndexSync()
@ -279,7 +254,6 @@ void MainWindow::startIndexing()
ui->txtSearch->setEnabled(false); ui->txtSearch->setEnabled(false);
ui->previewProcessBar->setValue(0); ui->previewProcessBar->setValue(0);
ui->previewProcessBar->setVisible(true); ui->previewProcessBar->setVisible(true);
ui->btnOpenFailed->setVisible(false);
QVector<QString> paths; QVector<QString> paths;
QStringList pathSettingsValue; QStringList pathSettingsValue;
@ -315,10 +289,6 @@ void MainWindow::finishIndexing()
ui->settingsTab->setEnabled(true); ui->settingsTab->setEnabled(true);
ui->txtPathScanAdd->setEnabled(true); ui->txtPathScanAdd->setEnabled(true);
ui->txtSearch->setEnabled(true); ui->txtSearch->setEnabled(true);
if(result.erroredPaths > 0)
{
ui->btnOpenFailed->setVisible(true);
}
} }
void MainWindow::comboScaleChanged(int i) void MainWindow::comboScaleChanged(int i)
@ -507,9 +477,6 @@ void MainWindow::handleSearchResults(const QVector<SearchResult> &results)
{ {
this->previewableSearchResults.clear(); this->previewableSearchResults.clear();
ui->treeResultsList->clear(); ui->treeResultsList->clear();
ui->comboPreviewFiles->clear();
ui->comboPreviewFiles->addItem("All previews");
ui->comboPreviewFiles->setVisible(true);
bool hasDeleted = false; bool hasDeleted = false;
for(const SearchResult &result : results) for(const SearchResult &result : results)
@ -538,7 +505,6 @@ void MainWindow::handleSearchResults(const QVector<SearchResult> &results)
if(PreviewGenerator::get(pathInfo) != nullptr) if(PreviewGenerator::get(pathInfo) != nullptr)
{ {
this->previewableSearchResults.append(result); this->previewableSearchResults.append(result);
ui->comboPreviewFiles->addItem(result.fileData.absPath);
} }
} }
} }
@ -616,13 +582,6 @@ void MainWindow::makePreviews(int page)
QVector<RenderTarget> targets; QVector<RenderTarget> targets;
for(SearchResult &sr : this->previewableSearchResults) for(SearchResult &sr : this->previewableSearchResults)
{ {
if(ui->comboPreviewFiles->currentIndex() != 0)
{
if(sr.fileData.absPath != ui->comboPreviewFiles->currentText())
{
continue;
}
}
RenderTarget renderTarget; RenderTarget renderTarget;
renderTarget.path = sr.fileData.absPath; renderTarget.path = sr.fileData.absPath;
@ -643,7 +602,6 @@ void MainWindow::makePreviews(int page)
ui->previewProcessBar->setVisible(this->previewableSearchResults.size() > 0); ui->previewProcessBar->setVisible(this->previewableSearchResults.size() > 0);
++this->currentPreviewGeneration; ++this->currentPreviewGeneration;
this->ui->spinPreviewPage->setEnabled(false); this->ui->spinPreviewPage->setEnabled(false);
this->ui->comboPreviewFiles->setEnabled(false);
emit startIpcPreviews(renderConfig, targets); emit startIpcPreviews(renderConfig, targets);
} }
@ -659,20 +617,6 @@ void MainWindow::createSearchResutlMenu(QMenu &menu, const QFileInfo &fileInfo)
menu.addAction("Copy full path to clipboard", menu.addAction("Copy full path to clipboard",
[&fileInfo] { QGuiApplication::clipboard()->setText(fileInfo.absoluteFilePath()); }); [&fileInfo] { QGuiApplication::clipboard()->setText(fileInfo.absoluteFilePath()); });
menu.addAction("Open containing folder", [this, &fileInfo] { this->openFile(fileInfo.absolutePath()); }); menu.addAction("Open containing folder", [this, &fileInfo] { this->openFile(fileInfo.absolutePath()); });
auto result =
std::find_if(this->previewableSearchResults.begin(), this->previewableSearchResults.end(),
[this, &fileInfo](SearchResult &a) { return fileInfo.absoluteFilePath() == a.fileData.absPath; });
if(result != this->previewableSearchResults.end())
{
menu.addAction("Show previews for this file",
[this, &fileInfo]
{
ui->tabWidget->setCurrentIndex(1);
this->ui->comboPreviewFiles->setCurrentText(fileInfo.absoluteFilePath());
});
}
} }
void MainWindow::openDocument(QString path, int num) void MainWindow::openDocument(QString path, int num)

Datei anzeigen

@ -75,7 +75,6 @@ class MainWindow : public QMainWindow
void addPathToIndex(); void addPathToIndex();
void startIndexSync(); void startIndexSync();
void saveSettings(); void saveSettings();
void exportFailedPaths();
signals: signals:
void startIpcPreviews(RenderConfig config, const QVector<RenderTarget> &targets); void startIpcPreviews(RenderConfig config, const QVector<RenderTarget> &targets);

Datei anzeigen

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1280</width> <width>1280</width>
<height>855</height> <height>736</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -27,7 +27,7 @@
<enum>QTabWidget::South</enum> <enum>QTabWidget::South</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>3</number>
</property> </property>
<widget class="QWidget" name="resultsTab"> <widget class="QWidget" name="resultsTab">
<attribute name="title"> <attribute name="title">
@ -82,7 +82,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1244</width> <width>1244</width>
<height>565</height> <height>446</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"/> <layout class="QHBoxLayout" name="horizontalLayout"/>
@ -162,16 +162,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QComboBox" name="comboPreviewFiles">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
@ -194,16 +184,6 @@
<string>Index</string> <string>Index</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="6" column="0">
<widget class="QLineEdit" name="txtIgnorePatterns"/>
</item>
<item row="11" column="0">
<widget class="QPushButton" name="btnStartIndexing">
<property name="text">
<string>Start indexing</string>
</property>
</widget>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QGroupBox" name="groupBoxPaths"> <widget class="QGroupBox" name="groupBoxPaths">
<property name="title"> <property name="title">
@ -263,12 +243,6 @@
<layout class="QHBoxLayout" name="horizontalLayout_7"> <layout class="QHBoxLayout" name="horizontalLayout_7">
<item> <item>
<widget class="QLabel" name="lblPathsFound"> <widget class="QLabel" name="lblPathsFound">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string>Paths found:</string> <string>Paths found:</string>
</property> </property>
@ -276,42 +250,17 @@
</item> </item>
<item> <item>
<widget class="QLabel" name="lblPathsFoundValue"> <widget class="QLabel" name="lblPathsFoundValue">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<item> <item>
<widget class="QLabel" name="lblAdded"> <widget class="QLabel" name="lblAdded">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font"> <property name="font">
<font> <font>
<weight>50</weight> <weight>50</weight>
@ -325,42 +274,17 @@
</item> </item>
<item> <item>
<widget class="QLabel" name="lblAddedValue"> <widget class="QLabel" name="lblAddedValue">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_5"> <layout class="QHBoxLayout" name="horizontalLayout_5">
<item> <item>
<widget class="QLabel" name="lblSkipped"> <widget class="QLabel" name="lblSkipped">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font"> <property name="font">
<font> <font>
<weight>50</weight> <weight>50</weight>
@ -374,42 +298,17 @@
</item> </item>
<item> <item>
<widget class="QLabel" name="lblSkippedValue"> <widget class="QLabel" name="lblSkippedValue">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_6"> <layout class="QHBoxLayout" name="horizontalLayout_6">
<item> <item>
<widget class="QLabel" name="lblFailed"> <widget class="QLabel" name="lblFailed">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font"> <property name="font">
<font> <font>
<weight>50</weight> <weight>50</weight>
@ -423,33 +322,24 @@
</item> </item>
<item> <item>
<widget class="QLabel" name="lblFailedValue"> <widget class="QLabel" name="lblFailedValue">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item> </layout>
<widget class="QPushButton" name="btnOpenFailed"> </item>
<property name="sizePolicy"> </layout>
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Open log of failed paths</string>
</property>
</widget> </widget>
</item> </item>
</layout> <item row="6" column="0">
<widget class="QLineEdit" name="txtIgnorePatterns"/>
</item> </item>
</layout> <item row="10" column="0">
<widget class="QPushButton" name="btnStartIndexing">
<property name="text">
<string>Start indexing</string>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>

Datei anzeigen

@ -17,7 +17,6 @@
inline void initResources() inline void initResources()
{ {
Q_INIT_RESOURCE(migrations); Q_INIT_RESOURCE(migrations);
Q_INIT_RESOURCE(plaintexts);
} }
bool Common::initSqliteDatabase(QString path) bool Common::initSqliteDatabase(QString path)
@ -69,11 +68,11 @@ void Common::setPdfViewer()
} }
else if(evincePath != "") else if(evincePath != "")
{ {
value = evincePath + " -i %p %f"; value = evincePath + "-i %p %f";
} }
else if(qpdfviewPath != "") else if(qpdfviewPath != "")
{ {
value = qpdfviewPath + " %f#%p"; value = qpdfviewPath + "%f#%p";
} }
QSettings settings; QSettings settings;

Datei anzeigen

@ -19,12 +19,9 @@ void DirScanWorker::run()
QString path; QString path;
/* TODO: if we have e. g. only one path, then only one thread will scan this path. /* TODO: if we have e. g. only one path, then only one thread will scan this path.
* *
* Thus, we must submit new directory paths to the queue so other threads can help * Thus, we must resubmit to the queue directories so other threads can help
the current one. the current one (requires a new logic for threads in ParallelDirScanner). Alterantively,
start new DirScanWorkers ourselves here... */
It also may not be guaranteed enqueuing new paths is faster than just scanning them,
at least not for dirs with a small number of files
*/
while(queue->dequeue(path)) while(queue->dequeue(path))
{ {
if(wildcardMatcher.match(path)) if(wildcardMatcher.match(path))

Datei anzeigen

@ -87,10 +87,6 @@ int FileSaver::processFiles(const QVector<QString> paths, std::function<SaveFile
{ {
Logger::info() << "Saved" << path << Qt::endl; Logger::info() << "Saved" << path << Qt::endl;
} }
else if(result == OK_WASEMPTY)
{
Logger::info() << "Saved (but content was empty)" << path << Qt::endl;
}
} }
} }
}); });
@ -102,12 +98,7 @@ SaveFileResult FileSaver::saveFile(const QFileInfo &fileInfo)
QVector<PageData> pageData; QVector<PageData> pageData;
QString canonicalPath = fileInfo.canonicalFilePath(); QString canonicalPath = fileInfo.canonicalFilePath();
int processorReturnCode = -1; int status = -1;
if(!fileInfo.isReadable())
{
return NOACCESS;
}
if(!fileInfo.exists()) if(!fileInfo.exists())
{ {
@ -124,8 +115,6 @@ SaveFileResult FileSaver::saveFile(const QFileInfo &fileInfo)
} }
} }
if(fileInfo.size() > 0)
{
QProcess process; QProcess process;
QStringList args; QStringList args;
args << "process" << canonicalPath; args << "process" << canonicalPath;
@ -149,20 +138,21 @@ SaveFileResult FileSaver::saveFile(const QFileInfo &fileInfo)
in >> pd; in >> pd;
pageData.append(pd); pageData.append(pd);
} }
processorReturnCode = process.exitCode(); status = process.exitCode();
if(processorReturnCode != OK && processorReturnCode != OK_WASEMPTY) if(status != 0 && status != NOTHING_PROCESSED)
{ {
Logger::error() << "FileSaver::saveFile(): Error while processing" << canonicalPath << ":" Logger::error() << "FileSaver::saveFile(): Error while processing" << canonicalPath << ":"
<< "Exit code " << processorReturnCode << Qt::endl; << "Exit code " << status << Qt::endl;
return static_cast<SaveFileResult>(processorReturnCode); return PROCESSFAIL;
} }
} }
}
SaveFileResult result = this->dbService->saveFile(fileInfo, pageData); // Could happen if a file corrupted for example
if(result == OK && processorReturnCode == OK_WASEMPTY) if(pageData.isEmpty() && status != NOTHING_PROCESSED)
{ {
return OK_WASEMPTY; Logger::error() << "Could not get any content for " << canonicalPath << Qt::endl;
} }
return result;
return this->dbService->saveFile(fileInfo, pageData);
} }

Datei anzeigen

@ -120,7 +120,7 @@ void Indexer::dirScanProgress(int current, int total)
void Indexer::processFileScanResult(FileScanResult result) void Indexer::processFileScanResult(FileScanResult result)
{ {
if(result.second != OK || result.second != OK_WASEMPTY || result.second != SKIPPED) if(result.second == DBFAIL || result.second == PROCESSFAIL || result.second == NOTFOUND)
{ {
this->currentIndexResult.results.append(result); this->currentIndexResult.results.append(result);
if(!keepGoing) if(!keepGoing)
@ -138,8 +138,7 @@ void Indexer::processFileScanResult(FileScanResult result)
} }
} }
/* TODO: OK_WASEMPTY might need a special list */ if(result.second == OK)
if(result.second == OK || result.second == OK_WASEMPTY)
{ {
++this->currentIndexResult.addedPaths; ++this->currentIndexResult.addedPaths;
} }

Datei anzeigen

@ -22,28 +22,17 @@ class IndexResult
return addedPaths + skippedPaths + erroredPaths; return addedPaths + skippedPaths + erroredPaths;
} }
QVector<FileScanResult> failedResults() const
{
QVector<FileScanResult> result;
std::for_each(results.begin(), results.end(),
[&result](FileScanResult res)
{
if(res.second == DBFAIL || res.second == PROCESSFAIL || res.second == NOTFOUND ||
res.second == NOACCESS)
{
result.append(res);
}
});
return result;
}
QVector<QString> failedPaths() const QVector<QString> failedPaths() const
{ {
QVector<QString> result; QVector<QString> result;
std::for_each(results.begin(), results.end(),
QVector<FileScanResult> results = failedResults(); [&result](FileScanResult res)
{
std::for_each(results.begin(), results.end(), [&result](FileScanResult res) { result.append(res.first); }); if(res.second == DBFAIL || res.second == PROCESSFAIL || res.second == NOTFOUND)
{
result.append(res.first);
}
});
return result; return result;
} }
}; };

Datei anzeigen

@ -71,35 +71,7 @@ void ParallelDirScanner::scan()
this->targetPathsQueue.clear(); this->targetPathsQueue.clear();
this->resultPathsQueue.clear(); this->resultPathsQueue.clear();
/* First scan without subdirs. This way we collect paths for the threads */ this->targetPathsQueue.enqueue(this->paths);
WildcardMatcher matcher;
matcher.setPatterns(this->ignorePatterns);
for(QString &path : this->paths)
{
QDirIterator iterator(path, QStringList{}, QDir::Dirs | QDir::QDir::Files | QDir::NoDotAndDotDot);
while(iterator.hasNext())
{
QString path = iterator.next();
if(matcher.match(path))
{
continue;
}
QFileInfo info = iterator.fileInfo();
if(!info.isSymLink())
{
if(info.isDir())
{
this->targetPathsQueue.enqueue(info.absoluteFilePath());
}
else
{
this->resultPathsQueue.enqueue(info.absoluteFilePath());
this->processedPaths += 1;
}
}
}
}
emit this->progress(this->processedPaths, this->processedPaths);
int threadsNum = getThreadsNum(); int threadsNum = getThreadsNum();
if(threadsNum == 0) if(threadsNum == 0)
{ {

Datei anzeigen

@ -1,6 +0,0 @@
<RCC>
<qresource>
<file>../LICENSE</file>
<file>../LICENSE-3RD-PARTY</file>
</qresource>
</RCC>

Datei anzeigen

@ -10,6 +10,8 @@ enum DataSource
ARRAY ARRAY
}; };
#define NOTHING_PROCESSED 4
class Processor class Processor
{ {
public: public:

Datei anzeigen

@ -80,7 +80,7 @@ void SandboxedProcessor::printResults(const QVector<PageData> &pageData)
fsstdout.close(); fsstdout.close();
} }
SaveFileResult SandboxedProcessor::process() int SandboxedProcessor::process()
{ {
QFileInfo fileInfo(this->filePath); QFileInfo fileInfo(this->filePath);
Processor *processor = processors.value(fileInfo.suffix(), nullptr); Processor *processor = processors.value(fileInfo.suffix(), nullptr);
@ -92,14 +92,10 @@ SaveFileResult SandboxedProcessor::process()
processor = defaultTextProcessor; processor = defaultTextProcessor;
} }
} }
if(!fileInfo.isReadable())
{
return NOACCESS;
}
if(processor == nullptr || processor == nothingProcessor) if(processor == nullptr || processor == nothingProcessor)
{ {
/* Nothing to do */ /* Nothing to do */
return OK; return NOTHING_PROCESSED;
} }
QVector<PageData> pageData; QVector<PageData> pageData;
@ -123,9 +119,9 @@ SaveFileResult SandboxedProcessor::process()
catch(LooqsGeneralException &e) catch(LooqsGeneralException &e)
{ {
Logger::error() << "SandboxedProcessor: Error while processing" << absPath << ":" << e.message << Qt::endl; Logger::error() << "SandboxedProcessor: Error while processing" << absPath << ":" << e.message << Qt::endl;
return PROCESSFAIL; return 3 /* PROCESSFAIL */;
} }
printResults(pageData); printResults(pageData);
return pageData.isEmpty() ? OK_WASEMPTY : OK; return 0;
} }

Datei anzeigen

@ -3,7 +3,6 @@
#include <QString> #include <QString>
#include <QMimeDatabase> #include <QMimeDatabase>
#include "pagedata.h" #include "pagedata.h"
#include "savefileresult.h"
class SandboxedProcessor class SandboxedProcessor
{ {
@ -20,7 +19,7 @@ class SandboxedProcessor
this->filePath = filepath; this->filePath = filepath;
} }
SaveFileResult process(); int process();
}; };
#endif // SANDBOXEDPROCESSOR_H #endif // SANDBOXEDPROCESSOR_H

Datei anzeigen

@ -1,33 +0,0 @@
#ifndef SAVEFILERESULT_H
#define SAVEFILERESULT_H
#include <QStringList>
enum SaveFileResult
{
OK,
OK_WASEMPTY, /* The file was successfully read but no content could be extracted. Might be just an empty document or
so*/
SKIPPED, /* The file was not processed/saved, because it has not changed */
DBFAIL, /* A database error occured */
PROCESSFAIL, /* General processor failure */
NOTFOUND, /* The file was not found */
NOACCESS /* The process can't read the file */
};
static inline QString SaveFileResultToString(SaveFileResult sfr)
{
QStringList SaveFileResultStr;
SaveFileResultStr << "OK"
<< "OK_WASEMPTY"
<< "SKIPPED"
<< "DBFAIL"
<< "PROCESSFAIL"
<< "NOTFOUND"
<< "NOACCESS";
return SaveFileResultStr[(int)sfr];
}
#endif // SAVEFILERESULT_H

Datei anzeigen

@ -88,7 +88,6 @@ HEADERS += sqlitesearch.h \
pdfprocessor.h \ pdfprocessor.h \
processor.h \ processor.h \
sandboxedprocessor.h \ sandboxedprocessor.h \
savefileresult.h \
searchresult.h \ searchresult.h \
sqlitedbservice.h \ sqlitedbservice.h \
tagstripperprocessor.h \ tagstripperprocessor.h \
@ -101,4 +100,3 @@ unix {
INSTALLS += target INSTALLS += target
} }
RESOURCES = migrations/migrations.qrc RESOURCES = migrations/migrations.qrc
RESOURCES += plaintexts.qrc

Datei anzeigen

@ -7,7 +7,14 @@
#include "filedata.h" #include "filedata.h"
#include "../shared/sqlitesearch.h" #include "../shared/sqlitesearch.h"
#include "../shared/token.h" #include "../shared/token.h"
#include "savefileresult.h" enum SaveFileResult
{
OK,
SKIPPED,
DBFAIL,
PROCESSFAIL,
NOTFOUND
};
class SqliteDbService class SqliteDbService
{ {