standardpanel.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * panels.hpp : Panels for the playlist
00003  ****************************************************************************
00004  * Copyright (C) 2000-2005 the VideoLAN team
00005  * $Id: 97663c50aec76b2e05e55ce22916b7e4e4caad42 $
00006  *
00007  * Authors: Clément Stenac <zorglub@videolan.org>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00022  *****************************************************************************/
00023 
00024 #ifndef _PLPANELS_H_
00025 #define _PLPANELS_H_
00026 
00027 #ifdef HAVE_CONFIG_H
00028 # include "config.h"
00029 #endif
00030 
00031 #include "qt4.hpp"
00032 #include "components/playlist/playlist.hpp"
00033 
00034 #include <QModelIndex>
00035 #include <QWidget>
00036 #include <QString>
00037 #include <QToolBar>
00038 
00039 #include <vlc_playlist.h>
00040 
00041 class QSignalMapper;
00042 class QTreeView;
00043 class QListView;
00044 class PLModel;
00045 class QPushButton;
00046 class QKeyEvent;
00047 class QWheelEvent;
00048 class QStackedLayout;
00049 class PlIconView;
00050 class PlListView;
00051 class LocationBar;
00052 
00053 class StandardPLPanel: public QWidget
00054 {
00055     Q_OBJECT
00056 
00057 public:
00058     StandardPLPanel( PlaylistWidget *, intf_thread_t *,
00059                      playlist_t *,playlist_item_t * );
00060     virtual ~StandardPLPanel();
00061 protected:
00062     friend class PlaylistWidget;
00063 
00064     PLModel *model;
00065 private:
00066     enum {
00067       TREE_VIEW = 0,
00068       ICON_VIEW,
00069       LIST_VIEW,
00070 
00071       VIEW_COUNT
00072     };
00073 
00074     intf_thread_t *p_intf;
00075 
00076     QWidget     *parent;
00077     QLabel      *title;
00078     QGridLayout *layout;
00079     LocationBar *locationBar;
00080     SearchLineEdit *searchEdit;
00081 
00082     QTreeView   *treeView;
00083     PlIconView  *iconView;
00084     PlListView  *listView;
00085     QAbstractItemView *currentView;
00086     QStackedLayout *viewStack;
00087 
00088     QAction *viewActions[ VIEW_COUNT ];
00089     QAction *iconViewAction, *treeViewAction;
00090     int currentRootId;
00091     QSignalMapper *selectColumnsSigMapper;
00092     QSignalMapper *viewSelectionMapper;
00093 
00094     int lastActivatedId;
00095     int currentRootIndexId;
00096 
00097     void createTreeView();
00098     void createIconView();
00099     void createListView();
00100     void wheelEvent( QWheelEvent *e );
00101     bool eventFilter ( QObject * watched, QEvent * event );
00102 
00103 public slots:
00104     void setRoot( playlist_item_t * );
00105     void browseInto( const QModelIndex& );
00106     void browseInto( );
00107 private slots:
00108     void deleteSelection();
00109     void handleExpansion( const QModelIndex& );
00110     void handleRootChange();
00111     void gotoPlayingItem();
00112     void search( const QString& searchText );
00113     void popupSelectColumn( QPoint );
00114     void popupPlView( const QPoint & );
00115     void toggleColumnShown( int );
00116     void showView( int );
00117     void cycleViews();
00118     void activate( const QModelIndex & );
00119     void browseInto( input_item_t * );
00120 };
00121 
00122 class LocationButton : public QPushButton
00123 {
00124 public:
00125     LocationButton( const QString &, bool bold, bool arrow, QWidget * parent = NULL );
00126     QSize sizeHint() const;
00127 private:
00128     void paintEvent ( QPaintEvent * event );
00129     QFontMetrics *metrics;
00130     bool b_arrow;
00131 };
00132 
00133 class LocationBar : public QWidget
00134 {
00135     Q_OBJECT
00136 public:
00137     LocationBar( PLModel * );
00138     void setIndex( const QModelIndex & );
00139     QSize sizeHint() const;
00140 signals:
00141     void invoked( const QModelIndex & );
00142 public slots:
00143     void setRootIndex();
00144 private slots:
00145     void invoke( int i_item_id );
00146 private:
00147     void layOut( const QSize& size );
00148     void resizeEvent ( QResizeEvent * event );
00149 
00150     PLModel *model;
00151     QSignalMapper *mapper;
00152     QHBoxLayout *box;
00153     QList<QWidget*> buttons;
00154     QList<QAction*> actions;
00155     LocationButton *btnMore;
00156     QMenu *menuMore;
00157     QList<int> widths;
00158 };
00159 
00160 #endif

Generated on Tue May 25 08:04:57 2010 for VLC by  doxygen 1.5.6