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

#include <qxrdexperiment.h>

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

Public Slots

void newLogFile (QString path)
 
void openNewLogFile () const
 
void executeCommand (QString cmd)
 
QString systemCommand (QString cmd)
 
QString defaultDataDirectory (QString path) const
 
QString defaultLogName (QString path) const
 
QString defaultScanName (QString path) const
 
QString experimentFilePath () const
 
QString logFilePath () const
 
QString scanFilePath () const
 
void setExperimentFilePath (QString path)
 
void saveExperimentCopyAs (QString path)
 
void saveExperimentAs (QString path)
 
void readSettings ()
 
void writeSettings ()
 
void readSettings (QSettings *settings, QString section)
 
void writeSettings (QSettings *settings, QString section)
 
void logMessage (QString msg) const
 
void splashMessage (QString msg)
 
void criticalMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) const
 
void statusMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) const
 
void printMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) const
 
void printLine (QString msg)
 
void saveExperiment ()
 
void completeWork (int amt)
 
void commenceWork (int amt)
 
void finishedWork (int amt)
 
void updateCompletionPercentage (int, int)
 
void dump ()
 
QColor pickColor (QColor start=QColor(Qt::white))
 
void evaluateScriptFiles (QStringList files)
 
void evaluateScriptFile (QString path)
 
- Public Slots inherited from QcepExperiment
QString defaultExperimentDirectory (QString path) const
 
QString defaultExperimentFileName (QString path) const
 
QString defaultExperimentName (QString path) const
 
- Public Slots inherited from QcepObject
virtual void printLine (QString line)
 
virtual void printMessage (QString msg, QDateTime dt=QDateTime::currentDateTime()) const
 
virtual void criticalMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) const
 
virtual void statusMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) const
 
virtual QString settingsScript ()
 
QString scriptValueLiteral (QVariant v)
 

Public Member Functions

 QxrdExperiment (QxrdExperimentThreadWPtr expthrd, QString path, QxrdApplicationWPtr app)
 
virtual ~QxrdExperiment ()
 
void initialize (QSettings *settings)
 
void openWindows ()
 
QxrdExperimentThreadWPtr experimentThread ()
 
QxrdAcquisitionWPtr acquisition () const
 
QxrdWindowPtr window ()
 
QxrdDataProcessorWPtr dataProcessor () const
 
QxrdCenterFinderWPtr centerFinder () const
 
QxrdIntegratorWPtr integrator () const
 
QxrdServerWPtr specServer ()
 
QxrdServerThreadWPtr specServerThread ()
 
QxrdSimpleServerWPtr simpleServer ()
 
QxrdSimpleServerThreadWPtr simpleServerThread ()
 
QxrdCalibrantLibraryWPtr calibrantLibrary () const
 
QxrdCalibrantLibraryModelWPtr calibrantLibraryModel () const
 
QxrdCalibrantDSpacingsWPtr calibrantDSpacings () const
 
QxrdCalibrantDSpacingsModelWPtr calibrantDSpacingsModel () const
 
QcepDatasetModelPtr dataset ()
 
QxrdFileSaverWPtr fileSaver () const
 
FILE * logFile ()
 
FILE * scanFile ()
 
void newScanFile (QString path)
 
QxrdScriptEngineWPtr scriptEngine ()
 
void openScanFile ()
 
- Public Member Functions inherited from QcepExperiment
 QcepExperiment (QString path, QString name, QcepObject *parent)
 
- Public Member Functions inherited from QcepObject
 QcepObject (QString name, QcepObject *parent)
 
virtual ~QcepObject ()
 
virtual void writeSettings (QSettings *set, QString section)
 
virtual void readSettings (QSettings *set, QString section)
 
QString get_Name () const
 
void set_Name (QString name)
 

Properties

QString dataDirectory
 
QString logFileName
 
QString scanFileName
 
QString scanFileExtension
 
int scanDataNegative
 
int defaultLayout
 
int workCompleted
 
int workTarget
 
int completionPercentage
 
QString defaultScript
 
QStringList extraScriptFiles
 
int fontSize
 
int spacing
 
- Properties inherited from QcepExperiment
int experimentKind
 
QString experimentDirectory
 
QString experimentFileName
 
QString experimentName
 
QString experimentDescription
 
- Properties inherited from QcepObject
QString name
 

Private Member Functions

void closeLogFile () const
 
void openLogFile () const
 
void readInitialLogFile ()
 
void closeScanFile ()
 

Private Attributes

QxrdApplicationWPtr m_Application
 
QxrdExperimentThreadWPtr m_ExperimentThread
 
QMutex m_Mutex
 
QxrdWindowSettingsPtr m_WindowSettings
 
QxrdWindowPtr m_Window
 
QxrdServerThreadPtr m_ServerThread
 
QxrdServerWPtr m_Server
 
QxrdSimpleServerThreadPtr m_SimpleServerThread
 
QxrdSimpleServerWPtr m_SimpleServer
 
QxrdDataProcessorPtr m_DataProcessor
 
QxrdCalibrantLibraryPtr m_CalibrantLibrary
 
QxrdCalibrantLibraryModelPtr m_CalibrantLibraryModel
 
QxrdCalibrantDSpacingsPtr m_CalibrantDSpacings
 
QxrdCalibrantDSpacingsModelPtr m_CalibrantDSpacingsModel
 
QxrdAcquisitionPtr m_Acquisition
 
QxrdDetectorThreadPtr m_DetectorThread
 
QxrdDetectorWPtr m_Detector
 
QxrdFileSaverThreadPtr m_FileSaverThread
 
QxrdFileSaverWPtr m_FileSaver
 
QxrdScriptEnginePtr m_ScriptEngine
 
QScriptEngineDebugger * m_ScriptEngineDebugger
 
QcepDatasetPtr m_Dataset
 
QcepDatasetModelPtr m_DatasetModel
 
QMutex m_LogFileMutex
 
FILE * m_LogFile
 
QMutex m_ScanFileMutex
 
FILE * m_ScanFile
 
QMutex m_ExperimentFileMutex
 

Additional Inherited Members

- Static Public Member Functions inherited from QcepObject
static int allocatedObjects ()
 
static int deletedObjects ()
 
static QSet< QcepObject * > allocatedObjectsSet ()
 
static QString addSlashes (QString str)
 
- Protected Attributes inherited from QcepExperiment
QcepSettingsSaverPtr m_SettingsSaver
 

Detailed Description

Definition at line 50 of file qxrdexperiment.h.

Constructor & Destructor Documentation

QxrdExperiment::QxrdExperiment ( QxrdExperimentThreadWPtr  expthrd,
QString  path,
QxrdApplicationWPtr  app 
)

Definition at line 44 of file qxrdexperiment.cpp.

References DEBUG_CONSTRUCTORS, and qcepDebug().

