]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/playlist/playlist.hpp
Qt: change the LocationBar Class file
[vlc] / modules / gui / qt4 / components / playlist / playlist.hpp
1 /*****************************************************************************
2  * interface_widgets.hpp : Playlist Widgets
3  ****************************************************************************
4  * Copyright (C) 2006-2009 the VideoLAN team
5  * $Id$
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 _PLAYLISTWIDGET_H_
27 #define _PLAYLISTWIDGET_H_
28
29 #ifdef HAVE_CONFIG_H
30 # include "config.h"
31 #endif
32
33 #include "qt4.hpp"
34
35 #include "dialogs_provider.hpp"              /* Media Info from ArtLabel */
36 #include "components/interface_widgets.hpp"  /* CoverArt */
37 //#include <vlc_playlist.h>
38
39 #include <QSplitter>
40
41 class PLSelector;
42 class StandardPLPanel;
43 class QPushButton;
44
45 class ArtLabel : public CoverArtLabel
46 {
47 public:
48     ArtLabel( QWidget *parent, intf_thread_t *intf )
49             : CoverArtLabel( parent, intf ) {}
50
51     virtual void mouseDoubleClickEvent( QMouseEvent *event )
52     {
53         THEDP->mediaInfoDialog();
54         event->accept();
55     }
56 };
57
58 class PlaylistWidget : public QSplitter
59 {
60     Q_OBJECT
61 public:
62     PlaylistWidget( intf_thread_t *_p_i, QWidget * );
63     virtual ~PlaylistWidget();
64     void forceHide();
65     void forceShow();
66 private:
67     PLSelector      *selector;
68     ArtLabel        *art;
69     StandardPLPanel *rightPanel;
70     QPushButton     *addButton;
71     QSplitter       *leftSplitter;
72 protected:
73     intf_thread_t *p_intf;
74     virtual void dropEvent( QDropEvent *);
75     virtual void dragEnterEvent( QDragEnterEvent * );
76     virtual void closeEvent( QCloseEvent * );
77
78 };
79
80 class LocationButton : public QPushButton
81 {
82 public:
83     LocationButton( const QString &, bool bold, bool arrow, QWidget * parent = NULL );
84     QSize sizeHint() const;
85 private:
86     void paintEvent ( QPaintEvent * event );
87     QFontMetrics *metrics;
88     bool b_arrow;
89 };
90
91 class PLModel;
92 class LocationBar : public QWidget
93 {
94     Q_OBJECT
95 public:
96     LocationBar( PLModel * );
97     void setIndex( const QModelIndex & );
98     QSize sizeHint() const;
99 signals:
100     void invoked( const QModelIndex & );
101 public slots:
102     void setRootIndex();
103 private slots:
104     void invoke( int i_item_id );
105 private:
106     void layOut( const QSize& size );
107     void resizeEvent ( QResizeEvent * event );
108
109     PLModel *model;
110     QSignalMapper *mapper;
111     QHBoxLayout *box;
112     QList<QWidget*> buttons;
113     QList<QAction*> actions;
114     LocationButton *btnMore;
115     QMenu *menuMore;
116     QList<int> widths;
117 };
118
119
120 #endif