|
|
#include "nmWxNewNormalDlg.h"
|
|
|
|
|
|
#include <QFormLayout>
|
|
|
#include <QScrollArea>
|
|
|
#include <QLabel>
|
|
|
#include <QLineEdit>
|
|
|
#include <QCheckBox>
|
|
|
#include <QPushButton>
|
|
|
#include <QDebug>
|
|
|
#include <QVBoxLayout>
|
|
|
#include <QListWidget>
|
|
|
|
|
|
#include "nmData/nmDataLogFile.h"
|
|
|
#include "nmData/nmDataDemo.h"
|
|
|
#include "nmData/nmDefines.h"
|
|
|
#include "ZxResolutionHelper.h"
|
|
|
#include "zxLogInstance.h"
|
|
|
#include "ZxDataObjectDbl.h"
|
|
|
|
|
|
nmWxNewNormalDlg::nmWxNewNormalDlg(nmDataDemo* dataPtr)
|
|
|
{
|
|
|
this->m_pAnalyzeData = nmDataDemo::getInstance();
|
|
|
m_pMainLayout = NULL;
|
|
|
m_pNameEdit = NULL;
|
|
|
m_pCheckboxWater = NULL;
|
|
|
m_pCheckboxOil = NULL;
|
|
|
m_pCheckboxGas = NULL;
|
|
|
this->setWindowTitle("New Analyze");
|
|
|
this->initUI();
|
|
|
this->setMinimumSize(QSize(_resoSizeW(400), _resoSizeW(200)));
|
|
|
}
|
|
|
|
|
|
nmWxNewNormalDlg::~nmWxNewNormalDlg()
|
|
|
{
|
|
|
}
|
|
|
|
|
|
void nmWxNewNormalDlg::initUI()
|
|
|
{
|
|
|
nmDataLogFile::getInstance()->writeLog("initUI nmNewDlg");
|
|
|
m_pMainLayout = new QVBoxLayout();
|
|
|
Q_ASSERT (NULL != m_pMainLayout);
|
|
|
m_pMainLayout->setSpacing(20);
|
|
|
m_pMainLayout->setMargin(5);
|
|
|
m_pMainLayout->setSizeConstraint(QVBoxLayout::SetMinAndMaxSize);
|
|
|
//以ScrollArea来显示,出现滚动条
|
|
|
{
|
|
|
QWidget* pWxBk = new QWidget();
|
|
|
Q_ASSERT (NULL != pWxBk);
|
|
|
pWxBk->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
pWxBk->setAutoFillBackground(true);
|
|
|
pWxBk->setLayout(m_pMainLayout);
|
|
|
// Area,设置Widget
|
|
|
QScrollArea* pArea = new QScrollArea();
|
|
|
pArea->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
|
|
|
pArea->setWidgetResizable(true);
|
|
|
pArea->setWidget(pWxBk);
|
|
|
pArea->setContextMenuPolicy(Qt::CustomContextMenu);//*/
|
|
|
// Layout, 设置Area。
|
|
|
QVBoxLayout* pLayoutBk = new QVBoxLayout();
|
|
|
pLayoutBk->setSpacing(0);
|
|
|
pLayoutBk->setMargin(0);
|
|
|
pLayoutBk->addWidget(pArea);
|
|
|
setLayout(pLayoutBk);
|
|
|
}
|
|
|
this->renderComponents();
|
|
|
}
|
|
|
|
|
|
void nmWxNewNormalDlg::renderComponents()
|
|
|
{
|
|
|
// TODO,渲染新建分析需要的组件
|
|
|
QFormLayout* fLayout = new QFormLayout;
|
|
|
// 创建标签和输入框
|
|
|
// Job名称
|
|
|
QLabel *nameLabel = new QLabel("Job name:");
|
|
|
m_pNameEdit = new QLineEdit();
|
|
|
// 相态选择
|
|
|
QLabel *phaseLabel = new QLabel("Phase selection:");
|
|
|
// 创建三个三态复选框
|
|
|
QHBoxLayout *phaseLayout = new QHBoxLayout;
|
|
|
m_pCheckboxOil = new QCheckBox("Oil");
|
|
|
m_pCheckboxGas = new QCheckBox("Gas");
|
|
|
m_pCheckboxWater = new QCheckBox("Water");
|
|
|
phaseLayout->addWidget(m_pCheckboxOil);
|
|
|
phaseLayout->addWidget(m_pCheckboxGas);
|
|
|
phaseLayout->addWidget(m_pCheckboxWater);
|
|
|
// 将标签和输入框添加到表单布局中
|
|
|
fLayout->addRow(nameLabel, m_pNameEdit);
|
|
|
fLayout->addRow(phaseLabel, phaseLayout);
|
|
|
// 添加到主框架上
|
|
|
m_pMainLayout->addLayout(fLayout);
|
|
|
// PVT和相渗选择
|
|
|
// QHBoxLayout* hLayout = new QHBoxLayout;
|
|
|
QGridLayout* gLayout = new QGridLayout;
|
|
|
gLayout->setMargin(0);
|
|
|
gLayout->setSpacing(2);
|
|
|
m_pMainLayout->addLayout(gLayout);
|
|
|
// 底部按钮
|
|
|
QHBoxLayout* hLayout = new QHBoxLayout;
|
|
|
QPushButton* saveBT = new QPushButton("Save");
|
|
|
QPushButton* cancelBT = new QPushButton("Cancel");
|
|
|
connect(saveBT, SIGNAL(clicked()), this, SLOT(on_save()));
|
|
|
connect(cancelBT, SIGNAL(clicked()), this, SLOT(reject()));
|
|
|
hLayout->addStretch();
|
|
|
hLayout->addWidget(saveBT);
|
|
|
hLayout->addWidget(cancelBT);
|
|
|
m_pMainLayout->addLayout(hLayout);
|
|
|
nmDataLogFile::getInstance()->writeLog("renderComponents nmNewDlg!!!");
|
|
|
}
|
|
|
|
|
|
void nmWxNewNormalDlg::on_save()
|
|
|
{
|
|
|
nmDataLogFile::getInstance()->writeLog("on_save nmNewDlg!!!");
|
|
|
// TODO,判断是否设置了名称
|
|
|
QString analyzeName = m_pNameEdit->text().trimmed();
|
|
|
if (analyzeName.length() == 0) {
|
|
|
QMessageBox::information(NULL, zxAppID, QObject::tr("name is empty"));
|
|
|
return;
|
|
|
} else {
|
|
|
if (m_pAnalyzeData != NULL) {
|
|
|
m_pAnalyzeData->setAnalyzeName(analyzeName);
|
|
|
} else {
|
|
|
QMessageBox::information(NULL, zxAppID, QObject::tr("m_pAnalyzeData is NULL"));
|
|
|
}
|
|
|
}
|
|
|
// TODO,判断是否设置了多相流
|
|
|
QList<NM_PHASE_TYPE> phaseList;
|
|
|
if (m_pCheckboxOil->isChecked()) {
|
|
|
phaseList.append(NM_PHASE_TYPE::PHASE_Oil);
|
|
|
}
|
|
|
if (m_pCheckboxGas->isChecked()) {
|
|
|
phaseList.append(NM_PHASE_TYPE::PHASE_Gas);
|
|
|
}
|
|
|
if (m_pCheckboxWater->isChecked()) {
|
|
|
phaseList.append(NM_PHASE_TYPE::PHASE_Water);
|
|
|
}
|
|
|
if (phaseList.length() == 0) {
|
|
|
QMessageBox::information(NULL, zxAppID, QObject::tr("phase is empty"));
|
|
|
return;
|
|
|
} else {
|
|
|
m_pAnalyzeData->setAnalyzeMultiphase(phaseList);
|
|
|
}
|
|
|
//// TODO,判断是否设置了PVT
|
|
|
//m_pAnalyzeData->setAnalyzePVTIndex(m_pvtListWidget->currentRow());
|
|
|
//// TODO,判断是否设置了相渗
|
|
|
//m_pAnalyzeData->setAnalyzeIIIndex(m_iiListWidget->currentRow());
|
|
|
this->accept();
|
|
|
}
|