]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/controller.hpp
Qt4: use QString or QByteArray instead of strdup()/free()
[vlc] / modules / gui / qt4 / components / controller.hpp
index d3eafc29ab8068bd7fb659df9e6bd1d95b4b439f..9c4f932da9efd844ba0bb048533de1ad25d78008 100644 (file)
@@ -21,8 +21,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#ifndef _CONTROLLER_H_
-#define _CONTROLLER_H_
+#ifndef QVLC_CONTROLLER_H_
+#define QVLC_CONTROLLER_H_
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 
 #include <QFrame>
 #include <QString>
-
-#define I_PLAY_TOOLTIP N_("Play\nIf the playlist is empty, open a media")
+#include <QSizeGrip>
 
 #define MAIN_TB1_DEFAULT "64;39;64;38;65"
-#define MAIN_TB2_DEFAULT "0-2;64;3;1;4;64;7;10;9;64-4;37;65;35-4"
+#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 I_PLAY_TOOLTIP N_("Play\nIf the playlist is empty, open a medium")
 
 class QPixmap;
 class QLabel;
@@ -51,7 +51,8 @@ class QBoxLayout;
 
 class QAbstractSlider;
 class QAbstractButton;
-class InputSlider;
+class SeekSlider;
+class QToolButton;
 
 class VolumeClickHandler;
 class WidgetListing;
@@ -64,8 +65,8 @@ typedef enum buttonType_e
     PLAY_BUTTON,
     STOP_BUTTON,
     OPEN_BUTTON,
-    PREVIOUS_BUTTON,
-    NEXT_BUTTON,
+    PREV_SLOW_BUTTON,
+    NEXT_FAST_BUTTON,
     SLOWER_BUTTON,
     FASTER_BUTTON,
     FULLSCREEN_BUTTON,
@@ -80,6 +81,12 @@ typedef enum buttonType_e
     SKIP_BACK_BUTTON,
     SKIP_FW_BUTTON,
     QUIT_BUTTON,
+    RANDOM_BUTTON,
+    LOOP_BUTTON,
+    INFO_BUTTON,
+    PREVIOUS_BUTTON,
+    NEXT_BUTTON,
+    OPEN_SUB_BUTTON,
     BUTTON_MAX,
 
     SPLITTER = 0x20,
@@ -90,6 +97,7 @@ typedef enum buttonType_e
     MENU_BUTTONS,
     TELETEXT_BUTTONS,
     ADVANCED_CONTROLLER,
+    PLAYBACK_BUTTONS,
     SPECIAL_MAX,
 
     WIDGET_SPACER = 0x40,
@@ -98,25 +106,34 @@ typedef enum buttonType_e
 } buttonType_e;
 
 
-static const QString nameL[BUTTON_MAX] = { "Play", "Stop", "Open",
-    "Previous", "Next", "Slower", "Faster", "Fullscreen", "De-Fullscreen",
-    "Extended panel", "Playlist", "Snapshot", "Record", "A->B Loop",
-    "Frame By Frame", "Trickplay Reverse", "Step backward" , "Step forward",
-    "Quit" };
-static const QString tooltipL[BUTTON_MAX] = { I_PLAY_TOOLTIP,
-    _("Stop playback"), _("Open a media"),
-    _("Previous media in the playlist"),
-    _("Next media in the playlist"), _("Slower"), _("Faster"),
-    _("Toggle the video in fullscreen"), _("Toggle the video out fullscreen"),
-    _("Show extended settings" ), _( "Show playlist" ), _( "Take a snapshot" ),
-    _( "Record" ), _( "Loop from point A to point B continuously." ),
-    _("Frame by frame"), _("Reverse"), _("Step backward"), _("Step forward"),
-    _("Quit") };
-static const QString iconL[BUTTON_MAX] ={ ":/play_b", ":/stop_b", ":/eject",
-    ":/previous_b", ":/next_b", ":/slower", ":/faster", ":/fullscreen",
-    ":/defullscreen", ":/extended", ":/playlist", ":/snapshot", ":/record",
-    ":/atob_nob", ":/frame", ":/reverse", ":/skip_back", ":/skip_fw",
-    ":/clear" };
+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")};
+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"),
+    N_("Next media in the playlist, skip forward when keep-pressed"), N_("Slower"), N_("Faster"),
+    N_("Toggle the video in fullscreen"), N_("Toggle the video out fullscreen"),
+    N_("Show extended settings" ), N_( "Show playlist" ),
+    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_("Change the loop and repeat modes"), N_("Information"),
+    N_("Previous media in the playlist"), N_("Next media in the playlist"),
+    N_("Open subtitles file")};
+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",
+    ":/buttons/playlist/repeat_all", ":/menu/info",
+    ":/toolbar/previous_b", ":/toolbar/next_b", "" };
 
 enum
 {
@@ -144,7 +161,7 @@ protected:
 
     AdvControlsWidget   *advControls;
 
-    void parseAndCreate( QString config, QBoxLayout *controlLayout );
+    void parseAndCreate( const QString& config, QBoxLayout *controlLayout );
 
     virtual void createAndAddWidget( QBoxLayout *controlLayout, int i_index,
                                      buttonType_e i_type, int i_option );
@@ -154,16 +171,17 @@ private:
     static void setupButton( QAbstractButton * );
     QFrame *discFrame();
     QFrame *telexFrame();
+    void applyAttributes( QToolButton *, bool b_flat, bool b_big );
 
+    QHBoxLayout         *buttonGroupLayout;
 protected slots:
     virtual void setStatus( int );
 
 signals:
-    void inputExists( bool ); /// This might be usefull in the IM ?
-    void inputPlaying( bool ); /// This might be usefull in the IM ?
+    void inputExists( bool ); /// This might be useful in the IM ?
+    void inputPlaying( bool ); /// This might be useful in the IM ?
     void inputIsRecordable( bool ); /// same ?
     void inputIsTrickPlayable( bool ); /// same ?
-    void sizeChanged();
 };
 
 /* Advanced Button Bar */
