newly added. Essentially a port of musrgui (Qt3.x) to Qt4.6. A lot of revisioning is still nedded. Code only partilly working.
This commit is contained in:
135
src/musredit/PGetFourierBlockDialog.cpp
Normal file
135
src/musredit/PGetFourierBlockDialog.cpp
Normal file
@ -0,0 +1,135 @@
|
||||
/****************************************************************************
|
||||
|
||||
PGetFourierBlockDialog.cpp
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
$Id: PGetFourierBlockDialog.cpp 3978 2009-06-09 11:16:39Z nemu $
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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>
|
||||
#include <QComboBox>
|
||||
#include <QValidator>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "PGetFourierBlockDialog.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
PGetFourierBlockDialog::PGetFourierBlockDialog()
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
setModal(true);
|
||||
|
||||
fFourierBlock = "";
|
||||
fFourierPower_lineEdit->setValidator( new QIntValidator(fFourierPower_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 PGetFourierBlockDialog::checkPhaseParameter()
|
||||
{
|
||||
QString str = fPhase_lineEdit->text();
|
||||
|
||||
if (str.isEmpty())
|
||||
return;
|
||||
|
||||
bool ok;
|
||||
int ival;
|
||||
|
||||
ival = str.toInt(&ok);
|
||||
if (!ok) { // i.e. the phase entry is not a number. Check for parXX
|
||||
str.trimmed();
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
void PGetFourierBlockDialog::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";
|
||||
str = fPhase_lineEdit->text();
|
||||
if (!str.isEmpty())
|
||||
fFourierBlock += "phase " + str + "\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";
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
void PGetFourierBlockDialog::helpContent()
|
||||
{
|
||||
QMessageBox::information(this, "**HELP**", "Will eventually show a help.");
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// END
|
||||
//----------------------------------------------------------------------------------------------------
|
Reference in New Issue
Block a user