logplus/WellLogUI/src/SmoothTool.cpp
2025-10-29 17:23:30 +08:00

169 lines
4.0 KiB
C++
Raw Blame History

#include "SmoothTool.h"
#include "ui_SmoothTool.h"
#include "qstring.h"
#include <qpushbutton.h>
SmoothTool::SmoothTool(QDialog *parent) :
QDialog(parent),
Sm_UI(new Ui::SmoothTool)
{
Sm_UI->setupUi(this);
setWindowFlags(windowFlags()& ~Qt::WindowMaximizeButtonHint);
setFixedSize(this->width(), this->height());
this->setWindowFlags(this->windowFlags() |Qt::Dialog);
this->setWindowModality(Qt::ApplicationModal);
connect(Sm_UI->pushButton, SIGNAL(clicked()), this, SLOT(acceptSmooth_SLOT()));
connect(Sm_UI->pushButton_2, SIGNAL(clicked()), this, SLOT(reject()));
connect(Sm_UI->pushButton_2, SIGNAL(clicked()), this, SLOT(rejectSmooth_SLOT()));
mode = 0;
cal = 0;
Sm_UI->radioButtonSm3->setChecked(true);
Sm_UI->radioButtonJ->setChecked(true);
connect(Sm_UI->radioButtonSm3, SIGNAL(toggled(bool)), this, SLOT(Sm3_SLOT(bool)));
connect(Sm_UI->radioButtonSm5, SIGNAL(toggled(bool)), this, SLOT(Sm5_SLOT(bool)));
connect(Sm_UI->radioButtonSm7, SIGNAL(toggled(bool)), this, SLOT(Sm7_SLOT(bool)));
connect(Sm_UI->radioButtonJ, SIGNAL(toggled(bool)), this, SLOT(SmJ_SLOT(bool)));
connect(Sm_UI->radioButtonG, SIGNAL(toggled(bool)), this, SLOT(SmG_SLOT(bool)));
connect(Sm_UI->radioButtonU, SIGNAL(toggled(bool)), this, SLOT(SmU_SLOT(bool)));
maxSmoothCount = 40;
Sm_UI->SmoothCount->setMinimum(0);
Sm_UI->SmoothCount->setMaximum(maxSmoothCount);
Sm_UI->SmoothCount->setSingleStep(1);
Sm_UI->spinBox->setRange(0, maxSmoothCount);
connect(Sm_UI->spinBox, SIGNAL(valueChanged(int)), Sm_UI->SmoothCount, SLOT(setValue(int)));
connect(Sm_UI->SmoothCount, SIGNAL(valueChanged(int)), Sm_UI->spinBox, SLOT(setValue(int)));
Sm_UI->spinBox->setValue(0);
connect(Sm_UI->SmoothCount, SIGNAL(valueChanged(int)), this, SLOT(smoothApplication_SLOT()));
}
SmoothTool::~SmoothTool()
{
delete Sm_UI;
}
void SmoothTool::setLineEditable()
{
Sm_UI->spinBox->setValue(0);
Sm_UI->lineEdit->setEnabled(true);
Sm_UI->lineEdit_2->setEnabled(true);
}
void SmoothTool::smoothApplication_SLOT()
{
QString t = Sm_UI->lineEdit->text();
Sdep = t.toFloat();
depCheck();
t = Sm_UI->lineEdit_2->text();
edep = t.toFloat();
depCheck();
Sm_UI->lineEdit->setEnabled(false);
Sm_UI->lineEdit_2->setEnabled(false);
emit sendDataSmoothSign(Sdep, edep, mode, cal, Sm_UI->spinBox->value());
}
void SmoothTool::sdepChange_SLOT()
{
QString t = Sm_UI->lineEdit->text();
Sdep = t.toFloat();
depCheck();
}
void SmoothTool::edepChange_SLOT()
{
QString t = Sm_UI->lineEdit_2->text();
edep = t.toFloat();
depCheck();
}
void SmoothTool::setSliderValue(int v)
{
Sm_UI->spinBox->setValue(v);
}
void SmoothTool::Sm3_SLOT(bool flag)
{
if(flag==true)
mode = 0;
}
void SmoothTool::Sm5_SLOT(bool flag)
{
if(flag==true)
mode = 1;
}
void SmoothTool::Sm7_SLOT(bool flag)
{
if(flag==true)
mode = 2;
}
void SmoothTool::SmJ_SLOT(bool flag)
{
if(flag==true)
cal = 0;
}
void SmoothTool::SmZ_SLOT(bool flag)
{
//<2F><><EFBFBD><EFBFBD>
if(flag==true)
cal = 1;
}
void SmoothTool::SmG_SLOT(bool flag)
{
if(flag==true)
cal = 2;
}
void SmoothTool::SmU_SLOT(bool flag)
{
if(flag==true)
cal = 3;
}
void SmoothTool::depCheck()
{
if(Sdep < realSdep)Sdep = realSdep;
if(edep > realEdep)edep = realEdep;
if(edep < Sdep)edep = Sdep;
}
void SmoothTool::setSmoothDep(float rsd, float red, float sd, float ed)
{
realSdep = rsd;
realEdep = red;
Sdep = sd;
edep = ed;
depCheck();
Sm_UI->lineEdit->setText(QString("%1").arg(Sdep));
Sm_UI->lineEdit_2->setText(QString("%1").arg(edep));
Sm_UI->lineEdit->setValidator(new QIntValidator(realSdep,realEdep,this));
Sm_UI->lineEdit_2->setValidator(new QIntValidator(realSdep,realEdep,this));
}
void SmoothTool::setmaxSmoothCount(int count)
{
if(count > maxSmoothCount){
maxSmoothCount = count;
Sm_UI->SmoothCount->setMaximum(maxSmoothCount);
}
}
void SmoothTool::sliderChange()
{
//emit sendDataSmoothSign(Sdep, edep, mode, cal, Sm_UI->spinBox->value());
}
void SmoothTool::rejectSmooth_SLOT()
{
emit cancelSmooth();
}
void SmoothTool::acceptSmooth_SLOT()
{
emit SaveSmooth();
accept();
}