]> git.sesse.net Git - vlc/commitdiff
Qt: allow loop/repeat button to be in a toolbar (part 1)
authorJean-Baptiste Kempf <jb@videolan.org>
Sun, 29 Nov 2009 16:47:09 +0000 (17:47 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Fri, 4 Dec 2009 06:21:39 +0000 (07:21 +0100)
modules/gui/qt4/actions_manager.hpp
modules/gui/qt4/components/controller.cpp
modules/gui/qt4/components/controller.hpp
modules/gui/qt4/components/controller_widget.cpp
modules/gui/qt4/components/controller_widget.hpp

index 9a56fde24e1f68fae58a39f853e3758b0a259af5..b6ff1485bd0db7a1862afe982a5135935cec45bd 100644 (file)
@@ -52,6 +52,7 @@ typedef enum actionType_e
     SKIP_FW_ACTION,
     QUIT_ACTION,
     RANDOM_ACTION,
+    LOOP_ACTION,
 } actionType_e;
 
 class ActionsManager : public QObject
index 0a2071e3a6ff4f4423d6c4a38205f1ccf5ce0a02..4c5ffc061c13b8b2329d3c9c5bec35bdd06685ec 100644 (file)
@@ -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;
index f7a046b12f73e2814ae2652ff1762c4d0ee0fbc9..aa71447c84c00ae9c1629be485f044257f0c9d7e 100644 (file)
@@ -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
 {
index f13a64855ae0413999e414c3544d091e00a979c5..c7746acfc44c0525a9c455a952ba8cdae238b128 100644 (file)
@@ -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() );
+}
index 44e5deefa2bba5688cff69c65096f53e8767f0a0..092730be1b6c0cd34ec09fe53c63d59cfa71e9ad 100644 (file)
@@ -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