projectdialog.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef PROJECTDIALOG_H
  2. #define PROJECTDIALOG_H
  3. #include <QComboBox>
  4. #include <QDialog>
  5. #include <QHash>
  6. #include <QJsonArray>
  7. #include <QJsonObject>
  8. #include "../regex.h"
  9. #include "hproject.h"
  10. namespace Ui {
  11. class ProjectDialog;
  12. }
  13. class ProjectDialog : public QDialog {
  14. Q_OBJECT
  15. public:
  16. explicit ProjectDialog(QWidget *parent = nullptr);
  17. ~ProjectDialog();
  18. void SetComboBoxBlast(const QJsonArray &bapoYuan);
  19. void SetComboBoxOperator(const QJsonArray &anQuanYuanArray);
  20. void SetL1AddressOptions(const QJsonArray &parentOptions);
  21. void setChildOptions(const QJsonArray &newChildOptions);
  22. void clearFormData();
  23. void setFormData(const HProject &Project);
  24. int getOperationStatus() const;
  25. void setOperationStatus(int newOperationStatus);
  26. private slots:
  27. void on_comboBoxAddr_currentIndexChanged(int index);
  28. void on_comboBoxAddr_2_currentIndexChanged(int index);
  29. void on_comboBoxOperator_currentIndexChanged(int index);
  30. void on_comboBoxBlast_currentIndexChanged(int index);
  31. signals:
  32. void validateDetNum(const QMap<QString, QString> &data);
  33. void validateDetNumUpdate(const QMap<QString, QString> &data);
  34. private:
  35. void fillComboBox(QComboBox *comboBox, const QJsonArray &jsonArray);
  36. void updateL2AddressOptions();
  37. void updateL3AddressOptions();
  38. void validateAndSaveProject();
  39. void extractNames(const QJsonArray &array, QStringList &names);
  40. private:
  41. Ui::ProjectDialog *ui;
  42. QString blasterId;
  43. QString operatorId;
  44. QJsonArray blasterArray;
  45. QJsonArray operatorArray;
  46. QJsonArray dataOptions;
  47. QJsonArray parentOptions;
  48. QJsonArray childOptions;
  49. QJsonArray grandChildOptions;
  50. QJsonArray L1AddressOptions;
  51. QJsonArray L2AddressOptions;
  52. QJsonArray L3AddressOptions;
  53. QHash<QString, QString> nameLoraSnMap;
  54. int operationStatus;
  55. };
  56. #endif // PROJECTDIALOG_H