166 lines
6.0 KiB
C++
166 lines
6.0 KiB
C++
#ifndef DOCUMENTSETTINGSDIALOG_H
|
|
#define DOCUMENTSETTINGSDIALOG_H
|
|
|
|
#include <QDialog>
|
|
#include <QTabWidget>
|
|
#include <QComboBox>
|
|
#include <QPushButton>
|
|
#include <QVBoxLayout>
|
|
#include <QHBoxLayout>
|
|
#include <QGridLayout>
|
|
#include <QLabel>
|
|
#include <QStringList>
|
|
#include <QGroupBox>
|
|
#include <QLineEdit>
|
|
#include <QMap>
|
|
#include <QScrollArea>
|
|
#include <QGraphicsView>
|
|
#include <QGraphicsScene>
|
|
#include <QGraphicsPixmapItem>
|
|
#include <QSlider>
|
|
#include <QSpinBox>
|
|
#include "../model/projectparamtablemodel.h"
|
|
#include "../model/titleinscriptionsmodel.h"
|
|
#include "titleinscriptiontypes.h"
|
|
|
|
class MainController;
|
|
|
|
// Перечисление типов документов
|
|
enum class DocumentType {
|
|
Perechen, // Перечень элементов
|
|
SpecificationPCB, // Спецификация ПП
|
|
Specification, // Спецификация материалов
|
|
Vedomost // Ведомость покупных изделий
|
|
};
|
|
|
|
class DocumentSettingsDialog : public QDialog
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit DocumentSettingsDialog(DocumentType docType, MainController *controller, QWidget *parent = nullptr);
|
|
|
|
// Методы для получения настроек таблицы
|
|
QStringList getTableColumnMappings() const;
|
|
void setTableColumnMappings(const QStringList &mappings);
|
|
|
|
// Методы для получения настроек надписей
|
|
QMap<int, QString> getTitleInscriptionValues() const;
|
|
void setTitleInscriptionValues(const QMap<int, QString> &values);
|
|
|
|
// Методы для работы с моделью надписей
|
|
void setTitleInscriptionsModel(TitleInscriptionsModel *model);
|
|
TitleInscriptionsModel* getTitleInscriptionsModel() const;
|
|
|
|
// Методы для работы с децимальными номерами
|
|
QMap<QString, QString> getDecimalNumberValues() const;
|
|
void setDecimalNumberValues(const QMap<QString, QString> &values);
|
|
|
|
private slots:
|
|
void onTableComboBoxChanged(int columnIndex, const QString &value);
|
|
void onInscriptionComboBoxChanged(int fieldNumber, const QString &value);
|
|
void onZoomChanged(int value);
|
|
void onAccept();
|
|
void onCancel();
|
|
void onResetTableSettings();
|
|
void onResetInscriptionSettings();
|
|
|
|
private:
|
|
void setUp();
|
|
void createTabWidget();
|
|
void createTableSettingsTab();
|
|
void createTitleInscriptionsTab();
|
|
void setWidgets();
|
|
void setUpLayout();
|
|
void setUpConnections();
|
|
void createTableColumnFields();
|
|
void createInscriptionFields();
|
|
void createInscriptionField(int fieldNumber, QGridLayout *layout, int row, bool isRequired);
|
|
void createImagePreview();
|
|
void createPlaceholderImage();
|
|
void updateTableFieldValue(int columnIndex, const QString &value);
|
|
void updateInscriptionFieldValue(int fieldNumber, const QString &value);
|
|
void loadTableSettings();
|
|
void loadInscriptionSettings();
|
|
void saveTableSettings();
|
|
void saveInscriptionSettings();
|
|
void createWhereUsedField();
|
|
|
|
// Методы для определения полей в зависимости от типа документа
|
|
QStringList getTableColumnNames() const;
|
|
QStringList getDefaultTableMappings() const;
|
|
QList<int> getRequiredInscriptionFields() const;
|
|
QList<int> getOptionalInscriptionFields() const;
|
|
|
|
DocumentType m_documentType;
|
|
MainController *m_controller;
|
|
ProjectParamTableModel *m_projectParamModel;
|
|
TitleInscriptionsModel *m_titleInscriptionsModel;
|
|
|
|
// Виджеты
|
|
QTabWidget *m_tabWidget;
|
|
QWidget *m_tableSettingsTab;
|
|
QWidget *m_titleInscriptionsTab;
|
|
|
|
// Виджеты для настроек таблицы
|
|
QScrollArea *m_tableScrollArea;
|
|
QWidget *m_tableScrollContent;
|
|
QList<QComboBox*> m_tableColumnComboBoxes;
|
|
QPushButton *m_resetTableButton;
|
|
QSpinBox *m_fontSizeSpinBox;
|
|
QSpinBox *m_fontStretchSpinBox;
|
|
|
|
// Виджеты для настроек надписей
|
|
QScrollArea *m_inscriptionScrollArea;
|
|
QWidget *m_inscriptionScrollContent;
|
|
QGraphicsView *m_imageView;
|
|
QGraphicsScene *m_imageScene;
|
|
QGraphicsPixmapItem *m_imageItem;
|
|
QSlider *m_zoomSlider;
|
|
QMap<int, QComboBox*> m_inscriptionComboBoxes;
|
|
QMap<int, QLabel*> m_inscriptionFieldLabels;
|
|
QPushButton *m_resetInscriptionButton;
|
|
|
|
// Кнопки диалога
|
|
QPushButton *m_okButton;
|
|
QPushButton *m_cancelButton;
|
|
|
|
// Данные
|
|
QStringList m_availableProperties;
|
|
QStringList m_currentTableMappings;
|
|
QMap<int, TitleInscriptionFieldExtended> m_inscriptionFields;
|
|
|
|
// Новые поля для децимальных номеров и названия платы
|
|
QMap<QString, QComboBox*> m_decimalNumberComboBoxes;
|
|
QMap<QString, QString> m_decimalNumberValues;
|
|
|
|
// Поля для "Первичное применение"
|
|
QComboBox *m_primaryApplicationComboBox;
|
|
int m_primaryApplicationFieldNumber;
|
|
|
|
// Статические данные о графах ГОСТ
|
|
static QMap<int, QString> s_fieldNames;
|
|
static QMap<int, QString> s_fieldDescriptions;
|
|
|
|
static void initializeFieldData();
|
|
|
|
// Новые методы для работы с децимальными номерами
|
|
void createDecimalNumberFields();
|
|
void loadDecimalNumberSettings();
|
|
void saveDecimalNumberSettings();
|
|
void onDecimalNumberComboBoxChanged(const QString &fieldName, const QString &value);
|
|
void updateDecimalNumberFieldValue(const QString &type, const QString &value);
|
|
|
|
// Методы для работы с полем "Первичное применение"
|
|
void createPrimaryApplicationField();
|
|
void loadPrimaryApplicationSettings();
|
|
void savePrimaryApplicationSettings();
|
|
void onPrimaryApplicationComboBoxChanged(int fieldNumber, const QString &value);
|
|
|
|
// Методы для работы с настройками шрифта
|
|
void createFontSettingsFields();
|
|
void loadFontSettings();
|
|
void saveFontSettings();
|
|
};
|
|
|
|
#endif // DOCUMENTSETTINGSDIALOG_H
|