46  :
47  QcepExperiment(path, "experiment", NULL),
48  m_Application(app),
49  m_ExperimentThread(expthrd),
50  m_WindowSettings(NULL),
51  m_Window(),
52 // m_AcquisitionWindow(),
53  m_ServerThread(NULL),
54  m_Server(),
58  m_Acquisition(),
59  m_FileSaverThread(NULL),
60  m_FileSaver(),
63  m_LogFile(NULL),
64  m_ScanFile(NULL),
66 
67  m_DataDirectory(m_SettingsSaver, this, "dataDirectory", defaultDataDirectory(path), "Saved Data Directory"),
68  m_LogFileName(m_SettingsSaver, this, "logFileName", defaultLogName(path), "Log File Name"),
69  m_ScanFileName(m_SettingsSaver, this, "scanFileName", defaultScanName(path), "Scan File Name"),
70  m_ScanFileExtension(m_SettingsSaver, this, "scanFileExtension", ".avg", "Scan File Extension"),
71  m_ScanDataNegative(m_SettingsSaver, this, "scanDataNegative", 0, "Scan Data Negative Value Handling"),
72  m_DefaultLayout(QcepSettingsSaverWPtr(), this,"defaultLayout",0, "Default Layout Used?"),
73  m_WorkCompleted(QcepSettingsSaverWPtr(), this, "workCompleted", 0, "Amount of Work Completed"),
74  m_WorkTarget(QcepSettingsSaverWPtr(), this, "workTarget", 0, "Amount of Work Targetted"),
75  m_CompletionPercentage(QcepSettingsSaverWPtr(), this, "completionPercentage", 0, "Percentage of Work Completed"),
76  m_DefaultScript(m_SettingsSaver, this, "defaultScript", "", "Default script for experiment"),
77  m_ExtraScriptFiles(m_SettingsSaver, this, "extraScriptFiles", QStringList(), "Additional script files for experiment"),
78  m_FontSize(m_SettingsSaver, this, "fontSize", -1, "Suggested font size"),
79  m_Spacing(m_SettingsSaver, this, "spacing", -1, "Suggested widget spacing")
80 {
82  printf("QxrdExperiment::QxrdExperiment(%p)\n", this);
83  }
84 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QScriptEngineDebugger * m_ScriptEngineDebugger
QString defaultScanName(QString path) const
QcepSettingsSaverPtr m_SettingsSaver
QxrdFileSaverThreadPtr m_FileSaverThread
QxrdDataProcessorPtr m_DataProcessor
QxrdAcquisitionPtr m_Acquisition
QxrdScriptEnginePtr m_ScriptEngine
QString defaultDataDirectory(QString path) const
QString defaultLogName(QString path) const
QxrdSimpleServerWPtr m_SimpleServer
QxrdSimpleServerThreadPtr m_SimpleServerThread
QxrdApplicationWPtr m_Application
QxrdWindowSettingsPtr m_WindowSettings
QcepExperiment(QString path, QString name, QcepObject *parent)
QxrdServerWPtr m_Server
QMutex m_ExperimentFileMutex
QxrdServerThreadPtr m_ServerThread
QWeakPointer< QcepSettingsSaver > QcepSettingsSaverWPtr
QxrdWindowPtr m_Window
QxrdFileSaverWPtr m_FileSaver
QxrdExperimentThreadWPtr m_ExperimentThread

Here is the call graph for this function:

QxrdExperiment::~QxrdExperiment ( )
virtual

Definition at line 361 of file qxrdexperiment.cpp.

References closeLogFile(), closeScanFile(), DEBUG_APP, DEBUG_CONSTRUCTORS, m_Application, QcepExperiment::m_SettingsSaver, and qcepDebug().

362 {
363 #ifndef QT_NO_DEBUG
364  printf("Deleting experiment\n");
365 #endif
366 
368 
369  if (app && qcepDebug(DEBUG_APP)) {
370  app->printMessage("QxrdExperiment::~QxrdExperiment");
371  }
372 
374  printf("QxrdExperiment::~QxrdExperiment(%p)\n", this);
375  }
376 
377  m_SettingsSaver->performSave();
378 
379  closeScanFile();
380  closeLogFile();
381 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QcepSettingsSaverPtr m_SettingsSaver
QxrdApplicationWPtr m_Application
QSharedPointer< QxrdApplication > QxrdApplicationPtr
void closeLogFile() const

Here is the call graph for this function:

Member Function Documentation

QxrdAcquisitionWPtr QxrdExperiment::acquisition ( ) const

Definition at line 466 of file qxrdexperiment.cpp.

References m_Acquisition.

467 {
468  return m_Acquisition;
469 }
QxrdAcquisitionPtr m_Acquisition
QxrdCalibrantDSpacingsWPtr QxrdExperiment::calibrantDSpacings ( ) const

Definition at line 511 of file qxrdexperiment.cpp.

References m_CalibrantDSpacings.

512 {
513  return m_CalibrantDSpacings;
514 }
QxrdCalibrantDSpacingsPtr m_CalibrantDSpacings
QxrdCalibrantDSpacingsModelWPtr QxrdExperiment::calibrantDSpacingsModel ( ) const

Definition at line 516 of file qxrdexperiment.cpp.

References m_CalibrantDSpacingsModel.

517 {
519 }
QxrdCalibrantDSpacingsModelPtr m_CalibrantDSpacingsModel
QxrdCalibrantLibraryWPtr QxrdExperiment::calibrantLibrary ( ) const

Definition at line 501 of file qxrdexperiment.cpp.

References m_CalibrantLibrary.

502 {
503  return m_CalibrantLibrary;
504 }
QxrdCalibrantLibraryPtr m_CalibrantLibrary
QxrdCalibrantLibraryModelWPtr QxrdExperiment::calibrantLibraryModel ( ) const

Definition at line 506 of file qxrdexperiment.cpp.

References m_CalibrantLibraryModel.

507 {
509 }
QxrdCalibrantLibraryModelPtr m_CalibrantLibraryModel
QxrdCenterFinderWPtr QxrdExperiment::centerFinder ( ) const

Definition at line 526 of file qxrdexperiment.cpp.

References m_DataProcessor.

527 {
529 
530  if (dp) {
531  return dp->centerFinder();
532  } else {
533  return QxrdCenterFinderWPtr();
534  }
535 }
QWeakPointer< QxrdCenterFinder > QxrdCenterFinderWPtr
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdDataProcessorPtr m_DataProcessor
void QxrdExperiment::closeLogFile ( ) const
private

Definition at line 659 of file qxrdexperiment.cpp.

References m_LogFile, and m_LogFileMutex.

Referenced by ~QxrdExperiment().

660 {
661  QcepMutexLocker lock(__FILE__, __LINE__, &m_LogFileMutex);
662 
663  if (m_LogFile) {
664  fprintf(m_LogFile, "#CX %s ------- shutdown --------\n",
665  qPrintable(QDateTime::currentDateTime().toString("yyyy.MM.dd : hh:mm:ss.zzz ")));
666 
667  fclose(m_LogFile);
668  m_LogFile = NULL;
669  }
670 }

Here is the caller graph for this function:

void QxrdExperiment::closeScanFile ( )
private

Definition at line 709 of file qxrdexperiment.cpp.

References m_ScanFile, and m_ScanFileMutex.

Referenced by ~QxrdExperiment().

710 {
711  QcepMutexLocker lock(__FILE__, __LINE__, &m_ScanFileMutex);
712 
713  if (m_ScanFile) {
714  fclose(m_ScanFile);
715  m_ScanFile = NULL;
716  }
717 }
QMutex m_ScanFileMutex

Here is the caller graph for this function:

void QxrdExperiment::commenceWork ( int  amt)
slot

Definition at line 954 of file qxrdexperiment.cpp.

955 {
956  prop_WorkTarget()->incValue(amt);
957 }
void QxrdExperiment::completeWork ( int  amt)
slot

Definition at line 949 of file qxrdexperiment.cpp.

950 {
951  prop_WorkCompleted()->incValue(amt);
952 }
void QxrdExperiment::criticalMessage ( QString  msg,
QDateTime  ts = QDateTime::currentDateTime() 
) const
slot

Definition at line 392 of file qxrdexperiment.cpp.

References m_Application, and m_Window.

