[vlc-commits] Qt, add a playback buttons group, with prev/play/next in the same deck

Jean-Baptiste Kempf git at videolan.org
Fri Apr 22 14:38:55 CEST 2011


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Apr 22 13:42:16 2011 +0200| [0f3df12eddf92802df6455fc2270dd305e1b9a62] | committer: Jean-Baptiste Kempf

Qt, add a playback buttons group, with prev/play/next in the same deck

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

 modules/gui/qt4/components/controller.cpp |   21 ++++++++++++++++++---
 modules/gui/qt4/components/controller.hpp |    1 +
 modules/gui/qt4/dialogs/toolbar.cpp       |   15 +++++++++++++++
 3 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/modules/gui/qt4/components/controller.cpp b/modules/gui/qt4/components/controller.cpp
index d6dadaa..ae84b28 100644
--- a/modules/gui/qt4/components/controller.cpp
+++ b/modules/gui/qt4/components/controller.cpp
@@ -32,6 +32,9 @@
 #include "components/controller.hpp"
 #include "components/controller_widget.hpp"
 #include "components/interface_widgets.hpp"
+#include "util/buttons/DeckButtonsLayout.hpp"
+#include "util/buttons/BrowseButton.hpp"
+#include "util/buttons/RoundButton.hpp"
 
 #include "dialogs_provider.hpp"                     /* Opening Dialogs */
 #include "actions_manager.hpp"                             /* *_ACTION */
@@ -132,8 +135,7 @@ void AbstractController::parseAndCreate( const QString& config,
             {
                 msg_Warn( p_intf, "Parsing error 3. Please, report this." );
                 continue;
-            }
-        }
+            }        }
 
         createAndAddWidget( controlLayout, -1, i_type, i_option );
     }
@@ -221,7 +223,6 @@ void AbstractController::createAndAddWidget( QBoxLayout *controlLayout,
 
 QWidget *AbstractController::createWidget( buttonType_e button, int options )
 {
-
     bool b_flat  = options & WIDGET_FLAT;
     bool b_big   = options & WIDGET_BIG;
     bool b_shiny = options & WIDGET_SHINY;
@@ -433,6 +434,20 @@ QWidget *AbstractController::createWidget( buttonType_e button, int options )
         NORMAL_BUTTON( INFO );
         }
         break;
+    case PLAYBACK_BUTTONS:{
+        widget = new QWidget;
+        DeckButtonsLayout *layout = new DeckButtonsLayout( widget );
+        BrowseButton *prev = new BrowseButton( widget, BrowseButton::Backward );
+        BrowseButton *next = new BrowseButton( widget );
+        RoundButton *play = new RoundButton( widget );
+        layout->setBackwardButton( prev );
+        layout->setForwardButton( next );
+        layout->setRoundButton( play );
+        CONNECT_MAP_SET( prev, PREVIOUS_ACTION );
+        CONNECT_MAP_SET( next, NEXT_ACTION );
+        CONNECT_MAP_SET( play, PLAY_ACTION );
+        }
+        break;
     default:
         msg_Warn( p_intf, "This should not happen %i", button );
         break;
diff --git a/modules/gui/qt4/components/controller.hpp b/modules/gui/qt4/components/controller.hpp
index 3278633..d5cda02 100644
--- a/modules/gui/qt4/components/controller.hpp
+++ b/modules/gui/qt4/components/controller.hpp
@@ -96,6 +96,7 @@ typedef enum buttonType_e
     MENU_BUTTONS,
     TELETEXT_BUTTONS,
     ADVANCED_CONTROLLER,
+    PLAYBACK_BUTTONS,
     SPECIAL_MAX,
 
     WIDGET_SPACER = 0x40,
diff --git a/modules/gui/qt4/dialogs/toolbar.cpp b/modules/gui/qt4/dialogs/toolbar.cpp
index c700d4e..3937395 100644
--- a/modules/gui/qt4/dialogs/toolbar.cpp
+++ b/modules/gui/qt4/dialogs/toolbar.cpp
@@ -31,6 +31,9 @@
 #include "util/input_slider.hpp"
 #include "util/customwidgets.hpp"
 #include "components/interface_widgets.hpp"
+#include "util/buttons/DeckButtonsLayout.hpp"
+#include "util/buttons/BrowseButton.hpp"
+#include "util/buttons/RoundButton.hpp"
 
 #include <QScrollArea>
 #include <QGroupBox>
@@ -415,6 +418,18 @@ WidgetListing::WidgetListing( intf_thread_t *p_intf, QWidget *_parent )
             }
             widgetItem->setText( qtr("Advanced Buttons") );
             break;
+        case PLAYBACK_BUTTONS:
+            {
+                widget = new QWidget;
+                DeckButtonsLayout *layout = new DeckButtonsLayout( widget );
+                BrowseButton *prev = new BrowseButton( widget, BrowseButton::Backward );
+                BrowseButton *next = new BrowseButton( widget );
+                RoundButton *play = new RoundButton( widget );
+                layout->setBackwardButton( prev );
+                layout->setForwardButton( next );
+                layout->setRoundButton( play );
+            }
+            break;
         default:
             msg_Warn( p_intf, "This should not happen %i", i );
             break;



More information about the vlc-commits mailing list