]> git.sesse.net Git - vlc/blob - modules/gui/qt4/main_interface.hpp
321534006847f8e6e3ad340cdf38eca39062813e
[vlc] / modules / gui / qt4 / main_interface.hpp
1 /*****************************************************************************
2  * main_interface.hpp : Main Interface
3  ****************************************************************************
4  * Copyright (C) 2006-2007 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *          Jean-Baptiste Kempf <jb@videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #ifndef _MAIN_INTERFACE_H_
26 #define _MAIN_INTERFACE_H_
27
28 #include "qt4.hpp"
29 #include "util/qvlcframe.hpp"
30
31 #include <vlc_aout.h>
32
33 #include <QSystemTrayIcon>
34
35 class QSettings;
36 class QCloseEvent;
37 class QKeyEvent;
38 class QLabel;
39 class QEvent;
40 class InputManager;
41 class VideoWidget;
42 class BackgroundWidget;
43 class PlaylistWidget;
44 class VisualSelector;
45 class AdvControlsWidget;
46 class ControlsWidget;
47 class SpeedControlWidget;
48 class QMenu;
49 class QSize;
50
51 class MainInterface : public QVLCMW
52 {
53     Q_OBJECT;
54 public:
55     MainInterface( intf_thread_t *);
56     virtual ~MainInterface();
57
58     void *requestVideo( vout_thread_t *p_nvout, int *pi_x,
59                         int *pi_y, unsigned int *pi_width,
60                         unsigned int *pi_height );
61     void releaseVideo( void * );
62     int controlVideo( void *p_window, int i_query, va_list args );
63
64     QSystemTrayIcon *getSysTray() { return sysTray; };
65     QMenu *getSysTrayMenu() { return systrayMenu; };
66     int getControlsVisibilityStatus();
67 protected:
68     void resizeEvent( QResizeEvent * );
69     void dropEvent( QDropEvent *);
70     void dragEnterEvent( QDragEnterEvent * );
71     void dragMoveEvent( QDragMoveEvent * );
72     void dragLeaveEvent( QDragLeaveEvent * );
73     void closeEvent( QCloseEvent *);
74  
75     friend class VolumeClickHandler;
76 private:
77     QSettings           *settings;
78     QSize                mainSize, addSize;
79     QSystemTrayIcon     *sysTray;
80     QMenu               *systrayMenu;
81     QString              input_name;
82     QVBoxLayout         *mainLayout;
83     ControlsWidget      *controls;
84     QMenu                               *speedControlMenu;
85     SpeedControlWidget  *speedControl;
86
87     bool                 need_components_update;
88
89     void calculateInterfaceSize();
90     void handleMainUi( QSettings* );
91     void handleSystray();
92     void doComponentsUpdate();
93     void createSystray();
94
95     /* Video */
96     VideoWidget         *videoWidget;
97     virtual void keyPressEvent( QKeyEvent *);
98     virtual void wheelEvent( QWheelEvent * );
99
100     bool                 embeddedPlaylistWasActive;
101     bool                 videoIsActive;
102     QSize                savedVideoSize;
103
104     BackgroundWidget    *bgWidget;
105     VisualSelector      *visualSelector;
106     PlaylistWidget      *playlistWidget;
107
108     bool                 playlistEmbeddedFlag;
109     bool                 videoEmbeddedFlag;
110     bool                 alwaysVideoFlag;
111     bool                 visualSelectorEnabled;
112     bool                 notificationEnabled;
113
114     InputManager        *main_input_manager;
115     input_thread_t      *p_input;    ///< Main input associated to the playlist
116
117     QLabel              *timeLabel;
118     QLabel              *speedLabel;
119     QLabel              *nameLabel;
120     
121     bool                 b_remainingTime;
122
123     void customEvent( QEvent *);
124 public slots:
125     void undockPlaylist();
126     void toggleMenus();
127     void togglePlaylist();
128     void toggleUpdateSystrayMenu();
129     void toggleAdvanced();
130 private slots:
131     void updateOnTimer();
132
133     void setStatus( int );
134     void setRate( int );
135     void setName( QString );
136     void setVLCWindowsTitle( QString title = "" );
137     void setDisplayPosition( float, int, int );
138     void toggleTimeDisplay();
139     void setElapsedTime();
140     void setRemainTime();
141 #if 0
142     void visual();
143 #endif
144     void handleSystrayClick( QSystemTrayIcon::ActivationReason );
145     void updateSystrayMenu( int );
146     void updateSystrayTooltipName( QString );
147     void updateSystrayTooltipStatus( int );
148     void showSpeedMenu( QPoint );
149     void showTimeMenu( QPoint );
150 };
151
152 #endif