main_interface.hpp 5.5 KB
Newer Older
zorglub's avatar
zorglub committed
1 2 3
/*****************************************************************************
 * main_interface.hpp : Main Interface
 ****************************************************************************
4
 * Copyright (C) 2006-2007 the VideoLAN team
5
 * $Id$
zorglub's avatar
zorglub committed
6 7
 *
 * Authors: Clément Stenac <zorglub@videolan.org>
8
 *          Jean-Baptiste Kempf <jb@videolan.org>
zorglub's avatar
zorglub committed
9 10 11 12 13 14 15 16 17 18 19 20 21
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
22
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23
 *****************************************************************************/
zorglub's avatar
zorglub committed
24 25 26 27

#ifndef _MAIN_INTERFACE_H_
#define _MAIN_INTERFACE_H_

zorglub's avatar
zorglub committed
28
#include "qt4.hpp"
zorglub's avatar
zorglub committed
29
#include "util/qvlcframe.hpp"
30
#include "components/preferences_widgets.hpp"
zorglub's avatar
zorglub committed
31

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
32 33
#include <vlc_aout.h>

34
#include <QSystemTrayIcon>
35 36

class QSettings;
zorglub's avatar
zorglub committed
37
class QCloseEvent;
38
class QKeyEvent;
39
class QLabel;
40
class QEvent;
41
class InputManager;
42
class VideoWidget;
43 44
class BackgroundWidget;
class PlaylistWidget;
zorglub's avatar
zorglub committed
45
class VisualSelector;
46
class AdvControlsWidget;
zorglub's avatar
zorglub committed
47
class ControlsWidget;
lukas.durfina's avatar
lukas.durfina committed
48
class FullscreenControllerWidget;
49
class SpeedControlWidget;
50
class QMenu;
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
51
class QSize;
52
//class QDockWidet;
53
class QProgressBar;
54 55 56 57 58 59

enum{
    CONTROLS_HIDDEN = 0x0,
    CONTROLS_VISIBLE = 0x1,
    CONTROLS_ADVANCED = 0x2
};
60

zorglub's avatar
zorglub committed
61
class MainInterface : public QVLCMW
zorglub's avatar
zorglub committed
62 63
{
    Q_OBJECT;
64 65 66 67

    friend class VolumeClickHandler;
    friend class InteractionDialog;

zorglub's avatar
zorglub committed
68 69 70
public:
    MainInterface( intf_thread_t *);
    virtual ~MainInterface();
71

72
    /* Video requests from core */
73 74 75
    void *requestVideo( vout_thread_t *p_nvout, int *pi_x,
                        int *pi_y, unsigned int *pi_width,
                        unsigned int *pi_height );
76
    void releaseVideo( vout_thread_t *, void * );
77
    int controlVideo( void *p_window, int i_query, va_list args );
78

79
    void requestLayoutUpdate();
80

81
    /* Getters */
82 83
    QSystemTrayIcon *getSysTray() { return sysTray; };
    QMenu *getSysTrayMenu() { return systrayMenu; };
84
    int getControlsVisibilityStatus();
85

86
#if 0    /* Sizehint() */
87
    QSize sizeHint() const;
88
#endif
zorglub's avatar
zorglub committed
89
protected:
90
//    void resizeEvent( QResizeEvent * );
zorglub's avatar
zorglub committed
91 92 93 94
    void dropEvent( QDropEvent *);
    void dragEnterEvent( QDragEnterEvent * );
    void dragMoveEvent( QDragMoveEvent * );
    void dragLeaveEvent( QDragLeaveEvent * );
zorglub's avatar
zorglub committed
95
    void closeEvent( QCloseEvent *);
96

zorglub's avatar
zorglub committed
97
private:
98 99 100 101 102 103
    QSettings           *settings;
    QSystemTrayIcon     *sysTray;
    QMenu               *systrayMenu;
    QString              input_name;
    QVBoxLayout         *mainLayout;
    ControlsWidget      *controls;
lukas.durfina's avatar
lukas.durfina committed
104
    FullscreenControllerWidget *fullscreenControls;
105
    QMenu               *speedControlMenu;
106
    SpeedControlWidget  *speedControl;
107
    QProgressBar        *pgBar;
108

109
    void handleMainUi( QSettings* );
110
    void askForPrivacy();
111
    int  privacyDialog( QList<ConfigControl *> controls );
112

113 114
    /* Systray */
    void handleSystray();
115
    void createSystray();
116

117 118 119
    void createStatusBar();
    void initSystray();

120
    /* Video */
121
    VideoWidget         *videoWidget;
122
    //    QSize                savedVideoSize;
123

124
    BackgroundWidget    *bgWidget;
zorglub's avatar
zorglub committed
125
    VisualSelector      *visualSelector;
126
    PlaylistWidget      *playlistWidget;
127
//    QDockWidget         *dockPL;
128

129 130 131
    bool                 videoIsActive; ///< Having a video now / THEMIM->hasV
    bool                 videoEmbeddedFlag; ///< Want an external Video Window
    bool                 playlistVisible; ///< Is the playlist visible ?
132
    bool                 visualSelectorEnabled;
133
    bool                 notificationEnabled; /// Systray Notifications
134 135
    bool                 b_remainingTime; /* Show elapsed or remaining time */
    bool                 bgWasVisible;
136
    int                  i_visualmode; ///< Visual Mode
137 138 139

    input_thread_t      *p_input;    ///< Main input associated to the playlist

140
    /* Status Bar */
141
    QLabel              *timeLabel;
142
    QLabel              *speedLabel;
143
    QLabel              *nameLabel;
144

145 146 147
    virtual void customEvent( QEvent *);
    virtual void keyPressEvent( QKeyEvent *);
    virtual void wheelEvent( QWheelEvent * );
148

zorglub's avatar
zorglub committed
149 150
public slots:
    void undockPlaylist();
151
    void toggleMinimalView();
152
    void togglePlaylist();
153
    void toggleUpdateSystrayMenu();
154
    void toggleAdvanced();
155
    void toggleFullScreen();
156 157 158 159

    /* Manage the Video Functions from the vout threads */
    void releaseVideoSlot( void * );

zorglub's avatar
zorglub committed
160
private slots:
161
    void debug();
162
    void updateOnTimer();
163
    void doComponentsUpdate();
164
    void setStatus( int );
165
    void setRate( int );
zorglub's avatar
zorglub committed
166
    void setName( QString );
167
    void setVLCWindowsTitle( QString title = "" );
168
    void setDisplayPosition( float, int, int );
169
    void toggleTimeDisplay();
170
#if 0
171
    void visual();
172 173
#endif
    void handleSystrayClick( QSystemTrayIcon::ActivationReason );
174 175
    void updateSystrayTooltipName( QString );
    void updateSystrayTooltipStatus( int );
176
    void showSpeedMenu( QPoint );
177
signals:
178
    void askReleaseVideo( void * );
179
    void askVideoToResize( unsigned int, unsigned int );
180 181
    void askVideoToToggle();
    void askBgWidgetToToggle();
182
    void askUpdate();
zorglub's avatar
zorglub committed
183 184
};

zorglub's avatar
zorglub committed
185
#endif