393 {
395  QxrdWindowPtr win(m_Window);
396 
397  if (win) {
398  win->displayCriticalMessage(msg);
399  } else if (app) {
400  app->criticalMessage(msg);
401  } else {
402  printf("%s\n", qPrintable(msg));
403  }
404 }
QSharedPointer< QxrdWindow > QxrdWindowPtr
Definition: qxrdwindow-ptr.h:6
QxrdApplicationWPtr m_Application
QSharedPointer< QxrdApplication > QxrdApplicationPtr
QxrdWindowPtr m_Window
QxrdDataProcessorWPtr QxrdExperiment::dataProcessor ( ) const

Definition at line 496 of file qxrdexperiment.cpp.

References m_DataProcessor.

497 {
498  return m_DataProcessor;
499 }
QxrdDataProcessorPtr m_DataProcessor
QcepDatasetModelPtr QxrdExperiment::dataset ( )

Definition at line 521 of file qxrdexperiment.cpp.

References m_DatasetModel.

522 {
523  return m_DatasetModel;
524 }
QcepDatasetModelPtr m_DatasetModel
QString QxrdExperiment::defaultDataDirectory ( QString  path) const
slot

Definition at line 843 of file qxrdexperiment.cpp.

844 {
845  return "";
846 }
QString QxrdExperiment::defaultLogName ( QString  path) const
slot

Definition at line 848 of file qxrdexperiment.cpp.

References QcepExperiment::defaultExperimentName().

Referenced by setExperimentFilePath().

849 {
850  return defaultExperimentName(path)+".log";
851 }
QString defaultExperimentName(QString path) const

Here is the call graph for this function:

Here is the caller graph for this function:

QString QxrdExperiment::defaultScanName ( QString  path) const
slot

Definition at line 853 of file qxrdexperiment.cpp.

References QcepExperiment::defaultExperimentName().

Referenced by setExperimentFilePath().

854 {
855  return defaultExperimentName(path)+".scans";
856 }
QString defaultExperimentName(QString path) const

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdExperiment::dump ( )
slot

Definition at line 965 of file qxrdexperiment.cpp.

966 {
967  printf("About to dump\n");
968  dumpObjectInfo();
969  dumpObjectTree();
970  printf("Dumped\n");
971 }
void QxrdExperiment::evaluateScriptFile ( QString  path)
slot

Definition at line 987 of file qxrdexperiment.cpp.

References m_ScriptEngine, and printMessage().

Referenced by evaluateScriptFiles().

988 {
990 
991  if (eng) {
992  printMessage(tr("Loading script %1").arg(path));
993 
994  eng->loadScript(path);
995  }
996 }
QSharedPointer< QxrdScriptEngine > QxrdScriptEnginePtr
QxrdScriptEnginePtr m_ScriptEngine
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdExperiment::evaluateScriptFiles ( QStringList  files)
slot

Definition at line 980 of file qxrdexperiment.cpp.

References evaluateScriptFile().

981 {
982  foreach(QString file, files) {
983  evaluateScriptFile(file);
984  }
985 }
void evaluateScriptFile(QString path)

Here is the call graph for this function:

void QxrdExperiment::executeCommand ( QString  cmd)
slot

Definition at line 553 of file qxrdexperiment.cpp.

References m_ScriptEngine.

554 {
556 
557  if (eng) {
558  eng->evaluateAppCommand(cmd);
559  }
560 }
QSharedPointer< QxrdScriptEngine > QxrdScriptEnginePtr
QxrdScriptEnginePtr m_ScriptEngine
QString QxrdExperiment::experimentFilePath ( ) const
slot

Definition at line 858 of file qxrdexperiment.cpp.

Referenced by readSettings(), and writeSettings().

859 {
860  QDir dir(get_ExperimentDirectory());
861 
862  return dir.filePath(get_ExperimentFileName());
863 }

Here is the caller graph for this function:

QxrdExperimentThreadWPtr QxrdExperiment::experimentThread ( )

Definition at line 301 of file qxrdexperiment.cpp.

References m_ExperimentThread.

302 {
303  return m_ExperimentThread;
304 }
QxrdExperimentThreadWPtr m_ExperimentThread
QxrdFileSaverWPtr QxrdExperiment::fileSaver ( ) const

Definition at line 471 of file qxrdexperiment.cpp.

References m_FileSaver.

Referenced by initialize().

472 {
473  return m_FileSaver;
474 }
QxrdFileSaverWPtr m_FileSaver

Here is the caller graph for this function:

void QxrdExperiment::finishedWork ( int  amt)
slot

Definition at line 959 of file qxrdexperiment.cpp.

960 {
961  prop_WorkCompleted()->incValue(-amt);
962  prop_WorkTarget()->incValue(-amt);
963 }
void QxrdExperiment::initialize ( QSettings *  settings)

Definition at line 86 of file qxrdexperiment.cpp.

References QxrdScriptEngine::evaluateSimpleServerCommand(), QxrdScriptEngine::evaluateSpecCommand(), QxrdSimpleServer::executeCommand(), fileSaver(), QxrdSimpleServer::finishedCommand(), m_Acquisition, m_Application, m_CalibrantDSpacings, m_CalibrantDSpacingsModel, m_CalibrantLibrary, m_CalibrantLibraryModel, m_DataProcessor, m_Dataset, m_DatasetModel, m_FileSaver, m_FileSaverThread, m_ScriptEngine, m_Server, m_ServerThread, QcepExperiment::m_SettingsSaver, m_SimpleServer, m_SimpleServerThread, m_WindowSettings, printMessage(), readSettings(), QxrdScriptEngine::simpleServerResultAvailable(), QxrdScriptEngine::specResultAvailable(), splashMessage(), STR, updateCompletionPercentage(), and QcepIntProperty::valueChanged().

Referenced by openWindows().

