~ubuntu-branches/ubuntu/natty/vlc/natty

« back to all changes in this revision

Viewing changes to modules/gui/qt4/main_interface.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2010-06-25 01:09:16 UTC
  • mfrom: (1.1.30 upstream)
  • Revision ID: james.westby@ubuntu.com-20100625010916-asxhep2mutg6g6pd
Tags: 1.1.0-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - build and install the libx264 plugin
  - add Xb-Npp header to vlc package
  - Add apport hook to include more vlc dependencies in bug reports
* Drop xulrunner patches.
* Drop 502_xulrunner_191.diff.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 * main_interface.hpp : Main Interface
3
3
 ****************************************************************************
4
 
 * Copyright (C) 2006-2008 the VideoLAN team
5
 
 * $Id: c9af6ef56832ebeb05f3bd74ba9361b43afda70f $
 
4
 * Copyright (C) 2006-2010 VideoLAN and AUTHORS
 
5
 * $Id: e2a59852f1bed0494d9d12aa2d2a5955c2e580e2 $
6
6
 *
7
7
 * Authors: Clément Stenac <zorglub@videolan.org>
8
8
 *          Jean-Baptiste Kempf <jb@videolan.org>
28
28
#include "qt4.hpp"
29
29
 
30
30
#include "util/qvlcframe.hpp"
31
 
#include "components/preferences_widgets.hpp" /* First Start */
 
31
 
 
32
#ifdef WIN32
 
33
 #include <vlc_windows_interfaces.h>
 
34
#endif
32
35
 
33
36
#include <QSystemTrayIcon>
 
37
#include <QStackedWidget>
34
38
 
35
39
class QSettings;
36
40
class QCloseEvent;
47
51
class InputControlsWidget;
48
52
class FullscreenControllerWidget;
49
53
class SpeedControlWidget;
 
54
class QVBoxLayout;
50
55
class QMenu;
51
56
class QSize;
52
57
 
53
58
enum {
54
 
    CONTROLS_VISIBLE = 0x1,
55
 
    CONTROLS_HIDDEN = 0x2,
 
59
    CONTROLS_VISIBLE  = 0x1,
 
60
    CONTROLS_HIDDEN   = 0x2,
56
61
    CONTROLS_ADVANCED = 0x4,
57
62
};
58
63
 
59
 
typedef enum pl_dock_e {
60
 
    PL_UNDOCKED,
61
 
    PL_BOTTOM,
62
 
    PL_RIGHT,
63
 
    PL_LEFT
64
 
} pl_dock_e;
65
64
 
