11 #include <QMessageBox>
12 #include <QFileDialog>
13 #include <QGridLayout>
26 printf(
"QxrdExperimentPreferencesDialog::QxrdExperimentPreferencesDialog(%p)\n",
this);
31 if (initialPage >= 0) {
32 m_PreferencesPanes->setCurrentIndex(initialPage);
38 setWindowTitle(expt->experimentFilePath() +
" Preferences");
44 int runSpecServer = 0;
45 int specServerPort = 0;
50 runSpecServer = srv -> get_RunSpecServer();
51 specServerPort = srv -> get_SpecServerPort();
54 int runSimpleServer = 0;
55 int simpleServerPort = 0;
60 runSimpleServer = ssrv -> get_RunSimpleServer();
61 simpleServerPort = ssrv -> get_SimpleServerPort();
68 for (
int i=0; i<acq->get_DetectorCount(); i++) {
71 acq->detectorThread(i),
72 acq->detector(i), acq));
78 m_DetectorsList->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
88 m_ExperimentDirectory -> setText(expt->get_ExperimentDirectory());
91 m_CurrentLogFile -> setText(expt->get_LogFileName());
94 m_DataDirectory -> setText(expt->get_DataDirectory());
97 m_IntegratedScansFile -> setText(expt->get_ScanFileName());
99 m_ScanFileExtension -> setText(expt->get_ScanFileExtension());
101 m_ScanDataNegative -> setCurrentIndex(expt->get_ScanDataNegative());
105 m_SaveRawInSubdir -> setChecked(proc->get_SaveRawInSubdirectory());
106 m_SaveRawSubdir -> setText (proc->get_SaveRawSubdirectory());
109 m_SaveDarkInSubdir -> setChecked(proc->get_SaveDarkInSubdirectory());
110 m_SaveDarkSubdir -> setText (proc->get_SaveDarkSubdirectory());
113 m_SaveSubtractedInSubdir -> setChecked(proc->get_SaveSubtractedInSubdirectory());
114 m_SaveSubtractedSubdir -> setText (proc->get_SaveSubtractedSubdirectory());
117 m_SaveIntegratedInLogFile -> setChecked(proc->get_SaveIntegratedData());
118 m_SaveIntegratedInSeparateFiles -> setChecked(proc->get_SaveIntegratedInSeparateFiles());
119 m_SaveIntegratedInSubdir -> setChecked(proc->get_SaveIntegratedInSubdirectory());
120 m_SaveIntegratedSubdir -> setText (proc->get_SaveIntegratedSubdirectory());
122 m_AccumulateIntegrated2D -> setChecked(proc->get_AccumulateIntegrated2D());
123 m_AccumulateIntegratedName ->setText(proc->get_AccumulateIntegratedName());
125 m_SaveOverflowFiles -> setChecked(proc->get_SaveOverflowFiles());
129 m_RunSpecServer -> setChecked(runSpecServer);
130 m_SpecServerPort -> setRange(-1,65535);
131 m_SpecServerPort -> setSpecialValueText(tr(
"Automatic"));
132 m_SpecServerPort -> setValue(specServerPort);
136 m_RunSimpleServer -> setChecked(runSimpleServer);
137 m_SimpleServerPort -> setRange(0,65535);
138 m_SimpleServerPort -> setValue(simpleServerPort);
142 m_FileIndexWidth -> setValue(acq->get_FileIndexWidth());
143 m_FilePhaseWidth -> setValue(acq->get_FilePhaseWidth());
144 m_FileOverflowWidth -> setValue(acq->get_FileOverflowWidth());
145 m_DetectorNumberWidth -> setValue(acq->get_DetectorNumberWidth());
148 m_FontSize -> setValue(expt->get_FontSize());
149 m_Spacing -> setValue(expt->get_Spacing());
156 printf(
"QxrdExperimentPreferencesDialog::~QxrdExperimentPreferencesDialog(%p)\n",
this);
162 return m_ExperimentDirectory->text();
172 QString initial = QDir(
dataDirectory()).filePath(edit->text());
174 QString dir = QFileDialog::getExistingDirectory(
this,
"", initial, QFileDialog::ShowDirsOnly);
177 QString result = QDir(
dataDirectory()).relativeFilePath(dir);
179 edit -> setText(result);
209 QString dir = QFileDialog::getExistingDirectory(
this,
"Output Directory", initial, QFileDialog::ShowDirsOnly);
220 QString file = QFileDialog::getSaveFileName(
this,
"Log File", initial);
229 QString initial = QDir(
dataDirectory()).filePath(m_IntegratedScansFile->text());
231 QString file = QFileDialog::getSaveFileName(
this,
"Scans File", initial);
234 m_IntegratedScansFile->setText(QDir(
dataDirectory()).relativeFilePath(file));
240 QDialog::changeEvent(e);
242 case QEvent::LanguageChange:
252 int runSpecServer = m_RunSpecServer -> isChecked();
253 int runSimpleServer = m_RunSimpleServer -> isChecked();
254 int specServerPort = m_SpecServerPort -> value();
255 int simpleServerPort = m_SimpleServerPort -> value();
271 srv -> set_RunSpecServer(runSpecServer);
272 srv -> set_SpecServerPort(specServerPort);
276 ssrv -> set_RunSimpleServer(runSimpleServer);
277 ssrv -> set_SimpleServerPort(simpleServerPort);
281 proc -> set_SaveRawInSubdirectory(m_SaveRawInSubdir -> isChecked());
282 proc -> set_SaveRawSubdirectory (m_SaveRawSubdir -> text());
284 proc -> set_SaveDarkInSubdirectory(m_SaveDarkInSubdir -> isChecked());
285 proc -> set_SaveDarkSubdirectory (m_SaveDarkSubdir -> text());
287 proc -> set_SaveSubtractedInSubdirectory(m_SaveSubtractedInSubdir -> isChecked());
288 proc -> set_SaveSubtractedSubdirectory (m_SaveSubtractedSubdir -> text());
290 proc -> set_SaveIntegratedData(m_SaveIntegratedInLogFile -> isChecked());
291 proc -> set_SaveIntegratedInSeparateFiles(m_SaveIntegratedInSeparateFiles -> isChecked());
292 proc -> set_SaveIntegratedInSubdirectory (m_SaveIntegratedInSubdir -> isChecked());
293 proc -> set_SaveIntegratedSubdirectory (m_SaveIntegratedSubdir -> text());
295 proc -> set_AccumulateIntegrated2D(m_AccumulateIntegrated2D -> isChecked());
296 proc -> set_AccumulateIntegratedName(m_AccumulateIntegratedName -> text());
298 proc -> set_SaveOverflowFiles(m_SaveOverflowFiles -> isChecked());
301 expt -> set_DataDirectory(m_DataDirectory -> text());
302 expt -> set_LogFileName (m_CurrentLogFile -> text());
303 expt -> set_ScanFileName (m_IntegratedScansFile -> text());
304 expt -> set_ScanFileExtension(m_ScanFileExtension->text());
305 expt -> set_ScanDataNegative(m_ScanDataNegative->currentIndex());
308 acq -> set_FileIndexWidth(m_FileIndexWidth -> value());
309 acq -> set_FilePhaseWidth(m_FilePhaseWidth -> value());
310 acq -> set_FileOverflowWidth(m_FileOverflowWidth -> value());
311 acq -> set_DetectorNumberWidth(m_DetectorNumberWidth -> value());
315 acq->clearDetectors();
317 for (
int i = 0; i<nDets; i++) {
322 expt -> set_FontSize(m_FontSize -> value());
323 expt -> set_Spacing(m_Spacing -> value());
346 QAction *choice = menu.exec(QCursor::pos());
349 int type = choice->data().toInt();
364 QItemSelectionModel *selected = m_DetectorsList->selectionModel();
365 QVector<int> selectedRows;
367 for (
int i=0; i<detCount; i++) {
368 if (selected->rowIntersectsSelection(i, QModelIndex())) {
369 selectedRows.append(i);
373 int res = QMessageBox::Cancel;
375 if (selectedRows.count() == 0) {
376 QMessageBox::information(
this,
"No Detectors Selected",
"Select detectors to delete", QMessageBox::Ok);
377 }
else if (selectedRows.count() == 1) {
378 res = QMessageBox::information(
this,
"Delete Detector?",
379 tr(
"Do you really want to delete detector %1").arg(selectedRows.value(0)),
380 QMessageBox::Ok, QMessageBox::Cancel);
383 foreach (
int i, selectedRows) {
385 dets = tr(
"%1").arg(i);
387 dets += tr(
", %1").arg(i);
391 res = QMessageBox::information(
this,
"Delete Detectors?,",
392 tr(
"Do you really want to delete detectors %1").arg(dets),
393 QMessageBox::Ok, QMessageBox::Cancel);
396 if (res == QMessageBox::Ok) {
397 for (
int i=selectedRows.count()-1; i>=0; i--) {
408 QItemSelectionModel *selected = m_DetectorsList->selectionModel();
409 QVector<int> selectedRows;
411 for (
int i=0; i<detCount; i++) {
412 if (selected->rowIntersectsSelection(i, QModelIndex())) {
413 selectedRows.append(i);
417 if (selectedRows.count() != 1) {
418 QMessageBox::information(
this,
"Only move one",
"Must have a single detector selected before moving it", QMessageBox::Ok);
428 QItemSelectionModel *selected = m_DetectorsList->selectionModel();
429 QVector<int> selectedRows;
431 for (
int i=0; i<detCount; i++) {
432 if (selected->rowIntersectsSelection(i, QModelIndex())) {
433 selectedRows.append(i);
437 if (selectedRows.count() != 1) {
438 QMessageBox::information(
this,
"Only move one",
"Must have a single detector selected before moving it", QMessageBox::Ok);
448 QItemSelectionModel *selected = m_DetectorsList->selectionModel();
449 QVector<int> selectedRows;
451 for (
int i=0; i<detCount; i++) {
452 if (selected->rowIntersectsSelection(i, QModelIndex())) {
453 selectedRows.append(i);
457 if (selectedRows.count() != 1) {
458 QMessageBox::information(
this,
"Only configure one",
"Must have a single detector selected before configuring it", QMessageBox::Ok);
463 proxy->configureDetector();
479 int row = item.row();
480 int col = item.column();
482 if (col == 0 || col == 2) {
486 proxy->configureDetector();
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QSharedPointer< QxrdDetectorProxy > QxrdDetectorProxyPtr
~QxrdExperimentPreferencesDialog()
void dataDirectoryBrowse()
QSharedPointer< QxrdServer > QxrdServerPtr
qint64 qcepDebug(int cond)
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdExperimentPreferencesDialog(QxrdExperimentWPtr exptw, QWidget *parent=0, int initialPage=-1)
QString experimentDirectory()
void changeEvent(QEvent *e)
QSharedPointer< QxrdSimpleServer > QxrdSimpleServerPtr
QWeakPointer< QxrdExperiment > QxrdExperimentWPtr
void saveSubtractedBrowse()
void saveIntegratedBrowse()
void currentLogFileBrowse()
QSharedPointer< QxrdDetectorProxyListModel > QxrdDetectorProxyListModelPtr
void detectorDoubleClicked(const QModelIndex &item)
void getRelativeDirectoryPath(QLineEdit *edit)
void integratedScansFileBrowse()
static int detectorTypeCount()
static QString detectorTypeName(int detectorType)
void appendDetectorProxy(QxrdDetectorProxyPtr proxy)
QxrdDetectorProxyListModelPtr m_DetectorProxyModel
QxrdExperimentWPtr m_Experiment