musredit 1.0.0
Loading...
Searching...
No Matches
PMsr2DataDialog.cpp
Go to the documentation of this file.
1/****************************************************************************
2
3 PMsr2DataDialog.cpp
4
5 Author: Andreas Suter
6 e-mail: andreas.suter@psi.ch
7
8*****************************************************************************/
9
10/***************************************************************************
11 * Copyright (C) 2009-2026 by Andreas Suter *
12 * andreas.suter@psi.ch *
13 * *
14 * This program is free software; you can redistribute it and/or modify *
15 * it under the terms of the GNU General Public License as published by *
16 * the Free Software Foundation; either version 2 of the License, or *
17 * (at your option) any later version. *
18 * *
19 * This program is distributed in the hope that it will be useful, *
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
22 * GNU General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU General Public License *
25 * along with this program; if not, write to the *
26 * Free Software Foundation, Inc., *
27 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
28 ***************************************************************************/
29
46
47#include <QLineEdit>
48#include <QValidator>
49#include <QMessageBox>
50#include <QTextEdit>
51#include <QCheckBox>
52#include <QDesktopServices>
53#include <QUrl>
54
55#include "PMsr2DataDialog.h"
56
57//----------------------------------------------------------------------------------------------------
114PMsr2DataDialog::PMsr2DataDialog(PMsr2DataParam *msr2DataParam, const QString helpUrl) : fMsr2DataParam(msr2DataParam), fHelpUrl(helpUrl)
115{
116 setupUi(this);
117
118 setModal(true);
119
120 QString str;
121
122 fRunTag = -1;
123
124 if (!fMsr2DataParam->runListFileName.isEmpty()) {
125 fRunListFileName_lineEdit->setText(fMsr2DataParam->runListFileName);
126 }
127
128 if (!fMsr2DataParam->runList.isEmpty()) {
129 fRunList_lineEdit->setText(fMsr2DataParam->runList);
130 }
131
132 if (!fMsr2DataParam->msrFileExtension.isEmpty()) {
133 fMsrFileExtension_lineEdit->setText(fMsr2DataParam->msrFileExtension);
134 }
135
136 fTemplateRunNumber_lineEdit->setValidator( new QIntValidator(fTemplateRunNumber_lineEdit) );
137 if (fMsr2DataParam->templateRunNo != -1) {
138 str = QString("%1").arg(fMsr2DataParam->templateRunNo);
139 fTemplateRunNumber_lineEdit->setText(str);
140 }
141
142 if (!fMsr2DataParam->dbOutputFileName.isEmpty()) {
143 fDataOutputFileName_lineEdit->setText(fMsr2DataParam->dbOutputFileName);
144 }
145
146 if (!fMsr2DataParam->paramList.isEmpty()) {
147 fParamList_lineEdit->setText(fMsr2DataParam->paramList);
148 }
149
150 fWriteDataHeader_checkBox->setChecked(fMsr2DataParam->writeDbHeader);
151 fIgnoreDataHeaderInfo_checkBox->setChecked(fMsr2DataParam->ignoreDataHeaderInfo);
152 fKeepMinuit2Output_checkBox->setChecked(fMsr2DataParam->keepMinuit2Output);
153 fEstimateN0_checkBox->setChecked(fMsr2DataParam->estimateN0);
154 fYamlOut_checkBox->setChecked(fMsr2DataParam->yamlOut);
155 fWriteColumnData_checkBox->setChecked(fMsr2DataParam->writeColumnData);
156 fRecreateDataFile_checkBox->setChecked(fMsr2DataParam->recreateDbFile);
157 fChainFit_checkBox->setChecked(fMsr2DataParam->chainFit);
158 fOpenFilesAfterFitting_checkBox->setChecked(fMsr2DataParam->openFilesAfterFitting);
159 fWritePerRunBlockChisq_checkBox->setChecked(fMsr2DataParam->perRunBlockChisq);
160 fTitleFromData_checkBox->setChecked(fMsr2DataParam->titleFromDataFile);
161 fCreateMsrFileOnly_checkBox->setChecked(fMsr2DataParam->createMsrFileOnly);
162 fFitOnly_checkBox->setChecked(fMsr2DataParam->fitOnly);
163 fGlobal_checkBox->setChecked(fMsr2DataParam->global);
164 fGlobalPlus_checkBox->setChecked(fMsr2DataParam->globalPlus);
165
166 fOk_pushButton->setDefault(true);
167
168 connect(fGlobal_checkBox, SIGNAL(clicked(bool)), this, SLOT(globalOptionSet(bool)));
169 connect(fGlobalPlus_checkBox, SIGNAL(clicked(bool)), this, SLOT(globalPlusOptionSet(bool)));
170}
171
172//----------------------------------------------------------------------------------------------------
223{
224 fMsr2DataParam->runList = fRunList_lineEdit->text();
225 fMsr2DataParam->runListFileName = fRunListFileName_lineEdit->text();
226 fMsr2DataParam->msrFileExtension = fMsrFileExtension_lineEdit->text();
227 if (fTemplateRunNumber_lineEdit->text().isEmpty()) {
228 fMsr2DataParam->templateRunNo = -1;
229 } else {
230 fMsr2DataParam->templateRunNo = fTemplateRunNumber_lineEdit->text().toInt();
231 }
232 fMsr2DataParam->paramList = fParamList_lineEdit->text();
233 fMsr2DataParam->dbOutputFileName = fDataOutputFileName_lineEdit->text();
234 fMsr2DataParam->writeDbHeader = fWriteDataHeader_checkBox->isChecked();
235 fMsr2DataParam->ignoreDataHeaderInfo = fIgnoreDataHeaderInfo_checkBox->isChecked();
236 fMsr2DataParam->keepMinuit2Output = fKeepMinuit2Output_checkBox->isChecked();
237 fMsr2DataParam->estimateN0 = fEstimateN0_checkBox->isChecked();
238 fMsr2DataParam->yamlOut = fYamlOut_checkBox->isChecked();
239 fMsr2DataParam->writeColumnData = fWriteColumnData_checkBox->isChecked();
240 fMsr2DataParam->recreateDbFile = fRecreateDataFile_checkBox->isChecked();
241 fMsr2DataParam->chainFit = fChainFit_checkBox->isChecked();
242 fMsr2DataParam->openFilesAfterFitting = fOpenFilesAfterFitting_checkBox->isChecked();
243 fMsr2DataParam->perRunBlockChisq = fWritePerRunBlockChisq_checkBox->isChecked();
244 fMsr2DataParam->titleFromDataFile = fTitleFromData_checkBox->isChecked();
245 fMsr2DataParam->createMsrFileOnly = fCreateMsrFileOnly_checkBox->isChecked();
246 fMsr2DataParam->fitOnly = fFitOnly_checkBox->isChecked();
247 fMsr2DataParam->global = fGlobal_checkBox->isChecked();
248 fMsr2DataParam->globalPlus = fGlobalPlus_checkBox->isChecked();
249
250 return fMsr2DataParam;
251}
252
253//----------------------------------------------------------------------------------------------------
276void PMsr2DataDialog::runListEntered(const QString &str)
277{
278 if (str.length() == 0)
279 return;
280
281 fRunTag = 0;
282
283 if (!fRunListFileName_lineEdit->text().isEmpty())
284 fRunListFileName_lineEdit->clear();
285}
286
287//----------------------------------------------------------------------------------------------------
321{
322 if (str.length() == 0)
323 return;
324
325 fRunTag = 1;
326
327 if (!fRunList_lineEdit->text().isEmpty())
328 fRunList_lineEdit->clear();
329}
330
331//----------------------------------------------------------------------------------------------------
357{
358 if (!str.isEmpty())
359 fFitOnly_checkBox->setChecked(false);
360 fTemplateRunNumber_lineEdit->setText(str);
361}
362
363//----------------------------------------------------------------------------------------------------
387{
388 if (buttonState == Qt::Checked) {
389 fFitOnly_checkBox->setChecked(false);
390 }
391}
392
393//----------------------------------------------------------------------------------------------------
422{
423 if (buttonState == Qt::Checked) {
424 fCreateMsrFileOnly_checkBox->setChecked(false);
425 fTemplateRunNumber_lineEdit->clear();
426 }
427}
428
429//----------------------------------------------------------------------------------------------------
462{
463 if (fHelpUrl.isEmpty()) {
464 QMessageBox::information(this, "INFO", "Will eventually show a help window");
465 } else {
466 bool ok = QDesktopServices::openUrl(QUrl(fHelpUrl, QUrl::TolerantMode));
467 if (!ok) {
468 QString msg = QString("<p>Sorry: Couldn't open default web-browser for the help.<br>Please try: <a href=\"%1\">musrfit docu</a> in your web-browser.").arg(fHelpUrl);
469 QMessageBox::critical( nullptr, tr("FATAL ERROR"), msg, QMessageBox::Close );
470 }
471 }
472}
473
474//----------------------------------------------------------------------------------------------------
499{
500 if (checked) {
501 if (fGlobalPlus_checkBox->isChecked())
502 fGlobalPlus_checkBox->setChecked(false);
503 }
504}
505
506//----------------------------------------------------------------------------------------------------
531{
532 if (checked) {
533 if (fGlobal_checkBox->isChecked())
534 fGlobal_checkBox->setChecked(false);
535 }
536}
537
538//----------------------------------------------------------------------------------------------------
539// END
540//----------------------------------------------------------------------------------------------------
Dialog interface for the msr2data batch processing tool.
void runListFileNameEntered(const QString &)
Handles run list file name text field activation.
PMsr2DataParam * fMsr2DataParam
Pointer to parameter structure for msr2data configuration.
void fitOnlyChanged(int)
Handles "Fit Only" checkbox state changes.
PMsr2DataDialog(PMsr2DataParam *msr2DataParam, const QString helpUrl)
Constructs the msr2data configuration dialog.
void globalPlusOptionSet(bool checked)
Enforces mutual exclusivity between global+ and global options.
virtual PMsr2DataParam * getMsr2DataParam()
Retrieves all msr2data parameters from the dialog.
void templateRunEntered(const QString &)
Handles template run number text field activation.
int fRunTag
Run input method: -1=invalid, 0=direct list, 1=file name.
void createMsrFileOnlyChanged(int)
Handles "Create msr-File only" checkbox state changes.
void helpContent()
Opens online help for msr2data.
QString fHelpUrl
URL to online msr2data documentation.
void globalOptionSet(bool checked)
Enforces mutual exclusivity between global and global+ options.
void runListEntered(const QString &)
Handles run list text field activation.
Parameter structure for msr2data tool integration.
Definition musredit.h:73