87 {
89 
90  if (app) {
91 // QThread::currentThread()->setObjectName("experiment");
92 
93  splashMessage("Initializing File Saver");
94 
96  new QxrdFileSaverThread(app->allocator()));
97 // m_FileSaverThread -> setObjectName("saver");
98  m_FileSaverThread -> start();
100 
101  splashMessage("Initializing Data Processing");
102 
105  sharedFromThis(),
107  app->allocator(),
108  m_FileSaver));
110 
112 
113  if (saver) {
114  saver -> setProcessor(m_DataProcessor);
115  saver -> setExperiment(sharedFromThis());
116  }
117 
118  splashMessage("Initializing Data Acquisition");
119 
122  sharedFromThis(),
124  app->allocator()));
126 
128  new QxrdCalibrantLibrary(m_SettingsSaver, sharedFromThis()));
129 
132 
134  new QxrdCalibrantDSpacings());
135 
138 
140 
141  if (proc) {
142  proc -> setAcquisition(m_Acquisition);
143  }
144 
145  if (saver) {
146  saver -> setAcquisition(m_Acquisition);
147  }
148 
150 
151  if (acq) {
152  acq -> setNIDAQPlugin(app->nidaqPlugin());
153  }
154 
157 
158  m_DatasetModel -> newGroup("group1");
159  m_DatasetModel -> newGroup("group2");
160  m_DatasetModel -> newGroup("group3");
161 
162  QStringList cols;
163  cols << "x" << "y" << "z" << "v" << "sdev";
164 
165  m_DatasetModel -> newColumnScan("group1/scan1", 1000, cols);
166  m_DatasetModel -> newColumnScan("group2/scan2", 1000, cols);
167  m_DatasetModel -> newColumnScan("group3/scan3", 1000, cols);
168 
169  m_DatasetModel -> newColumn("group4/x", 1000);
170  m_DatasetModel -> newColumn("group4/y", 1000);
171  m_DatasetModel -> newColumn("group4/z", 1000);
172  m_DatasetModel -> newColumn("group4/t", 1000);
173  m_DatasetModel -> newColumn("group4/sdev", 1000);
174 
176 
177  splashMessage("Starting SPEC Server");
178 
180  new QxrdServerThread(m_SettingsSaver, sharedFromThis(), "qxrd"));
181 // m_ServerThread -> setObjectName("server");
182  m_ServerThread -> start();
183  m_Server = m_ServerThread -> server();
184 
185  splashMessage("Starting Simple Socket Server");
186 
188  new QxrdSimpleServerThread(m_SettingsSaver, sharedFromThis(), "simpleserver"));
189 // m_SimpleServerThread -> setObjectName("smpsrv");
190  m_SimpleServerThread -> start();
191  m_SimpleServer = m_SimpleServerThread -> server();
192 
193 // m_ScriptEngineThread = QxrdScriptEngineThreadPtr(
194 // new QxrdScriptEngineThread(m_Application, m_Experiment));
195 // m_ScriptEngineThread -> setObjectName("script");
196 // m_ScriptEngineThread -> start();
197 // m_ScriptEngine = m_ScriptEngineThread -> scriptEngine();
198 
200  new QxrdScriptEngine(app, sharedFromThis()));
202 
203  QxrdServerPtr srv(m_Server);
205 
206 // if (eng) {
207 // m_ScriptEngineDebugger = new QScriptEngineDebugger(this);
208 // m_ScriptEngineDebugger -> attachTo(eng.data());
209 // m_ScriptEngineDebugger -> setAutoShowStandardWindow(true);
210 // }
211 
212  if (srv && eng) {
213  connect(srv.data(), &QSpecServer::executeCommand,
215 
216  connect(eng.data(), &QxrdScriptEngine::specResultAvailable,
217  srv.data(), &QSpecServer::finishedCommand);
218  }
219 
221 
222  if (ssrv && eng) {
223  connect(ssrv.data(), &QxrdSimpleServer::executeCommand,
225 
227  ssrv.data(), &QxrdSimpleServer::finishedCommand);
228  }
229 
230  splashMessage("Loading Preferences");
231 
232  readSettings(settings, "experiment");
233 
234  splashMessage("Loading Background Images");
235 
236  if (proc) {
237  proc -> loadDefaultImages();
238  }
239 
240 #ifdef Q_OS_WIN32
241  QDir::setCurrent(QDir::homePath());
242 #endif
243 
244  printMessage(tr("------- Starting new session -------"));
245  printMessage(tr("Experiment name: %1").arg(get_ExperimentName()));
246  printMessage(tr("Experiment Directory: %1").arg(get_ExperimentDirectory()));
247  printMessage(tr("Stored in file: %1").arg(get_ExperimentFileName()));
248 
249  QString about = STR(QXRD_VERSION);
250 
251  if (sizeof(void*) == 4) {
252  about += " - 32 Bit";
253  } else {
254  about += " - 64 Bit";
255  }
256 
257 #ifdef Q_CC_MSVC
258  about += " MSVC";
259 #endif
260 
261 #ifdef Q_CC_GNU
262  about += " gcc";
263 #endif
264 
265 #ifdef QT_NO_DEBUG
266  about += " Release";
267 #else
268  about += " Debug";
269 #endif
270 
271 #ifdef Q_OS_MAC
272  about += " : Macintosh";
273 #elif defined(Q_OS_WIN32)
274  about += " : Windows";
275 #elif defined(Q_OS_UNIX)
276  about += " : Unix";
277 #endif
278 
279  printMessage(tr("Qxrd Version : %1").arg(about));
280  printMessage(tr("Qt Version %1").arg(qVersion()));
281  printMessage(tr("Qceplib Version %1").arg(STR(QCEPLIB_VERSION)));
282  printMessage(tr("QWT Version %1").arg(STR(QCEPLIB_QWT_VERSION)));
283  printMessage(tr("Mar345 Version %1").arg(STR(QCEPLIB_MAR345_VERSION)));
284  printMessage(tr("CBF Version %1").arg(STR(QCEPLIB_CBF_VERSION)));
285  printMessage(tr("TIFF Version %1").arg(STR(QCEPLIB_TIFF_VERSION)));
286  printMessage(tr("LevMar Version %1").arg(STR(QCEPLIB_LEVMAR_VERSION)));
287 #ifdef QCEPLIB_HDF5_VERSION
288  printMessage(tr("HDF5 Version %1").arg(STR(QCEPLIB_HDF5_VERSION)));
289 #endif
290  printMessage(tr("Spec Server Version %1").arg(STR(QCEPLIB_SPECSERVER_VERSION)));
291  printMessage(tr("Running on host %1").arg(QHostInfo::localHostName()));
292  printMessage(tr("Current directory %1").arg(QDir::currentPath()));
293 
294  connect(prop_WorkCompleted(), &QcepIntProperty::valueChanged, this, &QxrdExperiment::updateCompletionPercentage);
296 
297  m_SettingsSaver->start();
298  }
299 }
QSharedPointer< QxrdServer > QxrdServerPtr
Definition: qxrdserver-ptr.h:6
QcepSettingsSaverPtr m_SettingsSaver
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QSharedPointer< QxrdCalibrantLibraryModel > QxrdCalibrantLibraryModelPtr
QxrdFileSaverThreadPtr m_FileSaverThread
QSharedPointer< QxrdWindowSettings > QxrdWindowSettingsPtr
void evaluateSimpleServerCommand(QString cmd)
QSharedPointer< QxrdCalibrantLibrary > QxrdCalibrantLibraryPtr
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
void finishedCommand(QScriptValue result)
#define STR(s)
Definition: qcepmacros.h:16
void initialize(QSettings *settings)
QSharedPointer< QxrdScriptEngine > QxrdScriptEnginePtr
QcepDatasetModelPtr m_DatasetModel
void evaluateSpecCommand(QString cmd)
QSharedPointer< QxrdSimpleServer > QxrdSimpleServerPtr
QxrdFileSaverWPtr fileSaver() const
void executeCommand(QString cmd)
QxrdCalibrantLibraryPtr m_CalibrantLibrary
QSharedPointer< QxrdCalibrantDSpacingsModel > QxrdCalibrantDSpacingsModelPtr
QxrdDataProcessorPtr m_DataProcessor
QSharedPointer< QxrdSimpleServerThread > QxrdSimpleServerThreadPtr
QxrdAcquisitionPtr m_Acquisition
QxrdScriptEnginePtr m_ScriptEngine
QxrdSimpleServerWPtr m_SimpleServer
QSharedPointer< QxrdCalibrantDSpacings > QxrdCalibrantDSpacingsPtr
QxrdSimpleServerThreadPtr m_SimpleServerThread
QxrdApplicationWPtr m_Application
QxrdCalibrantDSpacingsPtr m_CalibrantDSpacings
QxrdWindowSettingsPtr m_WindowSettings
QSharedPointer< QxrdServerThread > QxrdServerThreadPtr
QxrdServerWPtr m_Server
void updateCompletionPercentage(int, int)
QxrdServerThreadPtr m_ServerThread
QSharedPointer< QxrdFileSaver > QxrdFileSaverPtr
QSharedPointer< QcepDataset > QcepDatasetPtr
QcepDatasetPtr m_Dataset
void simpleServerResultAvailable(QScriptValue cmd)
QSharedPointer< QxrdFileSaverThread > QxrdFileSaverThreadPtr
QxrdCalibrantDSpacingsModelPtr m_CalibrantDSpacingsModel
void valueChanged(int val, int index)
QSharedPointer< QxrdApplication > QxrdApplicationPtr
QSharedPointer< QcepDatasetModel > QcepDatasetModelPtr
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
void splashMessage(QString msg)
QxrdCalibrantLibraryModelPtr m_CalibrantLibraryModel
QxrdFileSaverWPtr m_FileSaver
void specResultAvailable(QScriptValue cmd)

