fixed fourier phase entry problem (MUSR-70)
This commit is contained in:
parent
51e257a276
commit
0e1f33cc23
@ -34,6 +34,7 @@
|
||||
#include <qvalidator.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qbutton.h>
|
||||
#include <qmessagebox.h>
|
||||
|
||||
#include "PGetFourierDialog.h"
|
||||
|
||||
@ -45,11 +46,49 @@ PGetFourierDialog::PGetFourierDialog()
|
||||
{
|
||||
fFourierBlock = "";
|
||||
fFourierPower_lineEdit->setValidator( new QIntValidator(fFourierPower_lineEdit) );
|
||||
fPhase_lineEdit->setValidator( new QDoubleValidator(fPhase_lineEdit) );
|
||||
fPhaseCorrectionRangeLow_lineEdit->setValidator( new QDoubleValidator(fPhaseCorrectionRangeLow_lineEdit) );
|
||||
fPhaseCorrectionRangeUp_lineEdit->setValidator( new QDoubleValidator(fPhaseCorrectionRangeUp_lineEdit) );
|
||||
fRangeLow_lineEdit->setValidator( new QDoubleValidator(fRangeLow_lineEdit) );
|
||||
fRangeUp_lineEdit->setValidator( new QDoubleValidator(fRangeUp_lineEdit) );
|
||||
|
||||
connect( fPhase_lineEdit, SIGNAL( lostFocus() ), this, SLOT( checkPhaseParameter() ) );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
void PGetFourierDialog::checkPhaseParameter()
|
||||
{
|
||||
QString str = fPhase_lineEdit->text();
|
||||
|
||||
if (str.isEmpty())
|
||||
return;
|
||||
|
||||
bool ok;
|
||||
double dval = str.toDouble(&ok);
|
||||
int ival;
|
||||
|
||||
if (!ok) { // i.e. the phase entry is not a number. Check for parXX
|
||||
str.stripWhiteSpace();
|
||||
if (str.startsWith("par")) { //
|
||||
str.remove("par");
|
||||
ival = str.toInt(&ok);
|
||||
if (!ok) {
|
||||
fPhase_lineEdit->clear();
|
||||
QMessageBox::critical(this, "**ERROR**",
|
||||
"Allowed phase entries are either a parameter number,\n or an parXX entry, where XX is a parameter number",
|
||||
QMessageBox::Ok, QMessageBox::NoButton);
|
||||
fPhase_lineEdit->setFocus();
|
||||
}
|
||||
} else { // neither a parXX nor a number
|
||||
fPhase_lineEdit->clear();
|
||||
QMessageBox::critical(this, "**ERROR**",
|
||||
"Allowed phase entries are either a parameter number,\n or an parXX entry, where XX is a parameter number",
|
||||
QMessageBox::Ok, QMessageBox::NoButton);
|
||||
fPhase_lineEdit->setFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
@ -44,6 +44,7 @@ class PGetFourierDialog : public PGetFourierDialogBase
|
||||
QString getFourierBlock() { return fFourierBlock; }
|
||||
|
||||
private slots:
|
||||
void checkPhaseParameter();
|
||||
void fillFourierBlock();
|
||||
|
||||
private:
|
||||
|
@ -254,25 +254,6 @@
|
||||
<string>If <b>no</b> Fourier power is given. The Fourier transform will be done on the number of bins (N) given. If a Fourier power (FP) > N is given, zero padding will be applied, i.e. filling the data vector > N with zeros up to 2^FP.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit">
|
||||
<property name="name">
|
||||
<cstring>fPhase_lineEdit</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>140</x>
|
||||
<y>140</y>
|
||||
<width>100</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>phased used to calculate Re/Im Parts, given in (°)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit">
|
||||
<property name="name">
|
||||
<cstring>fPhaseCorrectionRangeLow_lineEdit</cstring>
|
||||
@ -409,6 +390,25 @@
|
||||
</rect>
|
||||
</property>
|
||||
</spacer>
|
||||
<widget class="QLineEdit">
|
||||
<property name="name">
|
||||
<cstring>fPhase_lineEdit</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>140</x>
|
||||
<y>140</y>
|
||||
<width>100</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>phased used to calculate Re/Im Parts, given in (°)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<images>
|
||||
<image name="image0">
|
||||
@ -450,6 +450,7 @@
|
||||
</tabstops>
|
||||
<slots>
|
||||
<slot>fillFourierBlock()</slot>
|
||||
<slot access="private">checkPhaseParameter()</slot>
|
||||
</slots>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
||||
|
@ -401,6 +401,54 @@
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox">
|
||||
<property name="name">
|
||||
<cstring>fDbOutputFileName_groupBox</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>325</y>
|
||||
<width>580</width>
|
||||
<height>65</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Data output file name</string>
|
||||
</property>
|
||||
<widget class="QLineEdit">
|
||||
<property name="name">
|
||||
<cstring>fDbOutputFileName_lineEdit</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<y>25</y>
|
||||
<width>350</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>e.g. MyPrefectFitCollection.db</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>fDbOutputFileName_textLabel</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>160</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Data Output File Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox">
|
||||
<property name="name">
|
||||
<cstring>fOptions_groupBox</cstring>
|
||||
@ -511,52 +559,20 @@
|
||||
<string>will recreate the db-file. Default (unchecked) will append data</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox">
|
||||
<property name="name">
|
||||
<cstring>fDbOutputFileName_groupBox</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>325</y>
|
||||
<width>580</width>
|
||||
<height>65</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Data output file name</string>
|
||||
</property>
|
||||
<widget class="QLineEdit">
|
||||
<widget class="QCheckBox">
|
||||
<property name="name">
|
||||
<cstring>fDbOutputFileName_lineEdit</cstring>
|
||||
<cstring>fOpenAfterFitting_checkBox</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<y>25</y>
|
||||
<width>350</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>e.g. MyPrefectFitCollection.db</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>fDbOutputFileName_textLabel</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>160</width>
|
||||
<height>20</height>
|
||||
<x>230</x>
|
||||
<y>70</y>
|
||||
<width>170</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Data Output File Name</string>
|
||||
<string>Open Files after Fitting</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
|
Loading…
x
Reference in New Issue
Block a user