added PGetFourierDialog

This commit is contained in:
nemu 2009-03-02 21:39:58 +00:00
parent 21a93c6525
commit 488eb22e78
5 changed files with 574 additions and 2 deletions

View File

@ -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 <qobject.h>
#include <qcombobox.h>
#include <qvalidator.h>
#include <qlineedit.h>
#include <qbutton.h>
#include "PGetFourierDialog.h"
//----------------------------------------------------------------------------------------------------
/**
* <p>
*/
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) );
}
//----------------------------------------------------------------------------------------------------
/**
* <p>
*/
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
//----------------------------------------------------------------------------------------------------

View File

@ -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 <qstring.h>
#include "forms/PGetFourierDialogBase.h"
class PGetFourierDialog : public PGetFourierDialogBase
{
public:
PGetFourierDialog();
QString getFourierBlock() { return fFourierBlock; }
private slots:
void fillFourierBlock();
private:
QString fFourierBlock;
};
#endif // _PGETFOURIERDIALOG_H_

View File

@ -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");
}
}
//----------------------------------------------------------------------------------------------------

View File

@ -0,0 +1,429 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>PGetFourierDialogBase</class>
<widget class="QDialog">
<property name="name">
<cstring>PGetFourierDialogBase</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>288</width>
<height>289</height>
</rect>
</property>
<property name="caption">
<string>Get Fourier</string>
</property>
<property name="sizeGripEnabled">
<bool>true</bool>
</property>
<property name="modal">
<bool>true</bool>
</property>
<widget class="QLineEdit">
<property name="name">
<cstring>fPhaseCorrectionRangeUp_lineEdit</cstring>
</property>
<property name="geometry">
<rect>
<x>210</x>
<y>170</y>
<width>60</width>
<height>24</height>
</rect>
</property>
</widget>
<widget class="QLineEdit">
<property name="name">
<cstring>fRangeUp_lineEdit</cstring>
</property>
<property name="geometry">
<rect>
<x>210</x>
<y>210</y>
<width>60</width>
<height>24</height>
</rect>
</property>
</widget>
<widget class="QLabel">
<property name="name">
<cstring>fUnits_textLabel</cstring>
</property>
<property name="geometry">
<rect>
<x>20</x>
<y>22</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Units</string>
</property>
</widget>
<widget class="QLabel">
<property name="name">
<cstring>fFourierPower_textLabel</cstring>
</property>
<property name="geometry">
<rect>
<x>20</x>
<y>52</y>
<width>110</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Fourier Power</string>
</property>
</widget>
<widget class="QLabel">
<property name="name">
<cstring>fApodization_textLabel</cstring>
</property>
<property name="geometry">
<rect>
<x>20</x>
<y>82</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Apodization</string>
</property>
</widget>
<widget class="QLabel">
<property name="name">
<cstring>fPlot_textLabel</cstring>
</property>
<property name="geometry">
<rect>
<x>20</x>
<y>112</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Plot</string>
</property>
</widget>
<widget class="QLabel">
<property name="name">
<cstring>fPhase_textLabel</cstring>
</property>
<property name="geometry">
<rect>
<x>20</x>
<y>142</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Phase</string>
</property>
</widget>
<widget class="QLabel">
<property name="name">
<cstring>textLabel6</cstring>
</property>
<property name="geometry">
<rect>
<x>20</x>
<y>160</y>
<width>110</width>
<height>50</height>
</rect>
</property>
<property name="text">
<string>&lt;p align="center"&gt;Phase Correction&lt;br&gt;Range&lt;/p&gt;</string>
</property>
</widget>
<widget class="QLabel">
<property name="name">
<cstring>textLabel7</cstring>
</property>
<property name="geometry">
<rect>
<x>20</x>
<y>210</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Range</string>
</property>
</widget>
<widget class="QComboBox">
<item>
<property name="text">
<string>Gauss</string>
</property>
</item>
<item>
<property name="text">
<string>MHz</string>
</property>
</item>
<item>
<property name="text">
<string>Mc/s</string>
</property>
</item>
<property name="name">
<cstring>fUnits_comboBox</cstring>
</property>
<property name="geometry">
<rect>
<x>140</x>
<y>20</y>
<width>99</width>
<height>24</height>
</rect>
</property>
</widget>
<widget class="QLineEdit">
<property name="name">
<cstring>fFourierPower_lineEdit</cstring>
</property>
<property name="geometry">
<rect>
<x>140</x>
<y>50</y>
<width>100</width>
<height>24</height>
</rect>
</property>
<property name="whatsThis" stdset="0">
<string>If &lt;b&gt;no&lt;/b&gt; Fourier power is given. The Fourier transform will be done on the number of bins (N) given. If a Fourier power (FP) &gt; N is given, zero padding will be applied, i.e. filling the data vector &gt; 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>
</widget>
<widget class="QLineEdit">
<property name="name">
<cstring>fPhaseCorrectionRangeLow_lineEdit</cstring>
</property>
<property name="geometry">
<rect>
<x>140</x>
<y>170</y>
<width>60</width>
<height>24</height>
</rect>
</property>
</widget>
<widget class="QLineEdit">
<property name="name">
<cstring>fRangeLow_lineEdit</cstring>
</property>
<property name="geometry">
<rect>
<x>140</x>
<y>210</y>
<width>60</width>
<height>24</height>
</rect>
</property>
</widget>
<widget class="QComboBox">
<item>
<property name="text">
<string>Power</string>
</property>
</item>
<item>
<property name="text">
<string>Real</string>
</property>
</item>
<item>
<property name="text">
<string>Imag</string>
</property>
</item>
<item>
<property name="text">
<string>Real &amp; Imag</string>
</property>
</item>
<item>
<property name="text">
<string>Phase</string>
</property>
</item>
<property name="name">
<cstring>fPlot_comboBox</cstring>
</property>
<property name="geometry">
<rect>
<x>140</x>
<y>110</y>
<width>99</width>
<height>24</height>
</rect>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>fCancel_button</cstring>
</property>
<property name="geometry">
<rect>
<x>11</x>
<y>251</y>
<width>75</width>
<height>26</height>
</rect>
</property>
<property name="text">
<string>&amp;Cancel</string>
</property>
<property name="accel">
<string></string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
<spacer>
<property name="name">
<cstring>Horizontal Spacing2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>122</width>
<height>20</height>
</size>
</property>
<property name="geometry">
<rect>
<x>92</x>
<y>254</y>
<width>122</width>
<height>20</height>
</rect>
</property>
</spacer>
<widget class="QPushButton">
<property name="name">
<cstring>fOk_button</cstring>
</property>
<property name="geometry">
<rect>
<x>220</x>
<y>251</y>
<width>49</width>
<height>26</height>
</rect>
</property>
<property name="text">
<string>&amp;OK</string>
</property>
<property name="accel">
<string></string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
<widget class="QComboBox">
<item>
<property name="text">
<string>none</string>
</property>
</item>
<item>
<property name="text">
<string>weak</string>
</property>
</item>
<item>
<property name="text">
<string>medium</string>
</property>
</item>
<item>
<property name="text">
<string>strong</string>
</property>
</item>
<property name="name">
<cstring>fApodization_comboBox</cstring>
</property>
<property name="geometry">
<rect>
<x>140</x>
<y>80</y>
<width>99</width>
<height>24</height>
</rect>
</property>
</widget>
</widget>
<connections>
<connection>
<sender>fOk_button</sender>
<signal>clicked()</signal>
<receiver>PGetFourierDialogBase</receiver>
<slot>accept()</slot>
</connection>
<connection>
<sender>fCancel_button</sender>
<signal>clicked()</signal>
<receiver>PGetFourierDialogBase</receiver>
<slot>reject()</slot>
</connection>
<connection>
<sender>fOk_button</sender>
<signal>clicked()</signal>
<receiver>PGetFourierDialogBase</receiver>
<slot>fillFourierBlock()</slot>
</connection>
</connections>
<tabstops>
<tabstop>fUnits_comboBox</tabstop>
<tabstop>fFourierPower_lineEdit</tabstop>
<tabstop>fApodization_comboBox</tabstop>
<tabstop>fPlot_comboBox</tabstop>
<tabstop>fPhase_lineEdit</tabstop>
<tabstop>fPhaseCorrectionRangeLow_lineEdit</tabstop>
<tabstop>fPhaseCorrectionRangeUp_lineEdit</tabstop>
<tabstop>fRangeLow_lineEdit</tabstop>
<tabstop>fRangeUp_lineEdit</tabstop>
<tabstop>fOk_button</tabstop>
<tabstop>fCancel_button</tabstop>
</tabstops>
<slots>
<slot>fillFourierBlock()</slot>
</slots>
<layoutdefaults spacing="6" margin="11"/>
</UI>

View File

@ -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 \