hi all,

as i need full-screen support for the record monitor, i've tried to get my 
hands 
dirty and have a look at the kdenlive source code. i've came up with an ugly 
patch (see attachment). it is based on the code of VideoContainer, which i 
tried 
to migrate to VideoPreviewContainer.

i had to disable the x11-specific code, because otherwise the window did not 
become visible (kwin). also the patch is not against master, but against v0.8.2 
(as there seem to be a problem with my blackmagic card).

iac, it would be great, if some kdenlive dev could review my patch and help me 
to integrate it. i'm neither familiar with the kdenlive architecture nor with 
qt, so there might be some issues ...

thanks, tim
>From 360c7dd421d09b882b0337d08eefaec2c16f58fd Mon Sep 17 00:00:00 2001
Message-Id: <360c7dd421d09b882b0337d08eefaec2c16f58fd.1329319342.git....@klingt.org>
From: Tim Blechmann <t...@klingt.org>
Date: Wed, 15 Feb 2012 16:19:57 +0100
Subject: [PATCH] record monitor: full-screen mode for record monitor

Signed-off-by: Tim Blechmann <t...@klingt.org>
---
 src/abstractmonitor.cpp |   55 +++++++++++++++++++++++++++++++++++++++++++++++
 src/abstractmonitor.h   |    3 ++
 src/recmonitor.cpp      |    8 ++++++
 src/recmonitor.h        |    1 +
 4 files changed, 67 insertions(+), 0 deletions(-)

diff --git a/src/abstractmonitor.cpp b/src/abstractmonitor.cpp
index 270bd4f..d1265c1 100644
--- a/src/abstractmonitor.cpp
+++ b/src/abstractmonitor.cpp
@@ -24,6 +24,8 @@
 #include <KDebug>
 
 #include <QPaintEvent>
+#include <QDesktopWidget>
+#include <QApplication>
 
 VideoPreviewContainer::VideoPreviewContainer(QWidget *parent) :
     QFrame(parent),
@@ -111,3 +113,56 @@ void VideoPreviewContainer::paintEvent(QPaintEvent *event)
 }
 
 
+void VideoPreviewContainer::switchFullScreen()
+{
+	// TODO: disable screensaver?
+	Qt::WindowFlags flags = windowFlags();
+	if (!isFullScreen()) {
+		// Check if we ahave a multiple monitor setup
+		setUpdatesEnabled(false);
+		#if QT_VERSION >= 0x040600
+		int monitors = QApplication::desktop()->screenCount();
+		#else
+		int monitors = QApplication::desktop()->numScreens();
+		#endif
+		if (monitors > 1) {
+			QRect screenres;
+			// Move monitor widget to the second screen (one screen for Kdenlive, the other one for the Monitor widget
+			int currentScreen = QApplication::desktop()->screenNumber(this);
+			if (currentScreen < monitors - 1)
+				screenres = QApplication::desktop()->screenGeometry(currentScreen + 1);
+			else
+				screenres = QApplication::desktop()->screenGeometry(currentScreen - 1);
+			move(QPoint(screenres.x(), screenres.y()));
+			resize(screenres.width(), screenres.height());
+		}
+
+		m_baseFlags = flags & (Qt::Window | Qt::SubWindow);
+		flags |= Qt::Window;
+		flags ^= Qt::SubWindow;
+		setWindowFlags(flags);
+// 	#ifdef Q_WS_X11
+// 		// This works around a bug with Compiz
+// 		// as the window must be visible before we can set the state
+// 		show();
+// 		raise();
+// 		setWindowState(windowState() | Qt::WindowFullScreen);   // set
+// 	#else
+		setWindowState(windowState() | Qt::WindowFullScreen);   // set
+		setUpdatesEnabled(true);
+		show();
+// 	#endif
+		setEnabled(true);
+		updateDisplayZone();
+	} else {
+		setUpdatesEnabled(false);
+		flags ^= (Qt::Window | Qt::SubWindow); //clear the flags...
+		flags |= m_baseFlags; //then we reset the flags (window and subwindow)
+		setWindowFlags(flags);
+		setWindowState(windowState()  ^ Qt::WindowFullScreen);   // reset
+		setUpdatesEnabled(true);
+		setEnabled(false);
+		show();
+	}
+// 	m_monitor->pause();
+}
diff --git a/src/abstractmonitor.h b/src/abstractmonitor.h
index 1167e6c..0fb18f0 100644
--- a/src/abstractmonitor.h
+++ b/src/abstractmonitor.h
@@ -44,6 +44,7 @@ public:
     void stop();
     /** @brief Set the display ratio for this display. */
     void setRatio(double ratio);
+	void switchFullScreen();
 
 protected:
     virtual void paintEvent(QPaintEvent */*event*/);
@@ -62,6 +63,8 @@ private:
     QTimer m_refreshTimer;
     /** @brief Re-calculate the display zone after a resize or aspect ratio change. */
     void updateDisplayZone();
+
+	Qt::WindowFlags m_baseFlags;
 };
 
 
diff --git a/src/recmonitor.cpp b/src/recmonitor.cpp
index a2b8906..7b54762 100644
--- a/src/recmonitor.cpp
+++ b/src/recmonitor.cpp
@@ -865,6 +865,14 @@ void RecMonitor::mousePressEvent(QMouseEvent * /*event*/)
 #endif
 }
 
+void RecMonitor::mouseDoubleClickEvent(QMouseEvent * event)
+{
+	if (!KdenliveSettings::openglmonitors()) {
+		m_videoBox->switchFullScreen();
+		event->accept();
+	}
+}
+
 void RecMonitor::slotUpdateFreeSpace()
 {
 #if KDE_IS_VERSION(4,2,0)
diff --git a/src/recmonitor.h b/src/recmonitor.h
index fe1d90f..8c573f9 100644
--- a/src/recmonitor.h
+++ b/src/recmonitor.h
@@ -64,6 +64,7 @@ public:
 
 protected:
     virtual void mousePressEvent(QMouseEvent * event);
+	virtual void mouseDoubleClickEvent(QMouseEvent * event);
 
 private:
     QString m_name;
-- 
1.7.5.4


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Kdenlive-devel mailing list
Kdenlive-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kdenlive-devel

Reply via email to