standardpanel.hpp 3.54 KB
Newer Older
zorglub's avatar
zorglub committed
1
2
3
4
/*****************************************************************************
 * panels.hpp : Panels for the playlist
 ****************************************************************************
 * Copyright (C) 2000-2005 the VideoLAN team
5
 * $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 _PLPANELS_H_
#define _PLPANELS_H_

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

zorglub's avatar
zorglub committed
31
#include "qt4.hpp"
32
#include "components/playlist/playlist.hpp"
zorglub's avatar
zorglub committed
33

zorglub's avatar
Qt4:    
zorglub committed
34
#include <QModelIndex>
zorglub's avatar
zorglub committed
35
36
#include <QWidget>
#include <QString>
37
#include <QToolBar>
zorglub's avatar
zorglub committed
38

39
40
#include <vlc_playlist.h>

41
class QSignalMapper;
zorglub's avatar
zorglub committed
42
class QTreeView;
43
class QListView;
zorglub's avatar
zorglub committed
44
class PLModel;
zorglub's avatar
zorglub committed
45
class QPushButton;
zorglub's avatar
zorglub committed
46
class QKeyEvent;
47
class QWheelEvent;
48
class PlIconView;
49
class LocationBar;
zorglub's avatar
zorglub committed
50

51
class StandardPLPanel: public QWidget
zorglub's avatar
zorglub committed
52
{
53
    Q_OBJECT
zorglub's avatar
zorglub committed
54
55

public:
56
    StandardPLPanel( PlaylistWidget *, intf_thread_t *,
zorglub's avatar
zorglub committed
57
                     playlist_t *,playlist_item_t * );
zorglub's avatar
zorglub committed
58
    virtual ~StandardPLPanel();
zorglub's avatar
zorglub committed
59
protected:
60
61
    friend class PlaylistWidget;

zorglub's avatar
zorglub committed
62
    virtual void keyPressEvent( QKeyEvent *e );
63
    virtual void wheelEvent( QWheelEvent *e );
64

zorglub's avatar
zorglub committed
65
    PLModel *model;
66
private:
67
    intf_thread_t *p_intf;
68
69
70

    QWidget     *parent;
    QLabel      *title;
71
    QToolButton *addButton;
72
    QGridLayout *layout;
73
    LocationBar *locationBar;
74

75
76
    QTreeView   *treeView;
    PlIconView  *iconView;
77
    QAbstractItemView *currentView;
78

79
    QAction *iconViewAction, *treeViewAction;
zorglub's avatar
zorglub committed
80
    int currentRootId;
81
    QSignalMapper *selectColumnsSigMapper;
82
    QSignalMapper *viewSelectionMapper;
83

84
85
    int last_activated_id;

86
87
88
89
90
91
92
93
94
    enum {
      TREE_VIEW = 0,
      ICON_VIEW,
      COVER_VIEW,
    };

    void createTreeView();
    void createIconView();

zorglub's avatar
zorglub committed
95
public slots:
zorglub's avatar
zorglub committed
96
    void removeItem( int );
97
    virtual void setRoot( playlist_item_t * );
zorglub's avatar
Qt4:    
zorglub committed
98
private slots:
zorglub's avatar
zorglub committed
99
    void deleteSelection();
zorglub's avatar
Qt4:    
zorglub committed
100
    void handleExpansion( const QModelIndex& );
101
    void gotoPlayingItem();
ivoire's avatar
ivoire committed
102
    void search( const QString& searchText );
103
    void popupAdd();
104
    void popupSelectColumn( QPoint );
jpd's avatar
jpd committed
105
    void popupPlView( const QPoint & );
106
    void toggleColumnShown( int );
107
    void showView( int );
108
    void cycleViews();
109
    void activate( const QModelIndex & );
110
    void browseInto( input_item_t * );
zorglub's avatar
zorglub committed
111
112
};

113
class LocationBar : public QWidget
114
115
116
117
118
119
120
{
    Q_OBJECT;
public:
    LocationBar( PLModel * );
    void setIndex( const QModelIndex & );
signals:
    void invoked( const QModelIndex & );
121
122
public slots:
    void setRootIndex();
123
124
125
126
127
private slots:
    void invoke( int i_item_id );
private:
    PLModel *model;
    QSignalMapper *mapper;
128
129
130
131
    QHBoxLayout *box;
    QList<QWidget*> buttons;
};

jpd's avatar
jpd committed
132
class LocationButton : public QPushButton
133
{
134
135
136
137
138
139
140
public:
    LocationButton( const QString &, bool bold, bool arrow );
private:
    void paintEvent ( QPaintEvent * event );
    QSize sizeHint() const;
    QFontMetrics *metrics;
    bool b_arrow;
141
142
};

zorglub's avatar
zorglub committed
143
#endif