QXRD  0.11.16
Public Slots | Public Member Functions | Private Attributes | List of all members
QxrdFileBrowser Class Reference

#include <qxrdfilebrowser.h>

Inheritance diagram for QxrdFileBrowser:
Inheritance graph
[legend]
Collaboration diagram for QxrdFileBrowser:
Collaboration graph
[legend]

Public Slots

void onFilterChanged (int newfilter)
 
void onSelectorChanged (QString str)
 
void doPushDirectory (QString newDir)
 
void doPreviousDirectory ()
 
void doUpDirectory ()
 
void doChangeDirectory ()
 
void doHomeDirectory ()
 
void doAcquisitionDirectory ()
 
void doRefreshBrowser ()
 
void doOpen ()
 
void doOpenDark ()
 
void doOpenMask ()
 
void doOpenGainMap ()
 
void doProcess ()
 
void doIntegrate ()
 
void doSumImages ()
 
void doClearAccumulator ()
 
void doIntegrateAndAccumulate ()
 
void doSaveAccumulator ()
 
void doAdd ()
 
void doSubtract ()
 
void doProjectX ()
 
void doProjectY ()
 
void doProjectZ ()
 
void doCorrelate ()
 
void doEvaluate (QString filePath)
 
void onRootDirectoryChanged (QString dir)
 
void mousePressed (QModelIndex index)
 
void onRowCountChanged (int oldCount, int newCount)
 
void doubleClicked (QModelIndex index)
 
void doSelectComboItem (int index)
 
void onModelReset ()
 
void onFileUpdated (QFileInfo file)
 

Public Member Functions

 QxrdFileBrowser (QxrdFileBrowserSettingsWPtr settings, int isOutput, QxrdExperimentWPtr experiment, QxrdDataProcessorWPtr processor, QWidget *parent)
 
virtual ~QxrdFileBrowser ()
 

Private Attributes

QxrdFileBrowserSettingsWPtr m_FileBrowserSettings
 
QMutex m_Mutex
 
int m_IsOutput
 
QxrdExperimentWPtr m_Experiment
 
QxrdDataProcessorWPtr m_Processor
 
QxrdFileBrowserModelPtr m_Model
 
QStringList m_DirectoryStack
 

Detailed Description

Definition at line 15 of file qxrdfilebrowser.h.

Constructor & Destructor Documentation

QxrdFileBrowser::QxrdFileBrowser ( QxrdFileBrowserSettingsWPtr  settings,
int  isOutput,
QxrdExperimentWPtr  experiment,
QxrdDataProcessorWPtr  processor,
QWidget *  parent 
)

Definition at line 17 of file qxrdfilebrowser.cpp.

References DEBUG_CONSTRUCTORS, doAcquisitionDirectory(), doChangeDirectory(), doHomeDirectory(), doIntegrate(), doOpen(), doPreviousDirectory(), doProcess(), doRefreshBrowser(), doSelectComboItem(), doSumImages(), doubleClicked(), doUpDirectory(), QxrdFileBrowserModel::fileUpdated(), m_FileBrowserSettings, m_Model, mousePressed(), onFileUpdated(), onFilterChanged(), onModelReset(), onRootDirectoryChanged(), onSelectorChanged(), qcepDebug(), QcepIntProperty::valueChanged(), and QcepStringProperty::valueChanged().

