Files
MI-38/s1000d/Converter14_Source/s1000d_manager.h
2023-06-14 18:08:32 +03:00

129 lines
5.0 KiB
C++

#ifndef S1000D_MANAGER_H
#define S1000D_MANAGER_H
#include <QString>
#include <QList>
//#include <QXmlStreamWriter>
//#include <QXmlStreamReader>
//#include <QXmlStreamAttribute>
#include <QDomDocument>
#include "ru_const.h"
#include "splashform.h"
#include <QApplication>
#include "QMessageBox"
#include <QElapsedTimer>
#include <QProcess>
#include <QDateTime>
enum _moduleType { mtDDN, mtDML, mtDM, mtPM, mtUNKNOWN };
enum _schemeType { stDDN, stDML, stPM, stAPPLICCROSSREFTABLE, stPRDCROSSREFTABLE, stCONDCROSSREFTABLE, stDESCRIPT, stPROCED, stPROCESS,
stCOMREP, stFRONTMATTER, stBREX, stBRDOC, stLEARNING, stCREW, stFAULT, stIPD, stCHECKLIST, stNOTATIONS, stCONTAINER, stXLINK, stWRNGFLDS, stUNKNOWN};
class S1000D_Manager
{
public:
S1000D_Manager();
~S1000D_Manager();
bool OpenProjectDirectory(const QString& projectPath, QString& schemasPath); // старое
void prepareSaveProject(); // старое
void SaveProject();
//static bool validateXML(const QString &xsdschema, const QString &xmlschema);
QDomNode findElementRec(QDomNode domNode, QString path);
QDomNode findElement(QString path);
//void searchPrepare();
//QDomNode searchNodeWithTag(QString tag); //QDomNode startNode,
//QDomNode searchNodeWithAttr(QString attrName, QString attrVal); //QDomNode startNode,
QString makeNodeXPath(QDomNode node);
QDomNode getNodeFromXPath(QString path, bool debugTrace=false);
QString getNodeText(QString path);
void setNodeText(QString path, QString text);
void deleteNode(QString path);
int createNode(QString path, QString nodeName);
bool isNodeCreated(QString path);
QString getNodeAttr(QString path, QString attrName);
void setNodeAttr(QString path, QString attrName, QString attrVal);
void deleteNodeAttr(QString path, QString attrName);
QStringList getNodeAllChilds(QString path);
int getNodeChildsWithNameCount(QString path, QString childNodeName);
int getNodePathIndex(QString name);
QString dmIdentString(QString dmIdentPath);
QString pmIdentString(QString pmIdentPath);
QString dmCodeIdentString(QDomNode node);
void setCurItem(int ind);
void clearItems();
void buildPMTree(int pmItemInd); // старое
void replaceCurItem_pmCode(QString new_Title, QString new_modelIdentCode, QString new_pmIssuer, QString new_pmNumber, QString pmVolume);
void moveItemToPM(int itemInd, int pmInd, int pmContextEntryIndex);
void replaceCurItem_dmCode(QString new_techName, QString new_infoName,
QString new_modelIdentCode, QString new_systemDiffCode,
QString new_systemCode, QString new_subSystemCode, QString new_subSubSystemCode, QString new_assyCode,
QString new_disassyCode, QString new_disassyCodeVariant,
QString new_infoCode, QString new_infoCodeVariant,
QString new_itemLocationCode, QString new_learnCode, QString new_learnEventCode);
int createPM(int parentItemInd, int insertAfterChildNum);
int createDM(int parentItemInd, int insertAfterChildNum, QString scheme);
QDomElement createEmpty_pmRef(QString parent_modelIdentCode, QString parent_pmIssuer);
QDomElement createEmpty_dmRef(QString parent_modelIdentCode);
void deleteItem(int itemInd);
_schemeType getSchemeTypeByStr(QString str);
void resetICN();
QString genICN();
bool copyDir(const QString &srcPath, const QString &dstPath);
void fillManifest(int itemIndex, QDomNode curOrgNode, QDomNode resNode, QDomDocument manifest);
bool exportS1000D(QString dstDir, QString packFileName, QString packTitle, SplashForm* splash);
bool exportSCORM(QString dstDir, QString packFileName, QString packTitle, SplashForm* splash);
QStringList html;
void addHTML(int lvl, QString s);
void catHTML(QString s);
int bugCnt=0;
RU_Const ru_const;
//struct searchListStruct {
// QString name;
// QDomNode node;
//};
struct ItemStruct { // Основная структура хранения данных
QString fileName, S1000D_fileName, SCORM_fileName;
QString fileCode;
_moduleType moduleType;
_schemeType schemeType;
int parent; // -1 = root
QList<int> child;
QDomDocument doc;
bool isReady, dmDataFilled, toExport, isQualifyed;
int selectedInDMCodeList;
QString importedFromLyX;
QStringList lyxLog, html, inPackages;
QString origTitle;
} *item;
int itemIndex;
QList <ItemStruct> items;
QList <QString> log;
bool DBG=true;
QString projectPath="";
QString rootLyXfile="";
int ICN_UI=0;
bool isConsole=false;
int timeConvert, timeSCORM, timeS1000D;
struct PackageStruct {
QString cfgName, title, exportFileName;
};
QList <PackageStruct> packages;
void LoadPackagesXML();
void SavePackagesXML();
void AddPackageContent(QDomNode node, int ind);
void ParsePackageContent(QDomNode node, int parentItem);
};
#endif // S1000D_MANAGER_H