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