ConfigExpertDataWidget.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. #ifndef CONFIGEXPERTDATAWIDGET_H
  2. #define CONFIGEXPERTDATAWIDGET_H
  3. #include <QWidget>
  4. #include "SchemePlanManager.h"
  5. #include <QMap>
  6. class NodeMatrixInfo;
  7. class QFUser;
  8. class UserConfig;
  9. class ToolButton;
  10. class PushButton;
  11. class QVBoxLayout;
  12. class QHBoxLayout;
  13. class QGridLayout;
  14. class QLabel;
  15. class QSplitter;
  16. class QPushButton;
  17. class QListWidget;
  18. class QSpinBox;
  19. /**
  20. * @brief The ConfigListItemWidget class
  21. * 自定义专家配置列表条目
  22. */
  23. class ConfigListItemWidget : public QWidget
  24. {
  25. Q_OBJECT
  26. public:
  27. explicit ConfigListItemWidget(QWidget *parent = nullptr);
  28. UserConfig *userConfig() const;
  29. void setUserConfig(UserConfig *config);
  30. void setImported(bool imported);
  31. int spinValue() const;
  32. signals:
  33. void sigImport(UserConfig *config);
  34. void sigRemove(UserConfig *config);
  35. private:
  36. void initWidget();
  37. void initLayouts();
  38. void connectSignalsAndSlots();
  39. private slots:
  40. void slotImport();
  41. void slotRemove();
  42. private:
  43. UserConfig *m_config = nullptr;
  44. QLabel *m_name = nullptr;
  45. QSpinBox *m_weight = nullptr;
  46. QPushButton *m_import = nullptr;
  47. QPushButton *m_remove = nullptr;
  48. QHBoxLayout *m_layout = nullptr;
  49. };
  50. /**
  51. * @brief The ExpertListItemWidget class
  52. * 自定义专家列表条目
  53. */
  54. class ExpertListItemWidget : public QWidget
  55. {
  56. Q_OBJECT
  57. public:
  58. explicit ExpertListItemWidget(QWidget *parent = nullptr);
  59. QFUser *user() const;
  60. void setUser(QFUser *user);
  61. void setIndex(int index);
  62. void setAdded(bool added);
  63. signals:
  64. void sigAddUser(QFUser *user);
  65. private:
  66. void initWidget();
  67. void initLayout();
  68. void connectSignalsAndSlots();
  69. private:
  70. void slotAdd();
  71. private:
  72. QFUser *m_user = nullptr;
  73. QLabel *m_index = nullptr;
  74. QLabel *m_name = nullptr;
  75. QPushButton *m_add = nullptr;
  76. QHBoxLayout *m_layout = nullptr;
  77. };
  78. /**
  79. * @brief The ConfigExpertDataWidget class
  80. * 专家配置和导入专家数据视图
  81. */
  82. class ConfigExpertDataWidget : public QWidget
  83. {
  84. Q_OBJECT
  85. public:
  86. explicit ConfigExpertDataWidget(QWidget *parent = nullptr);
  87. void initialize();
  88. void initLayout();
  89. void connectSignalsAndSlots();
  90. void setProcess(SchemePlanManager::SchemeProcessInfo process);
  91. void loadData();
  92. void loadExpert();
  93. void loadConfig();
  94. void loadNodeData();
  95. void selectFirstImported();
  96. void selectConfig(UserConfig *config);
  97. QList<NodeMatrixInfo *> selectedData();
  98. signals:
  99. void sigImportData(UserConfig *config);
  100. void sigConfigCurrentChanged();
  101. protected:
  102. virtual void showEvent(QShowEvent *event) override;
  103. virtual void hideEvent(QHideEvent *event) override;
  104. private:
  105. void refreshConfigList();
  106. void refreshExpList();
  107. private slots:
  108. void slotSave();
  109. void slotRefresh();
  110. void slotAddUser(QFUser *user);
  111. void slotRemoveConfig(UserConfig *config);
  112. void slotImportData(UserConfig *config);
  113. void slotUserConfigCurrentChanged();
  114. private:
  115. SchemePlanManager::SchemeProcessInfo m_process;
  116. bool m_isProcessChanged = false;
  117. QVBoxLayout *m_vBoxLayout = nullptr;
  118. QLabel *m_titleLabel = nullptr;
  119. QSplitter *m_splitter = nullptr;
  120. QWidget *m_configWidget = nullptr;
  121. QVBoxLayout *m_configWidgetLayout = nullptr;
  122. QWidget *m_configListHeader = nullptr;
  123. QHBoxLayout *m_configListHeaderLayout = nullptr;
  124. QLabel *m_configListTitleLabel = nullptr;
  125. QLabel *m_configListTipsLabel = nullptr;
  126. QPushButton *m_saveButton = nullptr;
  127. QListWidget *m_configListWidget = nullptr;
  128. QWidget *m_expWidget = nullptr;
  129. QVBoxLayout *m_expWidgetLayout = nullptr;
  130. QWidget *m_expListHeader = nullptr;
  131. QHBoxLayout *m_expListHeaderLayout = nullptr;
  132. QLabel *m_expListTitleLabel = nullptr;
  133. QPushButton *m_refreshButton = nullptr;
  134. QListWidget *m_expListWidget = nullptr;
  135. QList<QFUser *> m_expertList;
  136. QList<UserConfig *> m_configList;
  137. QMap<QString, QList<NodeMatrixInfo *>> m_nodeData; // 按组归类的专家数据
  138. };
  139. #endif // CONFIGEXPERTDATAWIDGET_H