Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

playlistwidget.h

Go to the documentation of this file.
00001 /*
00002                             This file is part of the Opie Project
00003 
00004                              Copyright (c)  2002,2003 Max Reiss <harlekin@handhelds.org>
00005                              Copyright (c)  2002 L. Potter <ljp@llornkcor.com>
00006                              Copyright (c)  2002 Holger Freyther <zecke@handhelds.org>
00007               =.
00008             .=l.
00009            .>+-=
00010  _;:,     .>    :=|.         This program is free software; you can
00011 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00012 :`=1 )Y*s>-.--   :           the terms of the GNU General Public
00013 .="- .-=="i,     .._         License as published by the Free Software
00014  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00015      ._= =}       :          or (at your option) any later version.
00016     .%`+i>       _;_.
00017     .i_,=:_.      -<s.       This program is distributed in the hope that
00018      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00019     : ..    .:,     . . .    without even the implied warranty of
00020     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00021   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00022 ..}^=.=       =       ;      General Public License for more
00023 ++=   -.     .`     .:       details.
00024  :     =  ...= . :.=-
00025  -.   .:....=;==+<;          You should have received a copy of the GNU
00026   -_. . .   )=.  =           General Public License along with
00027     --        :-=`           this library; see the file COPYING.LIB.
00028                              If not, write to the Free Software Foundation,
00029                              Inc., 59 Temple Place - Suite 330,
00030                              Boston, MA 02111-1307, USA.
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     // retrieve the current playlist entry (media file link)
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 /*     void readm3u(const QString &); */
00098 /*     void readPls(const QString &); */
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& ); // Add a media file to the playlist
00116     void addToSelection( QListViewItem* ); // Add a media file to the playlist
00117     void clearList();
00118     void addAllToList();
00119     void addAllMusicToList();
00120     void addAllVideoToList();
00121     void saveList();  // Save the playlist
00122     void loadList( const DocLnk &);  // Load a playlist
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 

Generated on Sat Nov 5 16:15:43 2005 for OPIE by  doxygen 1.4.2