22  : QDockWidget(parent),
23  m_FileBrowserSettings(settings),
24  m_IsOutput(isOutput),
25  m_Experiment(experiment),
26  m_Processor(processor),
27  m_Model(NULL)
28 {
30  printf("QxrdFileBrowser::QxrdFileBrowser(%p)\n", this);
31  }
32 
33  qRegisterMetaType<QFileInfo>("QFileInfo");
34 
35  setupUi(this);
36  if (isOutput) {
37  setWindowTitle("Output " + windowTitle());
38  } else {
39  setWindowTitle("Input " + windowTitle());
40  }
41 
43  new QxrdFileBrowserModel(NULL));
44 
45  m_Model -> initialize();
46  m_Model -> setRootPath(QDir::currentPath());
47 
48  m_FileBrowser -> setModel(m_Model.data());
49 
50 // m_FileBrowser -> resizeColumnsToContents();
51 // m_FileBrowser -> resizeRowsToContents();
52 
53 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
54  m_FileBrowser->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
55  m_FileBrowser->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
56 #else
57  m_FileBrowser->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
58  m_FileBrowser->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
59 #endif
60 
61  m_Model -> setNameFilters(QStringList("*.tif"));
62  m_Model -> setNameFilterDisables(false);
63 
64  connect(m_Model.data(), &QAbstractItemModel::modelReset, this, &QxrdFileBrowser::onModelReset);
66 
67  connect(m_PrevDirectoryButton, &QAbstractButton::clicked, this, &QxrdFileBrowser::doPreviousDirectory);
68  connect(m_UpDirectoryButton, &QAbstractButton::clicked, this, &QxrdFileBrowser::doUpDirectory);
69  connect(m_ChangeDirectoryButton, &QAbstractButton::clicked, this, &QxrdFileBrowser::doChangeDirectory);
70  connect(m_HomeDirectoryButton, &QAbstractButton::clicked, this, &QxrdFileBrowser::doHomeDirectory);
71  connect(m_AcquisitionDirectoryButton, &QAbstractButton::clicked, this, &QxrdFileBrowser::doAcquisitionDirectory);
72  connect(m_RefreshButton, &QAbstractButton::clicked, this, &QxrdFileBrowser::doRefreshBrowser);
73  connect(m_OpenButton, &QAbstractButton::clicked, this, &QxrdFileBrowser::doOpen);
74  connect(m_ProcessButton, &QAbstractButton::clicked, this, &QxrdFileBrowser::doProcess);
75  connect(m_IntegrateButton, &QAbstractButton::clicked, this, &QxrdFileBrowser::doIntegrate);
76  connect(m_AccumulateButton, &QPushButton::clicked, this, &QxrdFileBrowser::doSumImages);
77 
79 
80  if (set) {
81  connect(set -> prop_RootDirectory(), &QcepStringProperty::valueChanged, this, &QxrdFileBrowser::onRootDirectoryChanged);
82  connect(set -> prop_BrowserFilter(), &QcepIntProperty::valueChanged, this, &QxrdFileBrowser::onFilterChanged);
83  connect(set -> prop_BrowserSelector(), &QcepStringProperty::valueChanged, this, &QxrdFileBrowser::onSelectorChanged);
84 
85  onRootDirectoryChanged(set->get_RootDirectory());
86  onFilterChanged(set->get_BrowserFilter());
87  onSelectorChanged(set->get_BrowserSelector());
88  }
89 
90  connect(m_FileBrowser, &QAbstractItemView::pressed, this, &QxrdFileBrowser::mousePressed);
91  connect(m_FileBrowser, &QAbstractItemView::doubleClicked, this, &QxrdFileBrowser::doubleClicked);
92 
93  connect(m_RootDirectoryCombo, (void (QComboBox::*)(int)) &QComboBox::activated, this, &QxrdFileBrowser::doSelectComboItem);
94 
95  if (set) {
96  set->prop_BrowserFilter() -> linkTo(m_FilterChoices);
97  set->prop_BrowserSelector() -> linkTo(m_FileSelector);
98  }
99 
100  m_PrevDirectoryButton->setEnabled(false);
101 
102  if (set) {
103  m_RootDirectoryCombo -> setItemText(0, set->get_RootDirectory());
104  }
105 }
QxrdFileBrowserSettingsWPtr m_FileBrowserSettings
QxrdExperimentWPtr m_Experiment
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void valueChanged(QString val, int index)
QSharedPointer< QxrdFileBrowserSettings > QxrdFileBrowserSettingsPtr
void onSelectorChanged(QString str)
void onFilterChanged(int newfilter)
void onRootDirectoryChanged(QString dir)
void doSelectComboItem(int index)
void doubleClicked(QModelIndex index)
QxrdFileBrowserModelPtr m_Model
void fileUpdated(QFileInfo file)
void onFileUpdated(QFileInfo file)
QSharedPointer< QxrdFileBrowserModel > QxrdFileBrowserModelPtr
void mousePressed(QModelIndex index)
void valueChanged(int val, int index)
QxrdDataProcessorWPtr m_Processor

Here is the call graph for this function:

QxrdFileBrowser::~QxrdFileBrowser ( )
virtual

Definition at line 107 of file qxrdfilebrowser.cpp.

References DEBUG_CONSTRUCTORS, and qcepDebug().

108 {
109 #ifndef QT_NO_DEBUG
110  printf("Deleting file browser\n");
111 #endif
112 
114  printf("QxrdFileBrowser::~QxrdFileBrowser(%p)\n", this);
115  }
116 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26

Here is the call graph for this function:

Member Function Documentation

void QxrdFileBrowser::doAcquisitionDirectory ( )
slot

Definition at line 250 of file qxrdfilebrowser.cpp.

References doPushDirectory(), and m_Experiment.

Referenced by QxrdFileBrowser().

