]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/controller.hpp
Qt: various string fixes and consistencies in the ui
[vlc] / modules / gui / qt4 / components / controller.hpp
index 8e2e5ad5c5f8415b39ee0b04b060cae1e69d6319..a8c145c0ec6147830e80e2b54f927affa980c9d0 100644 (file)
@@ -1,12 +1,10 @@
 /*****************************************************************************
- * interface_widgets.hpp : Custom widgets for the main interface
+ * Controller.hpp : Controller for the main interface
  ****************************************************************************
- * Copyright (C) 2006 the VideoLAN team
+ * Copyright (C) 2006-2008 the VideoLAN team
  * $Id$
  *
- * Authors: Clément Stenac <zorglub@videolan.org>
- *          Jean-Baptiste Kempf <jb@videolan.org>
- *          Rafaël Carré <funman@videolanorg>
+ * Authors: Jean-Baptiste Kempf <jb@videolan.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * 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"
 #endif
 
-#include <vlc_common.h>
-#include <vlc_interface.h>
-
 #include "qt4.hpp"
-#include "main_interface.hpp"
-#include "input_manager.hpp"
 
-#include <QWidget>
 #include <QFrame>
+#include <QString>
+
+#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 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;
+
+class QGridLayout;
 class QHBoxLayout;
+class QBoxLayout;
 
-/* Advanced Button Bar */
-class QPushButton;
-class AdvControlsWidget : public QFrame
+class QAbstractSlider;
+class QAbstractButton;
+class InputSlider;
+
+class VolumeClickHandler;
+class WidgetListing;
+
+class QSignalMapper;
+class QTimer;
+
+typedef enum buttonType_e
+{
+    PLAY_BUTTON,
+    STOP_BUTTON,
+    OPEN_BUTTON,
+    PREVIOUS_BUTTON,
+    NEXT_BUTTON,
+    SLOWER_BUTTON,
+    FASTER_BUTTON,
+    FULLSCREEN_BUTTON,
+    DEFULLSCREEN_BUTTON,
+    EXTENDED_BUTTON,
+    PLAYLIST_BUTTON,
+    SNAPSHOT_BUTTON,
+    RECORD_BUTTON,
+    ATOB_BUTTON,
+    FRAME_BUTTON,
+    REVERSE_BUTTON,
+    SKIP_BACK_BUTTON,
+    SKIP_FW_BUTTON,
+    QUIT_BUTTON,
+    BUTTON_MAX,
+
+    SPLITTER = 0x20,
+    INPUT_SLIDER,
+    TIME_LABEL,
+    VOLUME,
+    VOLUME_SPECIAL,
+    MENU_BUTTONS,
+    TELETEXT_BUTTONS,
+    ADVANCED_CONTROLLER,
+    SPECIAL_MAX,
+
+    WIDGET_SPACER = 0x40,
+    WIDGET_SPACER_EXTEND,
+    WIDGET_MAX,
+} 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 medium"),
+    _("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" };
+
+enum
 {
+   WIDGET_NORMAL = 0x0,
+   WIDGET_FLAT   = 0x1,
+   WIDGET_BIG    = 0x2,
+   WIDGET_SHINY  = 0x4,
+};
+
+class AdvControlsWidget;
+class AbstractController : public QFrame
+{
+    friend class WidgetListing; /* For ToolBar Edition HACKS */
+
     Q_OBJECT
 public:
-    AdvControlsWidget( intf_thread_t *, bool );
-    virtual ~AdvControlsWidget();
+    AbstractController( intf_thread_t  *_p_i, QWidget *_parent = 0 );
 
-    void enableInput( bool );
-    void enableVideo( bool );
+protected:
+    intf_thread_t       *p_intf;
 
-private:
-    intf_thread_t *p_intf;
-    QPushButton *recordButton, *ABButton;
-    QPushButton *snapshotButton, *frameButton;
+    QSignalMapper       *toolbarActionsMapper;
+    QHBoxLayout         *controlLayout;
+    /* Change to BoxLayout if both dir are needed */
 
-    static mtime_t timeA, timeB;
-    int i_last_input_id;
+    AdvControlsWidget   *advControls;
 
-private slots:
-    void snapshot();
-#if 0
-    void frame();
-#endif
-    void fromAtoB();
-    void record();
-    void AtoBLoop( float, int, int );
-    void setIcon();
+    void parseAndCreate( QString config, QBoxLayout *controlLayout );
+
+    virtual void createAndAddWidget( QBoxLayout *controlLayout, int i_index,
+                                     buttonType_e i_type, int i_option );
+
+    QWidget *createWidget( buttonType_e, int options = WIDGET_NORMAL );
+private:
+    static void setupButton( QAbstractButton * );
+    QFrame *discFrame();
+    QFrame *telexFrame();
+
+protected slots:
+    virtual void setStatus( int );
 
 signals:
-    void timeChanged();
+    void inputExists( bool ); /// This might be usefull in the IM ?
+    void inputPlaying( bool ); /// This might be usefull in the IM ?
+    void inputIsRecordable( bool ); /// same ?
+    void inputIsTrickPlayable( bool ); /// same ?
+    void sizeChanged();
 };
 
