musredit 1.0.0
Loading...
Searching...
No Matches
PPrefsDialog.cpp
Go to the documentation of this file.
1/****************************************************************************
2
3 PPrefsDialog.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 <memory>
48#include <unistd.h> // for # of threads
49
51#include "PPrefsDialog.h"
52
53//----------------------------------------------------------------------------------------------------
117{
118 if (!fAdmin)
119 return;
120
121 setupUi(this);
122
123 setModal(true);
124
125 if (fAdmin->getDarkThemeIconsMenuFlag()) {
126 fDarkThemeIconsMenu_checkBox->setCheckState(Qt::Checked);
127 } else {
128 fDarkThemeIconsMenu_checkBox->setCheckState(Qt::Unchecked);
129 }
130
131 if (fAdmin->getDarkThemeIconsToolbarFlag()) {
132 fDarkThemeIconsToolbar_checkBox->setCheckState(Qt::Checked);
133 } else {
134 fDarkThemeIconsToolbar_checkBox->setCheckState(Qt::Unchecked);
135 }
136
137 if (fAdmin->getIgnoreThemeAutoDetection()) {
138 fIgnoreThemeAutoDetection_checkBox->setCheckState(Qt::Checked);
139 } else {
140 fIgnoreThemeAutoDetection_checkBox->setCheckState(Qt::Unchecked);
141 }
142
143 fKeepMn2Output_checkBox->setChecked(fAdmin->getKeepMinuit2OutputFlag());
144
145 if (fAdmin->getDumpAsciiFlag() && !fAdmin->getDumpRootFlag()) {
146 fDumpAscii_checkBox->setChecked(true);
147 fDumpRoot_checkBox->setChecked(false);
148 } else if (!fAdmin->getDumpAsciiFlag() && fAdmin->getDumpRootFlag()) {
149 fDumpAscii_checkBox->setChecked(false);
150 fDumpRoot_checkBox->setChecked(true);
151 } else {
152 fDumpAscii_checkBox->setChecked(false);
153 fDumpRoot_checkBox->setChecked(false);
154 }
155
156 fTitleFromData_checkBox->setChecked(fAdmin->getTitleFromDataFileFlag());
157 fEnableMusrT0_checkBox->setChecked(fAdmin->getEnableMusrT0Flag());
158 fPerRunBlockChisq_checkBox->setChecked(fAdmin->getChisqPerRunBlockFlag());
159 fEstimateN0_checkBox->setChecked(fAdmin->getEstimateN0Flag());
160 fYamlOut_checkBox->setChecked(fAdmin->getYamlOutFlag());
161 fFourier_checkBox->setChecked(fAdmin->getMusrviewShowFourierFlag());
162 fAvg_checkBox->setChecked(fAdmin->getMusrviewShowAvgFlag());
163 fOneToOne_checkBox->setChecked(fAdmin->getMusrviewShowOneToOneFlag());
164
165 fTimeout_lineEdit->setText(QString("%1").arg(fAdmin->getTimeout()));
166 fTimeout_lineEdit->setValidator(new QIntValidator(fTimeout_lineEdit));
167
168 // get number of threads info from the systems
169 long nprocs = sysconf(_SC_NPROCESSORS_ONLN);
170 if (fAdmin->getNoOfThreadsToBeUsed() > nprocs)
171 fAdmin->setNoOfThreadsToBeUsed(nprocs);
172 for (auto i=0; i<nprocs; i++)
173 fNumberOfThreads_comboBox->addItem(QString("%1").arg(i+1));
174 fNumberOfThreads_comboBox->setCurrentIndex(fAdmin->getNoOfThreadsToBeUsed()-1);
175 QObject::connect(fNumberOfThreads_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(numberOfThreadsChanged(int)));
176
177 QObject::connect(fDefaultPath_pushButton, SIGNAL(clicked()), this, SLOT(handleDefaultPaths()));
178}
179
180//----------------------------------------------------------------------------------------------------
215{
216 int result = 0;
217
218 if (fDumpAscii_checkBox->isChecked())
219 result = 1;
220 else if (fDumpRoot_checkBox->isChecked())
221 result = 2;
222
223 return result;
224}
225
226//----------------------------------------------------------------------------------------------------
255{
256 if (fDumpAscii_checkBox->isChecked())
257 fDumpRoot_checkBox->setChecked(false);
258}
259
260//----------------------------------------------------------------------------------------------------
297{
298 if (fDumpRoot_checkBox->isChecked())
299 fDumpAscii_checkBox->setChecked(false);
300}
301
302//----------------------------------------------------------------------------------------------------
345{
346 std::unique_ptr<PChangeDefaultPathsDialog> dlg = std::make_unique<PChangeDefaultPathsDialog>();
347
348 if (dlg->exec() == QDialog::Accepted) {
349
350 }
351}
352
353//----------------------------------------------------------------------------------------------------
360{
361 fAdmin->setNoOfThreadsToBeUsed(idx+1);
362}
363
364//----------------------------------------------------------------------------------------------------
365// END
366//----------------------------------------------------------------------------------------------------
Dialog for managing default data file search paths in musredit.
Preferences dialog for musredit application settings.
Central administration class for musredit configuration management.
Definition PAdmin.h:209
PAdmin * fAdmin
Pointer to global administration object storing all preferences.
void dumpAscii()
Slot: Handles ASCII dump checkbox selection.
void dumpRoot()
Slot: Handles ROOT dump checkbox selection.
int getDump()
Returns the dump format preference.
void handleDefaultPaths()
Slot: Opens the default paths configuration dialog.
void numberOfThreadsChanged(int idx)
Slot: called when the current index of the number of threads to be used has changed.
PPrefsDialog(PAdmin *admin)
Constructs the preferences dialog.