66
65
class MainInterface : public QVLCMW
67
66
{
68
 
    Q_OBJECT;
 
67
    Q_OBJECT
69
68
 
70
69
    friend class PlaylistWidget;
71
70
 
72
71
public:
 
72
    /* tors */
73
73
    MainInterface( intf_thread_t *);
74
74
    virtual ~MainInterface();
75
75
 
76
76
    /* Video requests from core */
77
 
    WId getVideo( vout_thread_t *p_nvout, int *pi_x, int *pi_y,
 
77
    WId  getVideo( int *pi_x, int *pi_y,
78
78
                  unsigned int *pi_width, unsigned int *pi_height );
79
 
    void releaseVideo( void  );
80
 
    int controlVideo( int i_query, va_list args );
 
79
    void releaseVideo( void );
 
80
    int  controlVideo( int i_query, va_list args );
81
81
 
82
82
    /* Getters */
83
 
    QSystemTrayIcon *getSysTray() { return sysTray; };
84
 
    QMenu *getSysTrayMenu() { return systrayMenu; };
 
83
#ifndef HAVE_MAEMO
 
84
    QSystemTrayIcon *getSysTray() { return sysTray; }
 
85
    QMenu *getSysTrayMenu() { return systrayMenu; }
 
86
#endif
85
87
    int getControlsVisibilityStatus();
86
 
 
87
 
    /* Sizehint() */
88
 
    virtual QSize sizeHint() const;
 
88
    bool isPlDocked() { return ( b_plDocked != false ); }
 
89
    bool isInterfaceFullScreen() { return b_interfaceFullScreen; }
89
90
 
90
91
protected:
91
92
    void dropEventPlay( QDropEvent *, bool);
 
93
#ifdef WIN32
 
94
    virtual bool winEvent( MSG *, long * );
 
95
#endif
92
96
    virtual void dropEvent( QDropEvent *);
93
97
    virtual void dragEnterEvent( QDragEnterEvent * );
94
98
    virtual void dragMoveEvent( QDragMoveEvent * );
95
99
    virtual void dragLeaveEvent( QDragLeaveEvent * );
96
100
    virtual void closeEvent( QCloseEvent *);
97
 
    virtual void customEvent( QEvent *);
98
101
    virtual void keyPressEvent( QKeyEvent *);
99
102
    virtual void wheelEvent( QWheelEvent * );
100
 
    virtual void resizeEvent( QResizeEvent * event );
101
103
 
102
104
private:
 
105
    /* Main Widgets Creation */
 
106
    void createMainWidget( QSettings* );
 
107
    void createStatusBar();
 
108
    void createPlaylist();
 
109
 
 
110
    /* Systray */
 
111
    void createSystray();
 
112
    void initSystray();
 
113
    void handleSystray();
 
114
 
 
115
    /* Central StackWidget Management */
 
116
    void showTab( QWidget *);
 
117
    void showVideo();
 
118
    void restoreStackOldWidget();
 
119
 
 
120
    /* */
 
121
    void setMinimalView( bool );
 
122
    void setInterfaceFullScreen( bool );
 
123
 
 
124
    /* */
103
125
    QSettings           *settings;
 
126
#ifndef HAVE_MAEMO
104
127
    QSystemTrayIcon     *sysTray;
105
128
    QMenu               *systrayMenu;
 
129
#endif
 
130
 
106
131
    QString              input_name;
107
132
    QVBoxLayout         *mainLayout;
108
133
    ControlsWidget      *controls;
109
134
    InputControlsWidget *inputC;
110
135
    FullscreenControllerWidget *fullscreenControls;
111
136
 
112
 
    void createMainWidget( QSettings* );
113
 
    void createStatusBar();
114
 
 
115
 
    void askForPrivacy();
116
 
    int  privacyDialog( QList<ConfigControl *> *controls );
117
 
 
118
 
    /* Systray */
119
 
    void handleSystray();
120
 
    void createSystray();
121
 
    void initSystray();
122
 
 
123
 
 
124
 
    /* Video */
 
137
    /* Widgets */
 
138
    QStackedWidget      *stackCentralW;
 
139
 
125
140
    VideoWidget         *videoWidget;
126
 
 
127
141
    BackgroundWidget    *bgWidget;
128
 
    VisualSelector      *visualSelector;
129
142
    PlaylistWidget      *playlistWidget;
130
 
 
131
 
    bool                 videoIsActive;       ///< Having a video now / THEMIM->hasV
132
 
    bool                 videoEmbeddedFlag;   ///< Want an external Video Window
133
 
    bool                 playlistVisible;     ///< Is the playlist visible ?
134
 
    bool                 visualSelectorEnabled;
135
 
    bool                 notificationEnabled; /// Systray Notifications
136
 
    bool                 bgWasVisible;
137
 
    bool                 b_keep_size;         ///< persistent resizeable window
138
 
    QSize                mainBasedSize;       ///< based Wnd (normal mode only)
139
 
    QSize                mainVideoSize;       ///< Wnd with video (all modes)
140
 
    int                  i_visualmode;        ///< Visual Mode
141
 
    pl_dock_e            i_pl_dock;
142
 
    bool                 isDocked() { return ( i_pl_dock != PL_UNDOCKED ); }
143
 
    int                  i_bg_height;         ///< Save height of bgWidget
144
 
    bool                 b_shouldHide;
 
143
    //VisualSelector      *visualSelector;
145
144
 
146
145
    /* Status Bar */
147
146
    QLabel              *nameLabel;
148
147
    QLabel              *cryptedLabel;
149
148
 
 
149
    /* Status and flags */
 
150
    QWidget             *stackCentralOldWidget;
 
151
 
 
152
    QMap<QWidget *, QSize> stackWidgetsSizes;
 
153
 
 
154
    /* Flags */
 
155
    bool                 b_notificationEnabled; /// Systray Notifications
 
156
    bool                 b_autoresize;          ///< persistent resizeable window
 
157
    bool                 b_videoEmbedded;       ///< Want an external Video Window
 
158
    bool                 b_videoFullScreen;     ///< --fullscreen
 
159
    bool                 b_videoOnTop;          ///< --video-on-top
 
160
    bool                 b_hideAfterCreation;
 
161
    bool                 b_minimalView;         ///< Minimal video
 
162
    bool                 b_interfaceFullScreen;
 
163
 
 
164
    /* States */
 
165
    bool                 playlistVisible;       ///< Is the playlist visible ?
 
166
//    bool                 videoIsActive;       ///< Having a video now / THEMIM->hasV
 
167
//    bool                 b_visualSelectorEnabled;
 
168
    bool                 b_plDocked;            ///< Is the playlist docked ?
 
169
 
 
170
 
 
171
#ifdef WIN32
 
172
    HIMAGELIST himl;
 
173
    LPTASKBARLIST3 p_taskbl;
 
174
    UINT taskbar_wmsg;
 
175
    void createTaskBarButtons();
 
176
#endif
 
177
 
150
178
public slots:
151
 
    void undockPlaylist();
152
 
    void dockPlaylist( pl_dock_e i_pos = PL_BOTTOM );
 
179
    void dockPlaylist( bool b_docked = true );
153
180
    void toggleMinimalView( bool );
154
181
    void togglePlaylist();
 
182
#ifndef HAVE_MAEMO
155
183
    void toggleUpdateSystrayMenu();
156
 
    void toggleAdvanced();
157
 
    void toggleFullScreen();
 
184
#endif
 
185
    void toggleAdvancedButtons();
 
186
    void toggleInterfaceFullScreen();
158
187
    void toggleFSC();
 
188
 
159
189
    void popupMenu( const QPoint& );
 
190
    void changeThumbbarButtons( int );
160
191
 
161
192
    /* Manage the Video Functions from the vout threads */
162
 
    void getVideoSlot( WId *p_id, vout_thread_t *, int *pi_x, int *pi_y,
 
193
    void getVideoSlot( WId *p_id, int *pi_x, int *pi_y,
163
194
                       unsigned *pi_width, unsigned *pi_height );
164
195
    void releaseVideoSlot( void );
165
196
 
167
198
    void debug();
168
199
    void destroyPopupMenu();
169
200
    void recreateToolbars();
170
 
    void doComponentsUpdate();
171
 
    void setName( QString );
172
 
    void setVLCWindowsTitle( QString title = "" );
 
201
    void setName( const QString& );
 
202
    void setVLCWindowsTitle( const QString& title = "" );
173
203
#if 0
174
204
    void visual();
175
205
#endif
 
206
#ifndef HAVE_MAEMO
176
207
    void handleSystrayClick( QSystemTrayIcon::ActivationReason );
177
 
    void updateSystrayTooltipName( QString );
 
208
    void updateSystrayTooltipName( const QString& );
178
209
    void updateSystrayTooltipStatus( int );
179
 
 
 
210
#endif
180
211
    void showCryptedLabel( bool );
 
212
 
 
213
    void handleKeyPress( QKeyEvent * );
 
214
 
 
215
    void showBuffering( float );
 
216
 
 
217
    void resizeStack( int w, int h ) {
 
218
        if( !isFullScreen() && !isMaximized() )
 
219
            if( b_minimalView ) resize( w, h ); /* Oh yes, it shouldn't
 
220
                                   be possible that size() - stackCentralW->size() < 0
 
221
                                   since stackCentralW is contained in the QMW... */
 
222
            else resize( size() - stackCentralW->size() + QSize( w, h ) );
 
223
        debug(); }
 
224
 
 
225
    void setVideoSize( unsigned int, unsigned int );
 
226
    void setVideoFullScreen( bool );
 
227
    void setVideoOnTop( bool );
 
228
 
181
229
signals:
182
 
    void askGetVideo( WId *p_id, vout_thread_t *, int *pi_x, int *pi_y,
 
230
    void askGetVideo( WId *p_id, int *pi_x, int *pi_y,
183
231
                      unsigned *pi_width, unsigned *pi_height );
184
232
    void askReleaseVideo( );
185
233
    void askVideoToResize( unsigned int, unsigned int );
186
 
    void askUpdate();
 
234
    void askVideoSetFullScreen( bool );
 
235
    void askVideoOnTop( bool );
187
236
    void minimalViewToggled( bool );
188
237
    void fullscreenInterfaceToggled( bool );
 
238
 
189
239
};
190
240
 
191
241
#endif