-/* Button Bar */
-class InputSlider;
-class QSlider;
-class QGridLayout;
-class VolumeClickHandler;
-class SoundSlider;
-class QAbstractSlider;
-class QToolButton;
+/* Advanced Button Bar */
+class AdvControlsWidget : public AbstractController
+{
+    Q_OBJECT
+public:
+    AdvControlsWidget( intf_thread_t *, QWidget *_parent = 0 );
+};
 
-class ControlsWidget : public QFrame
+/* Slider Bar */
+class InputControlsWidget : public AbstractController
+{
+    Q_OBJECT
+public:
+    InputControlsWidget( intf_thread_t * , QWidget *_parent = 0 );
+};
+
+/* Button Bar */
+class ControlsWidget : public AbstractController
 {
     Q_OBJECT
 public:
     /* p_intf, advanced control visible or not, blingbling or not */
-    ControlsWidget( intf_thread_t *_p_i, MainInterface *_p_mi,
-        bool b_advControls, bool b_shiny, bool b_fsCreation = false);
+    ControlsWidget( intf_thread_t *_p_i, bool b_advControls,
+                    QWidget *_parent = 0 );
     virtual ~ControlsWidget();
 
-    QPushButton *playlistButton;
-    void setStatus( int );
-    void enableInput( bool );
-public slots:
-    void setNavigation( int );
 protected:
     friend class MainInterface;
-    friend class VolumeClickHandler;
-protected:
-    intf_thread_t       *p_intf;
-    QWidget             *discFrame;
-    QWidget             *telexFrame;
-    QGridLayout         *controlLayout;
-    InputSlider         *slider;
-    QPushButton         *prevSectionButton, *nextSectionButton, *menuButton;
-    QPushButton         *playButton, *fullscreenButton, *extSettingsButton;
-    QPushButton         *telexTransparent, *telexOn;
-    QSpinBox            *telexPage;
-    QToolButton         *slowerButton, *fasterButton;
-    QHBoxLayout         *controlButLayout;
-    AdvControlsWidget   *advControls;
-    QLabel              *volMuteLabel;
-    QAbstractSlider     *volumeSlider;
-    VolumeClickHandler  *hVolLabel;
 
     bool                 b_advancedVisible;
-    bool                 b_telexTransparent;
-    bool                 b_telexEnabled;
+
 protected slots:
-    void play();
-    void stop();
-    void prev();
-    void next();
-    void updateVolume( int );
-    void updateVolume( void );
-    void updateInput();
-    void fullscreen();
-    void extSettings();
-    void faster();
-    void slower();
     void toggleAdvanced();
-    void toggleTeletext();
-    void toggleTeletextTransparency();
-    void enableTeletext( bool );
-    void enableVideo( bool );
+
 signals:
     void advancedControlsToggled( bool );
 };
@@ -166,25 +224,22 @@ signals:
 /***********************************
  * Fullscreen controller
  ***********************************/
-class FullscreenControllerWidget : public ControlsWidget
+class FullscreenControllerWidget : public AbstractController
 {
     Q_OBJECT
 public:
-    FullscreenControllerWidget( intf_thread_t *, MainInterface*, bool, bool );
+    FullscreenControllerWidget( intf_thread_t * );
     virtual ~FullscreenControllerWidget();
 
-    /* */
-    void attachVout( vout_thread_t *p_vout );
-    void detachVout();
+    /* Vout */
     void fullscreenChanged( vout_thread_t *, bool b_fs, int i_timeout );
-    vout_thread_t *p_vout;
+    void mouseChanged( vout_thread_t *, int i_mousex, int i_mousey );
 
-    int i_mouse_last_move_x;
-    int i_mouse_last_move_y;
+public slots:
+    void setVoutList( vout_thread_t **, int );
 
 protected:
     friend class MainInterface;
-    friend class VolumeClickHandler;
 
     virtual void mouseMoveEvent( QMouseEvent *event );
     virtual void mousePressEvent( QMouseEvent *event );
@@ -196,35 +251,36 @@ private slots:
     void showFSC();
     void planHideFSC();
     void hideFSC();
-
     void slowHideFSC();
 
-
 private:
+    virtual void customEvent( QEvent *event );
+
     QTimer *p_hideTimer;
 #if HAVE_TRANSPARENCY
     QTimer *p_slowHideTimer;
+    bool b_slow_hide_begin;
+    int  i_slow_hide_timeout;
 #endif
 
-    int i_mouse_last_x;
-    int i_mouse_last_y;
-
+    int i_mouse_last_x, i_mouse_last_y;
     bool b_mouse_over;
-
-    bool b_slow_hide_begin;
-    int  i_slow_hide_timeout;
+    int i_screennumber;
+    QRect screenRes;
 
 #ifdef WIN32TRICK
     bool b_fscHidden;
 #endif
 
-    virtual void customEvent( QEvent *event );
-
+    /* List of vouts currently tracked */
+    QList<vout_thread_t *> vout;
 
     /* Shared variable between FSC and VLC (protected by a lock) */
     vlc_mutex_t lock;
     bool        b_fullscreen;
     int         i_hide_timeout;  /* FSC hiding timeout, same as mouse hiding timeout */
+    int i_mouse_last_move_x;
+    int i_mouse_last_move_y;
 };
 
 #endif