main_interface.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * main_interface.hpp : Main Interface
00003  ****************************************************************************
00004  * Copyright (C) 2006-2007 the VideoLAN team
00005  * $Id$
00006  *
00007  * Authors: Clément Stenac <zorglub@videolan.org>
00008  *          Jean-Baptiste Kempf <jb@videolan.org>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00023  *****************************************************************************/
00024 
00025 #ifndef _MAIN_INTERFACE_H_
00026 #define _MAIN_INTERFACE_H_
00027 
00028 #include "qt4.hpp"
00029 #include "util/qvlcframe.hpp"
00030 #include "components/preferences_widgets.hpp"
00031 
00032 #include <vlc_aout.h>
00033 
00034 #include <QSystemTrayIcon>
00035 
00036 class QSettings;
00037 class QCloseEvent;
00038 class QKeyEvent;
00039 class QLabel;
00040 class QEvent;
00041 class InputManager;
00042 class VideoWidget;
00043 class BackgroundWidget;
00044 class PlaylistWidget;
00045 class VisualSelector;
00046 class AdvControlsWidget;
00047 class ControlsWidget;
00048 class FullscreenControllerWidget;
00049 class SpeedControlWidget;
00050 class QMenu;
00051 class QSize;
00052 //class QDockWidet;
00053 
00054 enum{
00055     CONTROLS_HIDDEN = 0x0,
00056     CONTROLS_VISIBLE = 0x1,
00057     CONTROLS_ADVANCED = 0x2
00058 };
00059 
00060 class MainInterface : public QVLCMW
00061 {
00062     Q_OBJECT;
00063 
00064     friend class VolumeClickHandler;
00065     friend class InteractionDialog;
00066 
00067 public:
00068     MainInterface( intf_thread_t *);
00069     virtual ~MainInterface();
00070 
00071     /* Video requests from core */
00072     void *requestVideo( vout_thread_t *p_nvout, int *pi_x,
00073                         int *pi_y, unsigned int *pi_width,
00074                         unsigned int *pi_height );
00075     void releaseVideo( void * );
00076     int controlVideo( void *p_window, int i_query, va_list args );
00077 
00078     void requestLayoutUpdate();
00079 
00080     /* Getters */
00081     QSystemTrayIcon *getSysTray() { return sysTray; };
00082     QMenu *getSysTrayMenu() { return systrayMenu; };
00083     int getControlsVisibilityStatus();
00084 
00085 #if 0    /* Sizehint() */
00086     QSize sizeHint() const;
00087 #endif
00088 protected:
00089 //    void resizeEvent( QResizeEvent * );
00090     void dropEvent( QDropEvent *);
00091     void dragEnterEvent( QDragEnterEvent * );
00092     void dragMoveEvent( QDragMoveEvent * );
00093     void dragLeaveEvent( QDragLeaveEvent * );
00094     void closeEvent( QCloseEvent *);
00095 
00096 private:
00097     QSettings           *settings;
00098     QSystemTrayIcon     *sysTray;
00099     QMenu               *systrayMenu;
00100     QString              input_name;
00101     QVBoxLayout         *mainLayout;
00102     ControlsWidget      *controls;
00103     FullscreenControllerWidget *fullscreenControls;
00104     QMenu               *speedControlMenu;
00105     SpeedControlWidget  *speedControl;
00106 
00107     void handleMainUi( QSettings* );
00108     void askForPrivacy();
00109     int  privacyDialog( QList<ConfigControl *> *controls );
00110 
00111     /* Systray */
00112     void handleSystray();
00113     void createSystray();
00114 
00115     void createStatusBar();
00116     void initSystray();
00117 
00118     /* Video */
00119     VideoWidget         *videoWidget;
00120     //    QSize                savedVideoSize;
00121 
00122     BackgroundWidget    *bgWidget;
00123     VisualSelector      *visualSelector;
00124     PlaylistWidget      *playlistWidget;
00125 //    QDockWidget         *dockPL;
00126 
00127     bool                 videoIsActive; ///< Having a video now / THEMIM->hasV
00128     bool                 videoEmbeddedFlag; ///< Want an external Video Window
00129     bool                 playlistVisible; ///< Is the playlist visible ?
00130     bool                 visualSelectorEnabled;
00131     bool                 notificationEnabled; /// Systray Notifications
00132     bool                 b_remainingTime; /* Show elapsed or remaining time */
00133     bool                 bgWasVisible;
00134     int                  i_visualmode; ///< Visual Mode
00135 
00136     input_thread_t      *p_input;    ///< Main input associated to the playlist
00137 
00138     /* Status Bar */
00139     QLabel              *timeLabel;
00140     QLabel              *speedLabel;
00141     QLabel              *nameLabel;
00142 
00143     virtual void customEvent( QEvent *);
00144     virtual void keyPressEvent( QKeyEvent *);
00145     virtual void wheelEvent( QWheelEvent * );
00146 
00147 public slots:
00148     void undockPlaylist();
00149     void toggleMinimalView();
00150     void togglePlaylist();
00151     void toggleUpdateSystrayMenu();
00152     void toggleAdvanced();
00153     void toggleFullScreen();
00154 
00155     /* Manage the Video Functions from the vout threads */
00156     void releaseVideoSlot( void * );
00157 
00158 private slots:
00159     void debug();
00160     void updateOnTimer();
00161     void doComponentsUpdate();
00162     void setStatus( int );
00163     void setRate( int );
00164     void setName( QString );
00165     void setVLCWindowsTitle( QString title = "" );
00166     void setDisplayPosition( float, int, int );
00167     void toggleTimeDisplay();
00168 #if 0
00169     void visual();
00170 #endif
00171     void handleSystrayClick( QSystemTrayIcon::ActivationReason );
00172     void updateSystrayTooltipName( QString );
00173     void updateSystrayTooltipStatus( int );
00174     void showSpeedMenu( QPoint );
00175 signals:
00176     void askReleaseVideo( void * );
00177     void askVideoToResize( unsigned int, unsigned int );
00178     void askVideoToToggle();
00179     void askBgWidgetToToggle();
00180     void askUpdate();
00181 };
00182 
00183 #endif

Generated on Wed Aug 13 08:02:38 2008 for VLC by  doxygen 1.5.1