main_interface.hpp 3.62 KB
Newer Older
zorglub's avatar
zorglub committed
1 2 3
/*****************************************************************************
 * main_interface.hpp : Main Interface
 ****************************************************************************
4 5
 * Copyright (C) 2006 the VideoLAN team
 * $Id$
zorglub's avatar
zorglub committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
 *
 * Authors: Clément Stenac <zorglub@videolan.org>
 *
 * 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
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/

#ifndef _MAIN_INTERFACE_H_
#define _MAIN_INTERFACE_H_

#include <vlc/intf.h>
zorglub's avatar
zorglub committed
27
#include <vlc/aout.h>
zorglub's avatar
zorglub committed
28
#include "ui/main_interface.h"
zorglub's avatar
zorglub committed
29
#include "util/qvlcframe.hpp"
zorglub's avatar
zorglub committed
30

31 32 33
#include <QSize>

class QSettings;
zorglub's avatar
zorglub committed
34
class QCloseEvent;
35
class QKeyEvent;
36
class QLabel;
37
class QEvent;
38
class InputManager;
39
class InputSlider;
40
class VideoWidget;
41 42
class BackgroundWidget;
class PlaylistWidget;
zorglub's avatar
zorglub committed
43
class VolumeClickHandler;
zorglub's avatar
zorglub committed
44
class VisualSelector;
45

zorglub's avatar
zorglub committed
46
class MainInterface : public QVLCMW
zorglub's avatar
zorglub committed
47 48 49 50 51
{
    Q_OBJECT;
public:
    MainInterface( intf_thread_t *);
    virtual ~MainInterface();
52 53 54 55 56
    void *requestVideo( vout_thread_t *p_nvout, int *pi_x,
                        int *pi_y, unsigned int *pi_width,
                        unsigned int *pi_height );
    void releaseVideo( void *);
    int controlVideo( void *p_window, int i_query, va_list args );
zorglub's avatar
zorglub committed
57
protected:
58
    void resizeEvent( QResizeEvent * );
zorglub's avatar
zorglub committed
59
    void closeEvent( QCloseEvent *);
zorglub's avatar
zorglub committed
60 61
    Ui::MainInterfaceUI ui;
    friend class VolumeClickHandler;
zorglub's avatar
zorglub committed
62
private:
63 64 65
    QSettings *settings;
    QSize mainSize, addSize;

66
    bool need_components_update;
67 68
    void calculateInterfaceSize();
    void handleMainUi( QSettings* );
69
    void doComponentsUpdate();
70

71
    /* Video */
72
    VideoWidget         *videoWidget;
73 74
    virtual void keyPressEvent( QKeyEvent *);

75
    BackgroundWidget    *bgWidget;
zorglub's avatar
zorglub committed
76
    VisualSelector      *visualSelector;
77 78 79 80
    PlaylistWidget      *playlistWidget;

    bool                 playlistEmbeddedFlag;
    bool                 videoEmbeddedFlag;
81
    bool                 alwaysVideoFlag;
82 83 84 85 86 87 88

    InputManager        *main_input_manager;
    InputSlider         *slider;
    input_thread_t      *p_input;    ///< Main input associated to the playlist

    QLabel              *timeLabel;
    QLabel              *nameLabel;
89 90

    void customEvent( QEvent *);
zorglub's avatar
zorglub committed
91 92
public slots:
    void undockPlaylist();
zorglub's avatar
zorglub committed
93
private slots:
94
    void setStatus( int );
zorglub's avatar
zorglub committed
95
    void setName( QString );
zorglub's avatar
zorglub committed
96
    void setDisplay( float, int, int );
zorglub's avatar
zorglub committed
97
    void updateOnTimer();
zorglub's avatar
zorglub committed
98 99 100 101
    void play();
    void stop();
    void prev();
    void next();
102
    void playlist();
103
    void visual();
zorglub's avatar
zorglub committed
104 105 106 107 108 109 110
    void updateVolume( int sliderVolume );
};


class VolumeClickHandler : public QObject
{
public:
111 112
    VolumeClickHandler( intf_thread_t *_p_intf, MainInterface *_m ) :QObject(_m)
    {m = _m; p_intf = _p_intf; }
zorglub's avatar
zorglub committed
113 114 115 116 117
    virtual ~VolumeClickHandler() {};
    bool eventFilter( QObject *obj, QEvent *e )
    {
        if (e->type() == QEvent::MouseButtonPress )
        {
118
            aout_VolumeMute( p_intf, NULL );
zorglub's avatar
zorglub committed
119 120 121 122 123 124
            return true;
        }
        return false;
    }
private:
    MainInterface *m;
125
    intf_thread_t *p_intf;
zorglub's avatar
zorglub committed
126 127 128
};

#endif