summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-02 14:12:57 (UTC)
committer simon <simon>2002-12-02 14:12:57 (UTC)
commit6a1400bdf754df18a1f20bd50ab5e5e4b0fd5a86 (patch) (side-by-side diff)
treed245c2d8dff55f422ed779c6c8ebeefb0ab10ac6
parentcc1324d2def09e55e5a688fa3e2d33924f7f5ef9 (diff)
downloadopie-6a1400bdf754df18a1f20bd50ab5e5e4b0fd5a86.zip
opie-6a1400bdf754df18a1f20bd50ab5e5e4b0fd5a86.tar.gz
opie-6a1400bdf754df18a1f20bd50ab5e5e4b0fd5a86.tar.bz2
- added a currentTab method that returns an enum containing the current tab
type in a verbose manner (AudioFiles, VideoFiles, CurrentPlayList, etc.), as a future replacment for whichList() which just returns an integer
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h3
2 files changed, 15 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index d1506db..9918eeb 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -23,64 +23,65 @@
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qpe/qpetoolbar.h>
#include <qpe/qpeapplication.h>
#include <qpe/storage.h>
#include <qpe/mimetype.h>
#include <qpe/global.h>
#include <qpe/resource.h>
#include <qdatetime.h>
#include <qdir.h>
#include <qmessagebox.h>
#include <qregexp.h>
#include <qtextstream.h>
#include "playlistselection.h"
#include "playlistwidget.h"
#include "mediaplayerstate.h"
#include "inputDialog.h"
#include "om3u.h"
//only needed for the random play
#include <stdlib.h>
+#include <assert.h>
#include "audiowidget.h"
#include "videowidget.h"
extern MediaPlayerState *mediaPlayerState;
// extern AudioWidget *audioUI;
// extern VideoWidget *videoUI;
QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg";
// no m3u's here please
PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
: PlayListWidgetGui( parent, name, fl ) {
d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),
"opieplayer2/add_to_playlist",
this , SLOT(addSelected() ) );
d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ),
"opieplayer2/remove_from_playlist",
this , SLOT(removeSelected() ) );
d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
this , SLOT( btnPlay( bool) ), TRUE );
d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle",
mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE );
d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop",
mediaPlayerState, SLOT( setLooping( bool ) ), TRUE );
(void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
(void)new MenuItem( pmPlayList, tr( "Add all audio files" ),
this, SLOT( addAllMusicToList() ) );
(void)new MenuItem( pmPlayList, tr( "Add all video files" ),
this, SLOT( addAllVideoToList() ) );
@@ -1116,43 +1117,54 @@ void PlayListWidget::populateSkinsMenu() {
skinName = fi->fileName();
// qDebug( fi->fileName() );
if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
item = skinsMenu->insertItem( fi->fileName() ) ;
}
if( skinName == "default" ) {
defaultSkinIndex = item;
}
if( skinName == skin ) {
skinsMenu->setItemChecked( item, TRUE );
}
++it;
}
}
void PlayListWidget::skinsMenuActivated( int item ) {
for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) {
skinsMenu->setItemChecked( i, FALSE );
}
skinsMenu->setItemChecked( item, TRUE );
Config cfg( "OpiePlayer" );
cfg.setGroup("Options");
cfg.writeEntry("Skin", skinsMenu->text( item ) );
QMessageBox::warning( this, tr( "OpiePlayer" ),
tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) );
}
int PlayListWidget::whichList() {
return tabWidget->currentPageIndex();
}
+PlayListWidget::TabType PlayListWidget::currentTab() const
+{
+ static const TabType indexToTabType[ NumTabTypes ] =
+ { CurrentPlaylist, AudioFiles, VideoFiles, PlayLists };
+
+ int index = tabWidget->currentPageIndex();
+ assert( index < NumTabTypes && index >= 0 );
+
+ return indexToTabType[ index ];
+}
+
QString PlayListWidget::currentFileListPathName() {
switch (whichList()) {
case 1:
return audioView->currentItem()->text(3);
break;
case 2:
return videoView->currentItem()->text(3);
break;
};
return "";
}
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h
index b2c389e..05d53a4 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.h
+++ b/noncore/multimedia/opieplayer2/playlistwidget.h
@@ -26,76 +26,79 @@
  -_. . .   )=.  = General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef PLAY_LIST_WIDGET_H
#define PLAY_LIST_WIDGET_H
#include <qmainwindow.h>
#include <qpe/applnk.h>
#include <qtabwidget.h>
#include <qpe/fileselector.h>
#include <qpushbutton.h>
#include <qpopupmenu.h>
#include "playlistwidgetgui.h"
//class PlayListWidgetPrivate;
class Config;
class QListViewItem;
class QListView;
class QPoint;
class QAction;
class QLabel;
class PlayListWidget : public PlayListWidgetGui {
Q_OBJECT
public:
+ enum TabType { CurrentPlayList, AudioFiles, VideoFiles, PlayLists, NumTabTypes = 4 };
+
PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 );
~PlayListWidget();
DocLnkSet files;
DocLnkSet vFiles;
bool fromSetDocument;
bool insanityBool;
QString setDocFileRef, currentPlayList;
// retrieve the current playlist entry (media file link)
const DocLnk *current();
void useSelectedDocument();
int selected;
int whichList();
+ TabType currentTab() const;
public slots:
bool first();
bool last();
bool next();
bool prev();
void writeDefaultPlaylist( );
QString currentFileListPathName();
protected:
void keyReleaseEvent( QKeyEvent *e);
private:
int defaultSkinIndex;
bool audioScan, videoScan, audioPopulated, videoPopulated;
void readm3u(const QString &);
void readPls(const QString &);
void initializeStates();
void populateAudioView();
void populateVideoView();
private slots:
void populateSkinsMenu();
void skinsMenuActivated(int);
void pmViewActivated(int);
void writem3u();
void writeCurrentM3u();
void scanForAudio();
void scanForVideo();
void openFile();
void setDocument( const QString& fileref );
void addToSelection( const DocLnk& ); // Add a media file to the playlist
void addToSelection( QListViewItem* ); // Add a media file to the playlist