main_interface.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * main_interface.hpp : Main Interface
00003  ****************************************************************************
00004  * Copyright (C) 2006-2010 VideoLAN and AUTHORS
00005  * $Id: 689da2b457f1ba30dd0ec09827569f7941d913b9 $
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 QVLC_MAIN_INTERFACE_H_
00026 #define QVLC_MAIN_INTERFACE_H_
00027 
00028 #include "qt4.hpp"
00029 
00030 #include "util/qvlcframe.hpp"
00031 
00032 #ifdef WIN32
00033  #include <vlc_windows_interfaces.h>
00034 #endif
00035 
00036 #include <QSystemTrayIcon>
00037 #include <QStackedWidget>
00038 
00039 class QSettings;
00040 class QCloseEvent;
00041 class QKeyEvent;
00042 class QLabel;
00043 class QEvent;
00044 class InputManager;
00045 class VideoWidget;
00046 class BackgroundWidget;
00047 class PlaylistWidget;
00048 class VisualSelector;
00049 class AdvControlsWidget;
00050 class ControlsWidget;
00051 class InputControlsWidget;
00052 class FullscreenControllerWidget;
00053 class SpeedControlWidget;
00054 class QVBoxLayout;
00055 class QMenu;
00056 class QSize;
00057 
00058 enum {
00059     CONTROLS_VISIBLE  = 0x1,
00060     CONTROLS_HIDDEN   = 0x2,
00061     CONTROLS_ADVANCED = 0x4,
00062 };
00063 
00064 
00065 class MainInterface : public QVLCMW
00066 {
00067     Q_OBJECT
00068 
00069     friend class PlaylistWidget;
00070 
00071 public:
00072     /* tors */
00073     MainInterface( intf_thread_t *);
00074     virtual ~MainInterface();
00075 
00076     /* Video requests from core */
00077     WId  getVideo( int *pi_x, int *pi_y,
00078                   unsigned int *pi_width, unsigned int *pi_height );
00079     void releaseVideo( void );
00080     int  controlVideo( int i_query, va_list args );
00081 
00082     /* Getters */
00083 #ifndef HAVE_MAEMO
00084     QSystemTrayIcon *getSysTray() { return sysTray; }
00085     QMenu *getSysTrayMenu() { return systrayMenu; }
00086 #endif
00087     int getControlsVisibilityStatus();
00088     bool isPlDocked() { return ( b_plDocked != false ); }
00089 
00090 protected:
00091     void dropEventPlay( QDropEvent *, bool);
00092 #ifdef WIN32
00093     virtual bool winEvent( MSG *, long * );
00094 #endif
00095     virtual void dropEvent( QDropEvent *);
00096     virtual void dragEnterEvent( QDragEnterEvent * );
00097     virtual void dragMoveEvent( QDragMoveEvent * );
00098     virtual void dragLeaveEvent( QDragLeaveEvent * );
00099     virtual void closeEvent( QCloseEvent *);
00100     virtual void customEvent( QEvent *);
00101     virtual void keyPressEvent( QKeyEvent *);
00102     virtual void wheelEvent( QWheelEvent * );
00103 
00104 private:
00105     /* Main Widgets Creation */
00106     void createMainWidget( QSettings* );
00107     void createStatusBar();
00108     void createPlaylist();
00109 
00110     /* Systray */
00111     void createSystray();
00112     void initSystray();
00113     void handleSystray();
00114 
00115     /* Central StackWidget Management */
00116     void showTab( QWidget *);
00117     void showVideo();
00118     void restoreStackOldWidget();
00119 
00120     /* */
00121     QSettings           *settings;
00122 #ifndef HAVE_MAEMO
00123     QSystemTrayIcon     *sysTray;
00124     QMenu               *systrayMenu;
00125 #endif
00126 
00127     QString              input_name;
00128     QVBoxLayout         *mainLayout;
00129     ControlsWidget      *controls;
00130     InputControlsWidget *inputC;
00131     FullscreenControllerWidget *fullscreenControls;
00132 
00133     /* Widgets */
00134     QStackedWidget      *stackCentralW;
00135 
00136     VideoWidget         *videoWidget;
00137     BackgroundWidget    *bgWidget;
00138     PlaylistWidget      *playlistWidget;
00139     //VisualSelector      *visualSelector;
00140 
00141     /* Status Bar */
00142     QLabel              *nameLabel;
00143     QLabel              *cryptedLabel;
00144 
00145     /* Status and flags */
00146     QWidget             *stackCentralOldWidget;
00147 
00148     QMap<QWidget *, QSize> stackWidgetsSizes;
00149 
00150     /* Flags */
00151     bool                 b_notificationEnabled; /// Systray Notifications
00152     bool                 b_autoresize;          ///< persistent resizeable window
00153     bool                 b_videoEmbedded;       ///< Want an external Video Window
00154     bool                 b_hideAfterCreation;
00155     int                  i_visualmode;          ///< Visual Mode
00156 
00157     /* States */
00158     bool                 playlistVisible;       ///< Is the playlist visible ?
00159 //    bool                 videoIsActive;       ///< Having a video now / THEMIM->hasV
00160 //    bool                 b_visualSelectorEnabled;
00161     bool                 b_plDocked;            ///< Is the playlist docked ?
00162 
00163 
00164 #ifdef WIN32
00165     HIMAGELIST himl;
00166     LPTASKBARLIST3 p_taskbl;
00167     UINT taskbar_wmsg;
00168     void createTaskBarButtons();
00169 #endif
00170 
00171 public slots:
00172     void dockPlaylist( bool b_docked = true );
00173     void toggleMinimalView( bool );
00174     void togglePlaylist();
00175 #ifndef HAVE_MAEMO
00176     void toggleUpdateSystrayMenu();
00177 #endif
00178     void toggleAdvancedButtons();
00179     void toggleFullScreen();
00180     void toggleFSC();
00181 
00182     void popupMenu( const QPoint& );
00183     void changeThumbbarButtons( int );
00184 
00185     /* Manage the Video Functions from the vout threads */
00186     void getVideoSlot( WId *p_id, int *pi_x, int *pi_y,
00187                        unsigned *pi_width, unsigned *pi_height );
00188     void releaseVideoSlot( void );
00189 
00190 private slots:
00191     void debug();
00192     void destroyPopupMenu();
00193     void recreateToolbars();
00194     void setName( const QString& );
00195     void setVLCWindowsTitle( const QString& title = "" );
00196 #if 0
00197     void visual();
00198 #endif
00199 #ifndef HAVE_MAEMO
00200     void handleSystrayClick( QSystemTrayIcon::ActivationReason );
00201     void updateSystrayTooltipName( const QString& );
00202     void updateSystrayTooltipStatus( int );
00203 #endif
00204     void showCryptedLabel( bool );
00205 
00206     void handleKeyPress( QKeyEvent * );
00207 
00208     void showBuffering( float );
00209 
00210     void resizeStack( int w, int h ) {
00211         if( !isFullScreen() && !isMaximized() )
00212             resize( size() - stackCentralW->size() + QSize( w, h ) );
00213         debug(); }
00214 
00215 
00216 signals:
00217     void askGetVideo( WId *p_id, int *pi_x, int *pi_y,
00218                       unsigned *pi_width, unsigned *pi_height );
00219     void askReleaseVideo( );
00220     void askVideoToResize( unsigned int, unsigned int );
00221     void askVideoSetFullScreen( bool );
00222     void minimalViewToggled( bool );
00223     void fullscreenInterfaceToggled( bool );
00224 
00225 };
00226 
00227 #endif

Generated on Tue May 25 08:04:58 2010 for VLC by  doxygen 1.5.6