tree: Move to Qt6
This commit is contained in:
@ -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 = "<h2>looqs</h2>";
|
||||
html += "Full-text search with previews for your files<br><br>";
|
||||
html += "Copyright (c) 2018-2022: Albert Schwarzkopf<br><br>";
|
||||
html += "Copyright (c) 2018-2024: 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>";
|
||||
|
12
gui/gui.pro
12
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
|
||||
|
@ -68,22 +68,25 @@ void IPCPreviewClient::start(RenderConfig config, const QVector<RenderTarget> &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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <poppler-qt5.h>
|
||||
#include <poppler-qt6.h>
|
||||
#include <QLabel>
|
||||
#include <QtDebug>
|
||||
#include <QFileInfo>
|
||||
@ -15,10 +15,8 @@
|
||||
#include <QFileDialog>
|
||||
#include <QScreen>
|
||||
#include <QProgressDialog>
|
||||
#include <QDesktopWidget>
|
||||
#include <QWidgetAction>
|
||||
#include <QInputDialog>
|
||||
|
||||
#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<ClickLabel *>(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);
|
||||
|
@ -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<PreviewResult> PreviewGeneratorPdf::generate(RenderConfig config, QString documentPath,
|
||||
@ -36,10 +37,12 @@ QSharedPointer<PreviewResult> PreviewGeneratorPdf::generate(RenderConfig config,
|
||||
Poppler::Document *doc = document(documentPath);
|
||||
if(doc == nullptr)
|
||||
{
|
||||
qDebug() << "Failed to obtain document for: " << documentPath;
|
||||
return QSharedPointer<PreviewResult>(result);
|
||||
}
|
||||
if(doc->isLocked())
|
||||
{
|
||||
qDebug() << "Failed to open document as its locked: " << documentPath;
|
||||
return QSharedPointer<PreviewResult>(result);
|
||||
}
|
||||
int p = (int)page - 1;
|
||||
@ -47,7 +50,12 @@ QSharedPointer<PreviewResult> 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<PreviewResult>(result);
|
||||
}
|
||||
QImage img = pdfPage->renderToImage(config.scaleX, config.scaleY);
|
||||
for(QString &word : config.wordsToHighlight)
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
#ifndef PREVIEWGENERATORPDF_H
|
||||
#define PREVIEWGENERATORPDF_H
|
||||
#include <poppler-qt5.h>
|
||||
#include <poppler-qt6.h>
|
||||
#include "previewgenerator.h"
|
||||
#include "previewresultpdf.h"
|
||||
|
||||
|
Reference in New Issue
Block a user