cctw  0.2.1
Public Slots | Public Member Functions | Properties | Private Attributes | List of all members
CctwObject Class Reference

#include <cctwobject.h>

Inheritance diagram for CctwObject:
Inheritance graph
Collaboration diagram for CctwObject:
Collaboration graph

Public Slots

virtual void printLine (QString line)
 
virtual void printMessage (QString msg, QDateTime dt=QDateTime::currentDateTime())
 
virtual QString settingsScript ()
 
QString scriptValueLiteral (QVariant v)
 

Public Member Functions

 CctwObject (QString name, QObject *parent=0)
 
virtual void writeSettings (QSettings *set, QString section)
 
virtual void readSettings (QSettings *set, QString section)
 

Properties

QString name
 

Private Attributes

QcepObjectNamer m_ObjectNamer
 

Detailed Description

Definition at line 9 of file cctwobject.h.

Constructor & Destructor Documentation

CctwObject::CctwObject ( QString  name,
QObject *  parent = 0 
)
explicit

Definition at line 7 of file cctwobject.cpp.

7  :
8  QObject(parent),
9  m_ObjectNamer(this, name),
10  m_Name(QcepSettingsSaverWPtr(), this, "name", name, "Object Name")
11 {
12 }
QString name
Definition: cctwobject.h:32
QcepObjectNamer m_ObjectNamer
Definition: cctwobject.h:29

Member Function Documentation

void CctwObject::printLine ( QString  line)
virtualslot

Definition at line 14 of file cctwobject.cpp.

Referenced by CctwPEIngressCommand::analyzeSpecDataFile(), and CctwImporter::checkImportedDataApproximately().

15 {
16 #ifdef NO_GUI
17  printf("%s\n", qPrintable(line));
18 #else
19  if (parent()) {
20  QMetaObject::invokeMethod( parent(), "printLine", Q_ARG(QString, line));
21  }
22 #endif
23 }
void CctwObject::printMessage ( QString  msg,
QDateTime  dt = QDateTime::currentDateTime() 
)
virtualslot

Definition at line 25 of file cctwobject.cpp.

Referenced by CctwPEIngressCommand::analyzeSpecDataFile(), CctwDataChunk::calculateChunkSize(), CctwDataChunk::calculateChunkStart(), CctwqtTransformTester::CctwqtTransformTester(), CctwImporter::checkImportedData(), CctwImporter::checkImportedDataApproximately(), CctwImporter::checkImportedDataRigorously(), CctwTransformer::checkTransform(), CctwChunkedData::chunk(), CctwChunkedData::closeAnglesFile(), CctwChunkedData::closeInputFile(), CctwChunkedData::closeInputNeXusFile(), CctwChunkedData::closeMaskFile(), CctwImporter::closeOutputFile(), CctwChunkedData::closeOutputFile(), CctwChunkedData::closeWeightsFile(), CctwComparer::compareDatasets(), CctwComparer::compareDatasetsApproximately(), CctwComparer::compareDatasetsRigorously(), CctwImporter::createOutputFile(), CctwChunkedData::flushOutputFile(), CctwImporter::importData(), CctwImporter::importDataFrame(), CctwImporter::loadDarkImage(), CctwDataChunk::mergeChunk(), CctwDataChunk::mergeData(), CctwDataChunk::normalizeChunk(), CctwChunkedData::openAnglesFile(), CctwInputDataH5::openInputFile(), CctwChunkedData::openInputFile(), CctwChunkedData::openInputNeXusFile(), CctwChunkedData::openMaskFile(), CctwChunkedData::openOutputFile(), CctwChunkedData::openWeightsFile(), CctwImporter::outputDataFromBuffer(), CctwqtTransformTester::parametersChanged(), CctwCrystalCoordinateParameters::parseAngleArgument(), CctwTransformer::parseSubset(), CctwChunkedData::readAnglesFile(), CctwInputDataH5::readChunk(), CctwChunkedData::readChunk(), CctwInputDataH5::readData(), CctwImporter::readDataFrameToBuffer(), CctwChunkedData::readMaskFile(), CctwChunkedData::readWeightsFile(), CctwDataChunk::reportDependencies(), CctwChunkedData::setAnglesSource(), CctwDataChunk::setBuffer(), CctwChunkedData::setChunks(), CctwChunkedData::setChunkSize(), CctwChunkedData::setDataSource(), CctwChunkedData::setDimensions(), CctwChunkedData::setDims(), CctwChunkedData::setMaskSource(), CctwChunkedData::setWeightsSource(), CctwTransformer::simpleTransform(), CctwChunkedData::sizingChanged(), CctwTransformer::transform(), CctwTransformer::transformChunkData(), CctwTransformer::transformChunkNumber(), CctwChunkedData::writeChunk(), CctwImporter::writeOutputFrame(), and CctwDataChunk::~CctwDataChunk().

