diff --git a/cli/cli.pro b/cli/cli.pro
index c6bc7f5..2724423 100644
--- a/cli/cli.pro
+++ b/cli/cli.pro
@@ -37,16 +37,15 @@ win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../shared/release/ -ls
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../shared/debug/ -lshared
else:unix: LIBS += -L$$OUT_PWD/../shared/ -lshared
-LIBS += -luchardet -lpoppler-qt5 -lquazip5
+LIBS += -luchardet -lpoppler-qt6
-packagesExist(quazip1-qt5) {
- PKGCONFIG += quazip1-qt5
+packagesExist(quazip1-qt6) {
+ PKGCONFIG += quazip1-qt6
CONFIG += link_pkgconfig
- LIBS -= -lquazip5
}
INCLUDEPATH += $$PWD/../shared
-INCLUDEPATH += /usr/include/poppler/qt5/
+INCLUDEPATH += /usr/include/poppler/qt6/
DEPENDPATH += $$PWD/../shared
diff --git a/gui/aboutdialog.cpp b/gui/aboutdialog.cpp
index 834021d..8942e28 100644
--- a/gui/aboutdialog.cpp
+++ b/gui/aboutdialog.cpp
@@ -19,7 +19,6 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent)
closeButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
connect(closeButton, &QPushButton::clicked, this, &QDialog::close);
- closeLayout->setMargin(10);
closeLayout->addStretch(10);
closeLayout->addWidget(closeButton);
@@ -32,7 +31,7 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent)
QLabel *aboutLooqs = new QLabel(this);
QString html = "
looqs
";
html += "Full-text search with previews for your files
";
- html += "Copyright (c) 2018-2022: Albert Schwarzkopf
";
+ html += "Copyright (c) 2018-2024: Albert Schwarzkopf
";
html += QString("Version: %1
").arg(Common::versionText());
html += "Contact: looqs at quitesimple dot org
";
html += "Website: https://quitesimple.org
";
diff --git a/gui/gui.pro b/gui/gui.pro
index 0b890c5..2d06669 100644
--- a/gui/gui.pro
+++ b/gui/gui.pro
@@ -71,8 +71,8 @@ HEADERS += \
FORMS += \
mainwindow.ui
-INCLUDEPATH += /usr/include/poppler/qt5/
-INCLUDEPATH += /usr/include/quazip5
+INCLUDEPATH += /usr/include/poppler/qt6/
+INCLUDEPATH += /usr/include/quazip6
QT += widgets sql
@@ -80,12 +80,12 @@ win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../shared/release/ -ls
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../shared/debug/ -lshared
else:unix: LIBS += -L$$OUT_PWD/../shared/ -lshared
-LIBS += -luchardet -lpoppler-qt5 -lquazip5
+LIBS += -luchardet -lpoppler-qt6 -lquazip6
-packagesExist(quazip1-qt5) {
- PKGCONFIG += quazip1-qt5
+packagesExist(quazip1-qt6) {
+ PKGCONFIG += quazip1-qt6
CONFIG += link_pkgconfig
- LIBS -= -lquazip5
+ LIBS -= -lquazip6
}
INCLUDEPATH += $$PWD/../shared
diff --git a/gui/ipcpreviewclient.cpp b/gui/ipcpreviewclient.cpp
index f985d9a..02c834d 100644
--- a/gui/ipcpreviewclient.cpp
+++ b/gui/ipcpreviewclient.cpp
@@ -68,22 +68,25 @@ void IPCPreviewClient::start(RenderConfig config, const QVector &t
if(socket->isOpen() && socket->isWritable())
{
QDataStream stream(socket);
+ stream.startTransaction();
stream << GeneratePreviews;
stream << config;
stream << targets;
+ stream.commitTransaction();
socket->flush();
- int numTarget = 0;
+ qsizetype numTarget = 0;
if(socket->isOpen() && socket->isReadable() && socket->state() == QLocalSocket::ConnectedState)
{
do
{
- socket->waitForReadyRead(100);
+ socket->waitForReadyRead(5000);
stream.startTransaction();
stream >> numTarget;
} while(!stream.commitTransaction() && socket->state() == QLocalSocket::ConnectedState);
if(numTarget != targets.count())
{
+ qDebug() << "Target count mismatch";
emit error("IPC Error: Server reports less targets than it should");
return;
}
diff --git a/gui/ipcserver.cpp b/gui/ipcserver.cpp
index 484bee9..58a9243 100644
--- a/gui/ipcserver.cpp
+++ b/gui/ipcserver.cpp
@@ -51,7 +51,9 @@ void IpcServer::spawnerNewConnection()
} while(!stream.commitTransaction() && socket->state() == QLocalSocket::ConnectedState);
if(socket->state() == QLocalSocket::ConnectedState)
{
+ stream.startTransaction();
stream << targets.count();
+ stream.commitTransaction();
socket->flush();
IPCPreviewWorker *previewWorker = new IPCPreviewWorker(socket);
connect(previewWorker, &IPCPreviewWorker::finished, this, [previewWorker] { delete previewWorker; });
@@ -59,6 +61,7 @@ void IpcServer::spawnerNewConnection()
}
else
{
+ qDebug() << "Deleting socket...";
delete socket;
}
}
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp
index 0fe049c..23b722b 100644
--- a/gui/mainwindow.cpp
+++ b/gui/mainwindow.cpp
@@ -1,4 +1,4 @@
-#include
+#include
#include
#include
#include
@@ -15,10 +15,8 @@
#include
#include
#include
-#include
#include
#include
-
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "clicklabel.h"
@@ -673,7 +671,7 @@ void MainWindow::previewReceived()
headerLabel->setText(QString("Path: ") + preview->getDocumentPath());
ClickLabel *label = dynamic_cast(preview->createPreviewWidget());
- label->setMaximumWidth(QApplication::desktop()->availableGeometry().width() - 200);
+ label->setMaximumWidth(QApplication::primaryScreen()->availableGeometry().width() - 200);
QVBoxLayout *previewLayout = new QVBoxLayout();
@@ -702,7 +700,7 @@ void MainWindow::previewReceived()
previewLayout->addWidget(headerLabel);
- previewLayout->setMargin(0);
+ previewLayout->setContentsMargins(0, 0, 0, 0);
previewLayout->insertStretch(0, 1);
previewLayout->insertStretch(-1, 1);
previewLayout->setAlignment(Qt::AlignCenter);
diff --git a/gui/previewgeneratorpdf.cpp b/gui/previewgeneratorpdf.cpp
index 71fe538..289f60f 100644
--- a/gui/previewgeneratorpdf.cpp
+++ b/gui/previewgeneratorpdf.cpp
@@ -13,20 +13,21 @@ Poppler::Document *PreviewGeneratorPdf::document(QString path)
return documentcache.value(path);
}
locker.unlock();
- Poppler::Document *result = Poppler::Document::load(path);
- if(result == nullptr)
+ auto result = Poppler::Document::load(path);
+ if(!result)
{
+ qDebug() << "Failed to load document: " << path;
// TODO: some kind of user feedback would be nice
return nullptr;
}
result->setRenderHint(Poppler::Document::TextAntialiasing);
result->setRenderHint(Poppler::Document::TextHinting);
result->setRenderHint(Poppler::Document::TextSlightHinting);
-
+ auto ptr = result.release();
locker.relock();
- documentcache.insert(path, result);
+ documentcache.insert(path, ptr);
locker.unlock();
- return result;
+ return ptr;
}
QSharedPointer PreviewGeneratorPdf::generate(RenderConfig config, QString documentPath,
@@ -36,10 +37,12 @@ QSharedPointer PreviewGeneratorPdf::generate(RenderConfig config,
Poppler::Document *doc = document(documentPath);
if(doc == nullptr)
{
+ qDebug() << "Failed to obtain document for: " << documentPath;
return QSharedPointer(result);
}
if(doc->isLocked())
{
+ qDebug() << "Failed to open document as its locked: " << documentPath;
return QSharedPointer(result);
}
int p = (int)page - 1;
@@ -47,7 +50,12 @@ QSharedPointer PreviewGeneratorPdf::generate(RenderConfig config,
{
p = 0;
}
- Poppler::Page *pdfPage = doc->page(p);
+ auto pdfPage = doc->page(p);
+ if(!pdfPage)
+ {
+ qDebug() << "Failed to open page " << p << " for document" << documentPath;
+ return QSharedPointer(result);
+ }
QImage img = pdfPage->renderToImage(config.scaleX, config.scaleY);
for(QString &word : config.wordsToHighlight)
{
diff --git a/gui/previewgeneratorpdf.h b/gui/previewgeneratorpdf.h
index 74c63ff..5c904f2 100644
--- a/gui/previewgeneratorpdf.h
+++ b/gui/previewgeneratorpdf.h
@@ -1,6 +1,6 @@
#ifndef PREVIEWGENERATORPDF_H
#define PREVIEWGENERATORPDF_H
-#include
+#include
#include "previewgenerator.h"
#include "previewresultpdf.h"
diff --git a/shared/defaulttextprocessor.cpp b/shared/defaulttextprocessor.cpp
index a06cd82..2845df3 100644
--- a/shared/defaulttextprocessor.cpp
+++ b/shared/defaulttextprocessor.cpp
@@ -1,6 +1,6 @@
#include
#include
-#include
+#include
#include
#include "defaulttextprocessor.h"
@@ -13,10 +13,10 @@ QString DefaultTextProcessor::processText(const QByteArray &data) const
QString encoding = encodingDetector.detectEncoding(data);
if(!encoding.isEmpty())
{
- QTextCodec *codec = QTextCodec::codecForName(encoding.toUtf8());
- if(codec != nullptr)
+ QStringDecoder decoder = QStringDecoder(encoding.toStdString().c_str());
+ if(decoder.isValid())
{
- return codec->toUnicode(data);
+ return decoder(data);
}
qWarning() << "No codec found for " << encoding;
return QString(data);
diff --git a/shared/documentoutlineentry.h b/shared/documentoutlineentry.h
index abf83b7..bfddeb7 100644
--- a/shared/documentoutlineentry.h
+++ b/shared/documentoutlineentry.h
@@ -3,6 +3,7 @@
#include
#include
#include
+#include
enum OutlineDestinationType
{
diff --git a/shared/indexsyncer.cpp b/shared/indexsyncer.cpp
index 70c5f3b..566b8d4 100644
--- a/shared/indexsyncer.cpp
+++ b/shared/indexsyncer.cpp
@@ -110,7 +110,7 @@ void IndexSyncer::sync()
if(!this->fileSaverOptions.keepGoing)
{
QString errorMsg = QString("Failed to update all files selected for updating in this batch. Updated") +
- updatedFilesCount + "out of" + shouldHaveUpdatedCount + "selected for updating";
+ QString::number(updatedFilesCount) + "out of" + QString::number(shouldHaveUpdatedCount) + "selected for updating";
emit error(errorMsg);
emit finished(totalUpdatesFilesCount, totalDeletedFilesCount, totalErroredFilesCount);
}
diff --git a/shared/pdfprocessor.cpp b/shared/pdfprocessor.cpp
index 34c84d5..c839926 100644
--- a/shared/pdfprocessor.cpp
+++ b/shared/pdfprocessor.cpp
@@ -1,5 +1,4 @@
#include
-#include
#include "pdfprocessor.h"
PdfProcessor::PdfProcessor()
{
@@ -29,8 +28,8 @@ QVector PdfProcessor::createOutline(const QVector doc(Poppler::Document::loadFromData(data));
- if(doc.isNull())
+ auto doc(Poppler::Document::loadFromData(data));
+ if(!doc)
{
throw LooqsGeneralException("Failed to process pdf data");
}
diff --git a/shared/pdfprocessor.h b/shared/pdfprocessor.h
index f932f11..4993157 100644
--- a/shared/pdfprocessor.h
+++ b/shared/pdfprocessor.h
@@ -1,6 +1,6 @@
#ifndef PDFPROCESSOR_H
#define PDFPROCESSOR_H
-#include
+#include
#include "processor.h"
class PdfProcessor : public Processor
{
diff --git a/shared/shared.pro b/shared/shared.pro
index 18ad6ea..19f8488 100644
--- a/shared/shared.pro
+++ b/shared/shared.pro
@@ -14,11 +14,11 @@ CONFIG += staticlib
CONFIG += c++17
INCLUDEPATH += $$PWD/../sandbox/exile.h/
-INCLUDEPATH += /usr/include/poppler/qt5/ /usr/include/quazip5
+INCLUDEPATH += /usr/include/poppler/qt6/ /usr/include/quazip5
# Dirty, we only need the includes here but well this magic works, so...
-packagesExist(quazip1-qt5) {
- PKGCONFIG += quazip1-qt5
+packagesExist(quazip1-qt6) {
+ PKGCONFIG += quazip1-qt6
CONFIG += link_pkgconfig
}
diff --git a/shared/sqlitedbservice.cpp b/shared/sqlitedbservice.cpp
index 940bc8c..fb436e5 100644
--- a/shared/sqlitedbservice.cpp
+++ b/shared/sqlitedbservice.cpp
@@ -2,6 +2,7 @@
#include
#include
#include
+#include
#include "looqsgeneralexception.h"
#include "sqlitedbservice.h"
#include "filedata.h"
@@ -84,13 +85,12 @@ unsigned int SqliteDbService::getFiles(QVector &results, QString wildC
// TODO: port this to QRegularExpression once >5.12 gets more widespread because of this bug
// https://bugreports.qt.io/browse/QTBUG-72539?focusedCommentId=439053&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel
bool usePattern = !wildCardPattern.isEmpty();
- QRegExp regexPattern(wildCardPattern);
- regexPattern.setPatternSyntax(QRegExp::PatternSyntax::WildcardUnix);
+ QRegularExpression regexPattern(QRegularExpression::wildcardToRegularExpression(wildCardPattern));
while(query.next())
{
QString absPath = query.value(0).toString();
- if(!usePattern || regexPattern.exactMatch(absPath))
+ if(!usePattern || regexPattern.match(absPath).hasMatch())
{
FileData current;
current.absPath = absPath;
diff --git a/shared/tagstripperprocessor.cpp b/shared/tagstripperprocessor.cpp
index 131fe31..e2cb955 100644
--- a/shared/tagstripperprocessor.cpp
+++ b/shared/tagstripperprocessor.cpp
@@ -1,5 +1,5 @@
#include "tagstripperprocessor.h"
-
+#include
TagStripperProcessor::TagStripperProcessor()
{
}
@@ -9,6 +9,6 @@ DocumentProcessResult TagStripperProcessor::process(const QByteArray &data) cons
auto result = DefaultTextProcessor::process(data);
// TODO: does not work properly with
and does not deal with entities...
Q_ASSERT(result.pages.size() > 0);
- result.pages[0].content.remove(QRegExp("<[^>]*>"));
+ result.pages[0].content.remove(QRegularExpression("<[^>]*>"));
return result;
}
diff --git a/shared/utils.cpp b/shared/utils.cpp
index b354fc4..e683a70 100644
--- a/shared/utils.cpp
+++ b/shared/utils.cpp
@@ -14,7 +14,7 @@ QByteArray Utils::readFile(QString path)
QByteArray data = file.readAll();
if(data.isEmpty() && file.error() != QFileDevice::FileError::NoError)
{
- throw LooqsGeneralException("Error reading file: " + path + ", Error: " + file.error());
+ throw LooqsGeneralException("Error reading file: " + path + ", Error: " + QString::number(file.error()));
}
return data;
}
diff --git a/shared/wildcardmatcher.cpp b/shared/wildcardmatcher.cpp
index e4b24ba..136fbf7 100644
--- a/shared/wildcardmatcher.cpp
+++ b/shared/wildcardmatcher.cpp
@@ -5,9 +5,8 @@ void WildcardMatcher::setPatterns(QStringList patterns)
this->regexes.clear();
for(QString &str : patterns)
{
- QRegExp regexp;
- regexp.setPattern(str);
- regexp.setPatternSyntax(QRegExp::WildcardUnix);
+ QRegularExpression regexp;
+ regexp.setPattern(QRegularExpression::wildcardToRegularExpression(str));
this->regexes.append(regexp);
}
}
@@ -18,9 +17,10 @@ WildcardMatcher::WildcardMatcher()
bool WildcardMatcher::match(QString haystack) const
{
- for(const QRegExp ®exp : this->regexes)
+ for(const QRegularExpression ®exp : this->regexes)
{
- if(regexp.exactMatch(haystack))
+ QRegularExpressionMatch match = regexp.match(haystack);
+ if(match.hasMatch())
{
return true;
}
diff --git a/shared/wildcardmatcher.h b/shared/wildcardmatcher.h
index dd6dd60..76fc7dc 100644
--- a/shared/wildcardmatcher.h
+++ b/shared/wildcardmatcher.h
@@ -1,11 +1,11 @@
#ifndef WILDCARDMATCHER_H
#define WILDCARDMATCHER_H
#include
-#include
+#include
class WildcardMatcher
{
private:
- QVector regexes;
+ QVector regexes;
QStringList patterns;
public: