[vlc-commits] Qt: Allow fullscreen controller to be stacked at the bottom

Edward Wang git at videolan.org
Thu Nov 24 01:37:46 CET 2011


vlc | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Thu Nov 24 01:30:46 2011 +0100| [dcae1998d9da6f54cce9fce1305ac70920d4e680] | committer: Jean-Baptiste Kempf

Qt: Allow fullscreen controller to be stacked at the bottom

Close #3120

Modified-by: Jean-Baptiste Kempf <jb at videolan.org>
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dcae1998d9da6f54cce9fce1305ac70920d4e680
---

 modules/gui/qt4/actions_manager.cpp       |    5 +++++
 modules/gui/qt4/actions_manager.hpp       |    1 +
 modules/gui/qt4/components/controller.cpp |   28 +++++++++++++++++++++++++++-
 modules/gui/qt4/components/controller.hpp |   24 ++++++++++++++++--------
 modules/gui/qt4/main_interface.hpp        |    1 +
 5 files changed, 50 insertions(+), 9 deletions(-)

diff --git a/modules/gui/qt4/actions_manager.cpp b/modules/gui/qt4/actions_manager.cpp
index 401ef30..7cca077 100644
--- a/modules/gui/qt4/actions_manager.cpp
+++ b/modules/gui/qt4/actions_manager.cpp
@@ -34,6 +34,7 @@
 #include "dialogs_provider.hpp" /* Opening Dialogs */
 #include "input_manager.hpp"
 #include "main_interface.hpp" /* Show playlist */
+#include "components/controller.hpp" /* Toggle FSC controller width */
 
 ActionsManager * ActionsManager::instance = NULL;
 
@@ -93,6 +94,10 @@ void ActionsManager::doAction( int id_action )
             THEDP->mediaInfoDialog(); break;
         case OPEN_SUB_ACTION:
             THEDP->loadSubtitlesFile(); break;
+        case FULLWIDTH_ACTION:
+            if( p_intf->p_sys->p_mi )
+                p_intf->p_sys->p_mi->getFullscreenControllerWidget()->toggleFullwidth();
+            break;
         default:
             msg_Dbg( p_intf, "Action: %i", id_action );
             break;
diff --git a/modules/gui/qt4/actions_manager.hpp b/modules/gui/qt4/actions_manager.hpp
index d73c811..602d8df 100644
--- a/modules/gui/qt4/actions_manager.hpp
+++ b/modules/gui/qt4/actions_manager.hpp
@@ -41,6 +41,7 @@ typedef enum actionType_e
     SLOWER_ACTION,
     FASTER_ACTION,
     FULLSCREEN_ACTION,
+    FULLWIDTH_ACTION,
     EXTENDED_ACTION,
     PLAYLIST_ACTION,
     SNAPSHOT_ACTION,
diff --git a/modules/gui/qt4/components/controller.cpp b/modules/gui/qt4/components/controller.cpp
index 2de9480..5960dc1 100644
--- a/modules/gui/qt4/components/controller.cpp
+++ b/modules/gui/qt4/components/controller.cpp
@@ -137,7 +137,8 @@ void AbstractController::parseAndCreate( const QString& config,
             {
                 msg_Warn( p_intf, "Parsing error 3. Please, report this." );
                 continue;
-            }        }
+            }
+        }
 
         createAndAddWidget( controlLayout, -1, i_type, i_option );
     }
@@ -303,6 +304,10 @@ QWidget *AbstractController::createWidget( buttonType_e button, int options )
         ENABLE_ON_VIDEO( FULLSCREENButton );
         }
         break;
+    case FULLWIDTH_BUTTON: {
+            NORMAL_BUTTON( FULLWIDTH );
+        }
+        break;
     case EXTENDED_BUTTON:{
         NORMAL_BUTTON( EXTENDED );
         }
