4 #include "ui_qxrddetectorconfigurationdialog.h"
13 #include <QGridLayout>
14 #include <QSignalMapper>
15 #include <QPushButton>
16 #include <QFileDialog>
30 int detNum =
m_Proxy->property(
"detectorNumber").toInt();
32 setWindowTitle(tr(
"Configure Det %1: %2 \"%3\" ")
33 .arg(detNum).arg(
m_Proxy->detectorTypeName()).arg(
m_Proxy->detectorName()));
35 m_Proxy->pushPropertiesToDialog(
this);
45 QDialog::changeEvent(e);
47 case QEvent::LanguageChange:
58 m_Proxy->pullPropertiesFromDialog(
this);
69 QLabel *propertyLabel =
new QLabel();
71 propertyLabel -> setText(description);
73 QWidget *propertyEditor = NULL;
74 QWidget *button = NULL;
77 propertyEditor =
new QLabel(value.toString());
82 propertyEditor =
new QLineEdit(value.toString());
85 QCheckBox *cb =
new QCheckBox();
86 cb->setCheckable(
true);
87 cb->setChecked(value.toBool());
92 propertyEditor =
new QLabel(value.toString());
95 QLineEdit *le =
new QLineEdit(value.toString());
96 QPushButton *pb =
new QPushButton(
"Browse");
98 QSignalMapper *mapper =
new QSignalMapper(pb);
100 connect(pb, &QPushButton::clicked, mapper, (
void (QSignalMapper::*)()) &QSignalMapper::map);
102 connect(mapper, (
void (QSignalMapper::*)(
int)) &QSignalMapper::mapped,
109 QLineEdit *le =
new QLineEdit(value.toString());
110 QPushButton *pb =
new QPushButton(
"Browse");
112 QSignalMapper *mapper =
new QSignalMapper(pb);
114 connect(pb, &QPushButton::clicked, mapper, (
void (QSignalMapper::*)()) &QSignalMapper::map);
116 connect(mapper, (
void (QSignalMapper::*)(
int)) &QSignalMapper::mapped,
123 QComboBox *cb =
new QComboBox();
124 cb -> addItem(
"tiff");
125 cb -> addItem(
"cbf");
126 cb -> setCurrentText(value.toString());
131 QSpinBox *sb =
new QSpinBox();
132 sb -> setMinimum(-1);
133 sb -> setMaximum(64);
134 sb -> setValue(value.toInt());
139 QComboBox *cb =
new QComboBox();
142 cb -> setCurrentIndex(value.toInt());
147 QComboBox *cb =
new QComboBox();
150 cb -> setCurrentIndex(value.toInt());
155 QComboBox *cb =
new QComboBox();
158 cb -> setCurrentIndex(value.toInt());
163 QSpinBox *sb =
new QSpinBox();
164 sb -> setMinimum(-100000);
165 sb -> setMaximum(+100000);
166 sb -> setValue(value.toInt());
171 QDoubleSpinBox *sb =
new QDoubleSpinBox();
172 sb -> setMinimum(-100000);
173 sb -> setMaximum(+100000);
174 sb -> setValue(value.toDouble());
179 QComboBox *cb =
new QComboBox();
180 cb -> addItem(
"Internal Triggering");
181 cb -> addItem(
"External Trigger");
182 cb -> addItem(
"External Enable");
183 cb -> setCurrentIndex(value.toInt());
188 printf(
"Unknown property type\n");
191 if (propertyEditor) {
192 m_DetectorConfigGrid->addWidget(propertyLabel,
m_CurrentRow, 0);
195 m_DetectorConfigGrid->addWidget(propertyEditor,
m_CurrentRow, 1);
196 m_DetectorConfigGrid->addWidget(button,
m_CurrentRow, 2);
198 m_DetectorConfigGrid->addWidget(propertyEditor,
m_CurrentRow, 1, 1, 2);
211 QLineEdit *le = qobject_cast<QLineEdit*>(w);
217 QCheckBox *cb = qobject_cast<QCheckBox*>(w);
220 return cb->isChecked();
223 QSpinBox *sb = qobject_cast<QSpinBox*>(w);
229 QDoubleSpinBox *ds = qobject_cast<QDoubleSpinBox*>(w);
235 QComboBox *bx = qobject_cast<QComboBox*>(w);
239 return bx->currentText();
241 return bx->currentIndex();
250 QLineEdit *le = qobject_cast<QLineEdit*>(
m_Widgets.value(i));
253 QString newPath = QFileDialog::getExistingDirectory(
this,
"Browse to Directory", le->text());
255 if (newPath.length() > 0) {
256 le->setText(newPath);
263 QLineEdit *le = qobject_cast<QLineEdit*>(
m_Widgets.value(i));
266 QString newPath = QFileDialog::getOpenFileName(
this,
"Browse to File", le->text());
268 if (newPath.length() > 0) {
269 le->setText(newPath);
QSharedPointer< QxrdDetectorProxy > QxrdDetectorProxyPtr
void browseToFilename(int i)
void browseToDirectory(int i)
QxrdDetectorConfigurationDialog(QxrdDetectorProxyPtr proxy, QWidget *parent=0)
void appendProperty(int type, QString name, QString description, QVariant value)
QVariant propertyValue(int propType, int i)
static QStringList binningModeNamesPE()
QxrdDetectorProxyPtr m_Proxy
static QStringList gainModeNamesPE()
void changeEvent(QEvent *e)
virtual ~QxrdDetectorConfigurationDialog()
static QStringList detectorSubTypeNamesPE()
static QString detectorTypeName(int detectorType)
QVector< QWidget * > m_Widgets