Here is the call graph for this function:

Here is the caller graph for this function:

QxrdIntegratorWPtr QxrdExperiment::integrator ( ) const

Definition at line 537 of file qxrdexperiment.cpp.

References m_DataProcessor.

538 {
540 
541  if (dp) {
542  return dp->integrator();
543  } else {
544  return QxrdIntegratorWPtr();
545  }
546 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdDataProcessorPtr m_DataProcessor
QWeakPointer< QxrdIntegrator > QxrdIntegratorWPtr
FILE * QxrdExperiment::logFile ( )

Definition at line 640 of file qxrdexperiment.cpp.

References m_LogFile, and m_LogFileMutex.

Referenced by readInitialLogFile().

641 {
642  QcepMutexLocker lock(__FILE__, __LINE__, &m_LogFileMutex);
643 
644  return m_LogFile;
645 }

Here is the caller graph for this function:

QString QxrdExperiment::logFilePath ( ) const
slot

Definition at line 892 of file qxrdexperiment.cpp.

Referenced by openLogFile(), and readInitialLogFile().

893 {
894  QDir dir(get_ExperimentDirectory());
895 
896  return dir.filePath(get_LogFileName());
897 }

Here is the caller graph for this function:

void QxrdExperiment::logMessage ( QString  msg) const
slot

Definition at line 647 of file qxrdexperiment.cpp.

References m_LogFile, m_LogFileMutex, and openLogFile().

Referenced by printMessage().

648 {
649  openLogFile();
650 
651  QcepMutexLocker lock(__FILE__, __LINE__, &m_LogFileMutex);
652 
653  if (m_LogFile) {
654  fprintf(m_LogFile, "#CX %s\n", qPrintable(msg));
655  fflush(m_LogFile);
656  }
657 }
void openLogFile() const

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdExperiment::newLogFile ( QString  path)
slot

Definition at line 572 of file qxrdexperiment.cpp.

References m_LogFile, m_LogFileMutex, and openLogFile().

Referenced by setExperimentFilePath().

573 {
574  {
575  QcepMutexLocker lock(__FILE__, __LINE__, &m_LogFileMutex);
576 
577  if (m_LogFile) {
578  fclose(m_LogFile);
579  m_LogFile = NULL;
580  }
581  }
582 
583  set_LogFileName(path);
584 
585  openLogFile();
586 }
void openLogFile() const

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdExperiment::newScanFile ( QString  path)

Definition at line 672 of file qxrdexperiment.cpp.

References m_ScanFile, m_ScanFileMutex, and openScanFile().

Referenced by setExperimentFilePath().

673 {
674  {
675  QcepMutexLocker lock(__FILE__, __LINE__, &m_ScanFileMutex);
676 
677  if (m_ScanFile) {
678  fclose(m_ScanFile);
679  m_ScanFile = NULL;
680  }
681  }
682 
683  set_ScanFileName(path);
684 
685  openScanFile();
686 }
QMutex m_ScanFileMutex

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdExperiment::openLogFile ( ) const
private

Definition at line 602 of file qxrdexperiment.cpp.

References logFilePath(), m_LogFile, and m_LogFileMutex.

Referenced by logMessage(), newLogFile(), and openNewLogFile().

603 {
604  QcepMutexLocker lock(__FILE__, __LINE__, &m_LogFileMutex);
605 
606  if (m_LogFile == NULL) {
607  m_LogFile = fopen(qPrintable(logFilePath()), "a");
608 
609  if (m_LogFile) {
610  fprintf(m_LogFile, "#F %s\n", qPrintable(get_LogFileName()));
611  fprintf(m_LogFile, "#E %d\n", QDateTime::currentDateTime().toTime_t());
612  fprintf(m_LogFile, "#D %s\n", qPrintable(QDateTime::currentDateTime().toString("ddd MMM d hh:mm:ss yyyy")));
613  fflush(m_LogFile);
614  }
615  }
616 }
QString logFilePath() const

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdExperiment::openNewLogFile ( ) const
slot

Definition at line 588 of file qxrdexperiment.cpp.

References m_LogFile, m_LogFileMutex, and openLogFile().

Referenced by QxrdAcquisitionDialog::QxrdAcquisitionDialog().

589 {
590  {
591  QcepMutexLocker lock(__FILE__, __LINE__, &m_LogFileMutex);
592 
593  if (m_LogFile) {
594  fclose(m_LogFile);
595  m_LogFile = NULL;
596  }
597  }
598 
599  openLogFile();
600 }
void openLogFile() const

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdExperiment::openScanFile ( )

Definition at line 688 of file qxrdexperiment.cpp.

References m_ScanFile, m_ScanFileMutex, and scanFilePath().

Referenced by newScanFile().

689 {
690  QcepMutexLocker lock(__FILE__, __LINE__, &m_ScanFileMutex);
691 
692  if (m_ScanFile == NULL) {
693  m_ScanFile = fopen(qPrintable(scanFilePath()), "a");
694 
695  if (m_ScanFile) {
696  fprintf(m_ScanFile, "#F %s\n", qPrintable(get_LogFileName()));
697  fprintf(m_ScanFile, "#E %d\n", QDateTime::currentDateTime().toTime_t());
698  fprintf(m_ScanFile, "#D %s\n", qPrintable(QDateTime::currentDateTime().toString("ddd MMM d hh:mm:ss yyyy")));
699  fflush(m_ScanFile);
700  }
701  }
702 }
QMutex m_ScanFileMutex
QString scanFilePath() const

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdExperiment::openWindows ( )

Definition at line 306 of file qxrdexperiment.cpp.

References QxrdScriptEngine::appResultAvailable(), QxrdScriptEngine::evaluateAppCommand(), QxrdWindow::executeCommand(), QxrdWindow::finishedCommand(), GUI_THREAD_CHECK, initialize(), m_Acquisition, m_Application, m_DataProcessor, m_ScriptEngine, m_Window, m_WindowSettings, readInitialLogFile(), and splashMessage().

307 {
309 
311 
312  if (app && app->get_GuiWanted()) {
313  splashMessage("Opening Main Window");
317  sharedFromThis(),
320  app->allocator(),
321  NULL), &QObject::deleteLater);
322 
326 
327  if (m_Window) {
328  m_Window -> initialize();
329 
330  if (proc) {
331  proc -> setWindow(m_Window);
332  }
333 
334  if (acq) {
335  acq -> setWindow(m_Window);
336  }
337 
338  if (eng) {
339  eng -> setWindow(m_Window);
340  }
341 
342  m_Window -> onAcquisitionInit();
343 
344  if (eng) {
345  connect(m_Window.data(), &QxrdWindow::executeCommand,
347 
348  connect(eng.data(), &QxrdScriptEngine::appResultAvailable,
350  }
351 
353 
354  if (m_Window && app && app->get_GuiWanted()) {
355  m_Window -> show();
356  }
357  }
358  }
359 }
QSharedPointer< QxrdWindow > QxrdWindowPtr
Definition: qxrdwindow-ptr.h:6
void executeCommand(QString cmd)
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
#define GUI_THREAD_CHECK
Definition: qcepmacros.h:10
void initialize(QSettings *settings)
QSharedPointer< QxrdScriptEngine > QxrdScriptEnginePtr
QxrdDataProcessorPtr m_DataProcessor
QxrdAcquisitionPtr m_Acquisition
QxrdScriptEnginePtr m_ScriptEngine
QxrdApplicationWPtr m_Application
QxrdWindowSettingsPtr m_WindowSettings
void appResultAvailable(QScriptValue res)
void evaluateAppCommand(QString cmd)
void finishedCommand(QScriptValue result)
QSharedPointer< QxrdApplication > QxrdApplicationPtr
void splashMessage(QString msg)
QxrdWindowPtr m_Window

Here is the call graph for this function:

QColor QxrdExperiment::pickColor ( QColor  start = QColor(Qt::white))
slot

Definition at line 973 of file qxrdexperiment.cpp.

974 {
975  QColor res = QColorDialog::getColor(start);
976 
977  return res;
978 }
void QxrdExperiment::printLine ( QString  msg)
slot

Definition at line 448 of file qxrdexperiment.cpp.

References m_Window.

449 {
450 #ifndef QT_NO_DEBUG
451  printf("%s\n", qPrintable(msg));
452 #endif
453 
454  QxrdWindowPtr win = m_Window;
455 
456  if (win) {
457  win->displayMessage(msg);
458  }
459 }
QSharedPointer< QxrdWindow > QxrdWindowPtr
Definition: qxrdwindow-ptr.h:6
QxrdWindowPtr m_Window
void QxrdExperiment::printMessage ( QString  msg,
QDateTime  ts = QDateTime::currentDateTime() 
) const
slot

Definition at line 420 of file qxrdexperiment.cpp.

References DEBUG_NOMESSAGES, logMessage(), m_Window, and qcepDebug().

Referenced by evaluateScriptFile(), initialize(), QxrdExperimentSettings::QxrdExperimentSettings(), saveExperimentCopyAs(), setExperimentFilePath(), and QxrdExperimentSettings::~QxrdExperimentSettings().

421 {
423  } else {
424  QString message = ts.toString("yyyy.MM.dd : hh:mm:ss.zzz ")+
425  QThread::currentThread()->objectName()+": "+
426  msg.trimmed();
427 
428  message = message.replace("\n", " : ");
429 
430 //#ifndef QT_NO_DEBUG
431 // printf("%s\n", qPrintable(message));
432 //#endif
433 
434  logMessage(message);
435 
436  QxrdWindowPtr win = m_Window;
437 
438  if (win) {
439  win->displayMessage(message);
440 // } else if (m_Application) {
441 // m_Application->printMessage(message);
442  } else {
443 // printf("%s\n", qPrintable(message));
444  }
445  }
446 }
QSharedPointer< QxrdWindow > QxrdWindowPtr
Definition: qxrdwindow-ptr.h:6
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void logMessage(QString msg) const
QxrdWindowPtr m_Window

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdExperiment::readInitialLogFile ( )
private

