looqs/gui/mainwindow.h

98 righe
2.4 KiB
C

#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 <QProgressDialog>
2021-06-12 14:59:58 +02:00
#include "../shared/looqsquery.h"
#include "../shared/indexsyncer.h"
#include "previewcoordinator.h"
2022-04-14 15:04:16 +02:00
#include "indexer.h"
#include "tagmanager.h"
namespace Ui
{
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
private:
2022-04-14 15:04:16 +02:00
DatabaseFactory *dbFactory;
SqliteDbService *dbService;
Ui::MainWindow *ui;
PreviewCoordinator previewCoordinator;
QThread syncerThread;
Indexer *indexer;
IndexSyncer *indexSyncer;
QProgressDialog progressDialog;
QFileIconProvider iconProvider;
2019-04-27 21:24:53 +02:00
QSqlDatabase db;
QFutureWatcher<QVector<SearchResult>> searchWatcher;
LooqsQuery contentSearchQuery;
QVector<QString> searchHistory;
TagManager *tagManager;
int currentSearchHistoryIndex = 0;
QString currentSavedSearchText;
bool previewDirty = false;
int previewsPerPage = 20;
void connectSignals();
void makePreviews(int page);
bool previewTabActive();
2022-04-14 15:04:16 +02:00
bool indexerTabActive();
void keyPressEvent(QKeyEvent *event) override;
void handleSearchResults(const QVector<SearchResult> &results);
void handleSearchError(QString error);
void createSearchResultMenu(QMenu &menu, const QFileInfo &fileInfo);
void openDocument(QString path, int num);
void openFile(QString path);
2022-06-13 19:36:12 +02:00
void initSettingsTabs();
int currentSelectedScale();
void processShortcut(int key);
bool eventFilter(QObject *object, QEvent *event) override;
private slots:
void lineEditReturnPressed();
void treeSearchItemActivated(QTreeWidgetItem *item, int i);
void showSearchResultsContextMenu(const QPoint &point);
void tabChanged();
void previewReceived();
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();
void startIndexSync();
2022-06-13 19:36:12 +02:00
void saveSettings();
void exportFailedPaths();
signals:
void startIpcPreviews(RenderConfig config, const QVector<RenderTarget> &targets);
void stopIpcPreviews();
void beginIndexSync();
public:
explicit MainWindow(QWidget *parent, QString socketPath);
~MainWindow();
signals:
void beginSearch(const QString &query);
void startPdfPreviewGeneration(QVector<SearchResult> paths, double scalefactor);
protected:
void closeEvent(QCloseEvent *event) override;
};
#endif // MAINWINDOW_H