diff --git a/src/musrgui/PGetFourierDialog.cpp b/src/musrgui/PGetFourierDialog.cpp new file mode 100644 index 00000000..715a5ffa --- /dev/null +++ b/src/musrgui/PGetFourierDialog.cpp @@ -0,0 +1,81 @@ +/**************************************************************************** + + PGetFourierDialog.cpp + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include +#include +#include + +#include "PGetFourierDialog.h" + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +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) ); +} + +//---------------------------------------------------------------------------------------------------- +/** + *

+ */ +void PGetFourierDialog::fillFourierBlock() +{ + fFourierBlock = "###############################################################\n"; + fFourierBlock += "FOURIER\n"; + fFourierBlock += "units " + fUnits_comboBox->currentText() + "\n"; + QString str = fFourierPower_lineEdit->text(); + if (!str.isEmpty()) + fFourierBlock += "fourier_power " + str + "\n"; + fFourierBlock += "apodization " + fApodization_comboBox->currentText() + "\n"; + fFourierBlock += "plot " + fPlot_comboBox->currentText() + "\n"; + fFourierBlock += "phase " + fPhase_lineEdit->text() + "\n"; + if (!fPhaseCorrectionRangeLow_lineEdit->text().isEmpty() && !fPhaseCorrectionRangeUp_lineEdit->text().isEmpty()) { + fFourierBlock += "range_for_phase_correction " + fPhaseCorrectionRangeLow_lineEdit->text() + " " + + fPhaseCorrectionRangeUp_lineEdit->text() + "\n"; + } + if (!fRangeLow_lineEdit->text().isEmpty() && !fRangeUp_lineEdit->text().isEmpty()) { + fFourierBlock += "range " + fRangeLow_lineEdit->text() + " " + fRangeUp_lineEdit->text() + "\n"; + } +} + +//---------------------------------------------------------------------------------------------------- +// END +//---------------------------------------------------------------------------------------------------- diff --git a/src/musrgui/PGetFourierDialog.h b/src/musrgui/PGetFourierDialog.h new file mode 100644 index 00000000..19dc00c9 --- /dev/null +++ b/src/musrgui/PGetFourierDialog.h @@ -0,0 +1,53 @@ +/**************************************************************************** + + PGetFourierDialog.h + + Author: Andreas Suter + e-mail: andreas.suter@psi.ch + + $Id$ + +*****************************************************************************/ + +/*************************************************************************** + * Copyright (C) 2009 by Andreas Suter * + * andreas.suter@psi.ch * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _PGETFOURIERDIALOG_H_ +#define _PGETFOURIERDIALOG_H_ + +#include + +#include "forms/PGetFourierDialogBase.h" + +class PGetFourierDialog : public PGetFourierDialogBase +{ + public: + PGetFourierDialog(); + + QString getFourierBlock() { return fFourierBlock; } + + private slots: + void fillFourierBlock(); + + private: + QString fFourierBlock; +}; + +#endif // _PGETFOURIERDIALOG_H_ diff --git a/src/musrgui/PSubTextEdit.cpp b/src/musrgui/PSubTextEdit.cpp index ed4f987e..f4b35674 100644 --- a/src/musrgui/PSubTextEdit.cpp +++ b/src/musrgui/PSubTextEdit.cpp @@ -37,6 +37,7 @@ #include "PSubTextEdit.h" #include "forms/PGetTitleDialog.h" #include "PGetParameterDialog.h" +#include "PGetFourierDialog.h" //---------------------------------------------------------------------------------------------------- /** @@ -193,6 +194,11 @@ void PSubTextEdit::insertCommandBlock() */ void PSubTextEdit::insertFourierBlock() { + PGetFourierDialog *dlg = new PGetFourierDialog(); + + if (dlg->exec() == QDialog::Accepted) { + insert(dlg->getFourierBlock()+"\n"); + } } //---------------------------------------------------------------------------------------------------- diff --git a/src/musrgui/forms/PGetFourierDialogBase.ui b/src/musrgui/forms/PGetFourierDialogBase.ui new file mode 100644 index 00000000..0dba3dca --- /dev/null +++ b/src/musrgui/forms/PGetFourierDialogBase.ui @@ -0,0 +1,429 @@ + +PGetFourierDialogBase + + + PGetFourierDialogBase + + + + 0 + 0 + 288 + 289 + + + + Get Fourier + + + true + + + true + + + + fPhaseCorrectionRangeUp_lineEdit + + + + 210 + 170 + 60 + 24 + + + + + + fRangeUp_lineEdit + + + + 210 + 210 + 60 + 24 + + + + + + fUnits_textLabel + + + + 20 + 22 + 71 + 20 + + + + Units + + + + + fFourierPower_textLabel + + + + 20 + 52 + 110 + 20 + + + + Fourier Power + + + + + fApodization_textLabel + + + + 20 + 82 + 90 + 20 + + + + Apodization + + + + + fPlot_textLabel + + + + 20 + 112 + 71 + 20 + + + + Plot + + + + + fPhase_textLabel + + + + 20 + 142 + 71 + 20 + + + + Phase + + + + + textLabel6 + + + + 20 + 160 + 110 + 50 + + + + <p align="center">Phase Correction<br>Range</p> + + + + + textLabel7 + + + + 20 + 210 + 71 + 20 + + + + Range + + + + + + Gauss + + + + + MHz + + + + + Mc/s + + + + fUnits_comboBox + + + + 140 + 20 + 99 + 24 + + + + + + fFourierPower_lineEdit + + + + 140 + 50 + 100 + 24 + + + + 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. + + + + + fPhase_lineEdit + + + + 140 + 140 + 100 + 24 + + + + 0.0 + + + + + fPhaseCorrectionRangeLow_lineEdit + + + + 140 + 170 + 60 + 24 + + + + + + fRangeLow_lineEdit + + + + 140 + 210 + 60 + 24 + + + + + + + Power + + + + + Real + + + + + Imag + + + + + Real & Imag + + + + + Phase + + + + fPlot_comboBox + + + + 140 + 110 + 99 + 24 + + + + + + fCancel_button + + + + 11 + 251 + 75 + 26 + + + + &Cancel + + + + + + true + + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 122 + 20 + + + + + 92 + 254 + 122 + 20 + + + + + + fOk_button + + + + 220 + 251 + 49 + 26 + + + + &OK + + + + + + true + + + true + + + + + + none + + + + + weak + + + + + medium + + + + + strong + + + + fApodization_comboBox + + + + 140 + 80 + 99 + 24 + + + + + + + fOk_button + clicked() + PGetFourierDialogBase + accept() + + + fCancel_button + clicked() + PGetFourierDialogBase + reject() + + + fOk_button + clicked() + PGetFourierDialogBase + fillFourierBlock() + + + + fUnits_comboBox + fFourierPower_lineEdit + fApodization_comboBox + fPlot_comboBox + fPhase_lineEdit + fPhaseCorrectionRangeLow_lineEdit + fPhaseCorrectionRangeUp_lineEdit + fRangeLow_lineEdit + fRangeUp_lineEdit + fOk_button + fCancel_button + + + fillFourierBlock() + + + diff --git a/src/musrgui/musrgui.pro b/src/musrgui/musrgui.pro index df99c2fc..de06ab51 100644 --- a/src/musrgui/musrgui.pro +++ b/src/musrgui/musrgui.pro @@ -19,7 +19,8 @@ HEADERS = PTextEdit.h \ PAdmin.h \ PFitOutputHandler.h \ PGetDefaultDialog.h \ - PGetParameterDialog.h + PGetParameterDialog.h \ + PGetFourierDialog.h SOURCES = PTextEdit.cpp \ PSubTextEdit.cpp \ @@ -27,12 +28,14 @@ SOURCES = PTextEdit.cpp \ PFitOutputHandler.cpp \ PGetDefaultDialog.cpp \ PGetParameterDialog.cpp \ + PGetFourierDialog.cpp \ main.cpp FORMS = forms/PGetDefaultDialogBase.ui \ forms/PMusrGuiAbout.ui \ forms/PGetTitleDialog.ui \ - forms/PGetParameterDialogBase.ui + forms/PGetParameterDialogBase.ui \ + forms/PGetFourierDialogBase.ui IMAGES = images/editcopy.xpm \ images/editcut.xpm \