Definition at line 618 of file qxrdexperiment.cpp.

References logFile(), logFilePath(), m_LogFileMutex, and m_Window.

Referenced by openWindows().

619 {
620  QcepMutexLocker lock(__FILE__, __LINE__, &m_LogFileMutex);
621 
622  FILE *logFile = fopen(qPrintable(logFilePath()), "r");
623 
624  if (logFile) {
625  fseek(logFile, -10000, SEEK_END);
626 
627  char buff[10001];
628  fgets(buff, 10000, logFile);
629 
630  while (!feof(logFile)) {
631  fgets(buff, 10000, logFile);
632 
633  m_Window->initialLogEntry(buff);
634  }
635 
636  fclose(logFile);
637  }
638 }
QString logFilePath() const
QxrdWindowPtr m_Window

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdExperiment::readSettings ( )
slot

Definition at line 719 of file qxrdexperiment.cpp.

References experimentFilePath(), and m_ExperimentFileMutex.

Referenced by initialize(), and readSettings().

720 {
721  QcepMutexLocker lock(__FILE__, __LINE__, &m_ExperimentFileMutex);
722 
723  QString docPath = experimentFilePath();
724 
725  if (docPath.length()>0) {
726  QSettings settings(docPath, QSettings::IniFormat);
727 
728  readSettings(&settings, "experiment");
729  } else {
730  QxrdExperimentSettings settings;
731 
732  readSettings(&settings, "experiment");
733  }
734 }
QString experimentFilePath() const
QMutex m_ExperimentFileMutex

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdExperiment::readSettings ( QSettings *  settings,
QString  section 
)
slot

Definition at line 736 of file qxrdexperiment.cpp.

References m_Acquisition, m_CalibrantLibrary, m_DataProcessor, m_Mutex, m_Server, m_SimpleServer, m_WindowSettings, QxrdDetectorThread::PerkinElmerDetector, QcepObject::readSettings(), and readSettings().

737 {
738  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
739 
740  if (settings) {
741  QcepExperiment::readSettings(settings, section);
742 
745  QxrdServerPtr srv(m_Server);
747 
748  m_WindowSettings -> readSettings(settings, "window");
749 
750  if (acq) {
751  acq -> readSettings(settings, "acquisition");
752  }
753 
754  if (settings->contains("experiment/detectorType")) {
755  int detType = settings->value("experiment/detectorType", -1).toInt();
756 
758  if (acq) {
759  if (acq->get_DetectorCount() == 0) {
760  acq->appendDetector(detType);
761  }
762  }
763  }
764  }
765 
766  if (proc) {
767  proc -> readSettings(settings, "processor");
768  }
769 
770  if (m_CalibrantLibrary) {
771  m_CalibrantLibrary->readSettings(settings, "calibrantLibrary");
772  }
773 
774  if (srv) {
775  srv -> readSettings(settings, "specserver");
776  }
777 
778  if (ssrv) {
779  ssrv -> readSettings(settings, "simpleserver");
780  }
781  }
782 }
QSharedPointer< QxrdServer > QxrdServerPtr
Definition: qxrdserver-ptr.h:6
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
virtual void readSettings(QSettings *set, QString section)
Definition: qcepobject.cpp:119
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QSharedPointer< QxrdSimpleServer > QxrdSimpleServerPtr
QxrdCalibrantLibraryPtr m_CalibrantLibrary
QxrdDataProcessorPtr m_DataProcessor
QxrdAcquisitionPtr m_Acquisition
QxrdSimpleServerWPtr m_SimpleServer
QxrdWindowSettingsPtr m_WindowSettings
QxrdServerWPtr m_Server

Here is the call graph for this function:

void QxrdExperiment::saveExperiment ( )
slot

Definition at line 906 of file qxrdexperiment.cpp.

References writeSettings().

Referenced by QxrdWindow::initialize().

907 {
908  writeSettings();
909 }

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdExperiment::saveExperimentAs ( QString  path)
slot

Definition at line 911 of file qxrdexperiment.cpp.

References setExperimentFilePath(), and writeSettings().

912 {
913  QxrdExperimentSettings settings(path);
914 
915  setExperimentFilePath(path);
916 
917  writeSettings(&settings, "experiment");
918 }
void setExperimentFilePath(QString path)

Here is the call graph for this function:

void QxrdExperiment::saveExperimentCopyAs ( QString  path)
slot

Definition at line 920 of file qxrdexperiment.cpp.

References printMessage(), and writeSettings().

