Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

playlistwindow.h

Go to the documentation of this file.
00001 #ifndef __PLAYLISTWINDOW__
00002 #define __PLAYLISTWINDOW__
00003 
00004 #include <qwidget.h>
00005 #include <qlistview.h>
00006 #include <qlayout.h>
00007 #include <qpushbutton.h>
00008 #include <qlineedit.h>
00009 #include <qlabel.h>
00010 #include <qpainter.h>
00011 
00012 #include "mpdc.h"
00013 #include "playlist.h"
00014 #include "mpdcom.h"
00015 #include "playlistmanager.h"
00016 
00017 class ControlPanel;
00018 
00023 class PlaylistWindow : public QWidget
00024 {
00025 Q_OBJECT
00026 private:
00031   class PlaylistViewItem: public QListViewItem
00032   {
00033     public:
00034       inline                    PlaylistViewItem( QListView * parent, QString label1, QString label2 = QString::null, QString label3 = QString::null, QString label4 = QString::null, QString label5 = QString::null, QString label6 = QString::null, QString label7 = QString::null, QString label8 = QString::null )
00035                                 :QListViewItem(parent,label1,label2,label3,label4,label5,label6,label7,label8),
00036                                  playing(false) {}
00037 
00038       virtual void              paintCell ( QPainter * p, const QColorGroup & cg, int column, int width, int align );
00039       inline bool               isPlaying(void)           { return playing; }
00040       inline void               setPlaying(bool on)       { playing = on; }
00041 
00042     private:
00043       bool                      playing;
00044   };
00045 
00050   class PlayListView: public QListView
00051   {
00052   public:
00053     inline                      PlayListView(MpdCom * mpdCom, QWidget * parent):QListView(parent), mpdCom(mpdCom), noUpdate(false)  {}
00054     inline bool                 canUpdate(void)                                 { return !noUpdate; }
00055 
00056   protected:
00057     virtual void                keyPressEvent(QKeyEvent *);
00058     virtual void                contentsMousePressEvent(QMouseEvent *);
00059     virtual void                contentsMouseMoveEvent ( QMouseEvent *);
00060     virtual void                contentsMouseReleaseEvent(QMouseEvent *);
00061 
00062   private:
00063     MpdCom                    * mpdCom;
00064     PlaylistViewItem          * dragging;
00065     int                         prevMouseY;
00066     bool                        noUpdate;
00067   };
00068 
00069 public:
00070                                 PlaylistWindow(MpdCom *, ControlPanel *);                       
00071   virtual                       ~PlaylistWindow(void);                                          
00072 
00073   virtual void                  show(void);                                                     
00074   virtual void                  hide(void);                                                     
00075 
00076 private slots:
00077   void                          slotPlaylistUpdate( const Playlist & );
00078   void                          slotDoubleClicked( QListViewItem * );
00079   void                          slotRefreshPlaylist( void );
00080   void                          slotFind( void );
00081   void                          slotReceiveUpdate( const MpdCom::Status & );
00082   void                          slotAddSong( void );
00083   void                          slotRemoveSong( void );
00084   void                          slotClearPlaylist( void );
00085 
00086 protected:
00087   virtual void                  closeEvent(QCloseEvent *);                      
00088 
00089 private:
00090   void                          markPlaying(PlaylistViewItem *, bool);
00091 
00092   QGridLayout                   mainLayout;
00093   QHBoxLayout                   topLayout;
00094   QHBoxLayout                   bottomLayout;
00095   MpdCom                * const mpdcom;
00096   ControlPanel          * const controlPanel;
00097   PlayListView                  songList;
00098   QLineEdit                     editArtist, editTitle;
00099   QLabel                        labArtist, labTitle;
00100   QPushButton                   btAdd, btRemove, btClear, btRefresh;
00101   MpdCom::Status                status;
00102 //  PlaylistManager             * playlistManager;
00103   PlaylistViewItem            * currentPlaying;
00104 };
00105 
00106 #endif

Generated on Thu Mar 11 21:57:51 2004 for Music Playing Daemon client by doxygen1.2.15