[vlc-devel] commit: Qt: allow loop/repeat button to be in a toolbar (part 1) ( Jean-Baptiste Kempf )

git version control git at videolan.org
Fri Dec 4 07:21:46 CET 2009


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun Nov 29 17:47:09 2009 +0100| [745c83a01aa0b4e666463566c053b0626e5d6157] | committer: Jean-Baptiste Kempf 

Qt: allow loop/repeat button to be in a toolbar (part 1)

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

 modules/gui/qt4/actions_manager.hpp              |    1 +
 modules/gui/qt4/components/controller.cpp        |    7 +++++++
 modules/gui/qt4/components/controller.hpp        |    9 ++++++---
 modules/gui/qt4/components/controller_widget.cpp |   19 +++++++++++++++++++
 modules/gui/qt4/components/controller_widget.hpp |    7 +++++++
 5 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/modules/gui/qt4/actions_manager.hpp b/modules/gui/qt4/actions_manager.hpp
index 9a56fde..b6ff148 100644
--- a/modules/gui/qt4/actions_manager.hpp
+++ b/modules/gui/qt4/actions_manager.hpp
@@ -52,6 +52,7 @@ typedef enum actionType_e
     SKIP_FW_ACTION,
     QUIT_ACTION,
     RANDOM_ACTION,
+    LOOP_ACTION,
 } actionType_e;
 
 class ActionsManager : public QObject
diff --git a/modules/gui/qt4/components/controller.cpp b/modules/gui/qt4/components/controller.cpp
index 0a2071e..4c5ffc0 100644
--- a/modules/gui/qt4/components/controller.cpp
+++ b/modules/gui/qt4/components/controller.cpp
@@ -367,6 +367,13 @@ QWidget *AbstractController::createWidget( buttonType_e button, int options )
                  RANDOMButton, setChecked( bool ) );
         }
         break;
+    case LOOP_BUTTON:{
+        LoopButton *loopButton = new LoopButton;
+        setupButton( loopButton );
+        loopButton->setToolTip( qtr( "Click to toggle between loop one, loop all" ) );
+        loopButton->setCheckable( true );
+        }
+        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 f7a046b..aa71447 100644
--- a/modules/gui/qt4/components/controller.hpp
+++ b/modules/gui/qt4/components/controller.hpp
@@ -81,6 +81,7 @@ typedef enum buttonType_e
     SKIP_FW_BUTTON,
     QUIT_BUTTON,
     RANDOM_BUTTON,
+    LOOP_BUTTON,
     BUTTON_MAX,
 
     SPLITTER = 0x20,
@@ -103,7 +104,8 @@ static const char* const nameL[BUTTON_MAX] = { N_("Play"), N_("Stop"), N_("Open"
     N_("Previous"), N_("Next"), 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_("Step backward" ), N_("Step forward"), N_("Quit"), N_("Random"),
+   N_("Loop/Repeat mode") };
 static const char* const tooltipL[BUTTON_MAX] = { I_PLAY_TOOLTIP,
     N_("Stop playback"), N_("Open a medium"),
     N_("Previous media in the playlist"),
@@ -113,14 +115,15 @@ static const char* const tooltipL[BUTTON_MAX] = { I_PLAY_TOOLTIP,
     N_( "Take a snapshot" ), N_( "Record" ),
     N_( "Loop from point A to point B continuously." ), N_("Frame by frame"),
     N_("Reverse"), N_("Step backward"), N_("Step forward"), N_("Quit"),
-    N_("Random") };
+    N_("Random"), N_("Change the loop and repeat modes") };
 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",
     ":/toolbar/defullscreen", ":/toolbar/extended", ":/toolbar/playlist",
     ":/toolbar/snapshot", ":/toolbar/record", ":/toolbar/atob_nob",
     ":/toolbar/frame", ":/toolbar/reverse", ":/toolbar/skip_back",
-    ":/toolbar/skip_fw", ":/toolbar/clear", ":/buttons/playlist/shuffle_on" };
+    ":/toolbar/skip_fw", ":/toolbar/clear", ":/buttons/playlist/shuffle_on",
+    ":/buttons/playlist/repeat_all" };
 
 enum
 {
diff --git a/modules/gui/qt4/components/controller_widget.cpp b/modules/gui/qt4/components/controller_widget.cpp
index f13a648..c7746ac 100644
--- a/modules/gui/qt4/components/controller_widget.cpp
+++ b/modules/gui/qt4/components/controller_widget.cpp
@@ -235,3 +235,22 @@ void AtoB_Button::setIcons( bool timeA, bool timeB )
     }
 }
 
+void LoopButton::update()
+{
+/*    if( model->hasRepeat() )
+    {
+        repeatButton->setIcon( QIcon( ":/buttons/playlist/repeat_one" ) );
+        repeatButton->setChecked( true );
+    }
+    else if( model->hasLoop() )
+    {
+        repeatButton->setIcon( QIcon( ":/buttons/playlist/repeat_all" ) );
+        repeatButton->setChecked( true );
+    }
+    else
+    {
+        repeatButton->setIcon( QIcon( ":/buttons/playlist/repeat_one" ) );
+        repeatButton->setChecked( false );
+    }*/
+    //BUTTONACT( repeatButton, toggleRepeat() );
+}
diff --git a/modules/gui/qt4/components/controller_widget.hpp b/modules/gui/qt4/components/controller_widget.hpp
index 44e5dee..092730b 100644
--- a/modules/gui/qt4/components/controller_widget.hpp
+++ b/modules/gui/qt4/components/controller_widget.hpp
@@ -53,6 +53,13 @@ private slots:
     void updateButton( bool );
 };
 
+class LoopButton : public QToolButton
+{
+    Q_OBJECT
+private slots:
+    void update();
+};
+
 class AtoB_Button : public QToolButton
 {
     Q_OBJECT




More information about the vlc-devel mailing list