921 {
922  printMessage(tr("Save experiment copy as %1").arg(path));
923 
924  QxrdExperimentSettings settings(path);
925 
926  writeSettings(&settings, "experiment");
927 
928 // QxrdExperiment *exp = new QxrdExperiment(path, m_Application, &settings);
929 
930 // exp -> setExperimentFilePath(path);
931 
932 // exp -> writeSettings(&settings);
933 
934 // delete exp;
935 }
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const

Here is the call graph for this function:

FILE * QxrdExperiment::scanFile ( )

Definition at line 704 of file qxrdexperiment.cpp.

References m_ScanFile.

705 {
706  return m_ScanFile;
707 }
QString QxrdExperiment::scanFilePath ( ) const
slot

Definition at line 899 of file qxrdexperiment.cpp.

Referenced by openScanFile().

900 {
901  QDir dir(get_ExperimentDirectory());
902 
903  return dir.filePath(get_ScanFileName());
904 }

Here is the caller graph for this function:

QxrdScriptEngineWPtr QxrdExperiment::scriptEngine ( )

Definition at line 548 of file qxrdexperiment.cpp.

References m_ScriptEngine.

549 {
550  return m_ScriptEngine;
551 }
QxrdScriptEnginePtr m_ScriptEngine
void QxrdExperiment::setExperimentFilePath ( QString  path)
slot

Definition at line 865 of file qxrdexperiment.cpp.

References DEBUG_PREFS, QcepExperiment::defaultExperimentDirectory(), QcepExperiment::defaultExperimentFileName(), QcepExperiment::defaultExperimentName(), defaultLogName(), defaultScanName(), m_Window, newLogFile(), newScanFile(), printMessage(), and qcepDebug().

Referenced by saveExperimentAs().

866 {
867  set_ExperimentDirectory(defaultExperimentDirectory(path));
868  set_ExperimentFileName(defaultExperimentFileName(path));
869  set_ExperimentName(defaultExperimentName(path));
870  set_LogFileName(defaultLogName(path));
871  set_ScanFileName(defaultScanName(path));
872 
873  QxrdWindowPtr win = m_Window;
874 
875  if (win) {
876  win -> updateTitle();
877  }
878 
879  if (qcepDebug(DEBUG_PREFS)) {
880  printMessage(tr("setExperimentFilePath %1").arg(path));
881  printMessage(tr(" experimentDirectory: %1").arg(get_ExperimentDirectory()));
882  printMessage(tr(" experimentFileName: %1").arg(get_ExperimentFileName()));
883  printMessage(tr(" experimentName: %1").arg(get_ExperimentName()));
884  printMessage(tr(" logFilePath: %1").arg(get_LogFileName()));
885  printMessage(tr(" scanFilePath: %1").arg(get_ScanFileName()));
886  }
887 
888  newLogFile(get_LogFileName());
889  newScanFile(get_ScanFileName());
890 }
QSharedPointer< QxrdWindow > QxrdWindowPtr
Definition: qxrdwindow-ptr.h:6
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QString defaultScanName(QString path) const
void newScanFile(QString path)
void newLogFile(QString path)
QString defaultExperimentDirectory(QString path) const
QString defaultExperimentFileName(QString path) const
QString defaultLogName(QString path) const
QString defaultExperimentName(QString path) const
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
QxrdWindowPtr m_Window

Here is the call graph for this function:

Here is the caller graph for this function:

QxrdSimpleServerWPtr QxrdExperiment::simpleServer ( )

Definition at line 486 of file qxrdexperiment.cpp.

References m_SimpleServer.

487 {
488  return m_SimpleServer;
489 }
QxrdSimpleServerWPtr m_SimpleServer
QxrdSimpleServerThreadWPtr QxrdExperiment::simpleServerThread ( )

Definition at line 491 of file qxrdexperiment.cpp.

References m_SimpleServerThread.

492 {
493  return m_SimpleServerThread;
494 }
QxrdSimpleServerThreadPtr m_SimpleServerThread
QxrdServerWPtr QxrdExperiment::specServer ( )

Definition at line 476 of file qxrdexperiment.cpp.

References m_Server.

477 {
478  return m_Server;
479 }
QxrdServerWPtr m_Server
QxrdServerThreadWPtr QxrdExperiment::specServerThread ( )

Definition at line 481 of file qxrdexperiment.cpp.

References m_ServerThread.

482 {
483  return m_ServerThread;
484 }
QxrdServerThreadPtr m_ServerThread
void QxrdExperiment::splashMessage ( QString  msg)
slot

Definition at line 383 of file qxrdexperiment.cpp.

References m_Application.

Referenced by initialize(), and openWindows().

384 {
386 
387  if (app) {
388  app->splashMessage(msg);
389  }
390 }
QxrdApplicationWPtr m_Application
QSharedPointer< QxrdApplication > QxrdApplicationPtr

Here is the caller graph for this function:

void QxrdExperiment::statusMessage ( QString  msg,
QDateTime  ts = QDateTime::currentDateTime() 
) const
slot

Definition at line 406 of file qxrdexperiment.cpp.

References m_Application, and m_Window.

407 {
409  QxrdWindowPtr win(m_Window);
410 
411  if (win) {
412  win->displayStatusMessage(msg);
413  } else if (app) {
414  app->statusMessage(msg);
415  } else {
416  printf("%s\n", qPrintable(msg));
417  }
418 }
QSharedPointer< QxrdWindow > QxrdWindowPtr
Definition: qxrdwindow-ptr.h:6
QxrdApplicationWPtr m_Application
QSharedPointer< QxrdApplication > QxrdApplicationPtr
QxrdWindowPtr m_Window
QString QxrdExperiment::systemCommand ( QString  cmd)
slot

Definition at line 562 of file qxrdexperiment.cpp.

563 {
564  QProcess process;
565 
566  process.start(cmd);
567  process.waitForReadyRead();
568 
569  return process.readAllStandardOutput();
570 }
void QxrdExperiment::updateCompletionPercentage ( int  ,
int   
)
slot

Definition at line 937 of file qxrdexperiment.cpp.

Referenced by initialize().

938 {
939  int completed = get_WorkCompleted();
940  int target = get_WorkTarget();
941 
942  if (target > 0) {
943  set_CompletionPercentage(100.0*completed/target);
944  } else {
945  set_CompletionPercentage(0);
946  }
947 }

Here is the caller graph for this function:

QxrdWindowPtr QxrdExperiment::window ( )

Definition at line 461 of file qxrdexperiment.cpp.

References m_Window.

462 {
463  return m_Window;
464 }
QxrdWindowPtr m_Window
void QxrdExperiment::writeSettings ( )
slot

Definition at line 784 of file qxrdexperiment.cpp.

References experimentFilePath(), and m_ExperimentFileMutex.

Referenced by saveExperiment(), saveExperimentAs(), saveExperimentCopyAs(), and writeSettings().

785 {
786  QcepMutexLocker lock(__FILE__, __LINE__, &m_ExperimentFileMutex);
787 
788  QString docPath = experimentFilePath();
789 
790  if (docPath.length()>0) {
791  QFile::remove(docPath+".new");
792 
793  {
794  QSettings settings(docPath+".new", QSettings::IniFormat);
795 
796  writeSettings(&settings, "experiment");
797  }
798 
799  QFile::remove(docPath+".bak");
800  QFile::rename(docPath, docPath+".bak");
801  QFile::rename(docPath+".new", docPath);
802  } else {
803  QxrdExperimentSettings settings;
804 
805  writeSettings(&settings, "experiment");
806  }
807 }
QString experimentFilePath() const
QMutex m_ExperimentFileMutex

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdExperiment::writeSettings ( QSettings *  settings,
QString  section 
)
slot

Definition at line 809 of file qxrdexperiment.cpp.