@@ -719,6 +724,8 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, QWi
 
     setWindowFlags( Qt::ToolTip );
     setMinimumWidth( 600 );
+    setMinimumHeight( 72 );
+    isWideFSC = false;
 
     setFrameShape( QFrame::StyledPanel );
     setFrameStyle( QFrame::Sunken );
@@ -875,6 +882,23 @@ void FullscreenControllerWidget::slowHideFSC()
 #endif
 }
 
+void FullscreenControllerWidget::toggleFullwidth() {
+    int fswidth = QApplication::desktop()->screenGeometry( var_InheritInteger( p_intf, "qt-fullscreen-screennumber" ) ).width();
+    int fsheight = QApplication::desktop()->screenGeometry( var_InheritInteger( p_intf, "qt-fullscreen-screennumber" ) ).height();
+    if( !isWideFSC ) {
+        /* Dock at the bottom of the screen */
+        setMinimumWidth( fswidth );
+        setGeometry(0, fsheight-72, fswidth, 72);
+    } else {
+        /* Restore half-bar and re-centre */
+        setMinimumWidth( 600 );
+        setGeometry(fswidth/2 - 300, fsheight-72, 600, 72);
+    }
+
+    /* Toggle isWideFSC switch */
+    isWideFSC = !isWideFSC;
+}
+
 /**
  * event handling
  * events: show, hide, start timer for hiding
@@ -953,6 +977,7 @@ void FullscreenControllerWidget::mouseMoveEvent( QMouseEvent *event )
  */
 void FullscreenControllerWidget::mousePressEvent( QMouseEvent *event )
 {
+    if( isWideFSC ) return;
     i_mouse_last_x = event->globalX();
     i_mouse_last_y = event->globalY();
     event->accept();
@@ -960,6 +985,7 @@ void FullscreenControllerWidget::mousePressEvent( QMouseEvent *event )
 
 void FullscreenControllerWidget::mouseReleaseEvent( QMouseEvent *event )
 {
+    if( isWideFSC ) return;
     i_mouse_last_x = -1;
     i_mouse_last_y = -1;
     event->accept();
diff --git a/modules/gui/qt4/components/controller.hpp b/modules/gui/qt4/components/controller.hpp
index 5f9ca15..1b796b7 100644
--- a/modules/gui/qt4/components/controller.hpp
+++ b/modules/gui/qt4/components/controller.hpp
@@ -38,7 +38,7 @@
 #define MAIN_TB2_DEFAULT "0-2;64;3;1;4;64;7;9;64;10;20;19;64-4;37;65;35-4"
 #define ADV_TB_DEFAULT "12;11;13;14"
 #define INPT_TB_DEFAULT "5-1;15-1;33;6-1"
-#define FSC_TB_DEFAULT "0-2;64;3;1;4;64;37;64;38;64;8;65;35-4;34"
+#define FSC_TB_DEFAULT "0-2;64;3;1;4;64;37;64;38;64;8;65;25;35-4;34"
 
 #define I_PLAY_TOOLTIP N_("Play\nIf the playlist is empty, open a medium")
 
@@ -87,6 +87,7 @@ typedef enum buttonType_e
     PREVIOUS_BUTTON,
     NEXT_BUTTON,
     OPEN_SUB_BUTTON,
+    FULLWIDTH_BUTTON,
     BUTTON_MAX,
 
     SPLITTER = 0x20,
@@ -108,11 +109,12 @@ typedef enum buttonType_e
 
 static const char* const nameL[BUTTON_MAX] = { N_("Play"), N_("Stop"), N_("Open"),
     N_("Previous/Backward"), N_("Next/Forward"), N_("Slower"), N_("Faster"), N_("Fullscreen"),
-   N_("De-Fullscreen"), N_("Extended panel"), N_("Playlist"), N_("Snapshot"),
-   N_("Record"), N_("A->B Loop"), N_("Frame By Frame"), N_("Trickplay Reverse"),
-   N_("Step backward" ), N_("Step forward"), N_("Quit"), N_("Random"),
-   N_("Loop/Repeat mode"), N_("Information"), N_("Previous"), N_("Next"),
-   N_("Open subtitles file")};
+    N_("De-Fullscreen"), N_("Extended panel"), N_("Playlist"), N_("Snapshot"),
+    N_("Record"), N_("A->B Loop"), N_("Frame By Frame"), N_("Trickplay Reverse"),
+    N_("Step backward" ), N_("Step forward"), N_("Quit"), N_("Random"),
+    N_("Loop/Repeat mode"), N_("Information"), N_("Previous"), N_("Next"),
+    N_("Open subtitles file"), N_("Fullscreen controller width toggle")
+};
 static const char* const tooltipL[BUTTON_MAX] = { I_PLAY_TOOLTIP,
     N_("Stop playback"), N_("Open a medium"),
     N_("Previous media in the playlist, skip backward when keep-pressed"),
@@ -124,7 +126,9 @@ static const char* const tooltipL[BUTTON_MAX] = { I_PLAY_TOOLTIP,
     N_("Reverse"), N_("Step backward"), N_("Step forward"), N_("Quit"),
     N_("Random"), N_("Change the loop and repeat modes"), N_("Information"),
     N_("Previous media in the playlist"), N_("Next media in the playlist"),
-    N_("Open subtitles file")};
+    N_("Open subtitles file"),
+    N_("Dock/undock fullscreen controller to/from bottom of screen")
+};
 static const QString iconL[BUTTON_MAX] ={ ":/toolbar/play_b", ":/toolbar/stop_b",
     ":/toolbar/eject", ":/toolbar/previous_b", ":/toolbar/next_b",
     ":/toolbar/slower", ":/toolbar/faster", ":/toolbar/fullscreen",
@@ -133,7 +137,8 @@ static const QString iconL[BUTTON_MAX] ={ ":/toolbar/play_b", ":/toolbar/stop_b"
     ":/toolbar/frame", ":/toolbar/reverse", ":/toolbar/skip_back",
     ":/toolbar/skip_fw", ":/toolbar/clear", ":/buttons/playlist/shuffle_on",
     ":/buttons/playlist/repeat_all", ":/menu/info",
-    ":/toolbar/previous_b", ":/toolbar/next_b", "" };
+    ":/toolbar/previous_b", ":/toolbar/next_b", "", ":/toolbar/space"
+};
 
 enum
 {
@@ -249,6 +254,7 @@ public:
     /* Vout */
     void fullscreenChanged( vout_thread_t *, bool b_fs, int i_timeout );
     void mouseChanged( vout_thread_t *, int i_mousex, int i_mousey );
+    void toggleFullwidth();
 
 signals:
     void keyPressed( QKeyEvent * );
@@ -298,6 +304,8 @@ private:
     int         i_hide_timeout;  /* FSC hiding timeout, same as mouse hiding timeout */
     int i_mouse_last_move_x;
     int i_mouse_last_move_y;
+
+    bool isWideFSC;
 };
 
 #endif
diff --git a/modules/gui/qt4/main_interface.hpp b/modules/gui/qt4/main_interface.hpp
index fe1fe68..87e04d5 100644
--- a/modules/gui/qt4/main_interface.hpp
+++ b/modules/gui/qt4/main_interface.hpp
@@ -82,6 +82,7 @@ public:
     /* Getters */
     QSystemTrayIcon *getSysTray() { return sysTray; }
     QMenu *getSysTrayMenu() { return systrayMenu; }
+    FullscreenControllerWidget* getFullscreenControllerWidget() { return fullscreenControls; }
     int getControlsVisibilityStatus();
     bool isPlDocked() { return ( b_plDocked != false ); }
     bool isInterfaceFullScreen() { return b_interfaceFullScreen; }



More information about the vlc-commits mailing list