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:
@@ -0,0 +1,161 @@
|
||||
#ifndef MAINCONTROLLER_H
|
||||
#define MAINCONTROLLER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QList>
|
||||
#include "databasecontroller.h"
|
||||
#include "pdfcontroller.h"
|
||||
#include "csvexporter.h"
|
||||
|
||||
class ComponentTableModel;
|
||||
class ProjectParamTableModel;
|
||||
class ProjectSettingsModel;
|
||||
class DesignatorMappingModel;
|
||||
class PerechenTableModel;
|
||||
class PerechenTableController;
|
||||
class SpecificationPCBTableModel;
|
||||
class SpecificationPCBController;
|
||||
class SpecificationTableModel;
|
||||
class SpecificationController;
|
||||
class VedomostTableModel;
|
||||
class VedomostController;
|
||||
class TitleInscriptionsModel;
|
||||
class PCBMaterialModel;
|
||||
class AltiumParser;
|
||||
|
||||
class MainController : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MainController(QObject *parent = nullptr);
|
||||
~MainController();
|
||||
|
||||
// Доступ к моделям
|
||||
ComponentTableModel* componentTableModel() const;
|
||||
ProjectParamTableModel* projectParamTableModel() const;
|
||||
ProjectSettingsModel* projectSettingsModel() const;
|
||||
DesignatorMappingModel* designatorMappingModel() const;
|
||||
PerechenTableModel* perechenTableModel() const;
|
||||
PerechenTableController* perechenTableController() const;
|
||||
SpecificationPCBTableModel* specificationPCBTableModel() const;
|
||||
SpecificationPCBController* specificationPCBController() const;
|
||||
SpecificationTableModel* specificationTableModel() const;
|
||||
SpecificationController* specificationController() const;
|
||||
VedomostTableModel* vedomostTableModel() const;
|
||||
VedomostController* vedomostController() const;
|
||||
TitleInscriptionsModel* titleInscriptionsModel() const;
|
||||
PCBMaterialModel* pcbMaterialModel() const;
|
||||
|
||||
// Работа с БД
|
||||
bool initializeDatabase(const QString &dbPath = "components.db");
|
||||
bool initializeGlobalDatabase();
|
||||
bool isDatabaseOpen() const;
|
||||
QString lastError() const;
|
||||
|
||||
// Работа с данными
|
||||
void clearAllData();
|
||||
bool setCurrentVariant(const QString &variant);
|
||||
bool loadComponentsFromDatabase();
|
||||
bool saveComponentsToDatabase();
|
||||
bool loadProjectParamsFromDatabase();
|
||||
bool saveProjectParamsToDatabase();
|
||||
|
||||
// Работа с материалами платы
|
||||
bool loadPCBMaterialsFromDatabase();
|
||||
|
||||
// Работа с настройками проекта
|
||||
bool loadProjectSettingsFromDatabase();
|
||||
bool saveProjectSettingsToDatabase();
|
||||
|
||||
// Синхронизация настроек колонок с PerechenTableController
|
||||
void syncColumnMappingsWithPerechenController();
|
||||
void syncColumnMappingsWithSpecificationPCBController();
|
||||
void syncColumnMappingsWithSpecificationController();
|
||||
void syncColumnMappingsWithVedomostController();
|
||||
|
||||
// Работа с надписями титульного листа
|
||||
bool saveTitleInscriptionsToDatabase(const QMap<int, QString> &inscriptions);
|
||||
bool loadTitleInscriptionsFromDatabase(QMap<int, QString> &inscriptions);
|
||||
|
||||
// Работа с перечнем элементов
|
||||
bool savePerechenTableToDatabase(const QByteArray &tableData, const QString &projectName = QString());
|
||||
QByteArray loadPerechenTableFromDatabase(const QString &projectName = QString());
|
||||
QString getPerechenTableInfo(const QString &projectName = QString());
|
||||
|
||||
// Работа со спецификацией платы
|
||||
bool saveSpecificationPCBTableToDatabase(const QByteArray &tableData, const QString &projectName = QString());
|
||||
QByteArray loadSpecificationPCBTableFromDatabase(const QString &projectName = QString());
|
||||
QString getSpecificationPCBTableInfo(const QString &projectName = QString());
|
||||
|
||||
// Работа со спецификацией материалов
|
||||
bool saveSpecificationTableToDatabase(const QByteArray &tableData, const QString &projectName = QString());
|
||||
QByteArray loadSpecificationTableFromDatabase(const QString &projectName = QString());
|
||||
QString getSpecificationTableInfo(const QString &projectName = QString());
|
||||
|
||||
// Работа с ведомостью покупных изделий
|
||||
bool saveVedomostTableToDatabase(const QByteArray &tableData, const QString &projectName = QString());
|
||||
QByteArray loadVedomostTableFromDatabase(const QString &projectName = QString());
|
||||
QString getVedomostTableInfo(const QString &projectName = QString());
|
||||
|
||||
// Парсинг файлов
|
||||
bool parseFile(const QString &filePath);
|
||||
bool parseFileAsync(const QString &filePath);
|
||||
bool isParsingAsync() const;
|
||||
void cancelParsing();
|
||||
|
||||
bool exportPerechen();
|
||||
|
||||
// Метод для экспорта перечня элементов в PDF
|
||||
bool exportPerechenToPdf(const QString &filePath);
|
||||
|
||||
// Метод для экспорта спецификации PCB в PDF
|
||||
bool exportSpecificationPcbToPdf(const QString &filePath);
|
||||
|
||||
// Метод для экспорта спецификации материалов в PDF
|
||||
bool exportSpecificationToPdf(const QString &filePath);
|
||||
|
||||
// Метод для экспорта ведомости покупных изделий в PDF
|
||||
bool exportVedomostToPdf(const QString &filePath);
|
||||
|
||||
// Методы для экспорта в CSV
|
||||
bool exportPerechenToCsv(const QString &filePath);
|
||||
bool exportSpecificationPcbToCsv(const QString &filePath);
|
||||
bool exportSpecificationToCsv(const QString &filePath);
|
||||
bool exportVedomostToCsv(const QString &filePath);
|
||||
|
||||
// Метод для получения PDFController
|
||||
PDFController* pdfController() const;
|
||||
|
||||
signals:
|
||||
void parsingStarted();
|
||||
void parsingProgress(int percentage);
|
||||
void parsingFinished(bool success);
|
||||
void error(const QString &error);
|
||||
void databaseError(const QString &error);
|
||||
|
||||
private:
|
||||
ComponentTableModel* m_componentTableModel;
|
||||
ProjectParamTableModel* m_projectParamTableModel;
|
||||
ProjectSettingsModel* m_projectSettingsModel;
|
||||
DesignatorMappingModel* m_designatorMappingModel;
|
||||
PerechenTableModel* m_perechenTableModel;
|
||||
PerechenTableController* m_perechenTableController;
|
||||
SpecificationPCBTableModel* m_specificationPCBTableModel;
|
||||
SpecificationPCBController* m_specificationPCBController;
|
||||
SpecificationTableModel* m_specificationTableModel;
|
||||
SpecificationController* m_specificationController;
|
||||
VedomostTableModel* m_vedomostTableModel;
|
||||
VedomostController* m_vedomostController;
|
||||
TitleInscriptionsModel* m_titleInscriptionsModel;
|
||||
PCBMaterialModel* m_pcbMaterialModel;
|
||||
DataBaseController* m_databaseController;
|
||||
DataBaseController* m_globalDatabaseController;
|
||||
AltiumParser* m_altiumParser;
|
||||
QString m_currentVariant;
|
||||
PDFController* m_pdfController;
|
||||
CSVExporter* m_csvExporter;
|
||||
};
|
||||
|
||||
#endif // MAINCONTROLLER_H
|
||||
Reference in New Issue
Block a user