26 {
27 #ifdef NO_GUI
28  printf("%s\n", qPrintable(msg));
29 #else
30  if (parent()) {
31  QMetaObject::invokeMethod( parent(), "printMessage", Q_ARG(QString, msg), Q_ARG(QDateTime, dt));
32  } else {
33  printf("MESSAGE: %s %s\n",
34  qPrintable(dt.toString("hh:mm:ss")), qPrintable(msg));
35  }
36 #endif
37 }
void CctwObject::readSettings ( QSettings *  set,
QString  section 
)
virtual

Reimplemented in CctwTransformer.

Definition at line 52 of file cctwobject.cpp.

Referenced by CctwTransformer::readSettings(), and CctwApplication::readSettings().

53 {
54  QcepProperty::readSettings(this, metaObject(), section, set);
55 }
QString CctwObject::scriptValueLiteral ( QVariant  v)
slot

Definition at line 57 of file cctwobject.cpp.

References CctwUnitCell::a(), CctwApplication::addSlashes(), CctwUnitCell::alpha(), CctwUnitCell::b(), CctwUnitCell::beta(), CctwUnitCell::c(), CctwUnitCell::gamma(), CctwVector3D< T >::x(), CctwVector3D< T >::y(), and CctwVector3D< T >::z().

Referenced by settingsScript().

58 {
59  if (v.canConvert<CctwIntVector3D>()) {
60  CctwIntVector3D dv = v.value<CctwIntVector3D>();
61  return tr("[%1,%2,%3]").arg(dv.x()).arg(dv.y()).arg(dv.z());
62  } else if (v.canConvert<CctwDoubleVector3D>()) {
63  CctwDoubleVector3D dv = v.value<CctwDoubleVector3D>();
64  return tr("[%1,%2,%3]").arg(dv.x()).arg(dv.y()).arg(dv.z());
65  } else if (v.canConvert<CctwDoubleMatrix3x3>()) {
67  return tr("[ [%1,%2,%3], [%4,%5,%6], [%7,%8,%9] ]")
68  .arg(m(0,0)).arg(m(0,1)).arg(m(0,2))
69  .arg(m(1,0)).arg(m(1,1)).arg(m(1,2))
70  .arg(m(2,0)).arg(m(2,1)).arg(m(2,2));
71  } else if (v.canConvert<CctwUnitCell>()) {
72  CctwUnitCell u = v.value<CctwUnitCell>();
73  return tr("[%1,%2,%3, %4,%5,%6]")
74  .arg(u.a()).arg(u.b()).arg(u.c())
75  .arg(u.alpha()).arg(u.beta()).arg(u.gamma());
76  } else if (v.type() == QMetaType::QString) {
77  return "\"" + CctwApplication::addSlashes(v.toString()) + "\"";
78  } else {
79  return v.toString();
80  }
81 }
static QString addSlashes(QString str)
double beta() const
double b() const
double a() const
double alpha() const
T x() const
Definition: cctwvector3d.h:17
T z() const
Definition: cctwvector3d.h:19
double gamma() const
double c() const
T y() const
Definition: cctwvector3d.h:18
QString CctwObject::settingsScript ( )
virtualslot

Definition at line 83 of file cctwobject.cpp.

References scriptValueLiteral().

Referenced by CctwApplication::settingsScript().

84 {
85  QString res = "";
86  const QMetaObject* metaObject = this->metaObject();
87 
88  for (int i=1; i < metaObject->propertyCount(); i++) {
89  QMetaProperty prop = metaObject->property(i);
90 
91  if (prop.isStored()) {
92  res += tr("%1.%2 = %3;\n").arg(this->get_Name())
93  .arg(prop.name())
94  .arg(scriptValueLiteral(this->property(prop.name())));
95  }
96  }
97 
98  return res;
99 }
QString scriptValueLiteral(QVariant v)
Definition: cctwobject.cpp:57
void CctwObject::writeSettings ( QSettings *  set,
QString  section 
)
virtual

Reimplemented in CctwTransformer.

Definition at line 39 of file cctwobject.cpp.

Referenced by CctwTransformer::writeSettings(), and CctwApplication::writeSettings().

40 {
41  const QMetaObject *meta = metaObject();
42 
43  while (meta) {
44  QcepProperty::writeSettings(this, meta, section, set);
45 
46  meta = meta->superClass();
47 
48  if (meta == &QObject::staticMetaObject) break;
49  }
50 }

Member Data Documentation

QcepObjectNamer CctwObject::m_ObjectNamer
private

Definition at line 29 of file cctwobject.h.

Property Documentation

QString CctwObject::name
readwrite

Definition at line 32 of file cctwobject.h.


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