@@ -190,12 +208,17 @@ public:
     /* p_intf, advanced control visible or not, blingbling or not */
     ControlsWidget( intf_thread_t *_p_i, bool b_advControls,
                     QWidget *_parent = 0 );
-    virtual ~ControlsWidget();
+
+    void setGripVisible( bool b_visible )
+    { grip->setVisible( b_visible ); }
 
 protected:
     friend class MainInterface;
 
-    bool                 b_advancedVisible;
+    bool b_advancedVisible;
+
+private:
+    QSizeGrip *grip;
 
 protected slots:
     void toggleAdvanced();
@@ -204,23 +227,14 @@ signals:
     void advancedControlsToggled( bool );
 };
 
-/* on WIN32 hide() for fullscreen controller doesnt work, so it have to be
-   done by trick with setting the opacity of window */
-#ifdef WIN32
-    #define WIN32TRICK
-#endif
 
 /* to trying transparency with fullscreen controller on windows enable that */
 /* it can be enabled on-non windows systems,
    but it will be transparent only with composite manager */
-#ifndef WIN32
-    #define HAVE_TRANSPARENCY 1
-#else
-    #define HAVE_TRANSPARENCY 0
-#endif
+#define HAVE_TRANSPARENCY 1
 
 /* Default value of opacity for FS controller */
-#define DEFAULT_OPACITY 0.75
+#define DEFAULT_OPACITY 0.70
 
 /***********************************
  * Fullscreen controller
@@ -229,13 +243,16 @@ class FullscreenControllerWidget : public AbstractController
 {
     Q_OBJECT
 public:
-    FullscreenControllerWidget( intf_thread_t * );
+    FullscreenControllerWidget( intf_thread_t *, QWidget *_parent = 0  );
     virtual ~FullscreenControllerWidget();
 
     /* Vout */
     void fullscreenChanged( vout_thread_t *, bool b_fs, int i_timeout );
     void mouseChanged( vout_thread_t *, int i_mousex, int i_mousey );
 
+signals:
+    void keyPressed( QKeyEvent * );
+
 public slots:
     void setVoutList( vout_thread_t **, int );
 
@@ -244,6 +261,7 @@ protected:
 
     virtual void mouseMoveEvent( QMouseEvent *event );
     virtual void mousePressEvent( QMouseEvent *event );
+    virtual void mouseReleaseEvent( QMouseEvent *event );
     virtual void enterEvent( QEvent *event );
     virtual void leaveEvent( QEvent *event );
     virtual void keyPressEvent( QKeyEvent *event );
@@ -251,8 +269,9 @@ protected:
 private slots:
     void showFSC();
     void planHideFSC();
-    void hideFSC();
+    void hideFSC() { hide(); }
     void slowHideFSC();
+    void centerFSC( int );
 
 private:
     virtual void customEvent( QEvent *event );
@@ -262,6 +281,7 @@ private:
     QTimer *p_slowHideTimer;
     bool b_slow_hide_begin;
     int  i_slow_hide_timeout;
+    float f_opacity;
 #endif
 
     int i_mouse_last_x, i_mouse_last_y;
@@ -269,10 +289,6 @@ private:
     int i_screennumber;
     QRect screenRes;
 
-#ifdef WIN32TRICK
-    bool b_fscHidden;
-#endif
-
     /* List of vouts currently tracked */
     QList<vout_thread_t *> vout;