gui: Retire IPCClient and PreviewWorker
This commit is contained in:
parent
fe29641d0a
commit
02642a147a
@ -1,27 +0,0 @@
|
||||
#include <QDataStream>
|
||||
#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;
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
#ifndef IPCCLIENT_H
|
||||
#define IPCCLIENT_H
|
||||
#include <QLocalSocket>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include "ipc.h"
|
||||
|
||||
class IPCClient
|
||||
{
|
||||
private:
|
||||
QString socketPath;
|
||||
|
||||
public:
|
||||
IPCClient(QString socketPath);
|
||||
bool sendCommand(IPCCommand command, QStringList args);
|
||||
};
|
||||
|
||||
#endif // IPCCLIENT_H
|
@ -1,39 +0,0 @@
|
||||
#include <QApplication>
|
||||
#include <QScreen>
|
||||
#include <QScopedPointer>
|
||||
#include <QMutexLocker>
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
#include <QtConcurrent/QtConcurrentMap>
|
||||
#include <atomic>
|
||||
#include "previewworker.h"
|
||||
|
||||
PreviewWorker::PreviewWorker()
|
||||
{
|
||||
}
|
||||
|
||||
QFuture<QSharedPointer<PreviewResult>> PreviewWorker::generatePreviews(const QVector<SearchResult> paths,
|
||||
QVector<QString> wordsToHighlight,
|
||||
double scalefactor)
|
||||
{
|
||||
QVector<QSharedPointer<PreviewResult>> previews;
|
||||
|
||||
for(const SearchResult &sr : paths)
|
||||
{
|
||||
for(unsigned int page : sr.pages)
|
||||
{
|
||||
QSharedPointer<PreviewResult> ptr =
|
||||
QSharedPointer<PreviewResult>(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);
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
#ifndef PREVIEWWORKER_H
|
||||
#define PREVIEWWORKER_H
|
||||
#include <QObject>
|
||||
#include <QImage>
|
||||
#include <QHash>
|
||||
#include <QThread>
|
||||
#include <QMutex>
|
||||
#include <QWaitCondition>
|
||||
#include <QMutex>
|
||||
#include <QFuture>
|
||||
#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<PreviewGenerator> createGenerator(QString path);
|
||||
|
||||
QFuture<QSharedPointer<PreviewResult>> generatePreviews(const QVector<SearchResult> paths,
|
||||
QVector<QString> wordsToHighlight, double scalefactor);
|
||||
};
|
||||
|
||||
#endif // PREVIEWWORKER_H
|
Loading…
Reference in New Issue
Block a user