1 /*****************************************************************************
2 * main_interface.hpp : Main Interface
3 ****************************************************************************
4 * Copyright (C) 2006-2007 the VideoLAN team
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 _MAIN_INTERFACE_H_
26 #define _MAIN_INTERFACE_H_
29 #include "util/qvlcframe.hpp"
33 #include <QSystemTrayIcon>
42 class BackgroundWidget;
45 class AdvControlsWidget;
47 class SpeedControlWidget;
53 CONTROLS_HIDDEN = 0x0,
54 CONTROLS_VISIBLE = 0x1,
55 CONTROLS_ADVANCED = 0x2
58 class MainInterface : public QVLCMW
62 MainInterface( intf_thread_t *);
63 virtual ~MainInterface();
65 void *requestVideo( vout_thread_t *p_nvout, int *pi_x,
66 int *pi_y, unsigned int *pi_width,
67 unsigned int *pi_height );
68 void releaseVideo( void * );
69 int controlVideo( void *p_window, int i_query, va_list args );
71 QSystemTrayIcon *getSysTray() { return sysTray; };
72 QMenu *getSysTrayMenu() { return systrayMenu; };
73 int getControlsVisibilityStatus();
75 void resizeEvent( QResizeEvent * );
76 void dropEvent( QDropEvent *);
77 void dragEnterEvent( QDragEnterEvent * );
78 void dragMoveEvent( QDragMoveEvent * );
79 void dragLeaveEvent( QDragLeaveEvent * );
80 void closeEvent( QCloseEvent *);
82 friend class VolumeClickHandler;
85 QSize mainSize, addSize;
86 QSystemTrayIcon *sysTray;
89 QVBoxLayout *mainLayout;
90 ControlsWidget *controls;
91 QMenu *speedControlMenu;
92 SpeedControlWidget *speedControl;
94 bool need_components_update;
96 void calculateInterfaceSize();
97 void handleMainUi( QSettings* );
99 void doComponentsUpdate();
100 void createSystray();
103 VideoWidget *videoWidget;
104 virtual void keyPressEvent( QKeyEvent *);
105 virtual void wheelEvent( QWheelEvent * );
107 bool embeddedPlaylistWasActive;
109 QSize savedVideoSize;
111 BackgroundWidget *bgWidget;
112 VisualSelector *visualSelector;
113 PlaylistWidget *playlistWidget;
116 bool videoEmbeddedFlag;
117 bool alwaysVideoFlag;
118 bool visualSelectorEnabled;
119 bool notificationEnabled;
121 InputManager *main_input_manager;
122 input_thread_t *p_input; ///< Main input associated to the playlist
129 bool b_remainingTime; /* showing elapsed or remaining time */
131 void customEvent( QEvent *);
133 void undockPlaylist();
135 void togglePlaylist();
136 void toggleUpdateSystrayMenu();
137 void toggleAdvanced();
140 void updateOnTimer();
142 void setStatus( int );
144 void setName( QString );
145 void setVLCWindowsTitle( QString title = "" );
146 void setDisplayPosition( float, int, int );
147 void toggleTimeDisplay();
151 void handleSystrayClick( QSystemTrayIcon::ActivationReason );
152 void updateSystrayTooltipName( QString );
153 void updateSystrayTooltipStatus( int );
154 void showSpeedMenu( QPoint );
156 void askVideoToHide();