standardpanel.hpp 3.97 KB
Newer Older
1
/*****************************************************************************
Pere Orga's avatar
Pere Orga committed
2
 * standardpanel.hpp : Panels for the playlist
3 4
 ****************************************************************************
 * Copyright (C) 2000-2005 the VideoLAN team
5
 * $Id$
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 *
 * 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.
 *****************************************************************************/

24 25
#ifndef VLC_QT_STANDARDPANEL_HPP_
#define VLC_QT_STANDARDPANEL_HPP_
26

Christophe Mutricy's avatar
Christophe Mutricy committed
27 28 29 30
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

31
#include "qt4.hpp"
32
#include "components/playlist/playlist.hpp"
François Cartegnie's avatar
François Cartegnie committed
33
#include "components/playlist/vlc_model.hpp"
34

35
#include <QWidget>
36
#include <QModelIndexList>
37

38
#include <vlc_playlist.h> /* playlist_item_t */
39

40
class QSignalMapper;
41
class QWheelEvent;
42
class QStackedLayout;
43 44 45 46
class QModelIndex;

class QAbstractItemView;
class QTreeView;
47
class PlIconView;
Jakob Leben's avatar
Jakob Leben committed
48
class PlListView;
49
class PicFlowView;
50

51 52
class PLSelector;
class PlaylistWidget;
53
class PixmapAnimator;
54

55
class StandardPLPanel: public QWidget
56
{
57
    Q_OBJECT
58 59

public:
60
    StandardPLPanel( PlaylistWidget *, intf_thread_t *,
61
                     playlist_item_t *, PLSelector *, VLCModel * );
62
    virtual ~StandardPLPanel();
63

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
64 65
    enum { ICON_VIEW = 0,
           TREE_VIEW ,
66
           LIST_VIEW,
67 68
           PICTUREFLOW_VIEW,
           VIEW_COUNT };
69

70
    int currentViewIndex() const;
71

72
    static QMenu *viewSelectionMenu(StandardPLPanel *obj);
73

Clément Stenac's avatar
Clément Stenac committed
74
protected:
75
    VLCModel *model;
76
    void wheelEvent( QWheelEvent *e ) Q_DECL_OVERRIDE;
François Cartegnie's avatar
François Cartegnie committed
77
    bool popup( const QPoint &point );
78

79
private:
80
    intf_thread_t *p_intf;
81

82
    PLSelector  *p_selector;
83

84 85 86
    QTreeView         *treeView;
    PlIconView        *iconView;
    PlListView        *listView;
87 88
    PicFlowView       *picFlowView;

89
    QAbstractItemView *currentView;
90 91

    QStackedLayout    *viewStack;
92

93
    QSignalMapper *selectColumnsSigMapper;
94

François Cartegnie's avatar
François Cartegnie committed
95 96
    int lastActivatedPLItemId;
    int currentRootIndexPLId;
97

98 99
    void createTreeView();
    void createIconView();
Jakob Leben's avatar
Jakob Leben committed
100
    void createListView();
101
    void createCoverView();
102
    void updateZoom( int i_zoom );
103
    virtual bool eventFilter ( QObject * watched, QEvent * event ) Q_DECL_OVERRIDE;
104

105 106 107
    /* Wait spinner */
    PixmapAnimator *spinnerAnimation;

108
public slots:
109
    void setRootItem( playlist_item_t *, bool );
110
    void browseInto( const QModelIndex& );
111
    void showView( int );
112
    void setWaiting( bool ); /* spinner */
113

Clément Stenac's avatar
Qt4:  
Clément Stenac committed
114
private slots:
Clément Stenac's avatar
Clément Stenac committed
115
    void deleteSelection();
Clément Stenac's avatar
Qt4:  
Clément Stenac committed
116
    void handleExpansion( const QModelIndex& );
117
    void activate( const QModelIndex & );
118 119

    void browseInto();
120
    void browseInto( int );
121

122
    void gotoPlayingItem();
123

124
    void search( const QString& searchText );
125 126
    void searchDelayed( const QString& searchText );

Jakob Leben's avatar
Jakob Leben committed
127
    void popupPlView( const QPoint & );
128
    void popupSelectColumn( QPoint );
François Cartegnie's avatar
François Cartegnie committed
129
    void popupAction( QAction * );
130 131
    void increaseZoom() { updateZoom( 1 ); };
    void decreaseZoom() { updateZoom( -1 ); };
132
    void toggleColumnShown( int );
133

134
    void cycleViews();
135
    void updateViewport(); /* spinner */
136 137 138

signals:
    void viewChanged( const QModelIndex& );
139 140
};

141 142

static const QString viewNames[ StandardPLPanel::VIEW_COUNT ]
143 144 145 146
                                = { qtr( "Icons" ),
                                    qtr( "Detailed List" ),
                                    qtr( "List" ),
                                    qtr( "PictureFlow") };
147

148
#endif