1 /*****************************************************************************
2  * playlist.hpp : Playlist Widgets
3  ****************************************************************************
4  * Copyright (C) 2006-2009 the VideoLAN team
5  * $Id: 64e7cc112b406d6e055e8729a9f8a55b5ba747d6 $
6  *
7  * Authors: Clément Stenac <zorglub@videolan.org>
8  *          Jean-Baptiste Kempf <jb@videolan.org>
9  *          Rafaël Carré <funman@videolanorg>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24  *****************************************************************************/
25 
26 #ifndef VLC_QT_PLAYLIST_HPP_
27 #define VLC_QT_PLAYLIST_HPP_
28 
29 #ifdef HAVE_CONFIG_H
30 # include "config.h"
31 #endif
32 
33 #include "qt.hpp"
34 
35 //#include <vlc_playlist.h>
36 
37 #include <QSplitter>
38 
39 #include <QPushButton>
40 #include <QSplitterHandle>
41 #include <QMouseEvent>
42 
43 class StandardPLPanel;
44 class LocationBar;
45 class QSignalMapper;
46 class SearchLineEdit;
47 class QModelIndex;
48 class QStackedWidget;
49 class PLSelector;
50 
51 class PlaylistWidget : public QWidget
52 {
53     Q_OBJECT
54 public:
55     virtual ~PlaylistWidget();
56 
57     void forceHide();
58     void forceShow();
59     void setSearchFieldFocus();
60     QStackedWidget *artContainer;
61     StandardPLPanel      *mainView;
62 
63 private:
64     QSplitter            *leftSplitter;
65     QSplitter            *split;
66 
67     PLSelector           *selector;
68 
69     LocationBar          *locationBar;
70     SearchLineEdit       *searchEdit;
71 
72     intf_thread_t *p_intf;
73 
74 protected:
75     PlaylistWidget( intf_thread_t *_p_i, QWidget * );
76     void dropEvent( QDropEvent *) Q_DECL_OVERRIDE;
77     void dragEnterEvent( QDragEnterEvent * ) Q_DECL_OVERRIDE;
78     void closeEvent( QCloseEvent * ) Q_DECL_OVERRIDE;
79 private slots:
80     void changeView( const QModelIndex& index );
81 
82     friend class PlaylistDialog;
83 };
84 
85 class LocationButton : public QPushButton
86 {
87 public:
88     LocationButton( const QString &, bool bold, bool arrow, QWidget * parent = NULL );
89     QSize sizeHint() const Q_DECL_OVERRIDE;
90 protected:
91     void paintEvent ( QPaintEvent * event ) Q_DECL_OVERRIDE;
92 private:
93     bool b_arrow;
94 };
95 
96 class VLCModel;
97 
98 class LocationBar : public QWidget
99 {
100     Q_OBJECT
101 public:
102     LocationBar( VLCModel * );
103     void setIndex( const QModelIndex & );
setModel(VLCModel * _model)104     void setModel( VLCModel * _model ) { model = _model; };
105     QSize sizeHint() const Q_DECL_OVERRIDE;
106 protected:
107     void resizeEvent ( QResizeEvent * event ) Q_DECL_OVERRIDE;
108 
109 private:
110     void layOut( const QSize& size );
111 
112     VLCModel *model;
113     QSignalMapper *mapper;
114     QWidgetList buttons;
115     QList<QAction*> actions;
116     LocationButton *btnMore;
117     QMenu *menuMore;
118     QList<int> widths;
119 
120 public slots:
121     void setRootIndex();
122 private slots:
123     void invoke( int i_item_id );
124 
125 signals:
126     void invoked( const QModelIndex & );
127 };
128 
129 
130 #endif
131