added plot dialog
This commit is contained in:
parent
73ac3d8d75
commit
981d2b53cf
149
src/musrgui/PGetPlotDialog.cpp
Normal file
149
src/musrgui/PGetPlotDialog.cpp
Normal file
@ -0,0 +1,149 @@
|
||||
/****************************************************************************
|
||||
|
||||
PGetPlotDialog.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 <qlineedit.h>
|
||||
#include <qvalidator.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qspinbox.h>
|
||||
#include <qtextedit.h>
|
||||
#include <qcombobox.h>
|
||||
|
||||
#include "PGetPlotDialog.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
PGetPlotDialog::PGetPlotDialog()
|
||||
{
|
||||
fXRangeLow_lineEdit->setValidator( new QDoubleValidator(fXRangeLow_lineEdit) );
|
||||
fXRangeUp_lineEdit->setValidator( new QDoubleValidator(fXRangeUp_lineEdit) );
|
||||
fYRangeLow_lineEdit->setValidator( new QDoubleValidator(fYRangeLow_lineEdit) );
|
||||
fYRangeUp_lineEdit->setValidator( new QDoubleValidator(fYRangeUp_lineEdit) );
|
||||
|
||||
fPlot_textEdit->setTextFormat( PlainText );
|
||||
fPlot_textEdit->setFamily("Courier");
|
||||
fPlot_textEdit->setPointSize(10); // 10pt
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
void PGetPlotDialog::addPlot()
|
||||
{
|
||||
QString param = "";
|
||||
QString str = "";
|
||||
QString spaces;
|
||||
|
||||
// add begining of plot block if fPlot_textEdit is still empty
|
||||
if (fPlot_textEdit->text().isEmpty()) {
|
||||
param = "###############################################################\n";
|
||||
}
|
||||
|
||||
// write type
|
||||
param += "PLOT ";
|
||||
if (fType_comboBox->currentText() == "Single Histo") {
|
||||
param += "1 (single histo plot)\n";
|
||||
} else if (fType_comboBox->currentText() == "Asymmetry") {
|
||||
param += "2 (asymmetry plot)\n";
|
||||
} else if (fType_comboBox->currentText() == "RRF") {
|
||||
param += "4 (rotating reference frame plot)\n";
|
||||
} else if (fType_comboBox->currentText() == "NonMusr") {
|
||||
param += "8 (non muSR plot)\n";
|
||||
}
|
||||
|
||||
// write runs
|
||||
param += "runs " + fRunList_lineEdit->text() + "\n";
|
||||
|
||||
// write range
|
||||
param += "range ";
|
||||
// lower x-/time range
|
||||
str = fXRangeLow_lineEdit->text();
|
||||
if (str.isEmpty()) {
|
||||
QMessageBox::critical(this, "**ERROR**",
|
||||
"empty lower time-/x-range name not allowed!",
|
||||
QMessageBox::Ok, QMessageBox::NoButton);
|
||||
return;
|
||||
}
|
||||
param += str;
|
||||
if (str.length() < 8)
|
||||
param += spaces.fill(' ', 8 - str.length());
|
||||
else
|
||||
param += " ";
|
||||
|
||||
// upper x-/time range
|
||||
str = fXRangeUp_lineEdit->text();
|
||||
if (str.isEmpty()) {
|
||||
QMessageBox::critical(this, "**ERROR**",
|
||||
"empty upper time-/x-range name not allowed!",
|
||||
QMessageBox::Ok, QMessageBox::NoButton);
|
||||
return;
|
||||
}
|
||||
param += str;
|
||||
if (str.length() < 8)
|
||||
param += spaces.fill(' ', 8 - str.length());
|
||||
else
|
||||
param += " ";
|
||||
|
||||
// check y-range: either none given or both
|
||||
if ((fYRangeLow_lineEdit->text().isEmpty() && !fYRangeUp_lineEdit->text().isEmpty()) ||
|
||||
(!fYRangeLow_lineEdit->text().isEmpty() && fYRangeUp_lineEdit->text().isEmpty())) {
|
||||
QMessageBox::critical(this, "**ERROR**",
|
||||
"Only fully empty y-range, or give lower AND upper y-range is acceptable!\n Will ignore the y-range",
|
||||
QMessageBox::Ok, QMessageBox::NoButton);
|
||||
} else if (!fYRangeLow_lineEdit->text().isEmpty() && !fYRangeUp_lineEdit->text().isEmpty()) {
|
||||
str = fYRangeLow_lineEdit->text();
|
||||
param += str;
|
||||
if (str.length() < 8)
|
||||
param += spaces.fill(' ', 8 - str.length());
|
||||
else
|
||||
param += " ";
|
||||
param += fYRangeUp_lineEdit->text() + "\n";
|
||||
} else {
|
||||
param += "\n";
|
||||
}
|
||||
param += "\n";
|
||||
|
||||
fPlot_textEdit->append(param);
|
||||
|
||||
// clean input
|
||||
fRunList_lineEdit->clear();
|
||||
fXRangeLow_lineEdit->clear();
|
||||
fXRangeUp_lineEdit->clear();
|
||||
fYRangeLow_lineEdit->clear();
|
||||
fYRangeUp_lineEdit->clear();
|
||||
fRunList_lineEdit->setFocus();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// END
|
||||
//----------------------------------------------------------------------------------------------------
|
48
src/musrgui/PGetPlotDialog.h
Normal file
48
src/musrgui/PGetPlotDialog.h
Normal file
@ -0,0 +1,48 @@
|
||||
/****************************************************************************
|
||||
|
||||
PGetPlotDialog.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 _PGETPLOTDIALOG_H_
|
||||
#define _PGETPLOTDIALOG_H_
|
||||
|
||||
#include "forms/PGetPlotDialogBase.h"
|
||||
|
||||
class PGetPlotDialog : public PGetPlotDialogBase
|
||||
{
|
||||
public:
|
||||
PGetPlotDialog();
|
||||
|
||||
QString getPlotBlock() { return fPlot_textEdit->text(); }
|
||||
|
||||
public slots:
|
||||
void addPlot();
|
||||
};
|
||||
|
||||
#endif // _PGETPLOTDIALOG_H_
|
@ -38,6 +38,7 @@
|
||||
#include "forms/PGetTitleDialog.h"
|
||||
#include "PGetParameterDialog.h"
|
||||
#include "PGetFourierDialog.h"
|
||||
#include "PGetPlotDialog.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
@ -207,6 +208,11 @@ void PSubTextEdit::insertFourierBlock()
|
||||
*/
|
||||
void PSubTextEdit::insertPlotBlock()
|
||||
{
|
||||
PGetPlotDialog *dlg = new PGetPlotDialog();
|
||||
|
||||
if (dlg->exec() == QDialog::Accepted) {
|
||||
insert(dlg->getPlotBlock()+"\n");
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
@ -18,83 +18,6 @@
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout2</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>270</y>
|
||||
<width>490</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>fCancel_button</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&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>290</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>fAdd_pushButton</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Add</string>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string>Alt+A</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>fOk_button</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&OK</string>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget class="QLineEdit">
|
||||
<property name="name">
|
||||
<cstring>fXRangeUp_lineEdit</cstring>
|
||||
@ -211,28 +134,15 @@
|
||||
<string>Run List</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit">
|
||||
<property name="name">
|
||||
<cstring>fRunList_lineEdit</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>40</y>
|
||||
<width>150</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Asymmetry</string>
|
||||
<string>Single Histo</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Single Histo</string>
|
||||
<string>Asymmetry</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
@ -257,6 +167,19 @@
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit">
|
||||
<property name="name">
|
||||
<cstring>fRunList_lineEdit</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>40</y>
|
||||
<width>150</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit">
|
||||
<property name="name">
|
||||
<cstring>fPlot_textEdit</cstring>
|
||||
@ -270,6 +193,97 @@
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>fCancel_button</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>11</x>
|
||||
<y>271</y>
|
||||
<width>75</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&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>290</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>92</x>
|
||||
<y>274</y>
|
||||
<width>290</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</spacer>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>fAdd_pushButton</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>388</x>
|
||||
<y>271</y>
|
||||
<width>56</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Add</string>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string>Alt+A</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>fOk_button</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>450</x>
|
||||
<y>271</y>
|
||||
<width>49</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&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>
|
||||
<connections>
|
||||
<connection>
|
||||
|
@ -1,58 +1,58 @@
|
||||
TEMPLATE = app
|
||||
|
||||
TARGET = musrgui
|
||||
target.path = $$(HOME)/analysis/bin
|
||||
INSTALLS += target
|
||||
TEMPLATE = app
|
||||
TARGET = musrgui
|
||||
target.path = $$(HOME)/analysis/bin
|
||||
INSTALLS += target
|
||||
|
||||
# install path for the XML configuration file
|
||||
unix: xml.path = $$(HOME)/analysis/bin/
|
||||
win32: xml.path = $$(HOME)/analysis/bin/
|
||||
unix:xml.path = $$(HOME)/analysis/bin/
|
||||
win32:xml.path = $$(HOME)/analysis/bin/
|
||||
xml.files = musrgui_startup.xml
|
||||
INSTALLS += xml
|
||||
|
||||
CONFIG += qt warn_on debug
|
||||
CONFIG += qt \
|
||||
warn_on \
|
||||
debug
|
||||
|
||||
HEADERS = PTextEdit.h \
|
||||
PSubTextEdit.h \
|
||||
PAdmin.h \
|
||||
PFitOutputHandler.h \
|
||||
PGetDefaultDialog.h \
|
||||
PGetParameterDialog.h \
|
||||
PGetFourierDialog.h \
|
||||
PGetPlotDialog.h
|
||||
|
||||
SOURCES = PTextEdit.cpp \
|
||||
PSubTextEdit.cpp \
|
||||
PAdmin.cpp \
|
||||
PFitOutputHandler.cpp \
|
||||
PGetDefaultDialog.cpp \
|
||||
PGetParameterDialog.cpp \
|
||||
PGetFourierDialog.cpp \
|
||||
PGetPlotDialog.cpp \
|
||||
main.cpp
|
||||
|
||||
HEADERS = PTextEdit.h \
|
||||
PSubTextEdit.h \
|
||||
PAdmin.h \
|
||||
PFitOutputHandler.h \
|
||||
PGetDefaultDialog.h \
|
||||
PGetParameterDialog.h \
|
||||
PGetFourierDialog.h
|
||||
|
||||
SOURCES = PTextEdit.cpp \
|
||||
PSubTextEdit.cpp \
|
||||
PAdmin.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/PGetFourierDialogBase.ui \
|
||||
forms/PGetPlotDialogBase.ui
|
||||
FORMS = forms/PGetDefaultDialogBase.ui \
|
||||
forms/PMusrGuiAbout.ui \
|
||||
forms/PGetTitleDialog.ui \
|
||||
forms/PGetParameterDialogBase.ui \
|
||||
forms/PGetFourierDialogBase.ui \
|
||||
forms/PGetPlotDialogBase.ui
|
||||
|
||||
IMAGES = images/editcopy.xpm \
|
||||
images/editcut.xpm \
|
||||
images/editpaste.xpm \
|
||||
images/editredo.xpm \
|
||||
images/editundo.xpm \
|
||||
images/filenew.xpm \
|
||||
images/fileopen.xpm \
|
||||
images/fileprint.xpm \
|
||||
images/filesave.xpm \
|
||||
images/musrasym.xpm \
|
||||
images/musrsinglehisto.xpm \
|
||||
images/musrcalcchisq.xpm \
|
||||
images/musrfit.xpm \
|
||||
images/musrmlog2db.xpm \
|
||||
images/musrview.xpm \
|
||||
images/musrt0.xpm \
|
||||
images/musrprefs.xpm
|
||||
|
||||
IMAGES = images/editcopy.xpm \
|
||||
images/editcut.xpm \
|
||||
images/editpaste.xpm \
|
||||
images/editredo.xpm \
|
||||
images/editundo.xpm \
|
||||
images/filenew.xpm \
|
||||
images/fileopen.xpm \
|
||||
images/fileprint.xpm \
|
||||
images/filesave.xpm \
|
||||
images/musrasym.xpm \
|
||||
images/musrsinglehisto.xpm \
|
||||
images/musrcalcchisq.xpm \
|
||||
images/musrfit.xpm \
|
||||
images/musrmlog2db.xpm \
|
||||
images/musrview.xpm \
|
||||
images/musrt0.xpm \
|
||||
images/musrprefs.xpm
|
||||
|
Loading…
x
Reference in New Issue
Block a user