00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef PLAY_LIST_WIDGET_H
00035 #define PLAY_LIST_WIDGET_H
00036
00037
00038 #include <qpushbutton.h>
00039 #include <qpopupmenu.h>
00040 #include <qpe/qcopenvelope_qws.h>
00041
00042 #include "playlistwidgetgui.h"
00043
00044 class Config;
00045 class QListViewItem;
00046 class QListView;
00047 class QPoint;
00048 class QAction;
00049 class QLabel;
00050 class MediaPlayerState;
00051 class MediaPlayer;
00052
00053 class PlayListWidget : public PlayListWidgetGui {
00054 Q_OBJECT
00055 public:
00056 enum TabType { CurrentPlayList, AudioFiles, VideoFiles, PlayLists };
00057 enum { TabTypeCount = 4 };
00058
00059 struct Entry
00060 {
00061 Entry( const QString &_name, const QString &_fileName )
00062 : name( _name ), file( _fileName ) {}
00063 Entry( const QString &_fileName )
00064 : name( _fileName ), file( _fileName ) {}
00065
00066 QString name;
00067 QString file;
00068 };
00069
00070 static QString appName() { return QString::fromLatin1("opieplayer2"); }
00071 PlayListWidget( QWidget* parent=0, const char* name=0, WFlags = 0 );
00072 ~PlayListWidget();
00073
00074
00075 const DocLnk *current() const;
00076 void useSelectedDocument();
00077 TabType currentTab() const;
00078
00079 Entry currentEntry() const;
00080
00081 public slots:
00082 bool first();
00083 bool last();
00084 bool next();
00085 bool prev();
00086 void writeDefaultPlaylist( );
00087 QString currentFileListPathName() const;
00088 protected:
00089 QCopChannel * channel;
00090 void keyReleaseEvent( QKeyEvent *e);
00091
00092 signals:
00093 void skinSelected();
00094
00095 private:
00096 int defaultSkinIndex;
00097
00098
00099 void readListFromFile(const QString &);
00100 void initializeStates();
00101
00102 bool inFileListMode() const;
00103
00104 private slots:
00105 void qcopReceive(const QCString&, const QByteArray&);
00106 void populateSkinsMenu();
00107 void skinsMenuActivated(int);
00108 void pmViewActivated(int);
00109 void writem3u();
00110 void writeCurrentM3u();
00111 void openFile();
00112 void openURL();
00113 void openDirectory();
00114 void setDocument( const QString& fileref );
00115 void addToSelection( const DocLnk& );
00116 void addToSelection( QListViewItem* );
00117 void clearList();
00118 void addAllToList();
00119 void addAllMusicToList();
00120 void addAllVideoToList();
00121 void saveList();
00122 void loadList( const DocLnk &);
00123 void playIt( QListViewItem *);
00124 void btnPlay(bool);
00125 void deletePlaylist();
00126 void addSelected();
00127 void removeSelected();
00128 void tabChanged(QWidget*);
00129 void viewPressed( int, QListViewItem *, const QPoint&, int);
00130 void playlistViewPressed( int, QListViewItem *, const QPoint&, int);
00131 void playSelected();
00132
00133 private:
00134 DocLnk addFileToPlaylist(const QString& directory, const QString& name);
00135 void setButtons(void);
00136 bool fromSetDocument;
00137 bool insanityBool;
00138 QString setDocFileRef, currentPlayList;
00139 int selected;
00140 QListView *currentFileListView;
00141
00142 MediaPlayer *m_mp;
00143 };
00144
00145 #endif // PLAY_LIST_WIDGET_H
00146