looqs/gui/mainwindow.h

73 rivejä
1.9 KiB
C
Raaka Normaali näkymä Historia

#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QThread>
#include <QTreeWidgetItem>
#include <QFileIconProvider>
#include <QKeyEvent>
2019-04-27 21:24:53 +02:00
#include <QFutureWatcher>
#include <QSqlDatabase>
#include <QLocalSocket>
#include "previewworker.h"
2021-06-12 14:59:58 +02:00
#include "../shared/looqsquery.h"
#include "ipcclient.h"
2022-04-14 15:04:16 +02:00
#include "indexer.h"
namespace Ui
{
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent, IPCClient &client);
~MainWindow();
signals:
2018-09-02 12:27:23 +02:00
void beginSearch(const QString &query);
void startPdfPreviewGeneration(QVector<SearchResult> paths, double scalefactor);
private:
2022-04-14 15:04:16 +02:00
DatabaseFactory *dbFactory;
SqliteDbService *dbService;
Ui::MainWindow *ui;
IPCClient *ipcClient;
2022-04-14 15:04:16 +02:00
Indexer *indexer;
QFileIconProvider iconProvider;
bool previewDirty;
2019-04-27 21:24:53 +02:00
QSqlDatabase db;
QFutureWatcher<QVector<SearchResult>> searchWatcher;
QFutureWatcher<QSharedPointer<PreviewResult>> previewWorkerWatcher;
void add(QString path, unsigned int page);
QVector<SearchResult> previewableSearchResults;
void connectSignals();
void makePreviews(int page);
bool previewTabActive();
2022-04-14 15:04:16 +02:00
bool indexerTabActive();
void keyPressEvent(QKeyEvent *event) override;
unsigned int processedPdfPreviews;
void handleSearchResults(const QVector<SearchResult> &results);
void handleSearchError(QString error);
LooqsQuery contentSearchQuery;
int previewsPerPage;
void createSearchResutlMenu(QMenu &menu, const QFileInfo &fileInfo);
void ipcDocOpen(QString path, int num);
void ipcFileOpen(QString path);
private slots:
void lineEditReturnPressed();
void treeSearchItemActivated(QTreeWidgetItem *item, int i);
void showSearchResultsContextMenu(const QPoint &point);
void tabChanged();
void previewReceived(QSharedPointer<PreviewResult> preview);
2021-06-12 23:01:14 +02:00
void comboScaleChanged(int i);
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();
};
#endif // MAINWINDOW_H