#include "abstractclipitem.h"
#include "monitorscene.h"
#include "widgets/monitoreditwidget.h"
-#include "widgets/videosurface.h"
#include "kdenlivesettings.h"
#include <KDebug>
, m_effectWidget(NULL)
, m_selectedClip(NULL)
, m_loopClipTransition(true)
-#ifdef USE_OPENGL
, m_glWidget(NULL)
-#endif
, m_editMarker(NULL)
{
QVBoxLayout *layout = new QVBoxLayout;
if (profile.isEmpty())
profile = KdenliveSettings::current_profile();
- bool monitorCreated = false;
-#ifdef Q_WS_MAC
createOpenGlWidget(videoBox, profile);
- monitorCreated = true;
- //m_glWidget->setFixedSize(width, height);
-#elif defined(USE_OPENGL)
- if (KdenliveSettings::openglmonitors()) {
- monitorCreated = createOpenGlWidget(videoBox, profile);
- }
-#endif
- if (!monitorCreated) {
- createVideoSurface();
- render = new Render(m_id, (int) videoSurface->winId(), profile, this);
- connect(videoSurface, SIGNAL(refreshMonitor()), render, SLOT(doRefresh()));
- }
-#ifdef USE_OPENGL
- else if (m_glWidget) {
- QVBoxLayout *lay = new QVBoxLayout;
- lay->setContentsMargins(0, 0, 0, 0);
- lay->addWidget(m_glWidget);
- videoBox->setLayout(lay);
- }
-#endif
+ QVBoxLayout *lay = new QVBoxLayout;
+ lay->setContentsMargins(0, 0, 0, 0);
+ lay->addWidget(m_glWidget);
+ videoBox->setLayout(lay);
// Monitor ruler
m_ruler = new SmallRuler(this, render);
connect(m_ruler, SIGNAL(zoneChanged(QPoint)), this, SLOT(setClipZone(QPoint)));
}
- if (videoSurface) videoSurface->show();
-
if (id == Kdenlive::ProjectMonitor) {
m_effectWidget = new MonitorEditWidget(render, videoBox);
connect(m_effectWidget, SIGNAL(showEdit(bool,bool)), this, SLOT(slotShowEffectScene(bool,bool)));
return videoBox;
}
-#ifdef USE_OPENGL
-bool Monitor::createOpenGlWidget(QWidget *parent, const QString &profile)
+void Monitor::createOpenGlWidget(QWidget *parent, const QString &profile)
{
render = new Render(id(), 0, profile, this);
m_glWidget = new VideoGLWidget(parent);
if (m_glWidget == NULL) {
// Creation failed, we are in trouble...
- return false;
+ QMessageBox::critical(this, i18n("Missing OpenGL support"),
+ i18n("You need working OpenGL support to run Kdenlive. Exiting."));
+ qApp->quit();
}
m_glWidget->setImageAspectRatio(render->dar());
m_glWidget->setBackgroundColor(KdenliveSettings::window_background());
connect(render, SIGNAL(showImageSignal(QImage)), m_glWidget, SLOT(showImage(QImage)));
- return true;
}
-#endif
void Monitor::setupMenu(QMenu *goMenu, QAction *playZone, QAction *loopZone, QMenu *markerMenu, QAction *loopClip)
{
event->accept();
}
-void Monitor::mouseDoubleClickEvent(QMouseEvent * event)
-{
- if (!KdenliveSettings::openglmonitors()) {
- videoBox->switchFullScreen();
- event->accept();
- }
-}
-
void Monitor::slotMouseSeek(int eventDelta, bool fast)
{
if (fast) {
void Monitor::start()
{
if (!isVisible() || !isActive()) return;
-#ifdef USE_OPENGL
if (m_glWidget) m_glWidget->activateMonitor();
-#endif
if (render) render->startConsumer();
}
if (!render->hasProfile(profile)) {
slotActivateMonitor();
render->resetProfile(profile);
-#ifdef USE_OPENGL
if (m_glWidget) m_glWidget->setImageAspectRatio(render->dar());
-#endif
}
}
if (!render->hasProfile(profile)) {
slotActivateMonitor();
render->resetProfile(profile);
-#ifdef USE_OPENGL
if (m_glWidget) m_glWidget->setImageAspectRatio(render->dar());
-#endif
}
if (m_effectWidget)
m_effectWidget->resetProfile(render);
KdenliveSettings::setDisplayMonitorInfo(show);
if (show) {
if (m_overlay) return;
- if (videoSurface == NULL) {
- // Using OpenGL display
-#ifdef USE_OPENGL
- if (m_glWidget->layout()) delete m_glWidget->layout();
- m_overlay = new Overlay();
- connect(m_overlay, SIGNAL(editMarker()), this, SLOT(slotEditMarker()));
- QVBoxLayout *layout = new QVBoxLayout;
- layout->addStretch(10);
- layout->addWidget(m_overlay);
- m_glWidget->setLayout(layout);
-#endif
- } else {
- if (videoSurface->layout()) delete videoSurface->layout();
- m_overlay = new Overlay();
- connect(m_overlay, SIGNAL(editMarker()), this, SLOT(slotEditMarker()));
- QVBoxLayout *layout = new QVBoxLayout;
- layout->addStretch(10);
- layout->addWidget(m_overlay);
- videoSurface->setLayout(layout);
- m_overlay->raise();
- m_overlay->setHidden(true);
- }
+ if (m_glWidget->layout()) delete m_glWidget->layout();
+ m_overlay = new Overlay();
+ connect(m_overlay, SIGNAL(editMarker()), this, SLOT(slotEditMarker()));
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addStretch(10);
+ layout->addWidget(m_overlay);
+ m_glWidget->setLayout(layout);
checkOverlay();
} else {
delete m_overlay;
return;
setUpdatesEnabled(false);
if (show) {
- if (videoSurface) {
- videoSurface->setVisible(false);
- // Preview is handeled internally through the Render::showFrame method
- render->disablePreview(true);
-#ifdef USE_OPENGL
- } else {
- m_glWidget->setVisible(false);
-#endif
- }
+ m_glWidget->setVisible(false);
m_effectWidget->setVisible(true);
m_effectWidget->getScene()->slotZoomFit();
emit requestFrameForAnalysis(true);
} else {
m_effectWidget->setVisible(false);
emit requestFrameForAnalysis(false);
- if (videoSurface) {
- videoSurface->setVisible(true);
- // Preview is handeled internally through the Render::showFrame method
- render->disablePreview(false);
-
-#ifdef USE_OPENGL
- } else {
- m_glWidget->setVisible(true);
-#endif
- }
+ m_glWidget->setVisible(true);
}
if (!manuallyTriggered)
m_effectWidget->showVisibilityButton(show);
</property>
</widget>
</item>
- <item row="1" column="0" colspan="5">
- <widget class="QCheckBox" name="kcfg_openglmonitors">
- <property name="text">
- <string>Use OpenGL for video display (restart Kdenlive to apply)</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
+ <item row="1" column="0">
<widget class="QLabel" name="textLabel1_2_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
</property>
</widget>
</item>
- <item row="2" column="2" colspan="3">
+ <item row="1" column="2" colspan="3">
<widget class="KComboBox" name="kcfg_video_driver"/>
</item>
- <item row="3" column="0">
+ <item row="2" column="0">
<widget class="QLabel" name="textLabel1_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
</property>
</widget>
</item>
- <item row="3" column="2" colspan="3">
+ <item row="2" column="2" colspan="3">
<widget class="KComboBox" name="kcfg_audio_driver"/>
</item>
- <item row="4" column="0">
+ <item row="3" column="0">
<widget class="QLabel" name="textLabel1">
<property name="text">
<string>Audio device:</string>
</property>
</widget>
</item>
- <item row="4" column="2" colspan="3">
+ <item row="3" column="2" colspan="3">
<widget class="KComboBox" name="kcfg_audio_device"/>
</item>
- <item row="5" column="0" colspan="2">
+ <item row="4" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Preview volume:</string>
</property>
</widget>
</item>
- <item row="5" column="2">
+ <item row="4" column="2">
<widget class="QSpinBox" name="kcfg_volume">
<property name="suffix">
<string>%</string>
</property>
</widget>
</item>
- <item row="6" column="0" colspan="2">
+ <item row="5" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string>Monitor background color:</string>
</property>
</widget>
</item>
- <item row="6" column="2" colspan="3">
+ <item row="5" column="2" colspan="3">
<widget class="KColorButton" name="kcfg_window_background">
<property name="defaultColor">
<color>
</property>
</widget>
</item>
- <item row="7" column="0" colspan="5">
+ <item row="6" column="0" colspan="5">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
- <item row="8" column="0" colspan="4">
+ <item row="7" column="0" colspan="4">
<widget class="QCheckBox" name="kcfg_external_display">
<property name="text">
<string>Use external display (Blackmagic card)</string>
</property>
</widget>
</item>
- <item row="9" column="0">
+ <item row="8" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Output device</string>
</property>
</widget>
</item>
- <item row="9" column="1" colspan="3">
+ <item row="8" column="1" colspan="3">
<widget class="KComboBox" name="kcfg_blackmagic_output_device">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
- <item row="9" column="4">
+ <item row="8" column="4">
<widget class="QToolButton" name="reload_blackmagic">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
- <item row="10" column="3">
+ <item row="9" column="3">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>