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 bool eventFilter(QObject *obj, QEvent *event);
77 friend class VolumeClickHandler;
80 QSize mainSize, addSize;
81 QSystemTrayIcon *sysTray;
84 QVBoxLayout *mainLayout;
85 ControlsWidget *controls;
86 QMenu *speedControlMenu;
87 SpeedControlWidget *speedControl;
89 bool need_components_update;
91 void calculateInterfaceSize();
92 void handleMainUi( QSettings* );
94 void doComponentsUpdate();
98 VideoWidget *videoWidget;
99 virtual void keyPressEvent( QKeyEvent *);
100 virtual void wheelEvent( QWheelEvent * );
102 bool embeddedPlaylistWasActive;
104 QSize savedVideoSize;
106 BackgroundWidget *bgWidget;
107 VisualSelector *visualSelector;
108 PlaylistWidget *playlistWidget;
110 bool playlistEmbeddedFlag;
111 bool videoEmbeddedFlag;
112 bool alwaysVideoFlag;
113 bool visualSelectorEnabled;
114 bool notificationEnabled;
116 InputManager *main_input_manager;
117 input_thread_t *p_input; ///< Main input associated to the playlist
123 bool b_remainingTime;
125 void customEvent( QEvent *);
127 void undockPlaylist();
129 void togglePlaylist();
130 void toggleUpdateSystrayMenu();
131 void toggleAdvanced();
133 void updateOnTimer();
135 void setStatus( int );
137 void setName( QString );
138 void setVLCWindowsTitle( QString title = "" );
139 void setDisplayPosition( float, int, int );
140 void toggleTimeDisplay();
141 void setElapsedTime();
142 void setRemainTime();
146 void handleSystrayClick( QSystemTrayIcon::ActivationReason );
147 void updateSystrayMenu( int );
148 void updateSystrayTooltipName( QString );
149 void updateSystrayTooltipStatus( int );
150 void showSpeedMenu( QPoint );
151 void showTimeMenu( QPoint );