2018-08-12 16:45:39 +02:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QThread>
|
|
|
|
#include <QTreeWidgetItem>
|
|
|
|
#include <QFileIconProvider>
|
2018-12-29 20:21:13 +01:00
|
|
|
#include <QKeyEvent>
|
2019-04-27 21:24:53 +02:00
|
|
|
#include <QFutureWatcher>
|
|
|
|
#include <QSqlDatabase>
|
2021-09-28 21:44:09 +02:00
|
|
|
#include <QLocalSocket>
|
2018-08-12 16:45:39 +02:00
|
|
|
#include "pdfworker.h"
|
2021-06-12 14:59:58 +02:00
|
|
|
#include "../shared/looqsquery.h"
|
2021-09-28 21:44:09 +02:00
|
|
|
#include "ipcclient.h"
|
2018-08-12 16:45:39 +02:00
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
class MainWindow;
|
|
|
|
}
|
|
|
|
|
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2021-09-28 21:44:09 +02:00
|
|
|
explicit MainWindow(QWidget *parent, IPCClient &client);
|
2018-08-12 16:45:39 +02:00
|
|
|
~MainWindow();
|
|
|
|
signals:
|
2018-09-02 12:27:23 +02:00
|
|
|
void beginSearch(const QString &query);
|
2018-08-12 16:45:39 +02:00
|
|
|
void startPdfPreviewGeneration(QVector<SearchResult> paths, double scalefactor);
|
|
|
|
|
|
|
|
private:
|
|
|
|
Ui::MainWindow *ui;
|
2021-09-28 21:44:09 +02:00
|
|
|
IPCClient *ipcClient;
|
2018-08-12 16:45:39 +02:00
|
|
|
QFileIconProvider iconProvider;
|
|
|
|
bool pdfDirty;
|
2019-04-27 21:24:53 +02:00
|
|
|
QSqlDatabase db;
|
|
|
|
QFutureWatcher<QVector<SearchResult>> searchWatcher;
|
2019-04-29 20:50:52 +02:00
|
|
|
QFutureWatcher<PdfPreview> pdfWorkerWatcher;
|
2018-08-12 16:45:39 +02:00
|
|
|
void add(QString path, unsigned int page);
|
|
|
|
QVector<SearchResult> pdfSearchResults;
|
|
|
|
void connectSignals();
|
2019-08-26 09:20:21 +02:00
|
|
|
void makePdfPreview(int page);
|
2018-08-12 16:45:39 +02:00
|
|
|
bool pdfTabActive();
|
2018-12-29 20:21:13 +01:00
|
|
|
void keyPressEvent(QKeyEvent *event) override;
|
2018-08-31 20:40:07 +02:00
|
|
|
unsigned int processedPdfPreviews;
|
2018-08-12 16:45:39 +02:00
|
|
|
void handleSearchResults(const QVector<SearchResult> &results);
|
2018-09-02 13:54:27 +02:00
|
|
|
void handleSearchError(QString error);
|
2021-12-30 12:17:12 +01:00
|
|
|
LooqsQuery contentSearchQuery;
|
2019-08-26 09:20:21 +02:00
|
|
|
int pdfPreviewsPerPage;
|
2021-03-27 17:58:38 +01:00
|
|
|
void createSearchResutlMenu(QMenu &menu, const QFileInfo &fileInfo);
|
2021-09-28 21:44:09 +02:00
|
|
|
void ipcDocOpen(QString path, int num);
|
|
|
|
void ipcFileOpen(QString path);
|
|
|
|
|
2019-04-29 23:09:23 +02:00
|
|
|
private slots:
|
|
|
|
void lineEditReturnPressed();
|
2018-08-12 16:45:39 +02:00
|
|
|
void treeSearchItemActivated(QTreeWidgetItem *item, int i);
|
|
|
|
void showSearchResultsContextMenu(const QPoint &point);
|
|
|
|
void tabChanged();
|
|
|
|
void pdfPreviewReceived(PdfPreview preview);
|
2021-06-12 23:01:14 +02:00
|
|
|
void comboScaleChanged(int i);
|
2019-08-26 09:20:21 +02:00
|
|
|
void spinPdfPreviewPageValueChanged(int val);
|
2018-08-12 16:45:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MAINWINDOW_H
|