|
qavrg 0.0.28
|
#include <qavrgapplication.h>
Public Slots | |
| void | shutdownThreads () |
| void | possiblyQuit () |
| void | printMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) |
| void | loadSettings () |
| void | saveSettings () |
| void | readSettings () |
| void | readSettings (QString filePath) |
| void | writeSettings () |
| void | writeSettings (QString filePath) |
Public Member Functions | |
| QavrgApplication (int &argc, char **argv) | |
| ~QavrgApplication () | |
| QavrgFillPattern * | fillPattern () |
| QcepSettingsSaverWPtr | saver () const |
Private Member Functions | |
| bool | wantToQuit () |
| void | readSettings (QavrgSettings *settings) |
| void | writeSettings (QavrgSettings *settings) |
Private Attributes | |
| QcepSettingsSaverPtr | m_SettingsSaver |
| QavrgWindow * | m_Window |
| QavrgServerThread * | m_ServerThread |
| QavrgServer * | m_Server |
| QavrgSpecServerThread * | m_SpecServerThread |
| QavrgSpecServer * | m_SpecServer |
| QavrgScriptingThread * | m_ScriptingThread |
| QavrgScriptingEngine * | m_ScriptingEngine |
| QavrgAcquisitionThread * | m_AcquisitionThread |
| QavrgAcquisition * | m_Acquisition |
| QavrgEpicsInterface * | m_EpicsInterface |
Definition at line 22 of file qavrgapplication.h.
| QavrgApplication::QavrgApplication | ( | int & | argc, |
| char ** | argv | ||
| ) |
Definition at line 28 of file qavrgapplication.cpp.
References fillPattern(), m_Acquisition, m_AcquisitionThread, m_EpicsInterface, m_ScriptingEngine, m_ScriptingThread, m_Server, m_ServerThread, m_SpecServer, m_SpecServerThread, m_Window, printMessage(), readSettings(), shutdownThreads(), and writeSettings().
: QApplication(argc, argv),
m_SettingsSaver(new QcepSettingsSaver(this)),
m_Window(NULL),
m_ServerThread(NULL),
m_Server(NULL),
m_SpecServerThread(NULL),
m_SpecServer(NULL),
m_ScriptingThread(NULL),
m_ScriptingEngine(NULL),
m_AcquisitionThread(NULL),
m_Acquisition(NULL),
m_EpicsInterface(NULL)
{
QcepProperty::registerMetaTypes();
setObjectName("qavrgapplication");
g_Application = this;
setOrganizationName("bessrc");
setOrganizationDomain("xor.aps.anl.gov");
setApplicationName("qavrg");
m_Window = new QavrgWindow(this);
m_AcquisitionThread = new QavrgAcquisitionThread(this);
m_Acquisition = m_AcquisitionThread -> acquisition();
m_Window -> setAcquisition(m_Acquisition);
connect(m_Acquisition, SIGNAL(noDeviceAvailable()),
m_Window, SLOT(showDeviceError()), Qt::QueuedConnection);
m_AcquisitionThread -> start();
m_ScriptingThread = new QavrgScriptingThread(this, m_Window, m_Acquisition);
m_ScriptingEngine = m_ScriptingThread -> scriptingEngine();
m_Window -> setScriptingEngine(m_ScriptingEngine);
m_ScriptingThread -> start();
connect(this, SIGNAL(aboutToQuit()), this, SLOT(writeSettings()));
connect(this, SIGNAL(aboutToQuit()), this, SLOT(shutdownThreads()));
connect(m_Acquisition, SIGNAL(new_RawData()),
m_Window, SLOT(new_RawData()));
connect(m_Acquisition, SIGNAL(new_ReferenceData()),
m_Window, SLOT(new_ReferenceData()));
connect(m_Acquisition, SIGNAL(new_DarkData()),
m_Window, SLOT(new_DarkData()));
connect(m_Acquisition, SIGNAL(new_FitData()),
m_Window, SLOT(new_FitData()));
connect(m_Window->m_ActionSetReferenceData, SIGNAL(triggered()),
m_Acquisition, SLOT(setReferenceData()));
connect(m_Window->m_ActionSetDarkData, SIGNAL(triggered()),
m_Acquisition, SLOT(setDarkData()));
m_EpicsInterface = new QavrgEpicsInterface(this);
connect(m_EpicsInterface -> fillPattern(), SIGNAL(fillPatternChanged()),
m_Acquisition, SLOT(fillPatternChanged()));
QavrgResultsModel *model = new QavrgResultsModel(m_Acquisition);
m_Window->m_FitResultsTable -> setModel(model);
connect(m_Acquisition, SIGNAL(new_FittingResults()),
model, SLOT(new_FittingResults()));
m_ServerThread = new QavrgServerThread();
m_Server = m_ServerThread -> server();
m_SpecServerThread = new QavrgSpecServerThread(m_Acquisition);
m_SpecServer = m_SpecServerThread -> server();
connect(m_Window, SIGNAL(executeCommand(QString)), m_ScriptingEngine, SLOT(evaluateAppCommand(QString)));
connect(m_ScriptingEngine, SIGNAL(appResultAvailable(QScriptValue)), m_Window, SLOT(finishedCommand(QScriptValue)));
connect(m_Server, SIGNAL(executeCommand(QString)), m_ScriptingEngine, SLOT(evaluateServerCommand(QString)));
connect(m_ScriptingEngine, SIGNAL(serverResultAvailable(QScriptValue)), m_Server, SLOT(finishedCommand(QScriptValue)));
connect(m_SpecServer, SIGNAL(executeCommand(QString)), m_ScriptingEngine, SLOT(evaluateSpecCommand(QString)));
connect(m_ScriptingEngine, SIGNAL(specResultAvailable(QScriptValue)), m_SpecServer, SLOT(finishedCommand(QScriptValue)));
connect(m_Server, SIGNAL(printMessage(QString)), m_Window, SLOT(printMessage(QString)));
connect(m_ServerThread, SIGNAL(printMessage(QString)), m_Window, SLOT(printMessage(QString)));
connect(m_SpecServer, SIGNAL(printMessage(QString)), m_Window, SLOT(printMessage(QString)));
connect(m_SpecServerThread, SIGNAL(printMessage(QString)), m_Window, SLOT(printMessage(QString)));
connect(m_Acquisition, SIGNAL(printMessage(QString)), m_Window, SLOT(printMessage(QString)));
connect(m_Acquisition, SIGNAL(warningMessage(QString)), m_Window, SLOT(warningMessage(QString)));
connect(m_AcquisitionThread, SIGNAL(printMessage(QString)), m_Window, SLOT(printMessage(QString)));
connect(m_ScriptingEngine, SIGNAL(printMessage(QString)), m_Window, SLOT(printMessage(QString)));
connect(m_ScriptingThread, SIGNAL(printMessage(QString)), m_Window, SLOT(printMessage(QString)));
m_ServerThread -> start();
m_SpecServerThread -> start();
readSettings();
m_Window -> show();
m_Window -> updateGraph();
}
| QavrgApplication::~QavrgApplication | ( | ) |
Definition at line 135 of file qavrgapplication.cpp.
References m_AcquisitionThread, m_EpicsInterface, m_ScriptingThread, and m_ServerThread.
{
delete m_ScriptingThread;
delete m_AcquisitionThread;
delete m_ServerThread;
delete m_EpicsInterface;
}
| QavrgFillPattern * QavrgApplication::fillPattern | ( | ) |
Definition at line 170 of file qavrgapplication.cpp.
References QavrgEpicsInterface::fillPattern(), and m_EpicsInterface.
Referenced by QavrgApplication().
{
if (m_EpicsInterface) {
return m_EpicsInterface->fillPattern();
} else {
return NULL;
}
}
| void QavrgApplication::loadSettings | ( | ) | [slot] |
Definition at line 179 of file qavrgapplication.cpp.
References m_Window, and readSettings().
{
QString loadName = QFileDialog::getOpenFileName(m_Window, tr("Load Settings"));
if (!loadName.isNull()) {
readSettings(loadName);
}
}
| void QavrgApplication::possiblyQuit | ( | ) | [slot] |
Definition at line 143 of file qavrgapplication.cpp.
References wantToQuit().
{
if (wantToQuit()) {
quit();
}
}
| void QavrgApplication::printMessage | ( | QString | msg, |
| QDateTime | ts = QDateTime::currentDateTime() |
||
| ) | [slot] |
Definition at line 165 of file qavrgapplication.cpp.
Referenced by QavrgApplication().
{
printf("%s\n", qPrintable(msg));
}
| void QavrgApplication::readSettings | ( | QString | filePath | ) | [slot] |
Definition at line 206 of file qavrgapplication.cpp.
References m_Acquisition, m_Window, and readSettings().
{
QavrgSettings settings(filePath);
this -> readSettings(&settings);
m_Window -> readSettings(&settings);
m_Acquisition -> readSettings(&settings);
}
| void QavrgApplication::readSettings | ( | QavrgSettings * | settings | ) | [private] |
Definition at line 238 of file qavrgapplication.cpp.
References readSettings().
{
QcepProperty::readSettings(this, &staticMetaObject, "application", settings);
}
| void QavrgApplication::readSettings | ( | ) | [slot] |
Definition at line 197 of file qavrgapplication.cpp.
References m_Acquisition, and m_Window.
Referenced by loadSettings(), QavrgApplication(), and readSettings().
{
QavrgSettings settings;
this -> readSettings(&settings);
m_Window -> readSettings(&settings);
m_Acquisition -> readSettings(&settings);
}
| QcepSettingsSaverWPtr QavrgApplication::saver | ( | ) | const |
Definition at line 233 of file qavrgapplication.cpp.
References m_SettingsSaver.
Referenced by QavrgAcquisition::saver().
{
return m_SettingsSaver;
}
| void QavrgApplication::saveSettings | ( | ) | [slot] |
Definition at line 188 of file qavrgapplication.cpp.
References m_Window, and writeSettings().
{
QString saveName = QFileDialog::getSaveFileName(m_Window, tr("Save Settings"));
if (!saveName.isNull()) {
writeSettings(saveName);
}
}
| void QavrgApplication::shutdownThreads | ( | ) | [slot] |
Definition at line 157 of file qavrgapplication.cpp.
References m_AcquisitionThread, m_EpicsInterface, m_ScriptingThread, and m_ServerThread.
Referenced by QavrgApplication().
{
m_AcquisitionThread -> shutdown();
m_ServerThread -> shutdown();
m_EpicsInterface -> shutdown();
m_ScriptingThread -> shutdown();
}
| bool QavrgApplication::wantToQuit | ( | ) | [private] |
Definition at line 150 of file qavrgapplication.cpp.
References m_Window.
Referenced by possiblyQuit().
{
return QMessageBox::question(m_Window, tr("Really Quit?"),
tr("Do you really want to exit the application?"),
QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok;
}
| void QavrgApplication::writeSettings | ( | ) | [slot] |
Definition at line 215 of file qavrgapplication.cpp.
References m_Acquisition, and m_Window.
Referenced by QavrgApplication(), saveSettings(), and writeSettings().
{
QavrgSettings settings;
this -> writeSettings(&settings);
m_Window -> writeSettings(&settings);
m_Acquisition -> writeSettings(&settings);
}
| void QavrgApplication::writeSettings | ( | QString | filePath | ) | [slot] |
Definition at line 224 of file qavrgapplication.cpp.
References m_Acquisition, m_Window, and writeSettings().
{
QavrgSettings settings(filePath);
this -> writeSettings(&settings);
m_Window -> writeSettings(&settings);
m_Acquisition -> writeSettings(&settings);
}
| void QavrgApplication::writeSettings | ( | QavrgSettings * | settings | ) | [private] |
Definition at line 243 of file qavrgapplication.cpp.
References writeSettings().
{
QcepProperty::writeSettings(this, &staticMetaObject, "application", settings);
}
QavrgAcquisition* QavrgApplication::m_Acquisition [private] |
Definition at line 64 of file qavrgapplication.h.
Referenced by QavrgApplication(), readSettings(), and writeSettings().
Definition at line 63 of file qavrgapplication.h.
Referenced by QavrgApplication(), shutdownThreads(), and ~QavrgApplication().
Definition at line 65 of file qavrgapplication.h.
Referenced by fillPattern(), QavrgApplication(), shutdownThreads(), and ~QavrgApplication().
Definition at line 62 of file qavrgapplication.h.
Referenced by QavrgApplication().
Definition at line 61 of file qavrgapplication.h.
Referenced by QavrgApplication(), shutdownThreads(), and ~QavrgApplication().
QavrgServer* QavrgApplication::m_Server [private] |
Definition at line 58 of file qavrgapplication.h.
Referenced by QavrgApplication().
Definition at line 57 of file qavrgapplication.h.
Referenced by QavrgApplication(), shutdownThreads(), and ~QavrgApplication().
QcepSettingsSaverPtr QavrgApplication::m_SettingsSaver [private] |
Definition at line 55 of file qavrgapplication.h.
Referenced by saver().
QavrgSpecServer* QavrgApplication::m_SpecServer [private] |
Definition at line 60 of file qavrgapplication.h.
Referenced by QavrgApplication().
Definition at line 59 of file qavrgapplication.h.
Referenced by QavrgApplication().
QavrgWindow* QavrgApplication::m_Window [private] |
Definition at line 56 of file qavrgapplication.h.
Referenced by loadSettings(), QavrgApplication(), readSettings(), saveSettings(), wantToQuit(), and writeSettings().
1.7.4