From 02642a147a3aa04c41431ea810bca67874c0547f Mon Sep 17 00:00:00 2001 From: Albert S Date: Fri, 27 May 2022 09:24:42 +0200 Subject: [PATCH] gui: Retire IPCClient and PreviewWorker --- gui/ipcclient.cpp | 27 --------------------------- gui/ipcclient.h | 18 ------------------ gui/previewworker.cpp | 39 --------------------------------------- gui/previewworker.h | 29 ----------------------------- 4 files changed, 113 deletions(-) delete mode 100644 gui/ipcclient.cpp delete mode 100644 gui/ipcclient.h delete mode 100644 gui/previewworker.cpp delete mode 100644 gui/previewworker.h diff --git a/gui/ipcclient.cpp b/gui/ipcclient.cpp deleted file mode 100644 index 9f29f6b..0000000 --- a/gui/ipcclient.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include "ipcclient.h" - -IPCClient::IPCClient(QString socketPath) -{ - this->socketPath = socketPath; -} - -bool IPCClient::sendCommand(IPCCommand command, QStringList args) -{ - bool result = false; - QLocalSocket socket; - socket.connectToServer(socketPath); - if(socket.isOpen() && socket.isWritable()) - { - QDataStream stream(&socket); - stream << command; - stream << args; - socket.flush(); - result = true; - } - else - { - qDebug() << "Not connected to IPC server"; - } - return result; -} diff --git a/gui/ipcclient.h b/gui/ipcclient.h deleted file mode 100644 index cd3eb2c..0000000 --- a/gui/ipcclient.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef IPCCLIENT_H -#define IPCCLIENT_H -#include -#include -#include -#include "ipc.h" - -class IPCClient -{ - private: - QString socketPath; - - public: - IPCClient(QString socketPath); - bool sendCommand(IPCCommand command, QStringList args); -}; - -#endif // IPCCLIENT_H diff --git a/gui/previewworker.cpp b/gui/previewworker.cpp deleted file mode 100644 index 9b43c2e..0000000 --- a/gui/previewworker.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include "previewworker.h" - -PreviewWorker::PreviewWorker() -{ -} - -QFuture> PreviewWorker::generatePreviews(const QVector paths, - QVector wordsToHighlight, - double scalefactor) -{ - QVector> previews; - - for(const SearchResult &sr : paths) - { - for(unsigned int page : sr.pages) - { - QSharedPointer ptr = - QSharedPointer(new PreviewResult{sr.fileData.absPath, page}); - previews.append(ptr); - } - } - - RenderConfig renderConfig; - renderConfig.scaleX = QGuiApplication::primaryScreen()->physicalDotsPerInchX() * scalefactor; - renderConfig.scaleY = QGuiApplication::primaryScreen()->physicalDotsPerInchY() * scalefactor; - renderConfig.wordsToHighlight = wordsToHighlight; - - auto mapFunctor = new PreviewGeneratorMapFunctor(); - mapFunctor->setRenderConfig(renderConfig); - - return QtConcurrent::mapped(previews, *mapFunctor); -} diff --git a/gui/previewworker.h b/gui/previewworker.h deleted file mode 100644 index 16125d2..0000000 --- a/gui/previewworker.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef PREVIEWWORKER_H -#define PREVIEWWORKER_H -#include -#include -#include -#include -#include -#include -#include -#include -#include "previewresultpdf.h" -#include "searchresult.h" -#include "previewgenerator.h" -#include "previewworker.h" -#include "previewgeneratorpdf.h" -#include "previewgeneratormapfunctor.h" - -class PreviewWorker : public QObject -{ - Q_OBJECT - public: - PreviewWorker(); - QSharedPointer createGenerator(QString path); - - QFuture> generatePreviews(const QVector paths, - QVector wordsToHighlight, double scalefactor); -}; - -#endif // PREVIEWWORKER_H