]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/playlist/standardpanel.hpp
Qt: replace playlist view title with interactive location bar
[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 LocationBar;
50
51 class StandardPLPanel: public QWidget
52 {
53     Q_OBJECT
54
55 public:
56     StandardPLPanel( PlaylistWidget *, intf_thread_t *,
57                      playlist_t *,playlist_item_t * );
58     virtual ~StandardPLPanel();
59 protected:
60     friend class PlaylistWidget;
61
62     virtual void keyPressEvent( QKeyEvent *e );
63     virtual void wheelEvent( QWheelEvent *e );
64
65     PLModel *model;
66 private:
67     intf_thread_t *p_intf;
68
69     QWidget     *parent;
70     QLabel      *title;
71     QPushButton *addButton;
72     QGridLayout *layout;
73     LocationBar *locationBar;
74
75     QTreeView   *treeView;
76     PlIconView  *iconView;
77     QAbstractItemView *currentView;
78
79     int currentRootId;
80     QSignalMapper *selectColumnsSigMapper;
81
82     int last_activated_id;
83
84     enum {
85       TREE_VIEW = 0,
86       ICON_VIEW,
87       COVER_VIEW,
88     };
89
90     void createTreeView();
91     void createIconView();
92
93 public slots:
94     void removeItem( int );
95     virtual void setRoot( playlist_item_t * );
96 private slots:
97     void deleteSelection();
98     void handleExpansion( const QModelIndex& );
99     void gotoPlayingItem();
100     void search( const QString& searchText );
101     void popupAdd();
102     void popupSelectColumn( QPoint );
103     void popupPlView( const QPoint & );
104     void toggleColumnShown( int );
105     void toggleView();
106     void activate( const QModelIndex & );
107     void handleInputChange( input_thread_t * );
108 };
109
110 class LocationBar : public QToolBar
111 {
112     Q_OBJECT;
113 public:
114     LocationBar( PLModel * );
115     void setIndex( const QModelIndex & );
116 signals:
117     void invoked( const QModelIndex & );
118 private slots:
119     void invoke( int i_item_id );
120 private:
121     PLModel *model;
122     QSignalMapper *mapper;
123 };
124
125 #endif