From d9b09bd1f1fbd5c1dbbbce217ae89ceb57f090c5 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Thu, 13 Mar 2014 19:38:13 +0100 Subject: [PATCH] Remove support for non-OpenGL main monitor. Every machine capable of doing video editing these days should have OpenGL, so remove the legacy support. --- src/CMakeLists.txt | 10 +-- src/kdenlivesettings.kcfg | 4 -- src/kdenlivesettingsdialog.cpp | 4 -- src/monitor.cpp | 104 ++++++-------------------------- src/monitor.h | 11 +--- src/recmonitor.cpp | 8 --- src/recmonitor.h | 1 - src/ui/configsdl_ui.ui | 39 +++++------- src/widgets/CMakeLists.txt | 1 + src/widgets/abstractmonitor.cpp | 2 - 10 files changed, 38 insertions(+), 146 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1ee4b651..19e34508 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -258,10 +258,6 @@ kde4_add_ui_files(kdenlive_UIS ui/importkeyframesdialog_ui.ui ) -if(OPENGL_FOUND) - list(APPEND kdenlive_SRCS widgets/videoglwidget.cpp) -endif(OPENGL_FOUND) - if(BUILD_JogShuttle) list(APPEND kdenlive_SRCS jogaction.cpp @@ -322,6 +318,7 @@ target_link_libraries(kdenlive ${LIBMLTPLUS_LIBRARY} ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT} + ${OPENGL_LIBRARIES} kiss_fft ) @@ -330,11 +327,6 @@ if(Q_WS_X11) target_link_libraries(kdenlive ${X11_LIBRARIES}) endif(Q_WS_X11) -if(OPENGL_FOUND AND QT_QTOPENGL_FOUND) - add_definitions(-DUSE_OPENGL) - target_link_libraries(kdenlive ${OPENGL_LIBRARIES}) -endif(OPENGL_FOUND AND QT_QTOPENGL_FOUND) - if(SDL_FOUND) target_link_libraries(kdenlive ${SDL_LIBRARY}) endif(SDL_FOUND) diff --git a/src/kdenlivesettings.kcfg b/src/kdenlivesettings.kcfg index 59c03341..7683db81 100644 --- a/src/kdenlivesettings.kcfg +++ b/src/kdenlivesettings.kcfg @@ -197,10 +197,6 @@ - - - false - diff --git a/src/kdenlivesettingsdialog.cpp b/src/kdenlivesettingsdialog.cpp index e64753b3..64f9aaeb 100644 --- a/src/kdenlivesettingsdialog.cpp +++ b/src/kdenlivesettingsdialog.cpp @@ -175,10 +175,6 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap& map m_configSdl.reload_blackmagic->setIcon(KIcon("view-refresh")); connect(m_configSdl.reload_blackmagic, SIGNAL(clicked(bool)), this, SLOT(slotReloadBlackMagic())); -#ifndef USE_OPENGL - m_configSdl.kcfg_openglmonitors->setHidden(true); -#endif - m_page6 = addPage(p6, i18n("Playback"), "media-playback-start"); QWidget *p7 = new QWidget; diff --git a/src/monitor.cpp b/src/monitor.cpp index 2b8cd627..b2c43060 100644 --- a/src/monitor.cpp +++ b/src/monitor.cpp @@ -24,7 +24,6 @@ #include "abstractclipitem.h" #include "monitorscene.h" #include "widgets/monitoreditwidget.h" -#include "widgets/videosurface.h" #include "kdenlivesettings.h" #include @@ -62,9 +61,7 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager *manager, QString profil , m_effectWidget(NULL) , m_selectedClip(NULL) , m_loopClipTransition(true) -#ifdef USE_OPENGL , m_glWidget(NULL) -#endif , m_editMarker(NULL) { QVBoxLayout *layout = new QVBoxLayout; @@ -153,29 +150,11 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager *manager, QString profil 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); @@ -195,8 +174,6 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager *manager, QString profil 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))); @@ -230,21 +207,20 @@ QWidget *Monitor::container() 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) { @@ -562,14 +538,6 @@ void Monitor::wheelEvent(QWheelEvent * event) event->accept(); } -void Monitor::mouseDoubleClickEvent(QMouseEvent * event) -{ - if (!KdenliveSettings::openglmonitors()) { - videoBox->switchFullScreen(); - event->accept(); - } -} - void Monitor::slotMouseSeek(int eventDelta, bool fast) { if (fast) { @@ -791,9 +759,7 @@ void Monitor::stop() void Monitor::start() { if (!isVisible() || !isActive()) return; -#ifdef USE_OPENGL if (m_glWidget) m_glWidget->activateMonitor(); -#endif if (render) render->startConsumer(); } @@ -940,9 +906,7 @@ void Monitor::setCustomProfile(const QString &profile, const Timecode &tc) if (!render->hasProfile(profile)) { slotActivateMonitor(); render->resetProfile(profile); -#ifdef USE_OPENGL if (m_glWidget) m_glWidget->setImageAspectRatio(render->dar()); -#endif } } @@ -953,9 +917,7 @@ void Monitor::resetProfile(const QString &profile) 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); @@ -989,28 +951,13 @@ void Monitor::slotSwitchMonitorInfo(bool show) 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; @@ -1074,31 +1021,14 @@ void Monitor::slotShowEffectScene(bool show, bool manuallyTriggered) 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); diff --git a/src/monitor.h b/src/monitor.h index 1d7b54cb..604dd39a 100644 --- a/src/monitor.h +++ b/src/monitor.h @@ -26,9 +26,7 @@ #include "definitions.h" #include "timecodedisplay.h" #include "widgets/abstractmonitor.h" -#ifdef USE_OPENGL #include "widgets/videoglwidget.h" -#endif #include #include @@ -45,7 +43,8 @@ class MonitorEditWidget; class Monitor; class MonitorManager; class QSlider; - +class VideoGLWidget; +class QGLWidget; class Overlay : public QLabel { @@ -101,7 +100,6 @@ public: protected: void mousePressEvent(QMouseEvent * event); void mouseReleaseEvent(QMouseEvent * event); - void mouseDoubleClickEvent(QMouseEvent * event); void resizeEvent(QResizeEvent *event); /** @brief Move to another position on mouse wheel event. @@ -143,11 +141,8 @@ private: /** true if selected clip is transition, false = selected clip is clip. * Necessary because sometimes we get two signals, e.g. we get a clip and we get selected transition = NULL. */ bool m_loopClipTransition; - -#ifdef USE_OPENGL VideoGLWidget *m_glWidget; - bool createOpenGlWidget(QWidget *parent, const QString &profile); -#endif + void createOpenGlWidget(QWidget *parent, const QString &profile); GenTime getSnapForPos(bool previous); Qt::WindowFlags m_baseFlags; diff --git a/src/recmonitor.cpp b/src/recmonitor.cpp index f3d9ac75..de9f07fa 100644 --- a/src/recmonitor.cpp +++ b/src/recmonitor.cpp @@ -185,14 +185,6 @@ RecMonitor::~RecMonitor() delete m_captureDevice; } -void RecMonitor::mouseDoubleClickEvent(QMouseEvent * event) -{ - if (!KdenliveSettings::openglmonitors() && videoBox && videoBox->isVisible()) { - videoBox->switchFullScreen(); - event->accept(); - } -} - void RecMonitor::slotSwitchFullScreen() { videoBox->switchFullScreen(); diff --git a/src/recmonitor.h b/src/recmonitor.h index 62d94594..ca89f21a 100644 --- a/src/recmonitor.h +++ b/src/recmonitor.h @@ -70,7 +70,6 @@ public: protected: void mousePressEvent(QMouseEvent * event); - void mouseDoubleClickEvent(QMouseEvent * event); private: KDateTime m_captureTime; diff --git a/src/ui/configsdl_ui.ui b/src/ui/configsdl_ui.ui index 42df8669..4bb7e3dd 100644 --- a/src/ui/configsdl_ui.ui +++ b/src/ui/configsdl_ui.ui @@ -21,14 +21,7 @@ - - - - Use OpenGL for video display (restart Kdenlive to apply) - - - - + @@ -44,10 +37,10 @@ - + - + @@ -63,10 +56,10 @@ - + - + Audio device: @@ -76,17 +69,17 @@ - + - + Preview volume: - + % @@ -99,14 +92,14 @@ - + Monitor background color: - + @@ -117,28 +110,28 @@ - + Qt::Horizontal - + Use external display (Blackmagic card) - + Output device - + true @@ -151,14 +144,14 @@ - + ... - + Qt::Vertical diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt index 38108ce2..4bfb183a 100644 --- a/src/widgets/CMakeLists.txt +++ b/src/widgets/CMakeLists.txt @@ -14,6 +14,7 @@ set(kdenlive_SRCS widgets/noteswidget.cpp widgets/renderwidget.cpp widgets/titlewidget.cpp + widgets/videoglwidget.cpp widgets/videosurface.cpp PARENT_SCOPE ) diff --git a/src/widgets/abstractmonitor.cpp b/src/widgets/abstractmonitor.cpp index e877dc80..eb3794a8 100644 --- a/src/widgets/abstractmonitor.cpp +++ b/src/widgets/abstractmonitor.cpp @@ -103,8 +103,6 @@ void VideoContainer::wheelEvent(QWheelEvent * event) void VideoContainer::mouseDoubleClickEvent(QMouseEvent * event) { - if (!KdenliveSettings::openglmonitors()) - switchFullScreen(); event->accept(); } -- 2.39.2