+RecMonitor::RecMonitor(QString name, MonitorManager *manager, QWidget *parent) :
+ AbstractMonitor(parent),
+ m_name(name),
+ m_isCapturing(false),
+ m_didCapture(false),
+ m_isPlaying(false),
+ m_manager(manager),
+ m_captureDevice(NULL),
+ m_analyse(false)
+{
+ setupUi(this);
+
+ video_frame->setAttribute(Qt::WA_PaintOnScreen);
+ device_selector->setCurrentIndex(KdenliveSettings::defaultcapture());
+ connect(device_selector, SIGNAL(currentIndexChanged(int)), this, SLOT(slotVideoDeviceChanged(int)));
+
+ // Video widget holder
+ QVBoxLayout *l = new QVBoxLayout;
+ l->setContentsMargins(0, 0, 0, 0);
+ l->setSpacing(0);
+ m_videoBox = new VideoPreviewContainer();
+ m_videoBox->setContentsMargins(0, 0, 0, 0);
+ m_videoBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
+ l->addWidget(m_videoBox);
+ video_frame->setLayout(l);
+
+ QToolBar *toolbar = new QToolBar(this);
+ QHBoxLayout *layout = new QHBoxLayout;
+ layout->setContentsMargins(0, 0, 0, 0);
+ m_playIcon = KIcon("media-playback-start");
+ m_pauseIcon = KIcon("media-playback-pause");
+
+ m_discAction = toolbar->addAction(KIcon("network-connect"), i18n("Connect"));
+ connect(m_discAction, SIGNAL(triggered()), this, SLOT(slotDisconnect()));
+
+ m_rewAction = toolbar->addAction(KIcon("media-seek-backward"), i18n("Rewind"));
+ connect(m_rewAction, SIGNAL(triggered()), this, SLOT(slotRewind()));
+
+ m_playAction = toolbar->addAction(m_playIcon, i18n("Play"));
+ connect(m_playAction, SIGNAL(triggered()), this, SLOT(slotStartPreview()));
+
+ m_stopAction = toolbar->addAction(KIcon("media-playback-stop"), i18n("Stop"));
+ connect(m_stopAction, SIGNAL(triggered()), this, SLOT(slotStopCapture()));
+ m_stopAction->setEnabled(false);
+ m_fwdAction = toolbar->addAction(KIcon("media-seek-forward"), i18n("Forward"));
+ connect(m_fwdAction, SIGNAL(triggered()), this, SLOT(slotForward()));
+
+ m_recAction = toolbar->addAction(KIcon("media-record"), i18n("Record"));
+ connect(m_recAction, SIGNAL(triggered()), this, SLOT(slotRecord()));
+ m_recAction->setCheckable(true);
+
+ toolbar->addSeparator();
+
+ QAction *configAction = toolbar->addAction(KIcon("configure"), i18n("Configure"));
+ connect(configAction, SIGNAL(triggered()), this, SLOT(slotConfigure()));
+ configAction->setCheckable(false);
+
+ layout->addWidget(toolbar);
+ layout->addWidget(&m_logger);
+ layout->addWidget(&m_dvinfo);
+ m_logger.setMaxCount(10);
+ m_logger.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ m_logger.setFrame(false);
+ //m_logger.setInsertPolicy(QComboBox::InsertAtTop);
+
+#if KDE_IS_VERSION(4,2,0)
+ m_freeSpace = new KCapacityBar(KCapacityBar::DrawTextInline, this);
+ m_freeSpace->setMaximumWidth(150);
+ QFontMetricsF fontMetrics(font());
+ m_freeSpace->setMaximumHeight(fontMetrics.height() * 1.2);
+ slotUpdateFreeSpace();
+ layout->addWidget(m_freeSpace);
+ connect(&m_spaceTimer, SIGNAL(timeout()), this, SLOT(slotUpdateFreeSpace()));
+ m_spaceTimer.setInterval(30000);
+ m_spaceTimer.setSingleShot(false);
+#endif
+
+ control_frame_firewire->setLayout(layout);
+ m_displayProcess = new QProcess;
+ m_captureProcess = new QProcess;
+
+ connect(m_captureProcess, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(slotProcessStatus(QProcess::ProcessState)));
+ connect(m_captureProcess, SIGNAL(readyReadStandardError()), this, SLOT(slotReadDvgrabInfo()));
+
+
+ QString videoDriver = KdenliveSettings::videodrivername();
+#if QT_VERSION >= 0x040600
+ QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
+ env.insert("SDL_WINDOWID", QString::number(video_frame->winId()));
+ if (!videoDriver.isEmpty()) {
+ if (videoDriver == "x11_noaccel") {
+ env.insert("SDL_VIDEO_YUV_HWACCEL", "0");
+ env.insert("SDL_VIDEODRIVER", "x11");
+ } else env.insert("SDL_VIDEODRIVER", videoDriver);
+ }
+ m_displayProcess->setProcessEnvironment(env);
+#else
+ QStringList env = QProcess::systemEnvironment();
+ env << "SDL_WINDOWID=" + QString::number(video_frame->winId());
+ if (!videoDriver.isEmpty()) {
+ if (videoDriver == "x11_noaccel") {
+ env << "SDL_VIDEO_YUV_HWACCEL=0";
+ env << "SDL_VIDEODRIVER=x11";
+ } else env << "SDL_VIDEODRIVER=" + videoDriver;
+ }
+ m_displayProcess->setEnvironment(env);
+#endif
+ setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 1);
+
+ kDebug() << "/////// BUILDING MONITOR, ID: " << video_frame->winId();
+ slotVideoDeviceChanged(device_selector->currentIndex());
+ recording_preview->setToolTip(i18n("Capture preview settings"));
+ recording_preview->setCurrentIndex(KdenliveSettings::recording_preview());
+ connect(recording_preview, SIGNAL(currentIndexChanged(int)), this, SLOT(slotChangeRecordingPreview(int)));
+}