main_interface.hpp 5.36 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;
48
class SpeedControlWidget;
49
class QMenu;
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
50
class QSize;
51
//class QDockWidet;
52
class QProgressBar;
53
54
55
56
57
58

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

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

    friend class VolumeClickHandler;
    friend class InteractionDialog;

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

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

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

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

zorglub's avatar
zorglub committed
95
private:
96
97
98
99
100
101
    QSettings           *settings;
    QSystemTrayIcon     *sysTray;
    QMenu               *systrayMenu;
    QString              input_name;
    QVBoxLayout         *mainLayout;
    ControlsWidget      *controls;
102
    QMenu               *speedControlMenu;
103
    SpeedControlWidget  *speedControl;
104
    QProgressBar        *pgBar;
105

106
    void handleMainUi( QSettings* );
107
    void askForPrivacy();
108
    int  privacyDialog( QList<ConfigControl *> controls );
109

110
111
    /* Systray */
    void handleSystray();
112
    void createSystray();
113

114
115
116
    void createStatusBar();
    void initSystray();

117
    /* Video */
118
    VideoWidget         *videoWidget;
119
    //    QSize                savedVideoSize;
120

121
    BackgroundWidget    *bgWidget;
zorglub's avatar
zorglub committed
122
    VisualSelector      *visualSelector;
123
    PlaylistWidget      *playlistWidget;
124
//    QDockWidget         *dockPL;
125

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

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

136
    /* Status Bar */
137
    QLabel              *timeLabel;
138
    QLabel              *speedLabel;
139
    QLabel              *nameLabel;
140

141
142
143
    virtual void customEvent( QEvent *);
    virtual void keyPressEvent( QKeyEvent *);
    virtual void wheelEvent( QWheelEvent * );
144

zorglub's avatar
zorglub committed
145
146
public slots:
    void undockPlaylist();
147
    void toggleMinimalView();
148
    void togglePlaylist();
149
    void toggleUpdateSystrayMenu();
150
    void toggleAdvanced();
151
    void toggleFullScreen();
152
153
154
155

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

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

zorglub's avatar
zorglub committed
181
#endif