Add initial project structure with essential files including .gitignore, application resources, and various model and view components for the application. Implemented asynchronous parsing support and database structure checks.

This commit is contained in:
2025-12-08 15:21:18 +03:00
parent 4f8c90c15b
commit 3467003721
110 changed files with 35406 additions and 0 deletions
+122
View File
@@ -0,0 +1,122 @@
#ifndef PREVIEWPDFWIDGET_H
#define PREVIEWPDFWIDGET_H
#include <QWidget>
#include <QVBoxLayout>
#include <QLabel>
#include <QScrollArea>
#include <QFrame>
#include <QDebug>
#include <QPainter>
#include <QPixmap>
#include <QList>
#include <QComboBox>
#include <QPushButton>
#include <QHBoxLayout>
#include <QSpacerItem>
#include <QTransform>
#include <QWheelEvent>
#include <QTimer>
// Включаем структуру PageInfo
#include "../model/pageinfo.h"
// Класс-обертка для QScrollArea с поддержкой Ctrl+колесико
class ZoomableScrollArea : public QScrollArea
{
Q_OBJECT
public:
explicit ZoomableScrollArea(QWidget *parent = nullptr);
protected:
void wheelEvent(QWheelEvent *event) override;
signals:
void zoomRequested(int delta);
};
class MainController;
class PDFController;
class PreviewPdfWidget : public QWidget
{
Q_OBJECT
public:
explicit PreviewPdfWidget(QWidget *parent = nullptr);
// Метод для установки главного контроллера (PDFController получается автоматически)
void setMainController(MainController *mainController);
// Метод для обновления предварительного просмотра
void updatePreview();
public slots:
// Слот для изменения типа документа (вызывается извне)
void onDocumentTypeChanged(const QString &documentType);
void onZoomChanged(int index);
void onPageChanged(int page);
private:
void setUp();
void setWidgets();
void setUpLayout();
void setUpConnections();
// Методы для работы с предварительным просмотром
void generatePages();
void renderPage(int pageIndex);
void updatePageNavigation();
// Вспомогательные методы
QPixmap createPagePixmap(const PageInfo &pageInfo);
void clearPages();
// Метод для изменения масштаба с любым значением
void setZoom(int zoom);
// Устаревший метод (для обратной совместимости)
void setPdfController(PDFController *pdfController);
// UI элементы
QVBoxLayout* m_mainLayout;
QHBoxLayout* m_controlsLayout;
ZoomableScrollArea* m_scrollArea;
QFrame* m_pagesContainer;
QVBoxLayout* m_pagesLayout;
QComboBox* m_documentTypeCombo;
QComboBox* m_zoomCombo;
QComboBox* m_pageCombo;
QPushButton* m_prevPageBtn;
QPushButton* m_nextPageBtn;
QLabel* m_pageInfoLabel;
// Контроллеры
MainController* m_mainController;
PDFController* m_pdfController;
// Таймер для отложенного обновления (чтобы избежать множественных обновлений при массовых изменениях)
QTimer* m_updateTimer;
// Данные
QList<PageInfo> m_pagesInfo;
QList<QPixmap> m_pagePixmaps;
int m_currentPage;
int m_currentZoom;
QString m_currentDocumentType;
// Константы
static const int ZOOM_LEVELS[];
static const QStringList DOCUMENT_TYPES;
// Дополнительные константы для мелкого масштабирования
static const int FINE_ZOOM_STEP; // Шаг для Ctrl+колесико (5%)
static const int MIN_ZOOM; // Минимальный масштаб 10%
static const int MAX_ZOOM; // Максимальный масштаб 400%
signals:
void pageChanged(int page);
void documentTypeChanged(const QString &type);
void zoomChanged(int zoom);
};
#endif // PREVIEWPDFWIDGET_H