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;
51 class MainInterface : public QVLCMW
55 MainInterface( intf_thread_t *);
56 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 );
64 QSystemTrayIcon *getSysTray() { return sysTray; };
65 QMenu *getSysTrayMenu() { return systrayMenu; };
66 int getControlsVisibilityStatus();
68 void resizeEvent( QResizeEvent * );
69 void dropEvent( QDropEvent *);
70 void dragEnterEvent( QDragEnterEvent * );
71 void dragMoveEvent( QDragMoveEvent * );
72 void dragLeaveEvent( QDragLeaveEvent * );
73 void closeEvent( QCloseEvent *);
75 friend class VolumeClickHandler;
78 QSize mainSize, addSize;
79 QSystemTrayIcon *sysTray;
82 QVBoxLayout *mainLayout;
83 ControlsWidget *controls;
84 QMenu *speedControlMenu;
85 SpeedControlWidget *speedControl;
87 bool need_components_update;
89 void calculateInterfaceSize();
90 void handleMainUi( QSettings* );
92 void doComponentsUpdate();
96 VideoWidget *videoWidget;
97 virtual void keyPressEvent( QKeyEvent *);
98 virtual void wheelEvent( QWheelEvent * );
100 bool embeddedPlaylistWasActive;
102 QSize savedVideoSize;
104 BackgroundWidget *bgWidget;
105 VisualSelector *visualSelector;
106 PlaylistWidget *playlistWidget;
108 bool playlistEmbeddedFlag;
109 bool videoEmbeddedFlag;
110 bool alwaysVideoFlag;
111 bool visualSelectorEnabled;
112 bool notificationEnabled;
114 InputManager *main_input_manager;
115 input_thread_t *p_input; ///< Main input associated to the playlist
121 bool b_remainingTime;
123 void customEvent( QEvent *);
125 void undockPlaylist();
127 void togglePlaylist();
128 void toggleUpdateSystrayMenu();
129 void toggleAdvanced();
131 void updateOnTimer();
133 void setStatus( 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();
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 );