]> git.sesse.net Git - vlc/blob - modules/gui/qt4/main_interface.hpp
Qt4 : Changes in the main interface:
[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
29 #include "qt4.hpp"
30 #include "ui/main_interface.h"
31 #include "util/qvlcframe.hpp"
32
33 #include <vlc_aout.h>
34
35 #include <QSystemTrayIcon>
36
37 class QSettings;
38 class QCloseEvent;
39 class QKeyEvent;
40 class QLabel;
41 class QEvent;
42 class InputManager;
43 class VideoWidget;
44 class BackgroundWidget;
45 class PlaylistWidget;
46 class VisualSelector;
47 class AdvControlsWidget;
48 class ControlsWidget;
49 class QMenu;
50 class QSize;
51
52 class MainInterface : public QVLCMW
53 {
54     Q_OBJECT;
55 public:
56     MainInterface( intf_thread_t *);
57     virtual ~MainInterface();
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 protected:
67     void resizeEvent( QResizeEvent * );
68     void dropEvent( QDropEvent *);
69     void dragEnterEvent( QDragEnterEvent * );
70     void dragMoveEvent( QDragMoveEvent * );
71     void dragLeaveEvent( QDragLeaveEvent * );
72     void closeEvent( QCloseEvent *);
73     //Ui::MainInterfaceUI ui;
74     friend class VolumeClickHandler;
75 private:
76     QSettings *settings;
77     QSize mainSize, addSize;
78     QSystemTrayIcon *sysTray;
79     QMenu *systrayMenu;
80     QString input_name;
81     QVBoxLayout *mainLayout;
82     ControlsWidget *controls;
83
84     bool need_components_update;
85     void calculateInterfaceSize();
86     void handleMainUi( QSettings* );
87     void handleSystray();
88     void doComponentsUpdate();
89     void createSystray();
90
91     /* Video */
92     VideoWidget         *videoWidget;
93     virtual void keyPressEvent( QKeyEvent *);
94     virtual void wheelEvent( QWheelEvent * );
95
96     bool embeddedPlaylistWasActive;
97     bool videoIsActive;
98     QSize savedVideoSize;
99
100
101     BackgroundWidget    *bgWidget;
102     VisualSelector      *visualSelector;
103     AdvControlsWidget      *advControls;
104     PlaylistWidget      *playlistWidget;
105
106     bool                 playlistEmbeddedFlag;
107     bool                 videoEmbeddedFlag;
108     bool                 alwaysVideoFlag;
109     bool                 advControlsEnabled;
110     bool                 visualSelectorEnabled;
111
112     InputManager        *main_input_manager;
113     input_thread_t      *p_input;    ///< Main input associated to the playlist
114
115     QLabel              *timeLabel;
116     QLabel              *speedLabel;
117     QLabel              *nameLabel;
118
119     void customEvent( QEvent *);
120 public slots:
121     void undockPlaylist();
122     void toggleMenus();
123     void playlist();
124     void toggleUpdateSystrayMenu();
125 private slots:
126     void setStatus( int );
127     void setName( QString );
128     void setVLCWindowsTitle( QString title = "" );
129     void setDisplay( float, int, int );
130     void updateOnTimer();
131     void visual();
132     void advanced();
133     void handleSystrayClick(  QSystemTrayIcon::ActivationReason );
134     void updateSystrayMenu( int );
135     void updateSystrayTooltipName( QString );
136     void updateSystrayTooltipStatus( int );
137     void showSpeedMenu( QPoint );
138     void showTimeMenu( QPoint );
139 };
140
141 #endif