Exemplo n.º 1
0
///Constructor
DlgVideo::DlgVideo(KConfigDialog* parent)
 : QWidget(parent),m_pDevice(nullptr),m_IsChanged(false),m_IsLoading(true),m_pChannel(nullptr),m_pResolution(nullptr)
{
   setupUi(this);
   m_pPreviewGV->setPreviewOnly(true);

   //updateWidgets();

   connect(m_pPreviewPB   ,SIGNAL(clicked())                   , this   , SLOT(startStopPreview())     );
   connect( this          ,SIGNAL(updateButtons())             , parent , SLOT(updateButtons())        );
   connect(&Video::PreviewManager::instance(),SIGNAL(previewStateChanged(bool)),this,SLOT(startStopPreview(bool))  );

   connect(&Video::PreviewManager::instance(),&Video::PreviewManager::previewStarted,m_pPreviewGV,&VideoWidget::addRenderer   );
   connect(&Video::PreviewManager::instance(),&Video::PreviewManager::previewStopped,m_pPreviewGV,&VideoWidget::removeRenderer);


   if (Video::PreviewManager::instance().isPreviewing()) {
      m_pPreviewPB->setText(i18n("Stop preview"));
   }
//    m_pVideoSettings->slotReloadDevices();
   m_IsChanged = false;
   m_IsLoading = false;

   if (!Video::ConfigurationProxy::deviceModel().rowCount()) {
      m_pPreviewPB->setDisabled(true);
      connect(m_pPreviewGV, SIGNAL(videoEnabled(bool)), m_pPreviewPB, SLOT(setEnabled(bool)));
   }
}
void QFESPIMB040SimpleCameraConfig::previewCurrentIndexChanged(int /*index*/) {
    emit previewConfigChanged();
    if (actStartStopPreview->isChecked()) { // just stop & resume, as this will load the new settings in the resume operation!
        stopPreview();
        actStartStopPreview->setChecked(true);
        startStopPreview();
    }
}
void QFESPIMB040SimpleCameraConfig::releaseCamera() {
    if (locked) {
        displayStates(QFESPIMB040SimpleCameraConfig::Connected);
        locked=false;
        if (restartPreview) {
            actStartStopPreview->setChecked(true);
            startStopPreview();
        }
    }
}
void QFESPIMB040SimpleCameraConfig::resume() {
    //qDebug()<<"resume";
    if (restartPreview) {
        actStartStopPreview->setChecked(true);
        startStopPreview();
        QElapsedTimer timer;
        timer.start();
        while (timer.elapsed()<150) {
            QApplication::processEvents();
        }
    }
}