#ifndef MAINWINDOW_H #define MAINWINDOW_H #include #include #include #include #include #include #include "XMLReader.h" QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } QT_END_NAMESPACE class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); enum eElementType:quint8 { root, database, table, field, unknown }; private slots: void on_actionOpen_triggered(); void on_treeView_doubleClicked(const QModelIndex &index); void on_pushButton_clicked(); void on_pushButton_3_clicked(); void on_actionSave_triggered(); private: Ui::MainWindow *ui; QStandardItemModel *_model; QString _fileName; //dbData QDomDocument _xmlDoc; QDomElement _rootData; QDomElement _lastDBElement; QDomElement _lastTableElement; QVector _fieldElemensVector; // QString _xmlDBAddress; //initData QDomDocument _xmlInitDataDoc; QDomElement _rootInitData; QDomElement _lastDBElementInitData; QDomElement _lastTableElementInitData; QDomElement _lastEntityElementInitData; QDomElement _lastFieldElementInitData; XMLReader* _xmlReader; QVector _DBNameVector; QVector _DBElementVector; eElementType getElementType(QModelIndex indInput); bool hasDatabaseChild(QDomElement xmlRoot, QString DBName); bool hasTableChild(QDomElement database, QString tableName); void initUI(); int _fieldIndex = 0; void readFile(); void writeFile(); void hideWidgets(); }; #endif // MAINWINDOW_H