1 /*****************************************************************************
2 * main_interface.hpp : Main Interface
3 ****************************************************************************
4 * Copyright (C) 2006-2007 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@videolan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #ifndef _MAIN_INTERFACE_H_
25 #define _MAIN_INTERFACE_H_
29 #include "ui/main_interface.h"
30 #include "util/qvlcframe.hpp"
33 #include <QSystemTrayIcon>
44 class BackgroundWidget;
46 class VolumeClickHandler;
51 class MainInterface : public QVLCMW
55 MainInterface( intf_thread_t *);
56 virtual ~MainInterface();
57 void *requestVideo( vout_thread_t *p_nvout, int *pi_x,
58 int *pi_y, unsigned int *pi_width,
59 unsigned int *pi_height );
60 void releaseVideo( void *);
61 int controlVideo( void *p_window, int i_query, va_list args );
62 void setVLCWindowsTitle( QString title = "" );
64 QSystemTrayIcon *getSysTray() { return sysTray; };
65 QMenu *getSysTrayMenu() { return systrayMenu; };
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;
77 QSize mainSize, addSize;
78 QSystemTrayIcon *sysTray;
81 bool need_components_update;
82 void calculateInterfaceSize();
83 void handleMainUi( QSettings* );
85 void doComponentsUpdate();
86 void createSystrayMenu();
89 VideoWidget *videoWidget;
90 virtual void keyPressEvent( QKeyEvent *);
91 virtual void wheelEvent( QWheelEvent * );
93 bool embeddedPlaylistWasActive;
98 BackgroundWidget *bgWidget;
99 VisualSelector *visualSelector;
100 ControlsWidget *advControls;
101 PlaylistWidget *playlistWidget;
103 bool playlistEmbeddedFlag;
104 bool videoEmbeddedFlag;
105 bool alwaysVideoFlag;
106 bool advControlsEnabled;
107 bool visualSelectorEnabled;
109 InputManager *main_input_manager;
111 input_thread_t *p_input; ///< Main input associated to the playlist
116 void customEvent( QEvent *);
118 void undockPlaylist();
121 void setNavigation( int );
122 void setStatus( int );
123 void setName( QString );
124 void setDisplay( float, int, int );
125 void updateOnTimer();
132 void updateVolume( int sliderVolume );
133 void updateSystrayMenu( int );
134 void handleSystrayClick( QSystemTrayIcon::ActivationReason );
138 class VolumeClickHandler : public QObject
141 VolumeClickHandler( intf_thread_t *_p_intf, MainInterface *_m ) :QObject(_m)
142 {m = _m; p_intf = _p_intf; }
143 virtual ~VolumeClickHandler() {};
144 bool eventFilter( QObject *obj, QEvent *e )
146 if (e->type() == QEvent::MouseButtonPress )
148 aout_VolumeMute( p_intf, NULL );
155 intf_thread_t *p_intf;