iCub-main
mainwindow.cpp
Go to the documentation of this file.
1 #include "mainwindow.h"
2 #include "ui_mainwindow.h"
3 #include <QDebug>
4 #include "log.h"
5 #include "dc1394slider.h"
6 #include "dc1394sliderwb.h"
7 #include <iostream>
8 
9 static QStringList video_mode_labels;
10 static QStringList video_rate_labels;
11 static QStringList color_coding_labels;
12 static QStringList iso_speed_labels;
13 static QStringList op_mode_labels;
14 
15 MainWindow::MainWindow(char *loc, char *rem, QWidget *parent) :
16  QMainWindow(parent),
17  loadingWidget(this),
18  dc1394Thread(loc,rem),
19  ui(new Ui::MainWindow)
20 {
21  ui->setupUi(this);
22 
23 // ui->tabWidget->setTabEnabled(ui->tabWidget->indexOf(ui->tabCamera), false);
24 
25  initMainWindow();
28  dc1394Thread.doTask(_initFormatTab);
29 
30  dc1394Thread.doTask(_init);
31  dc1394Thread.doTask(_reload);
32 
33  connect(ui->tabWidget,SIGNAL(currentChanged(int)),
34  this,SLOT(onTabClicked(int)));
35 
36 }
37 
39 {
40  disconnectWidgets();
41  dc1394Thread.stop();
42 
43  delete ui;
44 }
45 
46 void MainWindow::onTabClicked(int index)
47 {
48  if(index == 0 || index == 1){
49  for(int i=0;i<m_pSli.count();i++){
50  ((DC1394SliderBase*)m_pSli.at(i))->updateSliders();
51  }
52  }
53 }
54 
55 void MainWindow::initMainWindow()
56 {
57  setWindowTitle("Grabber Remote GUI");
58 
60  "160x120 YUV444" <<
61  "320x240 YUV422" <<
62  "640x480 YUV411" <<
63  "640x480 YUV422" <<
64  "640x480 RGB8" <<
65  "640x480 MONO8" <<
66  "640x480 MONO16" <<
67  "800x600 YUV422" <<
68  "800x600 RGB8" <<
69  "800x600_MONO8" <<
70  "1024x768 YUV422" <<
71  "1024x768 RGB8" <<
72  "1024x768 MONO8" <<
73  "800x600 MONO16" <<
74  "1024x768 MONO16" <<
75  "1280x960 YUV422" <<
76  "1280x960 RGB8" <<
77  "1280x960_MONO8" <<
78  "1600x1200 YUV422" <<
79  "1600x1200 RGB8" <<
80  "1600x1200 MONO8" <<
81  "1280x960 MONO16" <<
82  "1600x1200_MONO16" <<
83  "EXIF" <<
84  "FORMAT7 0" <<
85  "FORMAT7 1" <<
86  "FORMAT7 2" <<
87  "FORMAT7 3" <<
88  "FORMAT7 4" <<
89  "FORMAT7 5" <<
90  "FORMAT7 6" <<
91  "FORMAT7 7";
92 
93  video_rate_labels << "1.875 fps" << "3.75 fps" << "7.5 fps" << "15 fps" << "30 fps" << "60 fps" << "120 fps" <<"240 fps";
94  color_coding_labels << "MONO8" << "YUV411" << "YUV422" << "YUV444" << "RGB8" << "MONO16" << "RGB16" << "MONO16S" << "RGB16S" << "RAW8" << "RAW16";
95  iso_speed_labels << "100 Mbps" << "200 Mbps" << "400 Mbps" << "800 Mbps" << "1600 Mbps" << "3200 Mbps";
96  op_mode_labels << "LEGACY" << "1394b";
97 
98  connect(ui->btnRefresh1,SIGNAL(clicked()),this,SLOT(onReloadClicked()));
99  connect(ui->btnRefresh2,SIGNAL(clicked()),this,SLOT(onReloadClicked()));
100 
101 
102  connect(&dc1394Thread,SIGNAL(initFormatTabDone(uint,uint,uint)),
103  this,SLOT(initFormatTab(uint,uint,uint)),Qt::QueuedConnection);
104  connect(&dc1394Thread,SIGNAL(initDone(uint,uint,uint,bool,uint,QSize,QSize,QSize,QSize,QSize,uint,bool)),
105  this,SLOT(Init(uint,uint,uint,bool,uint,QSize,QSize,QSize,QSize,QSize,uint,bool)),Qt::QueuedConnection);
106  connect(&dc1394Thread,SIGNAL(reloadDone(uint,uint,QSize,QSize,QSize,QSize,QSize,uint,uint,uint,uint,uint)),
107  this,SLOT(Reload(uint,uint,QSize,QSize,QSize,QSize,QSize,uint,uint,uint,uint,uint)),Qt::QueuedConnection);
108  connect(&dc1394Thread,SIGNAL(loadDefaultDone(uint,uint,bool)),
109  this,SLOT(loadDefault(uint,uint,bool)),Qt::QueuedConnection);
110  connect(&dc1394Thread,SIGNAL(resetDone(uint,uint,bool)),
111  this,SLOT(reset(uint,uint,bool)),Qt::QueuedConnection);
112  connect(&dc1394Thread,SIGNAL(setTransmissionDC1394Done()),
113  this,SLOT(onTransmissionOnoffDone()),Qt::QueuedConnection);
114  connect(&dc1394Thread,SIGNAL(setPowerDC1394Done()),
115  this,SLOT(onPowerOnoffDone()),Qt::QueuedConnection);
116  connect(&dc1394Thread,SIGNAL(setFormat7WindowDC1394Done()),
117  this,SLOT(onFormat7WindowDone()),Qt::QueuedConnection);
118  connect(&dc1394Thread,SIGNAL(setVideoModeDC1394Done()),
119  this,SLOT(onVideoFormatCurrentDone()),Qt::QueuedConnection);
120  connect(&dc1394Thread,SIGNAL(setColorCodingDC1394Done()),
121  this,SLOT(onColorCodingDone()),Qt::QueuedConnection);
122  connect(&dc1394Thread,SIGNAL(setFPSDC1394Done()),
123  this,SLOT(onFramerateDone()),Qt::QueuedConnection);
124  connect(&dc1394Thread,SIGNAL(setISOSpeedDC1394Done()),
125  this,SLOT(onISOSpeedDone()),Qt::QueuedConnection);
126  connect(&dc1394Thread,SIGNAL(setBytesPerPacketDC1394Done()),
127  this,SLOT(onSizeByteDone()),Qt::QueuedConnection);
128  connect(&dc1394Thread,SIGNAL(setOperationModeDC1394Done()),
129  this,SLOT(onOpModeDone()),Qt::QueuedConnection);
130 
131  connect(&dc1394Thread,SIGNAL(startLoading()),
132  this,SLOT(onStartLoading()),Qt::QueuedConnection);
133  connect(&dc1394Thread,SIGNAL(stopLoading()),
134  this,SLOT(onStopLoading()),Qt::QueuedConnection);
135 
136  dc1394Thread.start();
137 
138  m_pSli.append(ui->sliderSharpness);
139  m_pSli.append(ui->sliderHue);
140  m_pSli.append(ui->sliderSaturation);
141  m_pSli.append(ui->sliderGamma);
142  m_pSli.append(ui->sliderIris);
143  m_pSli.append(ui->sliderFocus);
144  m_pSli.append(ui->sliderShutter);
145  m_pSli.append(ui->sliderBrightness);
146  m_pSli.append(ui->sliderGain);
147  m_pSli.append(ui->sliderExposure);
148  m_pSli.append(ui->sliderWB);
149 
150  for(int i=0;i<m_pSli.count();i++){
151  connect(((DC1394SliderBase*)m_pSli.at(i)),SIGNAL(featureDisabled(QObject*)),
152  this,SLOT(onSliderDisabled(QObject *)),Qt::QueuedConnection);
153  }
154 }
155 
156 void MainWindow::onReloadClicked()
157 {
158  dc1394Thread.doTask(_reload);
159 }
160 
161 void MainWindow::connectWidgets()
162 {
163  connect(ui->m_MenuMode,SIGNAL(currentIndexChanged(int)),this,SLOT(onVideoFormatCurrentIndexChanged(int)));
164  connect(ui->m_MenuColorCoding,SIGNAL(currentIndexChanged(int)),this,SLOT(onColorCodingCurrentIndexChanged(int)));
165  connect(ui->m_MenuFPS,SIGNAL(currentIndexChanged(int)),this,SLOT(onFramerateCurrentIndexChanged(int)));
166  connect(ui->m_MenuISO,SIGNAL(currentIndexChanged(int)),this,SLOT(onISOSpeedCurrentIndexChanged(int)));
167  connect(ui->m_MenuOpMode,SIGNAL(currentIndexChanged(int)),this,SLOT(onOpModeCurrentIndexChanged(int)));
168  connect(ui->m_bpp,SIGNAL(valueChanged(int)),this,SLOT(onSizeByteValueChanged(int)));
169  connect(ui->m_xdim,SIGNAL(valueChanged(int)),this,SLOT(onFormat7WindowChange(int)));
170  connect(ui->m_ydim,SIGNAL(valueChanged(int)),this,SLOT(onFormat7WindowChange(int)));
171  connect(ui->m_xoff,SIGNAL(valueChanged(int)),this,SLOT(onFormat7WindowChange(int)));
172  connect(ui->m_yoff,SIGNAL(valueChanged(int)),this,SLOT(onFormat7WindowChange(int)));
173  connect(ui->m_power,SIGNAL(toggled(bool)),this,SLOT(onPowerOnoffChange(bool)));
174  connect(ui->m_transmission,SIGNAL(toggled(bool)),this,SLOT(onTransmissionOnoffChange(bool)));
175  connect(ui->m_reset,SIGNAL(clicked()),this,SLOT(onResetChange()));
176  connect(ui->m_defaults,SIGNAL(clicked()),this,SLOT(onLoadDefaultsChange()));
177 
178 }
179 
180 void MainWindow::disconnectWidgets()
181 {
182  disconnect(ui->m_MenuMode,SIGNAL(currentIndexChanged(int)),this,SLOT(onVideoFormatCurrentIndexChanged(int)));
183  disconnect(ui->m_MenuColorCoding,SIGNAL(currentIndexChanged(int)),this,SLOT(onColorCodingCurrentIndexChanged(int)));
184  disconnect(ui->m_MenuFPS,SIGNAL(currentIndexChanged(int)),this,SLOT(onFramerateCurrentIndexChanged(int)));
185  disconnect(ui->m_MenuISO,SIGNAL(currentIndexChanged(int)),this,SLOT(onISOSpeedCurrentIndexChanged(int)));
186  disconnect(ui->m_MenuOpMode,SIGNAL(currentIndexChanged(int)),this,SLOT(onOpModeCurrentIndexChanged(int)));
187  disconnect(ui->m_bpp,SIGNAL(valueChanged(int)),this,SLOT(onSizeByteValueChanged(int)));
188  disconnect(ui->m_xdim,SIGNAL(valueChanged(int)),this,SLOT(onFormat7WindowChange(int)));
189  disconnect(ui->m_ydim,SIGNAL(valueChanged(int)),this,SLOT(onFormat7WindowChange(int)));
190  disconnect(ui->m_xoff,SIGNAL(valueChanged(int)),this,SLOT(onFormat7WindowChange(int)));
191  disconnect(ui->m_yoff,SIGNAL(valueChanged(int)),this,SLOT(onFormat7WindowChange(int)));
192  disconnect(ui->m_power,SIGNAL(toggled(bool)),this,SLOT(onPowerOnoffChange(bool)));
193  disconnect(ui->m_transmission,SIGNAL(toggled(bool)),this,SLOT(onTransmissionOnoffChange(bool)));
194  disconnect(ui->m_reset,SIGNAL(clicked()),this,SLOT(onResetChange()));
195  disconnect(ui->m_defaults,SIGNAL(clicked()),this,SLOT(onLoadDefaultsChange()));
196 
197 }
198 
200 {
201  ui->sliderSharpness->init(YARP_FEATURE_SHARPNESS,(char*)"Sharpness",&dc1394Thread);
202  ui->sliderHue->init(YARP_FEATURE_HUE,(char*)"Hue",&dc1394Thread);
203  ui->sliderSaturation->init(YARP_FEATURE_SATURATION,(char*)"Saturation",&dc1394Thread);
204  ui->sliderGamma->init(YARP_FEATURE_GAMMA,(char*)"Gamma",&dc1394Thread);
205  ui->sliderIris->init(YARP_FEATURE_IRIS,(char*)"Iris",&dc1394Thread);
206  ui->sliderFocus->init(YARP_FEATURE_FOCUS,(char*)"Focus",&dc1394Thread);
207 }
208 
210 {
211  ui->sliderShutter->init(YARP_FEATURE_SHUTTER,(char*)"Shutter",&dc1394Thread);
212  ui->sliderBrightness->init(YARP_FEATURE_BRIGHTNESS,(char*)"Brightness",&dc1394Thread);
213  ui->sliderGain->init(YARP_FEATURE_GAIN,(char*)"Gain",&dc1394Thread);
214  ui->sliderExposure->init(YARP_FEATURE_EXPOSURE,(char*)"Exposure",&dc1394Thread);
215  ui->sliderWB->init(&dc1394Thread);
216 }
217 
218 void MainWindow::onSliderDisabled(QObject *slider)
219 {
220  sliderInitMutex.lock();
221 
222  QWidget *s = (QWidget*)slider;
223  QWidget *p = (QWidget*)s->parent();
224  p->layout()->removeWidget(s);
225  m_pSli.removeOne(s);
226 
227  sliderInitMutex.unlock();
228 }
229 
230 void MainWindow::initFormatTab(unsigned int videoModeMaskDC1394,
231  unsigned int fPSMaskDC1394,
232  unsigned int colorCodingMaskDC1394)
233 {
234 
235  //disconnectWidgets();
236  unsigned int mask=videoModeMaskDC1394;
237 
238  for (int i=0,e=0; i<32; ++i){
239  if (((1<<i) & mask) && (i<video_mode_labels.length())){
240  m_VideoModeLut[e]=i;
241  ui->m_MenuMode->insertItem(e++,video_mode_labels.at(i));
242  }
243  }
244 
245  mask=fPSMaskDC1394;
246  for (int i=0,e=0; i<8; ++i){
247  if (((1<<i) & mask) && (i<video_rate_labels.length())){
248  m_FPSLut[e]=i;
249  ui->m_MenuFPS->insertItem(e++,video_rate_labels.at(i));
250  }
251  }
252 
253  ui->m_MenuISO->insertItem(0,iso_speed_labels.at(0));
254  ui->m_MenuISO->insertItem(1,iso_speed_labels.at(1));
255  ui->m_MenuISO->insertItem(2,iso_speed_labels.at(2));
256 
257 
258  mask=colorCodingMaskDC1394;
259  for (int i=0,e=0; i<32; ++i){
260  if (((1<<i) & mask) && (i<color_coding_labels.length())){
261  m_ColorCodingLut[e]=i;
262  ui->m_MenuColorCoding->insertItem(e++,color_coding_labels.at(i));
263  }
264  }
265 
266  //connectWidgets();
267 }
268 
269 
270 
271 
272 
274 {
275  //disconnectWidgets();
276  ui->m_MenuOpMode->insertItem(0,op_mode_labels.at(0));
277  ui->m_MenuOpMode->insertItem(1,op_mode_labels.at(1));
278 
279  ui->m_power->setChecked(true);
280 
281  //connectWidgets();
282 }
283 
284 
285 void MainWindow::Init(uint videoModeDC1394, uint fPSDC1394, uint iSOSpeedDC1394, bool operationModeDC1394,
286  uint colorCodingDC1394, QSize max, QSize step, QSize offset, QSize dim, QSize pos,
287  uint bytesPerPacketDC1394, bool transmissionDC1394)
288 {
289  LOG("Init\n");
290 
291  //for (int n=0; n<m_nFeatures; ++n) m_pSli[n]->Refresh();
292  disconnectWidgets();
293 
294  ui->m_MenuMode->setCurrentText(video_mode_labels.at(videoModeDC1394));
295 
296  bool bFormat7=videoModeDC1394>=24;
297 
298  ui->m_MenuColorCoding->setEnabled(bFormat7);
299  ui->m_xdim->setEnabled(bFormat7);
300  ui->m_ydim->setEnabled(bFormat7);
301  ui->m_xoff->setEnabled(bFormat7);
302  ui->m_yoff->setEnabled(bFormat7);
303 
304  ui->m_MenuFPS->setEnabled(!bFormat7);
305  if (!bFormat7){
306  ui->m_MenuFPS->setCurrentText(video_rate_labels.at(fPSDC1394));
307  }
308 
309  ui->m_MenuISO->setCurrentText(iso_speed_labels.at(iSOSpeedDC1394));
310  ui->m_MenuOpMode->setCurrentText(operationModeDC1394 ? op_mode_labels.at(1):op_mode_labels.at(0));
311  ui->m_MenuColorCoding->setCurrentText(color_coding_labels.at(colorCodingDC1394));
312 
313  unsigned int xmax,ymax,xstep,ystep,xoffstep,yoffstep;
314  xmax = max.width();
315  ymax = max.height();
316  xstep = step.width();
317  ystep = step.height();
318  xoffstep = offset.width();
319  yoffstep = offset.height();
320 
321  unsigned int xdim,ydim;
322  int x0,y0;
323  xdim = dim.width();
324  ydim = dim.height();
325  x0 = pos.width();
326  y0 = pos.height();
327 
328 
329  if (xstep<2){
330  xstep=2;
331  }
332  if (ystep<2){
333  ystep=2;
334  }
335 
336  ui->m_xdim->setRange(0,xmax);
337  ui->m_ydim->setRange(0,ymax);
338  ui->m_xdim->setSingleStep(xstep);
339  ui->m_ydim->setSingleStep(ystep);
340  ui->m_xdim->setValue(xdim);
341  ui->m_ydim->setValue(ydim);
342 
343  int xoffMax=(xmax-xdim)/2;
344  int yoffMax=(ymax-ydim)/2;
345 
346 
347  ui->m_xoff->setRange(-xoffMax,xoffMax);
348  ui->m_yoff->setRange(-yoffMax,yoffMax);
349  ui->m_xoff->setSingleStep(xoffstep);
350  ui->m_yoff->setSingleStep(yoffstep);
351  ui->m_xoff->setValue(x0);
352  ui->m_yoff->setValue(y0);
353 
354  ui->labelMaxWidth->setText(QString("%1").arg(xmax));
355  ui->labelMaxHeight->setText(QString("%1").arg(ymax));
356 
357  ui->m_bpp->setValue(bytesPerPacketDC1394);
358  ui->m_bpp->setEnabled(bFormat7);
359  ui->m_transmission->setChecked(transmissionDC1394);
360 
361 
362  CameraDescriptor camera;
363  if(dc1394Thread.getCameraDescription(&camera))
364  {
365  std::cout << "BUS type is " << camera.busType << "; description is " << camera.deviceDescription << std::endl;
366 
367  if(camera.busType != BUS_FIREWIRE)
368  ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabCamera));
369  else
370  initCameraTab();
371  }
372  else
373  LOG("Remote camera device has no IFrameGrabberControl2 interface\n");
374 
375  connectWidgets();
376 }
377 
378 void MainWindow::Reload(uint videoModeDC1394, uint colorCodingMaskDC1394,
379  QSize max, QSize step, QSize offset, QSize dim, QSize pos,
380  uint colorCodingDC1394, uint bytesPerPacketDC1394,uint fPSMaskDC1394,
381  uint fPSDC1394,uint iSOSpeedDC1394)
382 {
383  disconnectWidgets();
384 
385  unsigned int video_mode=videoModeDC1394;
386  ui->m_MenuMode->setCurrentText(video_mode_labels.at(video_mode));
387 
388  ui->m_MenuColorCoding->clear();
389 
390  unsigned int mask=colorCodingMaskDC1394;
391 
392  for (int i=0,e=0; i<32; ++i){
393  if (((1<<i) & mask) && i<color_coding_labels.length()){
394  m_ColorCodingLut[e]=i;
395  ui->m_MenuColorCoding->insertItem(e++,color_coding_labels.at(i));
396  }
397  }
398 
399  unsigned int xmax,ymax,xstep,ystep,xoffstep,yoffstep;
400  xmax = max.width();
401  ymax = max.height();
402  xstep = step.width();
403  ystep = step.height();
404  xoffstep = offset.width();
405  yoffstep = offset.height();
406 
407  unsigned int xdim,ydim;
408  int x0,y0;
409  xdim = dim.width();
410  ydim = dim.height();
411  x0 = pos.width();
412  y0 = pos.height();
413 
414  if (xstep<2){
415  xstep=2;
416  }
417  if (ystep<2){
418  ystep=2;
419  }
420 
421 
422  ui->m_xdim->setRange(0,xmax);
423  ui->m_ydim->setRange(0,ymax);
424  ui->m_xdim->setSingleStep(xstep);
425  ui->m_ydim->setSingleStep(ystep);
426  ui->m_xdim->setValue(xdim);
427  ui->m_ydim->setValue(ydim);
428 
429  int xoffMax=(xmax-xdim)/2;
430  int yoffMax=(ymax-ydim)/2;
431 
432  ui->m_xoff->setRange(-xoffMax,xoffMax);
433  ui->m_yoff->setRange(-yoffMax,yoffMax);
434  ui->m_xoff->setSingleStep(xoffstep);
435  ui->m_yoff->setSingleStep(yoffstep);
436  ui->m_xoff->setValue(x0);
437  ui->m_yoff->setValue(y0);
438 
439  ui->labelMaxWidth->setText(QString("%1").arg(xmax));
440  ui->labelMaxHeight->setText(QString("%1").arg(ymax));
441 
442 
443  // FORMAT 7
444  if (mask) {
445  ui->m_MenuColorCoding->setEnabled(true);
446  ui->m_MenuColorCoding->setCurrentText(color_coding_labels.at(colorCodingDC1394));
447 
448  //ui->m_MenuFPS->setEnabled(false);
449 
450  ui->m_bpp->setEnabled(true);
451 
452  ui->m_bpp->setValue(bytesPerPacketDC1394);
453 
454  ui->m_xdim->setEnabled(true);
455  ui->m_ydim->setEnabled(true);
456  ui->m_xoff->setEnabled(true);
457  ui->m_yoff->setEnabled(true);
458 
459  } else {
460 
461  ui->m_MenuFPS->clear();
462 
463  mask=fPSMaskDC1394;
464 
465  for (int i=0,e=0; i<8; ++i){
466  if (((1<<i) & mask) && i<video_rate_labels.length()){
467  m_FPSLut[e]=i;
468  ui->m_MenuFPS->insertItem(e++,video_rate_labels.at(i));
469  }
470  }
471 
472  ui->m_MenuFPS->setCurrentText(video_rate_labels.at(fPSDC1394));
473 
474  ui->m_MenuColorCoding->setEnabled(false);
475  ui->m_bpp->setEnabled(false);
476  }
477 
478  ui->m_MenuISO->setCurrentText(iso_speed_labels.at(iSOSpeedDC1394));
479 
480  for (int n=0; n<m_pSli.count(); n++){
481  DC1394SliderBase *slider = ((DC1394SliderBase*)m_pSli.at(n));
482  if(slider->getSliderType() == SLIDER){
483  ((DC1394Slider*)slider)->Refresh();
484  }else{
485  ((DC1394SliderWB*)slider)->Refresh();
486  }
487  }
488 
489  connectWidgets();
490 }
491 
492 
493 
494 
495 /*******************************************************/
496 void MainWindow::onResetChange()
497 {
498  LOG("on_reset_change()\n");
499  dc1394Thread.doTask(_reset);
500 }
501 
502 void MainWindow::reset(uint bytesPerPacketDC1394,uint colorCodingMaskDC1394,bool transmissionDC1394)
503 {
504  ui->m_bpp->setValue(bytesPerPacketDC1394);
505  ui->m_bpp->setEnabled(colorCodingMaskDC1394);
506  ui->m_transmission->setChecked(transmissionDC1394);
507 }
508 
509 void MainWindow::onLoadDefaultsChange()
510 {
511  LOG("on_load_defaults_change()\n");
512  QVariantList list;
513  dc1394Thread.doTask(_loadDefault);
514 }
515 
516 void MainWindow::loadDefault(uint bytesPerPacketDC1394,uint colorCodingMaskDC1394,bool transmissionDC1394)
517 {
518 
519  ui->m_bpp->setValue(bytesPerPacketDC1394);
520  ui->m_bpp->setEnabled(colorCodingMaskDC1394);
521  ui->m_transmission->setChecked(transmissionDC1394);
522 }
523 
524 void MainWindow::onTransmissionOnoffChange(bool value)
525 {
526  LOG("on_transmission_onoff_change()\n");
527  QVariantList list;
528  list.append(QVariant(value));
529  dc1394Thread.doTask(_setTransmissionDC1394,list);
530 }
531 
532 void MainWindow::onTransmissionOnoffDone()
533 {
534 
535 }
536 
537 void MainWindow::onPowerOnoffChange(bool value)
538 {
539  LOG("on_power_onoff_change()\n");
540  QVariantList list;
541  list.append(QVariant(value));
542  dc1394Thread.doTask(_setPowerDC1394,list);
543 }
544 
545 void MainWindow::onPowerOnoffDone()
546 {
547 
548 }
549 
550 void MainWindow::onFormat7WindowChange(int value)
551 {
552  Q_UNUSED(value);
553 
554  if (!ui->m_xdim->isEnabled() || !ui->m_ydim->isEnabled() || !ui->m_xoff->isEnabled() || !ui->m_yoff->isEnabled()){
555  return;
556  }
557 
558  LOG("on_format7_window_change()\n");
559 
560  unsigned int xdim=(unsigned)ui->m_xdim->value();
561  unsigned int ydim=(unsigned)ui->m_ydim->value();
562  int x0=(unsigned)ui->m_xoff->value();
563  int y0=(unsigned)ui->m_yoff->value();
564 
565  QVariantList list;
566  list.append(QVariant(xdim));
567  list.append(QVariant(ydim));
568  list.append(QVariant(x0));
569  list.append(QVariant(y0));
570  dc1394Thread.doTask(_setFormat7WindowDC1394,list);
571 }
572 
573 void MainWindow::onFormat7WindowDone()
574 {
575 
576 }
577 
578 void MainWindow::onVideoFormatCurrentIndexChanged(int value)
579 {
580  LOG("on_mode_change()\n");
581  unsigned int video_mode=m_VideoModeLut[value];
582  QVariantList list;
583  list.append(video_mode);
584 
585  dc1394Thread.doTask(_setVideoModeDC1394,list);
586 }
587 
588 void MainWindow::onVideoFormatCurrentDone()
589 {
590  dc1394Thread.doTask(_reload);
591 }
592 
593 void MainWindow::onColorCodingCurrentIndexChanged(int value)
594 {
595  if (!ui->m_MenuColorCoding->isEnabled()){
596  return;
597  }
598 
599  if (value<0){
600  return;
601  }
602 
603  LOG("on_color_coding_change()\n");
604 
605  QVariantList list;
606  list.append(m_ColorCodingLut[value]);
607 
608  dc1394Thread.doTask(_setColorCodingDC1394,list);
609 
610 
611 }
612 
613 void MainWindow::onColorCodingDone()
614 {
615  for (int n=0; n<m_pSli.count(); n++){
616  DC1394SliderBase *slider = ((DC1394SliderBase*)m_pSli.at(n));
617  if(slider->getSliderType() == SLIDER){
618  ((DC1394Slider*)slider)->Refresh();
619  }else{
620  ((DC1394SliderWB*)slider)->Refresh();
621  }
622  }
623 }
624 
625 void MainWindow::onFramerateCurrentIndexChanged(int value)
626 {
627  if(!ui->m_MenuFPS->isEnabled()){
628  return;
629  }
630 
631  if (value<0){
632  return;
633  }
634 
635  LOG("on_framerate_change()\n");
636 
637  QVariantList list;
638  list.append(m_FPSLut[value]);
639 
640  dc1394Thread.doTask(_setFPSDC1394,list);
641 }
642 
643 void MainWindow::onFramerateDone()
644 {
645 
646 }
647 
648 void MainWindow::onISOSpeedCurrentIndexChanged(int value)
649 {
650  LOG("on_iso_speed_change()\n");
651  QVariantList list;
652  list.append(value);
653 
654  dc1394Thread.doTask(_setISOSpeedDC1394,list);
655 
656 }
657 
658 void MainWindow::onISOSpeedDone()
659 {
660  dc1394Thread.doTask(_reload);
661 }
662 
663 void MainWindow::onSizeByteValueChanged(int value)
664 {
665  if (!ui->m_bpp->isEnabled()){
666  return;
667  }
668 
669 
670 
671  LOG("on_bpp_change()\n");
672  QVariantList list;
673  list.append((unsigned int)value);
674 
675  dc1394Thread.doTask(_setBytesPerPacketDC1394,list);
676 }
677 
678 void MainWindow::onSizeByteDone()
679 {
680 
681 }
682 
683 void MainWindow::onOpModeCurrentIndexChanged(int value)
684 {
685  LOG("on_operation_mode_change()\n");
686  QVariantList list;
687  list.append(value);
688 
689  dc1394Thread.doTask(_setOperationModeDC1394,list);
690 }
691 void MainWindow::onOpModeDone()
692 {
693 
694 }
695 
696 
697 void MainWindow::onStartLoading()
698 {
699  loadingWidget.start();
700 }
701 
702 void MainWindow::onStopLoading()
703 {
704  loadingWidget.accept();
705  loadingWidget.stop();
706 }
virtual void Refresh()=0
void doTask(threadFunction)
bool getCameraDescription(CameraDescriptor *camera)
void initCameraTab()
Definition: mainwindow.cpp:273
void initFeatureAdvTab()
Definition: mainwindow.cpp:199
MainWindow(FirmwareUpdaterCore *core, bool adminMode, QWidget *parent=0)
Definition: mainwindow.cpp:13
void initFeatureTab()
Definition: mainwindow.cpp:209
#define SLIDER
@ _setOperationModeDC1394
Definition: dc1394thread.h:28
@ _setBytesPerPacketDC1394
Definition: dc1394thread.h:27
@ _setFPSDC1394
Definition: dc1394thread.h:25
@ _setPowerDC1394
Definition: dc1394thread.h:21
@ _initFormatTab
Definition: dc1394thread.h:16
@ _setTransmissionDC1394
Definition: dc1394thread.h:20
@ _init
Definition: dc1394thread.h:15
@ _reload
Definition: dc1394thread.h:17
@ _setVideoModeDC1394
Definition: dc1394thread.h:23
@ _setISOSpeedDC1394
Definition: dc1394thread.h:26
@ _loadDefault
Definition: dc1394thread.h:19
@ _setFormat7WindowDC1394
Definition: dc1394thread.h:22
@ _reset
Definition: dc1394thread.h:18
@ _setColorCodingDC1394
Definition: dc1394thread.h:24
int n
static QStringList op_mode_labels
Definition: mainwindow.cpp:13
static QStringList iso_speed_labels
Definition: mainwindow.cpp:12
static QStringList video_rate_labels
Definition: mainwindow.cpp:10
static QStringList video_mode_labels
Definition: mainwindow.cpp:9
static QStringList color_coding_labels
Definition: mainwindow.cpp:11
#define LOG(...)
Definition: log.h:7
const FSC max
Definition: strain.h:48
degrees offset
Definition: sine.m:4