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>
|
2022-06-04 15:49:29 +02:00
|
|
|
#include <QProgressDialog>
|
2021-06-12 14:59:58 +02:00
|
|
|
#include "../shared/looqsquery.h"
|
2022-06-04 15:49:29 +02:00
|
|
|
#include "../shared/indexsyncer.h"
|
2022-05-27 09:31:21 +02:00
|
|
|
#include "ipcpreviewclient.h"
|
2022-04-14 15:04:16 +02:00
|
|
|
#include "indexer.h"
|
2018-08-12 16:45:39 +02:00
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
class MainWindow;
|
|
|
|
}
|
|
|
|
|
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2022-05-27 09:31:21 +02:00
|
|
|
explicit MainWindow(QWidget *parent, QString socketPath);
|
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:
|
2022-04-14 15:04:16 +02:00
|
|
|
DatabaseFactory *dbFactory;
|
|
|
|
SqliteDbService *dbService;
|
2018-08-12 16:45:39 +02:00
|
|
|
Ui::MainWindow *ui;
|
2022-05-27 09:31:21 +02:00
|
|
|
IPCPreviewClient ipcPreviewClient;
|
|
|
|
QThread ipcClientThread;
|
2022-06-04 15:49:29 +02:00
|
|
|
QThread syncerThread;
|
|
|
|
IndexSyncer *indexSyncer;
|
|
|
|
QProgressDialog progressDialog;
|
2022-05-27 09:31:21 +02:00
|
|
|
|
2022-04-14 15:04:16 +02:00
|
|
|
Indexer *indexer;
|
2018-08-12 16:45:39 +02:00
|
|
|
QFileIconProvider iconProvider;
|
2022-01-03 23:02:21 +01:00
|
|
|
bool previewDirty;
|
2019-04-27 21:24:53 +02:00
|
|
|
QSqlDatabase db;
|
|
|
|
QFutureWatcher<QVector<SearchResult>> searchWatcher;
|
2018-08-12 16:45:39 +02:00
|
|
|
void add(QString path, unsigned int page);
|
2022-01-03 23:02:21 +01:00
|
|
|
QVector<SearchResult> previewableSearchResults;
|
2018-08-12 16:45:39 +02:00
|
|
|
void connectSignals();
|
2022-01-03 23:02:21 +01:00
|
|
|
void makePreviews(int page);
|
|
|
|
bool previewTabActive();
|
2022-04-14 15:04:16 +02:00
|
|
|
bool indexerTabActive();
|
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;
|
2022-01-03 23:02:21 +01:00
|
|
|
int previewsPerPage;
|
2021-03-27 17:58:38 +01:00
|
|
|
void createSearchResutlMenu(QMenu &menu, const QFileInfo &fileInfo);
|
2022-05-28 22:02:54 +02:00
|
|
|
void openDocument(QString path, int num);
|
|
|
|
void openFile(QString path);
|
2022-05-27 09:31:21 +02:00
|
|
|
unsigned int currentPreviewGeneration = 1;
|
2022-06-13 19:36:12 +02:00
|
|
|
void initSettingsTabs();
|
2022-07-23 20:21:45 +02:00
|
|
|
int currentSelectedScale();
|
2022-08-14 13:04:10 +02:00
|
|
|
void processShortcut(int key);
|
2022-08-21 17:28:04 +02:00
|
|
|
bool eventFilter(QObject *object, QEvent *event);
|
|
|
|
QVector<QString> searchHistory;
|
|
|
|
int currentSearchHistoryIndex = 0;
|
|
|
|
QString currentSavedSearchText;
|
|
|
|
private slots:
|
2019-04-29 23:09:23 +02:00
|
|
|
void lineEditReturnPressed();
|
2018-08-12 16:45:39 +02:00
|
|
|
void treeSearchItemActivated(QTreeWidgetItem *item, int i);
|
|
|
|
void showSearchResultsContextMenu(const QPoint &point);
|
|
|
|
void tabChanged();
|
2022-05-27 09:31:21 +02:00
|
|
|
void previewReceived(QSharedPointer<PreviewResult> preview, unsigned int previewGeneration);
|
2021-06-12 23:01:14 +02:00
|
|
|
void comboScaleChanged(int i);
|
2022-01-03 23:02:21 +01:00
|
|
|
void spinPreviewPageValueChanged(int val);
|
2022-04-14 15:04:16 +02:00
|
|
|
void startIndexing();
|
|
|
|
void finishIndexing();
|
2022-04-15 21:06:19 +02:00
|
|
|
void addPathToIndex();
|
2022-06-04 15:49:29 +02:00
|
|
|
void startIndexSync();
|
2022-06-13 19:36:12 +02:00
|
|
|
void saveSettings();
|
2022-06-23 15:27:13 +02:00
|
|
|
void exportFailedPaths();
|
2022-05-27 09:31:21 +02:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void startIpcPreviews(RenderConfig config, const QVector<RenderTarget> &targets);
|
|
|
|
void stopIpcPreviews();
|
2022-06-04 15:49:29 +02:00
|
|
|
void beginIndexSync();
|
2018-08-12 16:45:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MAINWINDOW_H
|