251 {
253 
254  if (exp) {
255  doPushDirectory(exp->get_ExperimentDirectory());
256  }
257 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment
void doPushDirectory(QString newDir)

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdFileBrowser::doAdd ( )
slot

Definition at line 482 of file qxrdfilebrowser.cpp.

References m_Model, and m_Processor.

Referenced by mousePressed().

483 {
484  QItemSelectionModel *sel = m_FileBrowser->selectionModel();
485  QModelIndexList rows = sel->selectedRows();
486  QModelIndex index;
487  QStringList paths;
488 
489  foreach(index, rows) {
490  if (!m_Model->isDir(index)) {
491  paths.append(m_Model->filePath(index));
492  }
493  }
494 
496 
497  if (proc) {
498  QMetaObject::invokeMethod(proc.data(), "addImages", Q_ARG(QStringList, paths));
499  }
500 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdFileBrowserModelPtr m_Model
QxrdDataProcessorWPtr m_Processor

Here is the caller graph for this function:

void QxrdFileBrowser::doChangeDirectory ( )
slot

Definition at line 219 of file qxrdfilebrowser.cpp.

References doPushDirectory(), and m_FileBrowserSettings.

Referenced by QxrdFileBrowser().

220 {
222 
223  if (set) {
224  QString newRoot = QFileDialog::getExistingDirectory(this, "New browser directory...", set->get_RootDirectory(), 0);
225 
226  if (newRoot != "") {
227  doPushDirectory(newRoot);
228  }
229  }
230 }
QxrdFileBrowserSettingsWPtr m_FileBrowserSettings
QSharedPointer< QxrdFileBrowserSettings > QxrdFileBrowserSettingsPtr
void doPushDirectory(QString newDir)

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdFileBrowser::doClearAccumulator ( )
slot

Definition at line 404 of file qxrdfilebrowser.cpp.

References m_Processor.

Referenced by mousePressed().

405 {
407 
408  if (proc) {
409  QMetaObject::invokeMethod(proc.data(), "clearAccumulator");
410  }
411 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdDataProcessorWPtr m_Processor

Here is the caller graph for this function:

void QxrdFileBrowser::doCorrelate ( )
slot

Definition at line 582 of file qxrdfilebrowser.cpp.

References m_Model, and m_Processor.

Referenced by mousePressed().

583 {
584  QItemSelectionModel *sel = m_FileBrowser->selectionModel();
585  QModelIndexList rows = sel->selectedRows();
586  QModelIndex index;
587  QStringList paths;
588 
589  foreach(index, rows) {
590  if (!m_Model->isDir(index)) {
591  paths.append(m_Model->filePath(index));
592  }
593  }
594 
596 
597  if (proc) {
598  QMetaObject::invokeMethod(proc.data(), "correlateImages", Q_ARG(QStringList, paths));
599  }
600 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdFileBrowserModelPtr m_Model
QxrdDataProcessorWPtr m_Processor

Here is the caller graph for this function:

void QxrdFileBrowser::doEvaluate ( QString  filePath)
slot

Definition at line 602 of file qxrdfilebrowser.cpp.

References INVOKE_CHECK, and m_Experiment.

Referenced by mousePressed().

603 {
604 // QItemSelectionModel *sel = m_FileBrowser->selectionModel();
605 // QModelIndexList rows = sel->selectedRows();
606 // QModelIndex index;
607 // QStringList paths;
608 
609 // foreach(index, rows) {
610 // if (!m_Model->isDir(index)) {
611 // paths.append(m_Model->filePath(index));
612 // }
613 // }
614 
616 
617  if (exp) {
618  INVOKE_CHECK(QMetaObject::invokeMethod(exp.data(), "evaluateScriptFile", Q_ARG(QString, filePath)));
619  }
620 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment
#define INVOKE_CHECK(res)
Definition: qcepmacros.h:13

Here is the caller graph for this function:

void QxrdFileBrowser::doHomeDirectory ( )
slot

Definition at line 245 of file qxrdfilebrowser.cpp.

References doPushDirectory().

Referenced by QxrdFileBrowser().

246 {
247  doPushDirectory(QDir::currentPath());
248 }
void doPushDirectory(QString newDir)

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdFileBrowser::doIntegrate ( )
slot

Definition at line 366 of file qxrdfilebrowser.cpp.

References m_Model, and m_Processor.

Referenced by QxrdWindow::initialize(), mousePressed(), and QxrdFileBrowser().

367 {
368  QItemSelectionModel *sel = m_FileBrowser->selectionModel();
369  QModelIndexList rows = sel->selectedRows();
370  QModelIndex index;
371 
373 
374  if (proc) {
375  foreach(index, rows) {
376  // printf("Process: %s\n", qPrintable(m_Model->filePath(index)));
377  if (!m_Model->isDir(index)) {
378  proc->integrateData(m_Model->filePath(index));
379  }
380  }
381  }
382 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdFileBrowserModelPtr m_Model
QxrdDataProcessorWPtr m_Processor

Here is the caller graph for this function:

void QxrdFileBrowser::doIntegrateAndAccumulate ( )
slot

Definition at line 413 of file qxrdfilebrowser.cpp.

References m_Model, and m_Processor.

Referenced by mousePressed().

414 {
415  QItemSelectionModel *sel = m_FileBrowser->selectionModel();
416  QModelIndexList rows = sel->selectedRows();
417  QModelIndex index;
418  QStringList paths;
419 
420  foreach(index, rows) {
421  if (!m_Model->isDir(index)) {
422  paths.append(m_Model->filePath(index));
423  }
424  }
425 
427 
428  if (proc) {
429  QMetaObject::invokeMethod(proc.data(), "integrateAndAccumulate", Q_ARG(QStringList, paths));
430  }
431 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdFileBrowserModelPtr m_Model
QxrdDataProcessorWPtr m_Processor

Here is the caller graph for this function:

void QxrdFileBrowser::doOpen ( )
slot

Definition at line 259 of file qxrdfilebrowser.cpp.

References doPushDirectory(), m_Model, and m_Processor.

Referenced by doubleClicked(), mousePressed(), and QxrdFileBrowser().

260 {
261  QItemSelectionModel *sel = m_FileBrowser->selectionModel();
262  QModelIndexList rows = sel->selectedRows();
263  QModelIndex index;
264  int ndirs = 0, nfiles = 0;
265  foreach(index, rows) {
266  if (m_Model->isDir(index)) {
267  ndirs += 1;
268  } else {
269  nfiles += 1;
270  }
271  }
272 
273  if (nfiles == 0) {
274  foreach(index, rows) {
275  if (m_Model->isDir(index)) {
276  doPushDirectory(m_Model->filePath(index));
277  return;
278  }
279  }
280  } else {
282 
283  if (proc) {
284  foreach(index, rows) {
285  if (!m_Model->isDir(index)) {
286  // printf("Open: %s\n", qPrintable(m_Model->filePath(index)));
287  proc->loadData(m_Model->filePath(index));
288  }
289  }
290  }
291  }
292 }
void doPushDirectory(QString newDir)
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdFileBrowserModelPtr m_Model
QxrdDataProcessorWPtr m_Processor

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdFileBrowser::doOpenDark ( )
slot

Definition at line 294 of file qxrdfilebrowser.cpp.

References m_Model, and m_Processor.

Referenced by mousePressed().

295 {
296  QItemSelectionModel *sel = m_FileBrowser->selectionModel();
297  QModelIndexList rows = sel->selectedRows();
298  QModelIndex index;
299 
301 
302  if (proc) {
303  foreach(index, rows) {
304  // printf("Process: %s\n", qPrintable(m_Model->filePath(index)));
305  if (!m_Model->isDir(index)) {
306  proc->loadDark(m_Model->filePath(index));
307  }
308  }
309  }
310 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdFileBrowserModelPtr m_Model
QxrdDataProcessorWPtr m_Processor

Here is the caller graph for this function:

void QxrdFileBrowser::doOpenGainMap ( )
slot

Definition at line 330 of file qxrdfilebrowser.cpp.

References m_Model, and m_Processor.

Referenced by mousePressed().

331 {
332  QItemSelectionModel *sel = m_FileBrowser->selectionModel();
333  QModelIndexList rows = sel->selectedRows();
334  QModelIndex index;
335 
337 
338  if (proc) {
339  foreach(index, rows) {
340  // printf("Process: %s\n", qPrintable(m_Model->filePath(index)));
341  if (!m_Model->isDir(index)) {
342  proc->loadGainMap(m_Model->filePath(index));
343  }
344  }
345  }
346 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdFileBrowserModelPtr m_Model
QxrdDataProcessorWPtr m_Processor

Here is the caller graph for this function:

void QxrdFileBrowser::doOpenMask ( )
slot

Definition at line 312 of file qxrdfilebrowser.cpp.

References m_Model, and m_Processor.

Referenced by mousePressed().

313 {
314  QItemSelectionModel *sel = m_FileBrowser->selectionModel();
315  QModelIndexList rows = sel->selectedRows();
316  QModelIndex index;
317 
319 
320  if (proc) {
321  foreach(index, rows) {
322  // printf("Process: %s\n", qPrintable(m_Model->filePath(index)));
323  if (!m_Model->isDir(index)) {
324  proc->loadMask(m_Model->filePath(index));
325  }
326  }
327  }
328 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdFileBrowserModelPtr m_Model
QxrdDataProcessorWPtr m_Processor

Here is the caller graph for this function:

void QxrdFileBrowser::doPreviousDirectory ( )
slot

Definition at line 208 of file qxrdfilebrowser.cpp.

References m_DirectoryStack, and m_FileBrowserSettings.

Referenced by QxrdFileBrowser().

209 {
211 
212  if (set && !m_DirectoryStack.isEmpty()) {
213  set->set_RootDirectory(m_DirectoryStack.takeLast());
214 
215  m_PrevDirectoryButton->setEnabled(!m_DirectoryStack.isEmpty());
216  }
217 }
QxrdFileBrowserSettingsWPtr m_FileBrowserSettings
QSharedPointer< QxrdFileBrowserSettings > QxrdFileBrowserSettingsPtr
QStringList m_DirectoryStack

Here is the caller graph for this function:

void QxrdFileBrowser::doProcess ( )
slot

Definition at line 348 of file qxrdfilebrowser.cpp.

References m_Model, and m_Processor.

Referenced by mousePressed(), and QxrdFileBrowser().

349 {
350  QItemSelectionModel *sel = m_FileBrowser->selectionModel();
351  QModelIndexList rows = sel->selectedRows();
352  QModelIndex index;
353 
355 
356  if (proc) {
357  foreach(index, rows) {
358  // printf("Process: %s\n", qPrintable(m_Model->filePath(index)));
359  if (!m_Model->isDir(index)) {
360  proc->processData(m_Model->filePath(index));
361  }
362  }
363  }
364 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdFileBrowserModelPtr m_Model
QxrdDataProcessorWPtr m_Processor

Here is the caller graph for this function:

void QxrdFileBrowser::doProjectX ( )
slot

Definition at line 522 of file qxrdfilebrowser.cpp.

References m_Model, and m_Processor.

Referenced by mousePressed().

523 {
524  QItemSelectionModel *sel = m_FileBrowser->selectionModel();
525  QModelIndexList rows = sel->selectedRows();
526  QModelIndex index;
527  QStringList paths;
528 
529  foreach(index, rows) {
530  if (!m_Model->isDir(index)) {
531  paths.append(m_Model->filePath(index));
532  }
533  }
534 
536 
537  if (proc) {
538  QMetaObject::invokeMethod(proc.data(), "projectImages", Q_ARG(QStringList, paths), Q_ARG(int, 1), Q_ARG(int, 0), Q_ARG(int, 0));
539  }
540 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdFileBrowserModelPtr m_Model
QxrdDataProcessorWPtr m_Processor

Here is the caller graph for this function:

void QxrdFileBrowser::doProjectY ( )
slot

Definition at line 542 of file qxrdfilebrowser.cpp.

References m_Model, and m_Processor.

Referenced by mousePressed().

543 {
544  QItemSelectionModel *sel = m_FileBrowser->selectionModel();
545  QModelIndexList rows = sel->selectedRows();
546  QModelIndex index;
547  QStringList paths;
548 
549  foreach(index, rows) {
550  if (!m_Model->isDir(index)) {
551  paths.append(m_Model->filePath(index));
552  }
553  }
554 
556 
557  if (proc) {
558  QMetaObject::invokeMethod(proc.data(), "projectImages", Q_ARG(QStringList, paths), Q_ARG(int, 0), Q_ARG(int, 1), Q_ARG(int, 0));
559  }
560 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdFileBrowserModelPtr m_Model
QxrdDataProcessorWPtr m_Processor

Here is the caller graph for this function:

void QxrdFileBrowser::doProjectZ ( )
slot

Definition at line 562 of file qxrdfilebrowser.cpp.

References m_Model, and m_Processor.

Referenced by mousePressed().

563 {
564  QItemSelectionModel *sel = m_FileBrowser->selectionModel();
565  QModelIndexList rows = sel->selectedRows();
566  QModelIndex index;
567  QStringList paths;
568 
569  foreach(index, rows) {
570  if (!m_Model->isDir(index)) {
571  paths.append(m_Model->filePath(index));
572  }
573  }
574 
576 
577  if (proc) {
578  QMetaObject::invokeMethod(proc.data(), "projectImages", Q_ARG(QStringList, paths), Q_ARG(int, 0), Q_ARG(int, 0), Q_ARG(int, 1));
579  }
580 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdFileBrowserModelPtr m_Model
QxrdDataProcessorWPtr m_Processor

Here is the caller graph for this function:

void QxrdFileBrowser::doPushDirectory ( QString  newDir)
slot

Definition at line 195 of file qxrdfilebrowser.cpp.

References m_DirectoryStack, and m_FileBrowserSettings.

Referenced by doAcquisitionDirectory(), doChangeDirectory(), doHomeDirectory(), doOpen(), doSelectComboItem(), and doUpDirectory().

196 {
198 
199  if (set && newDir != "") {
200  m_DirectoryStack.append(set->get_RootDirectory());
201 
202  set->set_RootDirectory(newDir);
203 
204  m_PrevDirectoryButton->setEnabled(true);
205  }
206 }
QxrdFileBrowserSettingsWPtr m_FileBrowserSettings
QSharedPointer< QxrdFileBrowserSettings > QxrdFileBrowserSettingsPtr
QStringList m_DirectoryStack

Here is the caller graph for this function:

void QxrdFileBrowser::doRefreshBrowser ( )
slot

Definition at line 622 of file qxrdfilebrowser.cpp.

References m_Model.

Referenced by QxrdFileBrowser().

623 {
624  m_Model->refresh();
625 }
QxrdFileBrowserModelPtr m_Model

Here is the caller graph for this function:

void QxrdFileBrowser::doSaveAccumulator ( )
slot

Definition at line 433 of file qxrdfilebrowser.cpp.

References m_Experiment, and m_Processor.

Referenced by mousePressed().

434 {
435 // QItemSelectionModel *sel = m_FileBrowser->selectionModel();
436 // QModelIndexList rows = sel->selectedRows();
437 // QModelIndex index;
438 // QString path;
439 
440 // if (rows.count() >= 1) {
441 // path = m_Model->filePath(rows.first());
442 // } else {
443 // path = m_Model->rootPath();
444 // }
445 
448 
449  if (expt && proc) {
450  QcepDatasetModelPtr ds(expt->dataset());
451 
452  if (ds) {
453  QcepDataObjectPtr obj = ds->item(proc->get_AccumulateIntegratedName());
454  if (obj) {
455  QString selectedFilter = proc->get_AccumulateIntegratedFormat();
456  QString path = proc->get_AccumulateIntegratedDirectory() + "/" +
457  proc->get_AccumulateIntegratedFileName();
458 
459  QString file = QFileDialog::getSaveFileName(this,
460  "Save accumulated data in...", path,
461  obj->fileFormatFilterString(), &selectedFilter);
462 
463  if (file.length() > 0) {
464  proc -> saveAccumulator(file, selectedFilter);
465 
466  proc -> set_AccumulateIntegratedFormat(selectedFilter);
467 
468  QFileInfo finfo(file);
469 
470  proc -> set_AccumulateIntegratedDirectory(finfo.dir().absolutePath());
471  proc -> set_AccumulateIntegratedFileName(finfo.fileName());
472 
473  QString message = tr("Accumulator saved in %1, Format %2").arg(file).arg(selectedFilter);
474  expt -> statusMessage(message);
475  expt -> printMessage(message);
476  }
477  }
478  }
479  }
480 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QSharedPointer< QcepDataObject > QcepDataObjectPtr
QSharedPointer< QcepDatasetModel > QcepDatasetModelPtr
QxrdDataProcessorWPtr m_Processor

Here is the caller graph for this function:

void QxrdFileBrowser::doSelectComboItem ( int  index)
slot

Definition at line 172 of file qxrdfilebrowser.cpp.

References doPushDirectory().

Referenced by QxrdFileBrowser().

173 {
174  QString path = m_RootDirectoryCombo->itemText(index);
175 
176  if (path != "") {
177  doPushDirectory(path);
178  }
179 }
void doPushDirectory(QString newDir)

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdFileBrowser::doSubtract ( )
slot

Definition at line 502 of file qxrdfilebrowser.cpp.

References m_Model, and m_Processor.

Referenced by mousePressed().

503 {
504  QItemSelectionModel *sel = m_FileBrowser->selectionModel();
505  QModelIndexList rows = sel->selectedRows();
506  QModelIndex index;
507  QStringList paths;
508 
509  foreach(index, rows) {
510  if (!m_Model->isDir(index)) {
511  paths.append(m_Model->filePath(index));
512  }
513  }
514 
516 
517  if (proc) {
518  QMetaObject::invokeMethod(proc.data(), "subtractImages", Q_ARG(QStringList, paths));
519  }
520 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdFileBrowserModelPtr m_Model
QxrdDataProcessorWPtr m_Processor

Here is the caller graph for this function:

void QxrdFileBrowser::doSumImages ( )
slot

Definition at line 384 of file qxrdfilebrowser.cpp.

References m_Model, and m_Processor.

Referenced by mousePressed(), and QxrdFileBrowser().

385 {
386  QItemSelectionModel *sel = m_FileBrowser->selectionModel();
387  QModelIndexList rows = sel->selectedRows();
388  QModelIndex index;
389  QStringList paths;
390 
391  foreach(index, rows) {
392  if (!m_Model->isDir(index)) {
393  paths.append(m_Model->filePath(index));
394  }
395  }
396 
398 
399  if (proc) {
400  QMetaObject::invokeMethod(proc.data(), "sumImages", Q_ARG(QStringList, paths));
401  }
402 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdFileBrowserModelPtr m_Model
QxrdDataProcessorWPtr m_Processor

Here is the caller graph for this function:

void QxrdFileBrowser::doubleClicked ( QModelIndex  index)
slot

Definition at line 696 of file qxrdfilebrowser.cpp.

References doOpen().

Referenced by QxrdFileBrowser().

697 {
698  doOpen();
699 }

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdFileBrowser::doUpDirectory ( )
slot

Definition at line 232 of file qxrdfilebrowser.cpp.

References doPushDirectory(), and m_FileBrowserSettings.

Referenced by QxrdFileBrowser().

233 {
235 
236  if (set) {
237  QDir dir(set->get_RootDirectory());
238 
239  if (dir.cdUp()) {
240  doPushDirectory(dir.path());
241  }
242  }
243 }
QxrdFileBrowserSettingsWPtr m_FileBrowserSettings
QSharedPointer< QxrdFileBrowserSettings > QxrdFileBrowserSettingsPtr
void doPushDirectory(QString newDir)

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdFileBrowser::mousePressed ( QModelIndex  index)
slot

Definition at line 627 of file qxrdfilebrowser.cpp.

References doAdd(), doClearAccumulator(), doCorrelate(), doEvaluate(), doIntegrate(), doIntegrateAndAccumulate(), doOpen(), doOpenDark(), doOpenGainMap(), doOpenMask(), doProcess(), doProjectX(), doProjectY(), doProjectZ(), doSaveAccumulator(), doSubtract(), doSumImages(), and m_Model.

Referenced by QxrdFileBrowser().

628 {
629  if (QApplication::mouseButtons() & Qt::RightButton) {
630  // g_Application->printMessage("Right mouse pressed");
631 
632  QString filePath = m_Model->filePath(index);
633 
634  QMenu *actions = new QMenu(this);
635  QAction *title = actions->addAction("File operations...");
636  QAction *open = actions->addAction("Open");
637  QAction *openDark = actions->addAction("Open as Dark Image");
638  QAction *openMask = actions->addAction("Open as Mask");
639  QAction *openGainMap = actions->addAction("Open as Gain Map");
640  QAction *integrate = actions->addAction("Integrate");
641  QAction *clearAccum = actions->addAction("Clear accumulator");
642  QAction *integAccum = actions->addAction("Integrate and accumulate");
643  QAction *saveAccum = actions->addAction("Save accumulator in...");
644  QAction *process = actions->addAction("Process");
645  QAction *sumImages = actions->addAction("Sum Images to make new Current Image");
646  QAction *add = actions->addAction("Add Images to existing Current Image");
647  QAction *subtract = actions->addAction("Subtract Images from Current Image");
648  QAction *projectX = actions->addAction("Project Along X");
649  QAction *projectY = actions->addAction("Project Along Y");
650  QAction *projectZ = actions->addAction("Project Along Z");
651  QAction *correlate = actions->addAction("Correlate Images with Current Image");
652  QAction *evaluate = actions->addAction("Evaluate scripts");
653 
654  title->setDisabled(true);
655 
656  QAction *action = actions->exec(QCursor::pos(), title);
657 
658  if (action == open) {
659  doOpen();
660  } else if (action == openDark) {
661  doOpenDark();
662  } else if (action == openMask) {
663  doOpenMask();
664  } else if (action == openGainMap) {
665  doOpenGainMap();
666  } else if (action == sumImages) {
667  doSumImages();
668  } else if (action == integrate) {
669  doIntegrate();
670  } else if (action == clearAccum) {
672  } else if (action == integAccum) {
674  } else if (action == saveAccum) {
676  } else if (action == process) {
677  doProcess();
678  } else if (action == add) {
679  doAdd();
680  } else if (action == subtract) {
681  doSubtract();
682  } else if (action == projectX) {
683  doProjectX();
684  } else if (action == projectY) {
685  doProjectY();
686  } else if (action == projectZ) {
687  doProjectZ();
688  } else if (action == correlate) {
689  doCorrelate();
690  } else if (action == evaluate) {
691  doEvaluate(filePath);
692  }
693  }
694 }
void doEvaluate(QString filePath)
QxrdFileBrowserModelPtr m_Model
void doIntegrateAndAccumulate()

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdFileBrowser::onFileUpdated ( QFileInfo  file)
slot

Definition at line 719 of file qxrdfilebrowser.cpp.

References DEBUG_DISPLAY, m_Experiment, and qcepDebug().

Referenced by QxrdFileBrowser().

720 {
722 
723  if (expt && qcepDebug(DEBUG_DISPLAY)) {
724  expt->printMessage(
725  tr("QxrdFileBrowser::fileUpdated(\"%1\",\"%2\")").arg(file.filePath()).arg(file.lastModified().toString()));
726  }
727 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdFileBrowser::onFilterChanged ( int  newfilter)
slot

Definition at line 118 of file qxrdfilebrowser.cpp.

References m_Model.

Referenced by QxrdFileBrowser().

119 {
120  switch (newfilter) {
121  case 0: // Image Files (*.tif)
122  m_Model -> setNameFilters(QStringList("*.tif"));
123  break;
124 
125  case 1: // Processed Image Files (*nnnnn.tif)
126  m_Model -> setNameFilters(QStringList("*[0-9][0-9][0-9][0-9][0-9].tif"));
127  break;
128 
129  case 2: // Raw image files
130  m_Model -> setNameFilters(QStringList("*.raw.tif"));
131  break;
132 
133  case 3: // Dark image files
134  m_Model -> setNameFilters(QStringList("*.dark.tif"));
135  break;
136 
137  case 4: // Integrated data files
138  m_Model -> setNameFilters(QStringList("*.avg"));
139  break;
140 
141  case 5: // Metadata files
142  m_Model -> setNameFilters(QStringList("*.metadata"));
143  break;
144 
145  case 6: // All files
146  m_Model -> setNameFilters(QStringList());
147  break;
148  }
149 }
QxrdFileBrowserModelPtr m_Model

Here is the caller graph for this function:

void QxrdFileBrowser::onModelReset ( )
slot

Definition at line 713 of file qxrdfilebrowser.cpp.

Referenced by QxrdFileBrowser().

714 {
715 // m_FileBrowser->resizeColumnsToContents();
716 // m_FileBrowser->resizeRowsToContents();
717 }

Here is the caller graph for this function:

void QxrdFileBrowser::onRootDirectoryChanged ( QString  dir)
slot

Definition at line 181 of file qxrdfilebrowser.cpp.

References m_Model.

Referenced by QxrdFileBrowser().

182 {
183  m_Model -> setRootPath(str);
184 
185  QDir dir(str);
186 
187  m_RootDirectoryCombo -> clear();
188  m_RootDirectoryCombo -> insertItem(0, str);
189 
190  while (dir.cdUp()) {
191  m_RootDirectoryCombo -> insertItem(0, dir.path());
192  }
193 }
QxrdFileBrowserModelPtr m_Model
#define str(s)

Here is the caller graph for this function:

void QxrdFileBrowser::onRowCountChanged ( int  oldCount,
int  newCount 
)
slot

Definition at line 701 of file qxrdfilebrowser.cpp.

References DEBUG_DISPLAY, m_Experiment, and qcepDebug().

702 {
704 
705  if (expt && qcepDebug(DEBUG_DISPLAY)) {
706  expt->printMessage(
707  tr("QxrdFileBrowser::onRowCountChanged(%1,%2)").arg(oldCount).arg(newCount));
708  }
709 
710 // m_FileBrowser->resizeColumnsToContents();
711 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26

Here is the call graph for this function:

void QxrdFileBrowser::onSelectorChanged ( QString  str)
slot

Definition at line 151 of file qxrdfilebrowser.cpp.

References m_Model.

Referenced by QxrdFileBrowser().

152 {
153  QItemSelectionModel *sel = m_FileBrowser->selectionModel();
154  QRegExp pattern(str, Qt::CaseSensitive, QRegExp::Wildcard);
155 
156  int rows = m_Model -> rowCount(QModelIndex());
157 
158  for (int i=0; i<rows; i++) {
159  QModelIndex index = m_Model -> index(i, 0, QModelIndex());
160 
161  QString path = m_Model->fileName(index);
162  // g_Application->printMessage(tr("Testing %1").arg(path));
163 
164  if (pattern.exactMatch(path)) {
165  sel -> select(index, QItemSelectionModel::Rows | QItemSelectionModel::Select);
166  } else {
167  sel -> select(index, QItemSelectionModel::Rows | QItemSelectionModel::Deselect);
168  }
169  }
170 }
QxrdFileBrowserModelPtr m_Model
#define str(s)

Here is the caller graph for this function:

Member Data Documentation

QStringList QxrdFileBrowser::m_DirectoryStack
private

Definition at line 69 of file qxrdfilebrowser.h.

Referenced by doPreviousDirectory(), and doPushDirectory().

QxrdExperimentWPtr QxrdFileBrowser::m_Experiment
private
QxrdFileBrowserSettingsWPtr QxrdFileBrowser::m_FileBrowserSettings
private
int QxrdFileBrowser::m_IsOutput
private

Definition at line 65 of file qxrdfilebrowser.h.

QxrdFileBrowserModelPtr QxrdFileBrowser::m_Model
private
QMutex QxrdFileBrowser::m_Mutex
mutableprivate

Definition at line 64 of file qxrdfilebrowser.h.

QxrdDataProcessorWPtr QxrdFileBrowser::m_Processor
private

The documentation for this class was generated from the following files: