From bc8af43104aafa0869cfb869c9d7caf0acefb23c Mon Sep 17 00:00:00 2001
From: MaZderMind <git@mazdermind.de>
Date: Sun, 15 Nov 2015 14:43:51 +0100
Subject: Implement a Button in the GUI to set a specific Source to Fullscreen,
 fixes #11

---
 voctogui/lib/videopreviews.py | 15 +++++++++++++++
 voctogui/ui/voctogui.ui       | 17 +++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/voctogui/lib/videopreviews.py b/voctogui/lib/videopreviews.py
index 233b132..c4700d9 100644
--- a/voctogui/lib/videopreviews.py
+++ b/voctogui/lib/videopreviews.py
@@ -80,6 +80,11 @@ class VideoPreviewsController(object):
 			key, mod = Gtk.accelerator_parse('<Ctrl>%u' % (idx+1))
 			btn_b.add_accelerator('activate', accelerators, key, mod, Gtk.AccelFlags.VISIBLE)
 
+			btn_fullscreen = uibuilder.find_widget_recursive(preview, 'btn_fullscreen')
+			btn_fullscreen.set_name("%c %u" % ('f', idx))
+
+			btn_fullscreen.connect('clicked', self.btn_fullscreen_clicked)
+
 			self.preview_players[source] = player
 			self.previews[source] = preview
 			self.a_btns[source] = btn_a
@@ -104,6 +109,16 @@ class VideoPreviewsController(object):
 		self.log.info('video-channel %s changed to %s', channel, source_name)
 		Connection.send('set_video_'+channel, source_name)
 
+	def btn_fullscreen_clicked(self, btn):
+		btn_name = btn.get_name()
+		self.log.debug('btn_fullscreen_clicked: %s', btn_name)
+
+		channel, idx = btn_name.split(' ')[:2]
+		source_name = self.sources[int(idx)]
+
+		self.log.info('selcting video %s for fullscreen', source_name)
+		Connection.send('set_videos_and_composite', source_name, '*', 'fullscreen')
+
 	def on_video_status(self, source_a, source_b):
 		self.log.info('on_video_status callback w/ sources: %s and %s', source_a, source_b)
 
diff --git a/voctogui/ui/voctogui.ui b/voctogui/ui/voctogui.ui
index d58f741..3501c1b 100644
--- a/voctogui/ui/voctogui.ui
+++ b/voctogui/ui/voctogui.ui
@@ -345,6 +345,23 @@
                     <property name="position">2</property>
                   </packing>
                 </child>
+                <child>
+                  <object class="GtkButton" id="btn_fullscreen">
+                    <property name="label" translatable="yes">Fullscreen</property>
+                    <property name="width_request">40</property>
+                    <property name="height_request">40</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="margin_right">5</property>
+                    <property name="xalign">0.5</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">3</property>
+                  </packing>
+                </child>
               </object>
               <packing>
                 <property name="expand">False</property>
-- 
cgit v1.2.3