|
|
#pragma once
|
|
|
|
|
|
#include "nmSubWxs_global.h"
|
|
|
#include "nmReservoirParameterCatalog.h"
|
|
|
|
|
|
#include <QList>
|
|
|
#include <QMap>
|
|
|
#include <QWidget>
|
|
|
|
|
|
class nmIReservoirParameterUnitService;
|
|
|
class nmReservoirParameterField;
|
|
|
class nmReservoirPropertiesSession;
|
|
|
class QComboBox;
|
|
|
class QGridLayout;
|
|
|
class QLabel;
|
|
|
class QVBoxLayout;
|
|
|
|
|
|
/**
|
|
|
* @brief 储层参数分类的原型式共享页面。
|
|
|
* @note 页面是普通QWidget,只负责一层内容布局,不拥有单位系统或真实数据。
|
|
|
*/
|
|
|
class NM_SUB_WXS_EXPORT nmReservoirParameterPage : public QWidget
|
|
|
{
|
|
|
Q_OBJECT
|
|
|
|
|
|
public:
|
|
|
/**
|
|
|
* @brief 构造共享参数页面。
|
|
|
* @param eCategory 页面分类。
|
|
|
* @param pSession 编辑会话,不转移所有权。
|
|
|
* @param pUnitService 主对话框单位服务,不转移所有权。
|
|
|
* @param pParent 父窗口。
|
|
|
*/
|
|
|
nmReservoirParameterPage(nmReservoirPropertiesCategory eCategory,
|
|
|
nmReservoirPropertiesSession* pSession,
|
|
|
nmIReservoirParameterUnitService* pUnitService,
|
|
|
QWidget* pParent = nullptr);
|
|
|
|
|
|
/** @brief 析构参数页面。 */
|
|
|
virtual ~nmReservoirParameterPage();
|
|
|
|
|
|
/**
|
|
|
* @brief 重新读取当前分类对象并显示第一个对象。
|
|
|
* @param sError 输出字段构建错误。
|
|
|
* @return 页面构建成功返回true。
|
|
|
*/
|
|
|
bool reloadObjects(QString& sError);
|
|
|
|
|
|
/**
|
|
|
* @brief 校验并将当前可见数值写入会话工作副本。
|
|
|
* @return 输入全部有效且写入成功时返回true。
|
|
|
*/
|
|
|
bool commitPendingEdits();
|
|
|
|
|
|
/** @brief 返回当前页面的可见输入是否全部有效。 */
|
|
|
bool isInputValid();
|
|
|
|
|
|
/** @brief 返回当前分类是否存在可编辑对象。 */
|
|
|
bool hasEditableObjects() const;
|
|
|
|
|
|
/** @brief 返回页面分类。 */
|
|
|
nmReservoirPropertiesCategory category() const;
|
|
|
|
|
|
signals:
|
|
|
/** @brief 当前页有效状态发生变化。 */
|
|
|
void sigValidityChanged(bool bValid);
|
|
|
|
|
|
private slots:
|
|
|
/** @brief 切换当前编辑对象。 */
|
|
|
void slotObjectChanged(int nIndex);
|
|
|
|
|
|
/** @brief 数值输入变化后刷新整体有效状态。 */
|
|
|
void slotFieldValueEdited();
|
|
|
|
|
|
/** @brief 枚举code变化后保存并执行集中联动。 */
|
|
|
void slotEnumIndexChanged(int nIndex);
|
|
|
|
|
|
private:
|
|
|
/** @brief 创建页标题、对象选择器和单层分组区域。 */
|
|
|
void createUi();
|
|
|
|
|
|
/** @brief 根据当前分类返回标题。 */
|
|
|
QString categoryTitle() const;
|
|
|
|
|
|
/** @brief 根据当前分类返回对象选择标签。 */
|
|
|
QString objectSelectorLabel() const;
|
|
|
|
|
|
/** @brief 构建指定对象的全部分组和字段。 */
|
|
|
bool buildObject(int nObjectIndex, QString& sError);
|
|
|
|
|
|
/** @brief 删除上一个对象的分组控件和字段对象。 */
|
|
|
void clearObjectEditors();
|
|
|
|
|
|
/** @brief 创建一个原型式参数分组。 */
|
|
|
bool buildGroup(const nmReservoirParameterGroupInfo& oGroupInfo,
|
|
|
QString& sError);
|
|
|
|
|
|
/** @brief 从工作副本加载字段初始值。 */
|
|
|
void loadFieldValue(nmReservoirParameterField* pField);
|
|
|
|
|
|
/** @brief 根据当前稳定code统一刷新字段可见性。 */
|
|
|
void applyVisibilityRules();
|
|
|
|
|
|
/** @brief 设置指定稳定参数ID的字段可见性。 */
|
|
|
void setFieldVisible(const QString& sParameterId, bool bVisible);
|
|
|
|
|
|
/** @brief 刷新有效状态并通知主对话框。 */
|
|
|
void updateValidity();
|
|
|
|
|
|
nmReservoirPropertiesCategory m_eCategory; ///< 页面分类。
|
|
|
nmReservoirPropertiesSession* m_pSession; ///< 编辑会话,不拥有所有权。
|
|
|
nmIReservoirParameterUnitService* m_pUnitService; ///< 主对话框单位服务,不拥有所有权。
|
|
|
QList<nmReservoirPropertyObjectInfo> m_listObjectInfos; ///< 当前分类对象描述。
|
|
|
int m_nCurrentObjectIndex; ///< 当前对象索引。
|
|
|
bool m_bUpdatingObject; ///< 阻止对象下拉框回滚重入。
|
|
|
bool m_bBuildingFields; ///< 阻止加载数据时触发业务信号。
|
|
|
|
|
|
QLabel* m_pTitleLabel; ///< 页面标题。
|
|
|
QLabel* m_pObjectLabel; ///< 对象选择标签。
|
|
|
QComboBox* m_pObjectComboBox; ///< 多对象选择下拉框。
|
|
|
QWidget* m_pGroupsWidget; ///< 无边框的分组布局载体。
|
|
|
QGridLayout* m_pGroupsLayout; ///< 两列分组布局。
|
|
|
QVBoxLayout* m_pMainLayout; ///< 页面主布局。
|
|
|
QLabel* m_pEmptyLabel; ///< 空对象提示。
|
|
|
QList<nmReservoirParameterField*> m_listFields; ///< 当前对象全部字段。
|
|
|
QMap<QString, nmReservoirParameterField*> m_mapFields; ///< 稳定ID到字段映射。
|
|
|
QMap<QObject*, nmReservoirParameterField*> m_mapEditorFields; ///< 编辑器到字段映射。
|
|
|
};
|