References m_Acquisition, m_CalibrantLibrary, m_DataProcessor, m_Server, m_SimpleServer, m_WindowSettings, QcepObject::writeSettings(), and writeSettings().

810 {
811  if (settings) {
812  QcepExperiment::writeSettings(settings, section);
813 
816  QxrdServerPtr srv(m_Server);
818 
819  m_WindowSettings -> writeSettings(settings, "window");
820 
821  if (acq) {
822  acq -> writeSettings(settings, "acquisition");
823  }
824 
825  if (proc) {
826  proc -> writeSettings(settings, "processor");
827  }
828 
829  if (m_CalibrantLibrary) {
830  m_CalibrantLibrary->writeSettings(settings, "calibrantLibrary");
831  }
832 
833  if (srv) {
834  srv -> writeSettings(settings, "specserver");
835  }
836 
837  if (ssrv) {
838  ssrv -> writeSettings(settings, "simpleserver");
839  }
840  }
841 }
QSharedPointer< QxrdServer > QxrdServerPtr
Definition: qxrdserver-ptr.h:6
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QSharedPointer< QxrdSimpleServer > QxrdSimpleServerPtr
QxrdCalibrantLibraryPtr m_CalibrantLibrary
QxrdDataProcessorPtr m_DataProcessor
QxrdAcquisitionPtr m_Acquisition
QxrdSimpleServerWPtr m_SimpleServer
QxrdWindowSettingsPtr m_WindowSettings
QxrdServerWPtr m_Server
virtual void writeSettings(QSettings *set, QString section)
Definition: qcepobject.cpp:114

Here is the call graph for this function:

Member Data Documentation

QxrdAcquisitionPtr QxrdExperiment::m_Acquisition
private

Definition at line 165 of file qxrdexperiment.h.

Referenced by acquisition(), initialize(), openWindows(), readSettings(), and writeSettings().

QxrdApplicationWPtr QxrdExperiment::m_Application
private
QxrdCalibrantDSpacingsPtr QxrdExperiment::m_CalibrantDSpacings
private

Definition at line 163 of file qxrdexperiment.h.

Referenced by calibrantDSpacings(), and initialize().

QxrdCalibrantDSpacingsModelPtr QxrdExperiment::m_CalibrantDSpacingsModel
private

Definition at line 164 of file qxrdexperiment.h.

Referenced by calibrantDSpacingsModel(), and initialize().

QxrdCalibrantLibraryPtr QxrdExperiment::m_CalibrantLibrary
private

Definition at line 161 of file qxrdexperiment.h.

Referenced by calibrantLibrary(), initialize(), readSettings(), and writeSettings().

QxrdCalibrantLibraryModelPtr QxrdExperiment::m_CalibrantLibraryModel
private

Definition at line 162 of file qxrdexperiment.h.

Referenced by calibrantLibraryModel(), and initialize().

QxrdDataProcessorPtr QxrdExperiment::m_DataProcessor
private
QcepDatasetPtr QxrdExperiment::m_Dataset
private

Definition at line 175 of file qxrdexperiment.h.

Referenced by initialize().

QcepDatasetModelPtr QxrdExperiment::m_DatasetModel
private

Definition at line 176 of file qxrdexperiment.h.

Referenced by dataset(), and initialize().

QxrdDetectorWPtr QxrdExperiment::m_Detector
private

Definition at line 167 of file qxrdexperiment.h.

QxrdDetectorThreadPtr QxrdExperiment::m_DetectorThread
private

Definition at line 166 of file qxrdexperiment.h.

QMutex QxrdExperiment::m_ExperimentFileMutex
private

Definition at line 183 of file qxrdexperiment.h.

Referenced by readSettings(), and writeSettings().

QxrdExperimentThreadWPtr QxrdExperiment::m_ExperimentThread
private

Definition at line 149 of file qxrdexperiment.h.

Referenced by experimentThread().

QxrdFileSaverWPtr QxrdExperiment::m_FileSaver
private

Definition at line 169 of file qxrdexperiment.h.

Referenced by fileSaver(), and initialize().

QxrdFileSaverThreadPtr QxrdExperiment::m_FileSaverThread
private

Definition at line 168 of file qxrdexperiment.h.

Referenced by initialize().

FILE* QxrdExperiment::m_LogFile
mutableprivate
QMutex QxrdExperiment::m_LogFileMutex
mutableprivate
QMutex QxrdExperiment::m_Mutex
private

Definition at line 152 of file qxrdexperiment.h.

Referenced by readSettings().

FILE* QxrdExperiment::m_ScanFile
private

Definition at line 181 of file qxrdexperiment.h.

Referenced by closeScanFile(), newScanFile(), openScanFile(), and scanFile().

QMutex QxrdExperiment::m_ScanFileMutex
private

Definition at line 180 of file qxrdexperiment.h.

Referenced by closeScanFile(), newScanFile(), and openScanFile().

QxrdScriptEnginePtr QxrdExperiment::m_ScriptEngine
private
QScriptEngineDebugger* QxrdExperiment::m_ScriptEngineDebugger
private

Definition at line 173 of file qxrdexperiment.h.

QxrdServerWPtr QxrdExperiment::m_Server
private

Definition at line 157 of file qxrdexperiment.h.

Referenced by initialize(), readSettings(), specServer(), and writeSettings().

QxrdServerThreadPtr QxrdExperiment::m_ServerThread
private

Definition at line 156 of file qxrdexperiment.h.

Referenced by initialize(), and specServerThread().

QxrdSimpleServerWPtr QxrdExperiment::m_SimpleServer
private

Definition at line 159 of file qxrdexperiment.h.

Referenced by initialize(), readSettings(), simpleServer(), and writeSettings().

QxrdSimpleServerThreadPtr QxrdExperiment::m_SimpleServerThread
private

Definition at line 158 of file qxrdexperiment.h.

Referenced by initialize(), and simpleServerThread().

QxrdWindowPtr QxrdExperiment::m_Window
private
QxrdWindowSettingsPtr QxrdExperiment::m_WindowSettings
private

Definition at line 153 of file qxrdexperiment.h.

Referenced by initialize(), openWindows(), readSettings(), and writeSettings().

Property Documentation

int QxrdExperiment::completionPercentage
readwrite

Definition at line 210 of file qxrdexperiment.h.

QString QxrdExperiment::dataDirectory
readwrite

Definition at line 186 of file qxrdexperiment.h.

int QxrdExperiment::defaultLayout
readwrite

Definition at line 201 of file qxrdexperiment.h.

QString QxrdExperiment::defaultScript
readwrite

Definition at line 213 of file qxrdexperiment.h.

QStringList QxrdExperiment::extraScriptFiles
readwrite

Definition at line 216 of file qxrdexperiment.h.

int QxrdExperiment::fontSize
readwrite

Definition at line 219 of file qxrdexperiment.h.

QString QxrdExperiment::logFileName
readwrite

Definition at line 189 of file qxrdexperiment.h.

int QxrdExperiment::scanDataNegative
readwrite

Definition at line 198 of file qxrdexperiment.h.

QString QxrdExperiment::scanFileExtension
readwrite

Definition at line 195 of file qxrdexperiment.h.

QString QxrdExperiment::scanFileName
readwrite

Definition at line 192 of file qxrdexperiment.h.

int QxrdExperiment::spacing
readwrite

Definition at line 222 of file qxrdexperiment.h.

int QxrdExperiment::workCompleted
readwrite

Definition at line 204 of file qxrdexperiment.h.

int QxrdExperiment::workTarget
readwrite

Definition at line 207 of file qxrdexperiment.h.


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