38 qRegisterMetaType<CByteImage**>(
"CByteImage**");
46 QSizePolicy sizePoli(QSizePolicy::Expanding, QSizePolicy::Expanding);
47 sizePoli.setVerticalStretch(15);
48 imageViewer->setSizePolicy(sizePoli);
49 ui.imageViewerLayout->addWidget(imageViewer);
53 imageMonitorPropertiesWidget->hide();
56 imageMonitorStatisticsWidget->hide();
59 connect(ui.settingsButton, SIGNAL(clicked(
bool)),
this, SLOT(settingsButtonClicked(
bool)));
60 connect(ui.statisticsButton, SIGNAL(clicked(
bool)),
this, SLOT(statisticsButtonClicked(
bool)));
61 connect(ui.snapshotButton, SIGNAL(clicked(
bool)),
this, SLOT(snapshotButtonClicked(
bool)));
62 connect(ui.playButton, SIGNAL(toggled(
bool)),
this, SLOT(playButtonToggled(
bool)));
63 connect(ui.cbBufferImages, SIGNAL(toggled(
bool)),
this, SLOT(bufferImagesToggled(
bool)));
64 connect(ui.sliderImageBuffer, SIGNAL(valueChanged(
int)),
this, SLOT(sliderPositionChanged(
int)));
65 connect(ui.buttonShowBufferImages, SIGNAL(toggled(
bool)),
this, SLOT(bufferImagesPaneChanged(
bool)));
67 connect(imageMonitorPropertiesWidget, SIGNAL(accepted()),
this, SLOT(propertiesAccepted()));
68 connect(imageMonitorStatisticsWidget, SIGNAL(accepted()),
this, SLOT(statisticsAccepted()));
70 ui.frameImageBuffer->hide();
75 ImageMonitorWidget::~ImageMonitorWidget()
77 delete imageMonitorPropertiesWidget;
87 for (
int i = 0; i < numberImages; ++i)
95 imageViewer->setImages(numberImages, images, imageTimestamp, receiveTimestamp);
98 void ImageMonitorWidget::hideControlWidgets(
bool hide)
100 ui.controlWidgetsContainer->setVisible(!hide);
106 void ImageMonitorWidget::settingsButtonClicked(
bool toggled)
112 imageMonitorPropertiesWidget->setModal(
true);
113 imageMonitorPropertiesWidget->show();
116 void ImageMonitorWidget::statisticsButtonClicked(
bool toggled)
122 imageMonitorStatisticsWidget->setModal(
true);
123 imageMonitorStatisticsWidget->show();
127 void ImageMonitorWidget::propertiesAccepted()
130 controller->applyProperties(imageMonitorPropertiesWidget->getProperties());
132 ui.sliderImageBuffer->setMaximum(imageMonitorPropertiesWidget->getProperties().imageBufferSize);
135 void ImageMonitorWidget::statisticsAccepted()
139 void ImageMonitorWidget::bufferImagesToggled(
bool toggled)
143 ui.sliderImageBuffer->setEnabled(toggled);
146 void ImageMonitorWidget::sliderPositionChanged(
int pos)
148 if (ui.playButton->isChecked())
150 ui.playButton->setChecked(
false);
153 unsigned int realPos = 0;
155 auto imagesToShow =
controller->getProperties().imagesToShow;
157 ui.lblSliderPosition->setText(QString::number(realPos + 1) +
"/" + QString::number(
controller->getBufferedImageCount()));
159 if (images.size() == 0)
164 std::vector<CByteImage*> selectedImages;
166 for (
unsigned int i = 0; i < images.size(); ++i)
168 if (imagesToShow.size() > 0 && imagesToShow.count(i) == 0)
172 if (!images[i].get())
178 selectedImages.push_back(images[i].get());
180 if (selectedImages.size() > 0)
186 void ImageMonitorWidget::bufferImagesPaneChanged(
bool toggled)
190 ui.buttonShowBufferImages->setArrowType(Qt::DownArrow);
194 ui.buttonShowBufferImages->setArrowType(Qt::LeftArrow);
203 void ImageMonitorWidget::snapshotButtonClicked(
bool toggled)
208 void ImageMonitorWidget::playButtonToggled(
bool playing)
211 ui.playButton->setChecked(playing);
214 void ImageMonitorWidget::setConnected(
bool connected)
216 ui.playButton->setEnabled(connected);
217 ui.statisticsButton->setEnabled(connected);
218 ui.snapshotButton->setEnabled(connected);
219 ui.cbBufferImages->setEnabled(connected);
223 ui.sliderImageBuffer->setEnabled(
false);
225 playButtonToggled(connected);
228 void ImageMonitorWidget::updateStatistics(
const QString& statisticsStr)
230 ui.imageViewerStats->setText(statisticsStr);