]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/playlist/standardpanel.hpp
Qt: the Add button on playlist panel is gone
[vlc] / modules / gui / qt4 / components / playlist / standardpanel.hpp
1 /*****************************************************************************
2  * panels.hpp : Panels for the playlist
3  ****************************************************************************
4  * Copyright (C) 2000-2005 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #ifndef _PLPANELS_H_
25 #define _PLPANELS_H_
26
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
30
31 #include "qt4.hpp"
32 #include "components/playlist/playlist.hpp"
33
34 #include <QModelIndex>
35 #include <QWidget>
36 #include <QString>
37 #include <QToolBar>
38
39 #include <vlc_playlist.h>
40
41 class QSignalMapper;
42 class QTreeView;
43 class QListView;
44 class PLModel;
45 class QPushButton;
46 class QKeyEvent;
47 class QWheelEvent;
48 class PlIconView;
49 class PlListView;
50 class LocationBar;
51
52 class StandardPLPanel: public QWidget
53 {
54     Q_OBJECT
55
56 public:
57     StandardPLPanel( PlaylistWidget *, intf_thread_t *,
58                      playlist_t *,playlist_item_t * );
59     virtual ~StandardPLPanel();
60 protected:
61     friend class PlaylistWidget;
62
63     PLModel *model;
64 private:
65     enum {
66       TREE_VIEW = 0,
67       ICON_VIEW,
68       LIST_VIEW,
69
70       VIEW_COUNT
71     };
72
73     intf_thread_t *p_intf;
74
75     QWidget     *parent;
76     QLabel      *title;
77     QGridLayout *layout;
78     LocationBar *locationBar;
79     SearchLineEdit *searchEdit;
80
81     QTreeView   *treeView;
82     PlIconView  *iconView;
83     PlListView  *listView;
84     QAbstractItemView *currentView;
85
86     QAction *viewActions[ VIEW_COUNT ];
87     QAction *iconViewAction, *treeViewAction;
88     int currentRootId;
89     QSignalMapper *selectColumnsSigMapper;
90     QSignalMapper *viewSelectionMapper;
91
92     int lastActivatedId;
93     int currentRootIndexId;
94
95     void createTreeView();
96     void createIconView();
97     void createListView();
98     void wheelEvent( QWheelEvent *e );
99     bool eventFilter ( QObject * watched, QEvent * event );
100
101 public slots:
102     void setRoot( playlist_item_t * );
103     void browseInto( const QModelIndex& );
104     void browseInto( );
105 private slots:
106     void deleteSelection();
107     void handleExpansion( const QModelIndex& );
108     void handleRootChange();
109     void gotoPlayingItem();
110     void search( const QString& searchText );
111     void popupSelectColumn( QPoint );
112     void popupPlView( const QPoint & );
113     void toggleColumnShown( int );
114     void showView( int );
115     void cycleViews();
116     void activate( const QModelIndex & );
117     void browseInto( input_item_t * );
118 };
119
120 class LocationBar : public QWidget
121 {
122     Q_OBJECT;
123 public:
124     LocationBar( PLModel * );
125     void setIndex( const QModelIndex & );
126 signals:
127     void invoked( const QModelIndex & );
128 public slots:
129     void setRootIndex();
130 private slots:
131     void invoke( int i_item_id );
132 private:
133     PLModel *model;
134     QSignalMapper *mapper;
135     QHBoxLayout *box;
136     QList<QWidget*> buttons;
137 };
138
139 class LocationButton : public QPushButton
140 {
141 public:
142     LocationButton( const QString &, bool bold, bool arrow );
143 private:
144     void paintEvent ( QPaintEvent * event );
145     QSize sizeHint() const;
146     QFontMetrics *metrics;
147     bool b_arrow;
148 };
149
150 #endif