Win7: add support for the taskbar's "oh, look, it's shiny" buttons. We need prettier...
[vlc/solaris.git] / modules / gui / qt4 / main_interface.hpp
blobe2458c957efa3480971a49bd9313465b8c4fc2c3
1 /*****************************************************************************
2 * main_interface.hpp : Main Interface
3 ****************************************************************************
4 * Copyright (C) 2006-2008 the VideoLAN team
5 * $Id$
7 * Authors: Clément Stenac <zorglub@videolan.org>
8 * Jean-Baptiste Kempf <jb@videolan.org>
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.
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.
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 *****************************************************************************/
25 #ifndef QVLC_MAIN_INTERFACE_H_
26 #define QVLC_MAIN_INTERFACE_H_
28 #include "qt4.hpp"
30 #include "util/qvlcframe.hpp"
31 #include "components/preferences_widgets.hpp" /* First Start */
32 #ifdef WIN32
33 #include <vlc_windows_interfaces.h>
34 #endif
36 #include <QSystemTrayIcon>
38 class QSettings;
39 class QCloseEvent;
40 class QKeyEvent;
41 class QLabel;
42 class QEvent;
43 class InputManager;
44 class VideoWidget;
45 class BackgroundWidget;
46 class PlaylistWidget;
47 class VisualSelector;
48 class AdvControlsWidget;
49 class ControlsWidget;
50 class InputControlsWidget;
51 class FullscreenControllerWidget;
52 class SpeedControlWidget;
53 class QMenu;
54 class QSize;
56 enum {
57 CONTROLS_VISIBLE = 0x1,
58 CONTROLS_HIDDEN = 0x2,
59 CONTROLS_ADVANCED = 0x4,
62 typedef enum pl_dock_e {
63 PL_UNDOCKED,
64 PL_BOTTOM,
65 PL_RIGHT,
66 PL_LEFT
67 } pl_dock_e;
69 class MainInterface : public QVLCMW
71 Q_OBJECT;
73 friend class PlaylistWidget;
75 public:
76 MainInterface( intf_thread_t *);
77 virtual ~MainInterface();
79 /* Video requests from core */
80 WId getVideo( int *pi_x, int *pi_y,
81 unsigned int *pi_width, unsigned int *pi_height );
82 void releaseVideo( void );
83 int controlVideo( int i_query, va_list args );
85 /* Getters */
86 QSystemTrayIcon *getSysTray() { return sysTray; };
87 QMenu *getSysTrayMenu() { return systrayMenu; };
88 int getControlsVisibilityStatus();
90 /* Sizehint() */
91 virtual QSize sizeHint() const;
93 protected:
94 void dropEventPlay( QDropEvent *, bool);
95 virtual void dropEvent( QDropEvent *);
96 virtual void dragEnterEvent( QDragEnterEvent * );
97 virtual void dragMoveEvent( QDragMoveEvent * );
98 virtual void dragLeaveEvent( QDragLeaveEvent * );
99 virtual void closeEvent( QCloseEvent *);
100 virtual void customEvent( QEvent *);
101 virtual void keyPressEvent( QKeyEvent *);
102 virtual void wheelEvent( QWheelEvent * );
103 virtual void resizeEvent( QResizeEvent * event );
105 private:
106 QSettings *settings;
107 QSystemTrayIcon *sysTray;
108 QMenu *systrayMenu;
109 QString input_name;
110 QGridLayout *mainLayout;
111 ControlsWidget *controls;
112 InputControlsWidget *inputC;
113 FullscreenControllerWidget *fullscreenControls;
115 void createMainWidget( QSettings* );
116 void createStatusBar();
118 void askForPrivacy();
119 int privacyDialog( QList<ConfigControl *> *controls );
121 /* Systray */
122 void handleSystray();
123 void createSystray();
124 void initSystray();
127 /* Video */
128 VideoWidget *videoWidget;
130 BackgroundWidget *bgWidget;
131 VisualSelector *visualSelector;
132 PlaylistWidget *playlistWidget;
134 bool videoIsActive; ///< Having a video now / THEMIM->hasV
135 bool videoEmbeddedFlag; ///< Want an external Video Window
136 bool playlistVisible; ///< Is the playlist visible ?
137 bool visualSelectorEnabled;
138 bool notificationEnabled; /// Systray Notifications
139 bool bgWasVisible;
140 bool b_keep_size; ///< persistent resizeable window
141 QSize mainBasedSize; ///< based Wnd (normal mode only)
142 QSize mainVideoSize; ///< Wnd with video (all modes)
143 int i_visualmode; ///< Visual Mode
144 pl_dock_e i_pl_dock;
145 bool isDocked() { return ( i_pl_dock != PL_UNDOCKED ); }
146 int i_bg_height; ///< Save height of bgWidget
147 bool b_shouldHide;
149 /* Status Bar */
150 QLabel *nameLabel;
151 QLabel *cryptedLabel;
153 #ifdef WIN32
154 HIMAGELIST himl;
155 LPTASKBARLIST3 p_taskbl;
156 #endif
158 public slots:
159 void undockPlaylist();
160 void dockPlaylist( pl_dock_e i_pos = PL_BOTTOM );
161 void toggleMinimalView( bool );
162 void togglePlaylist();
163 void toggleUpdateSystrayMenu();
164 void toggleAdvanced();
165 void toggleFullScreen();
166 void toggleFSC();
167 void popupMenu( const QPoint& );
168 void changeThumbbarButtons( int );
170 /* Manage the Video Functions from the vout threads */
171 void getVideoSlot( WId *p_id, int *pi_x, int *pi_y,
172 unsigned *pi_width, unsigned *pi_height );
173 void releaseVideoSlot( void );
175 private slots:
176 void debug();
177 void destroyPopupMenu();
178 void recreateToolbars();
179 void doComponentsUpdate();
180 void setName( const QString& );
181 void setVLCWindowsTitle( const QString& title = "" );
182 #if 0
183 void visual();
184 #endif
185 void handleSystrayClick( QSystemTrayIcon::ActivationReason );
186 void updateSystrayTooltipName( const QString& );
187 void updateSystrayTooltipStatus( int );
189 void showCryptedLabel( bool );
191 void handleKeyPress( QKeyEvent * );
193 signals:
194 void askGetVideo( WId *p_id, int *pi_x, int *pi_y,
195 unsigned int *pi_width, unsigned int *pi_height );
196 void askReleaseVideo( );
197 void askVideoToResize( unsigned int, unsigned int );
198 void askVideoSetFullScreen( bool );
199 void askUpdate();
200 void minimalViewToggled( bool );
201 void fullscreenInterfaceToggled( bool );
204 #endif