2#include "ui_dc1394slider.h"
27 int value = ui->m_Slider->value();
28 double val = (double)value/1000;
29 int w = ui->m_Slider->width() - 30;
30 double newX = ((double)w/(
double)1000) * (
double)value;
31 ui->lblValue->setGeometry(newX,0,30,20);
32 ui->lblValue->setText(QString(
"%L1").arg(val,0,
'f',3));
37 QWidget::resizeEvent(event);
45 this->controlThread = controlThread;
47 connect(controlThread,SIGNAL(sliderHasFeatureDone(QObject*,
bool)),
48 this,SLOT(onHasFeatureDone(QObject*,
bool)),Qt::QueuedConnection);
50 connect(controlThread,SIGNAL(sliderRefreshDone(QObject*,
bool,
bool,
bool,
bool,
bool,
bool,
double)),
51 this,SLOT(onRefreshDone(QObject*,
bool,
bool,
bool,
bool,
bool,
bool,
double)),Qt::QueuedConnection);
53 connect(controlThread,SIGNAL(sliderSetFeatureDC1394Done(QObject*,
double)),
54 this,SLOT(onSliderSetFeatureDone(QObject*,
double)),Qt::QueuedConnection);
56 connect(controlThread,SIGNAL(sliderRadioAutoDone(QObject*,
bool,
bool)),
57 this,SLOT(onRadioAutoDone(QObject*,
bool,
bool)),Qt::QueuedConnection);
59 connect(controlThread,SIGNAL(sliderPowerDone(QObject*,
bool,
bool,
bool,
bool)),
60 this,SLOT(onPowerDone(QObject*,
bool,
bool,
bool,
bool)),Qt::QueuedConnection);
62 connect(controlThread,SIGNAL(sliderOnePushDone(QObject*,
double)),
63 this,SLOT(onOnePushDone(QObject*,
double)),Qt::QueuedConnection);
68 ui->label->setTitle(
m_Name);
73 list.append(qVariantFromValue((
void*)
this));
80void DC1394Slider::onHasFeatureDone(QObject *slider,
bool hasFeature)
98void DC1394Slider::connectWidgets()
100 connect(ui->m_Slider,SIGNAL(valueChanged(
int)),
this,SLOT(onSliderValueChanged(
int)));
101 connect(ui->m_Slider,SIGNAL(sliderPressed()),
this,SLOT(onSliderPressed()));
102 connect(ui->m_Slider,SIGNAL(sliderReleased()),
this,SLOT(onSliderReleased()));
104 connect(ui->m_OnePush,SIGNAL(clicked()),
this,SLOT(onOnePushClicked()));
105 connect(ui->pRBa,SIGNAL(toggled(
bool)),
this,SLOT(onRadioAuto(
bool)));
107 connect(ui->pPwr,SIGNAL(toggled(
bool)),
this,SLOT(onPower(
bool)));
110void DC1394Slider::disconnectWidgets()
112 disconnect(ui->m_Slider,SIGNAL(valueChanged(
int)),
this,SLOT(onSliderValueChanged(
int)));
113 disconnect(ui->m_Slider,SIGNAL(sliderPressed()),
this,SLOT(onSliderPressed()));
114 disconnect(ui->m_Slider,SIGNAL(sliderReleased()),
this,SLOT(onSliderReleased()));
115 disconnect(ui->m_OnePush,SIGNAL(clicked()),
this,SLOT(onOnePushClicked()));
116 disconnect(ui->pRBa,SIGNAL(toggled(
bool)),
this,SLOT(onRadioAuto(
bool)));
118 disconnect(ui->pPwr,SIGNAL(toggled(
bool)),
this,SLOT(onPower(
bool)));
130 list.append(qVariantFromValue((
void*)
this));
131 list.append(QVariant(
f));
135void DC1394Slider::onRefreshDone(QObject *slider,
bool bON,
bool bAuto,
bool bHasOnOff,
bool bHasAuto,
bool bHasManual,
bool bHasOnePush,
double val)
142 ui->pPwr->setChecked(bON);
143 ui->pPwr->setEnabled(bHasOnOff || bON);
144 ui->pRBa->setEnabled(bON && bHasAuto);
145 ui->pRBm->setEnabled(bON && bHasManual);
147 ui->m_Slider->setEnabled(bHasManual && !bAuto);
148 ui->lblValue->setEnabled(bHasManual && !bAuto);
149 ui->m_OnePush->setEnabled(bON && bHasOnePush);
152 ui->pRBa->setChecked(
true);
154 ui->pRBm->setChecked(
true);
160 ui->m_Slider->update();
175 list.append(QVariant((
double)ui->m_Slider->value() / 1000));
176 list.append(QVariant(ui->pRBa->isChecked()));
177 list.append(QVariant(ui->pPwr->isChecked()));
182void DC1394Slider::onSliderPressed()
187void DC1394Slider::onSliderReleased()
191 double val = (double)ui->m_Slider->value()/1000;
194 list.append(qVariantFromValue((
void*)
this));
196 list.append(QVariant(val));
200void DC1394Slider::onSliderValueChanged(
int value)
202 double val = (double)value/1000;
203 int w = ui->m_Slider->width() - 30;
204 double newX = ((double)w/(
double)1000) * (
double)value;
205 ui->lblValue->setGeometry(newX,0,30,20);
206 ui->lblValue->setText(QString(
"%L1").arg(val,0,
'f',3));
209void DC1394Slider::onSliderSetFeatureDone(QObject *slider,
double val)
214 LOG(
"%s new value %lf\n",
m_Name.toLatin1().data(),val);
217void DC1394Slider::onOnePushClicked()
221 list.append(qVariantFromValue((
void*)
this));
226void DC1394Slider::onOnePushDone(QObject *slider,
double val)
243void DC1394Slider::onRadioAuto(
bool toggled)
248 list.append(qVariantFromValue((
void*)
this));
250 list.append(QVariant(bAuto));
254void DC1394Slider::onRadioAutoDone(QObject *slider,
bool bON,
bool bAuto)
260 ui->m_Slider->setEnabled(bON && !bAuto);
261 ui->lblValue->setEnabled(bON && !bAuto);
262 LOG(
"%s\n",ui->pRBa->isChecked() ?
"auto":
"man");
267void DC1394Slider::onPower(
bool checked)
272 list.append(qVariantFromValue((
void*)
this));
274 list.append(QVariant(bON));
278void DC1394Slider::onPowerDone(QObject *slider,
bool bON,
bool hasAuto,
bool hasManual,
bool hasOnePush)
284 ui->pRBa->setEnabled(bON && hasAuto);
285 ui->pRBm->setEnabled(bON && hasManual);
286 ui->m_Slider->setEnabled(bON && ui->pRBm->isChecked());
287 ui->lblValue->setEnabled(bON && ui->pRBm->isChecked());
288 ui->m_OnePush->setEnabled(bON && hasOnePush);
289 LOG(
"power %s\n",ui->pPwr->isChecked()?
"on":
"off");
296 ui->m_Slider->setValue(val * 1000);
297 onSliderValueChanged(val * 1000);
void featureDisabled(QObject *)
DC1394Slider(QWidget *parent=0)
void set_value(double val)
void resizeEvent(QResizeEvent *event)
bool init(cameraFeature_id_t feature, char *label, DC1394Thread *controlThread)
cameraFeature_id_t m_Feature
void doTask(threadFunction)